How to print only the value of the variable in gdb? -
so have script of gdb commands:
$ cat gdb_commands.txt set pagination off set logging file output.txt set logging on file stuff b *0x80000014 run echo ***diff this***\n echo eax: print $eax echo ebx: print $ebx echo ecx: print $ecx echo edx: print $edx echo ***diff end***\n quit if run in this:
$ gdb -q -x gdb_commands.txt breakpoint 1 @ 0x80000014 breakpoint 1, 0x80000014 in _start () ***diff this*** eax:$1 = 1 ebx:$2 = 2 ecx:$3 = 3 edx:$4 = 4 ***diff end*** debugging session active. inferior 1 [process 8947] killed. quit anyway? (y or n) [answered y; input not terminal] so there ugly dollar sign thing. can sed out, have gdb that. possible?
(the reason i'm use gdb because writing emulator, , want test if behaves correctly.)
ugly dollar sign thing ... have gdb that
you can control gdb's output precisely printf command:
(gdb) print/x $rax $1 = 0x7ffff7ffe2a0 (gdb) printf "0x%lx\n", $rax 0x7ffff7ffe2a0
Comments
Post a Comment