Fix GDB Symbols
Opened this issue · 1 comments
ConnorNelson commented
Nix is tricky! It seems like the challenge image might need to be a bit more explicit about things.
This shows that image gdb knows where to find libc debug info:
strace /usr/bin/gdb --batch -ex 'starti' -ex 'c' -ex 'p __libc_start_main' /bin/false 2>&1 | grep open | grep debug | grep 02430
Unfortunately nix gdb does not:
strace gdb --batch -ex 'starti' -ex 'c' -ex 'p __libc_start_main' /bin/false 2>&1 | grep open | grep debug | grep 02430
With -ex 'set debug-file-directory /lib/debug'
nix gdb can find the debug info:
strace gdb --batch -ex 'set debug-file-directory /lib/debug' -ex 'starti' -ex 'c' -ex 'p __libc_start_main' /bin/false 2>&1 | grep open | grep debug | grep 02430
Rather than have users manually perform this, I think we can get a system gdbinit that always runs, or maybe theres an ENV variable for us to set, or otherwise we can patch nix gdb (but this sounds unideal because this is a challenge image attribute).
spencerpogo commented
Have you tried exporting NIX_DEBUG_INFO_DIRS
? Reference: https://nixos.wiki/wiki/Debug_Symbols