| About Blog Cheatsheets Defense Links Offense |
Gdb
| Command | Description |
| Compile Debug |
gcc -Wall -o myprogram myprogram.c gcc -g -Wall -o myprogram myprogram.c |
|
Start |
gdb ./myprogram |
|
Args |
gdb --args myprogram param1 param2 |
|
Commands |
gdb --commands=FILE myprogram |
|
List |
list |
|
Run |
run [args] |
|
cd |
cd [path] |
|
List |
list [file]:[position] |
|
Args |
set args [arg1] [arg2] [..] |
|
Stop/Exec |
Ctrl+C / cont |
|
Backtrace |
backtrace |
|
Disassemble |
set disassembly-flavor intel/att disassemble function |
|
Breakpoints |
break [linenumber|function|address] info break delete [nr] [nr] [..] ignore [nr] [times] disable [nr] [nr] [..] enable [nr] [nr] [..] commands [nr] |
|
Stepping |
step [TIMES] next [TIMES] |
|
Print |
print (char)*string / print s[0] print strlen(s) /[count][fmt] o, Octal x, Hexidecimal d, Decimal u, Usigned decimal t, Binary f, Float a, Address i, Instruction (processor) c, Character s, String |
|
Examine Memory |
x |
|
Display |
display [EXPR] undisplay disable display enable display |
|
Changing Data |
set variable [EXPR] set [EXPR] |
|
Help |
help help [command]/help [subtopic] |
|
Settings |
set args [ARG] [ARG] [..] set follow-fork-mode [parent|child|ask] set listsize [NR] set logging [SUBOPTION]/set logging file [FILE]/set logging on set print [SUBOPTION]/set print pretty on |