2017年3月10日星期五

Frequency Used GDB commands


set args set arguments
show args show arguments
Run
(or gdb –args <program> <args...>)
run with argument(if previous was set by "set args")


load load the program
attach process-id
(or gdb –pid <pid>)
debug an already running process
detach release the previous attached process


symbol-file filename Read symbol table information from file filename
i threads Display thread
i share Print the names of the shared libraries which are currently loaded


c continue
b add breakpoint
w add watchpoint
s step
n next
si step instruction


info all-registers show all registers
i r same as info registers
i r rax display register rax value (HEX)


p/x $rax display register rax value (HEX)
p/d $rax display register rax value (signed DEC)
p/u $rax display register rax value (unsigned DEC)
p/t $rax display register rax value (BIN)
p/f $rax display register rax value (Floating point number)
p/c $rax display register rax value (CHAR)


p/a $rip display register rip value (ADDRESS)
x /i $pc print next instruction to be executed


p *array@len display array content
p/x (short[2])0x12345678 display array content
x /256xb mem examine memory, 256=repeat count, x=hex, {b=byte, h=2bytes,w=4bytes,g=8bytes}
set *((int *) mem) = value set memory content (char, short, int, long, long long)
set *((char *) reg) = *((char *) reg) | 0x80 set peripheral register bit
set *((char *) reg) = *((char *) reg) & (~0x80) clear peripheral register bit


l filename:function list the source in the filename:function
l function list the source in function
l + list more
l - list less


bt backtrace
f n select frame number n


set $f00=*object_ptr set convenience variable
show convenience show convenience variable
source gdbscriptFile load GDB script file
define print_vars
p var1
p var2
end
create GDB function


disas view disassemble

沒有留言:

發佈留言