pwncollege / dojo

Infrastructure powering the pwn.college dojo
https://pwn.college
BSD 2-Clause "Simplified" License
306 stars 101 forks source link

nix gdb quirks and workarounds #564

Open robwaz opened 2 months ago

robwaz commented 2 months ago

gdb is particularly troubled with our nix setup. This issue will document the known issues as well as the current workarounds until a permanent fix is implemented.

There's decent odds I do not fully understand the underlying issues, so take the explanations with a grain of salt.

gdb lacks debug information A default dojo install gdb will fail to break at libc symbols and will silently fail to run simple gdb scripts.

Fix: Add the following line to .gdbinit

set debug-file-directory /tmp/debug

gdb is not referencing the correct libc Some libc symbols (example rev 19.0, memcpy), gdb will set a breakpoint, but it is at the incorrect address. As an immediate workaround a breakpoint can be set at the call site, or some other related location, but this functionality should behave as expected.

Fix: Specify the correct shared library path in .gdbinit

set solib-absolute-prefix /lib/x86_64-linux-gnu
supercoolspy commented 1 month ago

https://github.com/edolstra/dwarffs may help with the first issue It needs internet, we could possibly preload the debug symbols in the init script