简体   繁体   中英

gdb + nasm debug info not being created

I am trying to debug a small .asm file that I wrote in Ubuntu. I am however running into an issue where my symbol table is not being loaded and was looking for some help.

I am compiling my program as follows.

nasm -f elf -g -F dwarf bs.asm
gcc -m32 -g bs.o -o bs

which produces the executable bs when I run

gdb bs 

I get a message that says no debugging symbols and when I try to set a break point by

b main 

it says function not defined even though its in the file and I can run it using ./bs

I read a couple posts that suggested adding the -F dwarf when assembling but that didn't help if anyone has any insight I would greatly appreciated your input.

Assemble your file with the following commands :-

nasm -f elf -F dwarf -g file.asm
ld -m elf_i386 -o file file.o

and then use gdb,

cpowel2 solved his own problem:

SOLVED: Just in case anyone else was having the same issue (it seems like there are a ton of posts on the net) I was able to resolve the issue by changing the section .txt portion of my file to section .text and gdb recognized it right away.

SECTION .text

; in nasm - a text section has to be in lower case for gdb to pick it up.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM