set confirm off set verbose off set height 0 set width 0 set output-radix 0x10 set input-radix 0x10 set disassembly-flavor intel set print asm-demangle on set print demangle on def regs printf "Dump of processor registers:\n" printf "EAX: 0x%08x ", $eax printf "EBX: 0x%08x ", $ebx printf "ECX: 0x%08x ", $ecx printf "EDX: 0x%08x ", $edx printf "\n" printf "ESI: 0x%08x ", $esi printf "EDI: 0x%08x ", $edi printf "EBP: 0x%08x ", $ebp printf "ESP: 0x%08x ", $esp printf "EIP: 0x%08x ", $eip printf "\n" printf "CS: 0x%04x ", $cs printf "DS: 0x%04x ", $ds printf "ES: 0x%04x ", $es printf "FS: 0x%04x ", $fs printf "GS: 0x%04x ", $gs printf "SS: 0x%04x ", $ss printf "\n" printf "End of registers dump.\n" end doc regs Print CPU registers (without flags) end def n ni echo \n disassemble $pc $pc+15 echo \n regs end doc n Do next instruction, disassemble and dump registers at once end def bpl info breakpoints end doc bpl List all breakpoints end def bp if $argc != 1 help bp else break $arg0 end end doc bp Set breakpoint Usage: bp end def bpc if $argc != 1 help bpc else clear $arg0 end end doc bpc Clear breakpoint Usage: bpc end def bpe if $argc != 1 help bpe else enable $arg0 end end doc bpe Enable breakpoint Usage: bpe end def bpd if $argc != 1 help bpd else disable $arg0 end end doc bpd Disable breakpoint Usage: bpd end def bpt if $argc != 1 help bpt else tbreak $arg0 end end doc bpt Set temporary breakpoint Usage: bpt end def bprw if $argc != 1 help bprw else awatch $arg0 end end doc bprw Set read/write breakpoint Usage: bprw end def bphb if $argc != 1 help bphw else hb $arg0 end end doc bphb Set hardware breakpoint Usage: bprw end def argv show args end doc argv Print program arguments end def stack if $argc == 0 info stack end if $argc == 1 info stack $arg0 end if $argc >= 2 help stack end end doc stack Print backtrace of the call stack Usage: stack end def fal info frame info args info locals end doc fal Print stack frame, args and locals at once end def rinit tbreak _init r end doc rinit Set temporary breakpoint to `_init' and run Usage: rinit end def rstart tbreak _start r end doc rstart Set temporary breakpoint to `_start' and run Usage: rstart end def rmain tbreak main r end doc rmain Set temporary breakpoint to `main' and run Usage: rmain end def rlibc tbreak __libc_start_main r end doc rlibc Set temporary breakpoint to `__libc_start_main' and run Usage: rlibc end