3

私はGDBコマンドのこのスクリプトを持っています:

$ 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 THIS END***\n
quit

GDB で実行すると、次のようになります。

$ gdb -q -x gdb_commands.txt
Breakpoint 1 at 0x80000014

Breakpoint 1, 0x80000014 in _start ()
***DIFF THIS***
eax:$1 = 1
ebx:$2 = 2
ecx:$3 = 3
edx:$4 = 4
***DIFF THIS END***
A debugging session is active.

    Inferior 1 [process 8947] will be killed.

Quit anyway? (y or n) [answered Y; input not from terminal]

だから、その醜いドル記号があります。私はsedそれを行うことができますが、GDBにそれをさせたいと思っています。出来ますか?

(私がこのように GDB を使用している理由は、エミュレーターを作成していて、それが正しく動作するかどうかをテストしたいからです。)

4

2 に答える 2