組み立ては初めてです。デバッグされている実際のコードとは別に、GDBで計算を実行する方法はありますか?たとえば、Linux IA-32アセンブリ(AT&T構文)を使用して次の手順を実行しています。
;$esi is 0xbffff0a8 which refers to 1 after this command. $eax is 2
0x08048cd5 <+42>: lea -0x20(%ebp),%esi
;$eax=ebx=2 after this instruction
0x08048cd8 <+45>: mov %ebx,%eax
;$eax equals 2 after this instruction
0x08048cda <+47>: add -0x4(%esi,%ebx,4),%eax
$ eaxが2になるのがわかりません。gdbで-0x4(%esi、%ebx、4)のような命令を実行して、結果を分析できますか?
私が理解しているように、$ebxに4を掛けて8を算出します。これを$esiに加算して9を算出します。次に-4を減算して5を算出します。次に5を$eaxに加算します。 eaxは2です。