I have a simple assembly program with the following makefile:
all : calc
calc : calc.o
gcc -m32 -g -o calc calc.o
calc.o : calc.s
nasm -f elf -g -F stabs calc.s
I try to debug it using gdb but it always says:
Single stepping until exit from function asc2int, which has no line number information.
I tried many solutions to the problem, including -F dwarf but none of them works. Can you please help me resolve this issue?
I don’t see any problems with your makefile.
Quick google search gives following nasm. The documentation example shows you need to disassemble to look through the code, but its kind of weird, as already assembly code is being debugged why would the debugger ask to disassemble it further. However the disassembled code is inline with assembly source file.
Form what you have mentioned it seems you are able to debug. use
nextiin case if you are usingnextinstruction to step through. You can youdisassemblecommand to every time see where the execution control lies. Or if you want it automated you can save following as a script.asm_nextbecomes the new instruction for you step in through the code.Run it using the command
P.S. for larger programs you might need to ad -O0 flag to get correlation between debugger disassembled code and your assembly code in .s file.