Why does the stack grow after passing a label in following code example? I haven’t used any push instruction.
I need to trust the stack so I need granular control. I know my setup isn’t conventional, that’s on purpose.
If this is intended behaviour, is there a way around, so I can for example predict stack growth?
Makefile
test:
nasm -g -F dwarf -felf64 test2.asm -o test.o
ld -m elf_x86_64 --omagic test.o -o test
test2.asm
global _start
section .text
_start:
xor rax, rax
xor rbx, rbx
mov rsi, knitter
mov rdi, intermediary
test:
mov al, byte [rsi + rbx]
end:
jmp end
len_array equ 4096
intermediary: resb len_array
knitter: db "zend:", 10,
0 ; End of string
output gdb
(gdb) make -e test
make: 'test' is up to date.
(gdb) b _start
Breakpoint 2 at 0x400080: file test2.asm, line 6.
(gdb) r
The program being debugged has been started already.
Start it from the beginning? (y or n) y
Starting program: /home/nico/Dropbox/Projects/datalp/test
Breakpoint 2, _start () at test2.asm:6
6 xor rax, rax
(gdb) n
7 xor rbx, rbx
(gdb)
8 mov rsi, knitter
(gdb) bt
#0 _start () at test2.asm:8
(gdb) n
9 mov rdi, intermediary
(gdb) bt
#0 _start () at test2.asm:9
(gdb) n
test () at test2.asm:11
11 mov al, byte [rsi + rbx]
(gdb) bt
#0 test () at test2.asm:11
#1 0x0000000000000001 in ?? ()
#2 0x00007fffffffe8ee in ?? ()
#3 0x0000000000000000 in ?? ()
(gdb)