我的 nasm x86 汇编代码包含以下内容:
; The code should mimic the following C-code:
; int a[10];
; for (int i = 0; i < 10; i++){
; a[i] = i;
; }
SECTION .data
arraylen dd 10
SECTION .bss
array RESD 10
SECTION .text
global main
main:
mov ecx, 0
mov eax, 0
loop:
inc ecx
mov dword [array+eax*4], ecx
inc eax
cmp ecx, arraylen
jl loop
end:
mov ebx, 0
mov eax, 1
int 0x80
Run Code Online (Sandbox Code Playgroud)
现在我想要的是检查这段代码是否在 gdb 中工作。但是,我如何打印array? …