Linuxでnasmを使用してアセンブリ言語プログラムを作成しています。gdbを使用してデバッグ中のメッセージ:関数_startから終了するまで単一のステップ実行
(gdb) break 2
Note: breakpoints 1 and 2 also set at pc 0x4000b0.
Breakpoint 3 at 0x4000b0: file new3.asm, line 2.
(gdb) break 3
Note: breakpoints 1, 2 and 3 also set at pc 0x4000b0.
Breakpoint 4 at 0x4000b0: file new3.asm, line 3.
:問題は、それはまた、「関数_startから出るまで、シングルステップ」
を_start関数内のステップとメッセージを与えていない、GDB、私はライン1の後にブレークポイントを設定すると、それは言うを使用してデバッグ中です
私はコマンドを使用して、それを組み立てるとリンクしています:
nasm -g -f elf64 new3.asm
ld -g new3.o
その後、私はそれがgdb new3.out
を使用してデバッグします。 gdbのバージョンは7.11.1
プログラムは以下です:
section .text
global _start ;must be declared for linker (ld)
_start: ;tells linker entry point
call sum
mov edx,len ;message length
mov ecx,msg ;message to write
mov ebx,1 ;file descriptor (stdout)
mov eax,4 ;system call number (sys_write)
int 0x80 ;call kernel
mov eax,1 ;system call number (sys_exit)
int 0x80 ;call kernel
sum:
mov eax, ecx
add eax, edx
add eax, '0'
ret
section .data
msg db 'Hello, world!', 0xa ;string to be printed
len equ $ - msg ;length of the string
iは、デバッグのための_start内でステップ実行することができますどのように、これの意味は何ですか?
(gdb) break 3
Note: breakpoints 1, 2 and 3 also set at pc 0x4000b0.
Breakpoint 4 at 0x4000b0: file new3.asm, line 3.
64ビットコードから 'int 0x80' 32ビットシステムコールABIを使用しないでください。代わりに 'syscall'を使用してください。それは、異なる呼び出し番号、および異なるレジスタ使用法を有する。 –