I am starting to program linux x86_64 assembly code, and thus I was trying to debug just like one would normal C code, for examble when I run gdb -tui ./a.out
, I get my source code and I can then toggle the registers to see what's going on, and go step by step, etc.
However that is not the case when I use it with assembly binaries, I simply get [ No Source Available ]
. However I can see the registers and the resulting assembly code (given I do layout next
). The thing is, since I am using C functions in the middle of my code (mainly printf
, in order to simplify the IO process, as instructed by my professor); I would like to see my original assembly code. At the moment I have installed:
gcc :(GCC) 12.2.0
ld :GNU ld (GNU Binutils) 2.39.0
NASM version 2.15.05
And to compile and run a program I run:
nasm -f elf64 -o hello.o hello.asm
gcc hello.o -o hello -no-pie
gdb ./hello
Those were the commands that my teacher told us to run. I have read online that I could pass the -g flag to gcc to debug my code; it compiles just fine, but I can't see my source code either. I have also tried passing -g to nasm (same issue, compiles but no source code)
Is there a flag/setting that I'm not passing?