1. First GDB compiles: gcc-g xxx.c-o xxx2. Then gdb xxx goes to debug
Break line number
Add Breakpoint
(1) Then run can run to the next breakpoint (2) step (or s) step tracking (3) print can (or p) to view the current program's operating data such as: Print a output a variable value output format can be set: for example p/d a decimal output a variable value (4) You can also set display, such as display a so that each debug will output the value of a variable (5) examine (or x) to see the value in memory address syntax:x/<n/f/u> <addr> (6) List View original program (7) Print x=8 modifies the value of the variable x during debugging, which takes effect (8) Jump <linespec> implementation jumps, either the line number of the file, the File:line, or the +num in this format, jumping <address> is the memory address of the line of code (9) Signal <signal> generate semaphore (Ten) return forced return (one) call <expr> Force invoke
Linux PDB Debug Summary