GNU Flashcards
(26 cards)
How to compile with gdb debugging symbols?
use -ggdb option with gcc; gcc -ggdb main.c -o main
Find the source file?
Info sources
To look at global variables?
Info variables
To look at local variables?
Info scope function_name
Extract DEBUG Symbols out of binary with DEBUG Symbols?
objcopy –only-keep-debug BIN_DEBUG DEBUG_Symbols
Dump Print Symbols?
maint print symbols filename_to_store
Strip DEBUG Symbols out of binary with DEBUG Symbols?
strip –strip-debug BIN_DEBUG
Strip all DEBUG Symbols out of binary with DEBUG Symbols?
strip –strip-debug –strip-unneeded BIN_DEBUG
Add DEBUG Symbols with a binary?
objcopy –add-gnu-debuglink=DEBUG_Symbols BIN_FILE
Load the symbol file with GDB?
symbol-file file_name
Load the symbol file within GDB?
symbol-file DEBUG_Symbols
List the files from which symbols were loaded?
Info files
List symbols from object file?
nm
Symbol Type A means?
Absolute Symbol
Symbol Type B means?
In the uninitialized Data Section (BSS)
Symbol Type D means?
In the initialized Data Section
Symbol Type N means?
Debugging Symbol
Symbol Type T means?
In the Text Section
Symbol Type U means?
Symbol undefined right now
NM to display size?
NM -s
NM to grep functionname?
NM -A …| grep function_name
NM to display objects in sorted order?
NM -n …
NM to display external variables?
NM -g …
What traces all system calls made by the program?
strace