I am writing assembly language program using nasm on linux. The problem is during debugging using gdb it does not step inside the _start function and gives the message "Single stepping until exit from function _start,"
Also, when I set break points after line 1 it says:
(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.
I am assembling and linking it using the commands :
nasm -g -f elf64 new3.asm
ld -g new3.o
then i debug it using gdb new3.out
. The gdb version is 7.11.1
the program is below :
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
How i can step inside the _start for debugging and what is the meaning of this?
(gdb) break 3
Note: breakpoints 1, 2 and 3 also set at pc 0x4000b0.
Breakpoint 4 at 0x4000b0: file new3.asm, line 3.