GDB basic instructions

objdump -t outputs the symbol table of the target binary file, you can view all functions
objdump -d decompiles the binary file, and outputs the assembly code, "objdump -d bomb> bomb.txt"

##GDB basic instructions
1.gdb (run gdb, if you directly specify the file to be operated, enter "gdb file name");
2.r or run (run the specified binary executable file);
3.q or quit (exit gdb) ;
4.file (specify the file "f file name" to be operated on);
5.b or break (set a breakpoint)
method 1: "b function name" (set a breakpoint before the first instruction in the function body)
method 2: "b file name. suffix: line number"
6. After setting, enter run and the program will execute to the breakpoint,
7.c or continue program will continue to execute the instruction after the breakpoint, and jump back to gdb after the entire program ends ;
8.n or next (single-step debugging), enter n and
press Enter, the printed statement is the statement to be executed next; 9.s or step is to enter the function to be called ; 10.l
or list display connection The next 10 lines of code to be executed;
11.p or print+variable name (check the value of the variable), +function name (check the address of the function), +array name (print the entire array);
12.Press enter directly in gdb "enter" is to execute the last executed command;
13. Enter "n (or other initial letter) tab key" to print all commands starting with n;
14. i or info query command, "ib" (query all breakpoints) , "Ir (or reg)" (query register status);
15.d or delete delete all breakpoints; "d serial number (for 1, 2, 3...)" delete the specified breakpoint;
16.disp or display (tracking Check a certain variable and display its value every time you win);
17.st or start (stop after executing the first line of the main function);
18.k or kill (terminate the program being debugged);
19.watch (monitor changes in variable values);
20.bt or backtrace (view function Calling information, that is, stack);
21.f or frame (check the stack frame);
22.x or examine to check the contents of the specified register (or variable expression)
"x/format $rdi (or variable expression)" x/ 4wd $rsp Check register or an address. The
format includes:
o-octal
x-hexadecimal
d-decimal
u-unsigned decimal
t-binary
f-floating point
a-address
c-character
s-string
i-indication

Attachment: GDB command reference
https://visualgdb.com/gdbreference/commands/

Guess you like

Origin blog.csdn.net/m0_47595520/article/details/107823174