Skip to main content

Inspecting Assembly

gdb executablestarts executable
layout asmprints Assembly codes
CTRL+Lreformats terminal
b function_namesets a breakpoint at function_name
b *0x555555555712sets a breakpoint at specified address
run 1 (phase number)run with input
x/x $registerprints register in hex
x/s $registerprints register in string
sistep instruction
ninext instruction
finishfinishes current steps and go to next instruction
x/d $registerprints register in digit
break mainsets a breakpoint at the start of the main function.
runrestarts the program when stopped in mid-execution.
nextruns until the next source line is reached.
wherereturns a function call trace of how you got to this point and shows line numbers inside files.
listprints surrounding code.
contcontinues execution from the current location.
quitquits gdb
"%d %[^\n]"integer + string
layout regslayout all registers
disas functionjump to that function
x/1gx $rspprint word from $rsp
x/32xb $rspprint 32 bytes from memory address inside $rsp