Setup Glibc Debug Symbols on Arch Linux
最近修交大程安遇到 heap 題,記錄一下怎麼在 Arch Linux 上取得 glibc debug symbols,方便用 pwndbg 的 heap, bins 等指令。
-
在
~/.gdbinit中加入set debuginfod enabled ask。可以設定on/off/ask,ask的好處在於打開 gdb 時,它會跳出Debuginfod has been disabled.的提示訊息,手動輸入set debuginfod enabled on之後才會載入 debug symbols。1 2 3
ice1187@ice1187-arch heapmath$ cat ~/.gdbinit source /usr/share/pwndbg/gdbinit.py set debuginfod enabled ask
-
設定 env variable
DEBUGINFOD_URLS="https://debuginfod.archlinux.org",我是放在~/.bashrc裡。1 2 3
ice1187@ice1187-arch heapmath$ cat ~/.bashrc ... export DEBUGINFOD_URLS="https://debuginfod.archlinux.org"
-
用
gdb載入 binary,輸入set debuginfod enabled on,再把程式跑起來,應該就會看到 glibc debug symbols,並且可以使用heap、bins等指令了。
