123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- # Invocation: gdb -x gdb-extract-def
- # extract-state /path/to/foo.bin /path/to/foo.fixture
- define extract-state
- file $arg0
- set $STACK_TOP=0x120000
- # Disables logging to stdout - only log to file
- set logging redirect on
- set logging file $arg1
- set logging overwrite on
- set logging on
- run
- printf "---BEGIN JSON---\n"
- printf "[\n"
- printf " %d,\n", $eax
- printf " %d,\n", $ecx
- printf " %d,\n", $edx
- printf " %d,\n", $ebx
- printf " %d,\n", $esp
- printf " %d,\n", $ebp
- printf " %d,\n", $esi
- printf " %d,\n", $edi
- printf " \n"
- printf " %d,\n", $mm0.v2_int32[0]
- printf " %d,\n", $mm0.v2_int32[1]
- printf " %d,\n", $mm1.v2_int32[0]
- printf " %d,\n", $mm1.v2_int32[1]
- printf " %d,\n", $mm2.v2_int32[0]
- printf " %d,\n", $mm2.v2_int32[1]
- printf " %d,\n", $mm3.v2_int32[0]
- printf " %d,\n", $mm3.v2_int32[1]
- printf " %d,\n", $mm4.v2_int32[0]
- printf " %d,\n", $mm4.v2_int32[1]
- printf " %d,\n", $mm5.v2_int32[0]
- printf " %d,\n", $mm5.v2_int32[1]
- printf " %d,\n", $mm6.v2_int32[0]
- printf " %d,\n", $mm6.v2_int32[1]
- printf " %d,\n", $mm7.v2_int32[0]
- printf " %d,\n", $mm7.v2_int32[1]
- printf " \n"
- printf " %d,\n", $xmm0.v4_int32[0]
- printf " %d,\n", $xmm0.v4_int32[1]
- printf " %d,\n", $xmm0.v4_int32[2]
- printf " %d,\n", $xmm0.v4_int32[3]
- printf " %d,\n", $xmm1.v4_int32[0]
- printf " %d,\n", $xmm1.v4_int32[1]
- printf " %d,\n", $xmm1.v4_int32[2]
- printf " %d,\n", $xmm1.v4_int32[3]
- printf " %d,\n", $xmm2.v4_int32[0]
- printf " %d,\n", $xmm2.v4_int32[1]
- printf " %d,\n", $xmm2.v4_int32[2]
- printf " %d,\n", $xmm2.v4_int32[3]
- printf " %d,\n", $xmm3.v4_int32[0]
- printf " %d,\n", $xmm3.v4_int32[1]
- printf " %d,\n", $xmm3.v4_int32[2]
- printf " %d,\n", $xmm3.v4_int32[3]
- printf " %d,\n", $xmm4.v4_int32[0]
- printf " %d,\n", $xmm4.v4_int32[1]
- printf " %d,\n", $xmm4.v4_int32[2]
- printf " %d,\n", $xmm4.v4_int32[3]
- printf " %d,\n", $xmm5.v4_int32[0]
- printf " %d,\n", $xmm5.v4_int32[1]
- printf " %d,\n", $xmm5.v4_int32[2]
- printf " %d,\n", $xmm5.v4_int32[3]
- printf " %d,\n", $xmm6.v4_int32[0]
- printf " %d,\n", $xmm6.v4_int32[1]
- printf " %d,\n", $xmm6.v4_int32[2]
- printf " %d,\n", $xmm6.v4_int32[3]
- printf " %d,\n", $xmm7.v4_int32[0]
- printf " %d,\n", $xmm7.v4_int32[1]
- printf " %d,\n", $xmm7.v4_int32[2]
- printf " %d,\n", $xmm7.v4_int32[3]
- printf " \n"
- printf " %d,\n", *(int*)($STACK_TOP-64)
- printf " %d,\n", *(int*)($STACK_TOP-60)
- printf " %d,\n", *(int*)($STACK_TOP-56)
- printf " %d,\n", *(int*)($STACK_TOP-52)
- printf " %d,\n", *(int*)($STACK_TOP-48)
- printf " %d,\n", *(int*)($STACK_TOP-44)
- printf " %d,\n", *(int*)($STACK_TOP-40)
- printf " %d,\n", *(int*)($STACK_TOP-36)
- printf " %d,\n", *(int*)($STACK_TOP-32)
- printf " %d,\n", *(int*)($STACK_TOP-28)
- printf " %d,\n", *(int*)($STACK_TOP-24)
- printf " %d,\n", *(int*)($STACK_TOP-20)
- printf " %d,\n", *(int*)($STACK_TOP-16)
- printf " %d,\n", *(int*)($STACK_TOP-12)
- printf " %d,\n", *(int*)($STACK_TOP-8)
- printf " %d,\n", *(int*)($STACK_TOP-4)
- printf " \n"
- printf " %d\n", $eflags
- printf "]\n"
- printf "---END JSON---\n"
- set logging off
- end
|