Trying to debug this issue (for nixpkgs#espanso
on aarch64-darwin
)
I’m building from a local checkout where I’ve added buildType = "debug";
and dontStrip = true;
to the buildRustPackage
definition.
It seems to be working, because when I build with these changes, I get a magnitude of order more output from objdump (not sure how else to check, I’m on aarch64-darwin
):
$ # without `buildType = "debug";` / `dontStrip`
$ objdump --syms ./result/bin/espanso | wc -l
40490
$
$ # with `buildType = "debug";` + `dontStrip = true`
$ objdump --syms ./result/bin/espanso | wc -l
410374
However, rust-lldb
has a hard time finding breakpoints, and when I stop at a breakpoint it just looks like assembly (I think):
thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = breakpoint 1.4 1.5
frame #0: 0x00000001000484e0 espanso`espanso::cli::launcher::daemon::launch_daemon::h8e14659196a7028e
espanso`espanso::cli::launcher::daemon::launch_daemon::h8e14659196a7028e:
-> 0x1000484e0 <+0>: stp x28, x27, [sp, #-0x20]!
0x1000484e4 <+4>: stp x29, x30, [sp, #0x10]
0x1000484e8 <+8>: add x29, sp, #0x10
0x1000484ec <+12>: sub sp, sp, #0xce0
Target 0: (espanso) stopped.
In contrast, if I manually compile a debug build from the espanso repository (using the usual rust toolchain), stopping at a breakpoint looks like this:
Process 84178 stopped
* thread #1, name = 'main', queue = 'com.apple.main-thread', stop reason = breakpoint 7.1 11.1
frame #0: 0x0000000100160184 espanso`espanso::cli::launcher::daemon::launch_daemon::h68a5a2a46a9d1439(paths_overrides=0x000000016fdcacb0) at daemon.rs:30:7
27 use crate::cli::PathsOverrides;
28
29 pub fn launch_daemon(paths_overrides: &PathsOverrides) -> Result<()> {
-> 30 dbg!(paths_overrides);
31 let espanso_exe_path = std::env::current_exe()?;
32 let mut command = Command::new(&espanso_exe_path.to_string_lossy().to_string());
33 command.args(&["daemon"]);
Target 0: (espanso) stopped.
Why am I unable to get the debugger to show the symbols properly when I’m building from nix?