9

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.

4

3 回答 3

14

使用以下命令组装您的文件:-

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

然后使用gdb,

于 2014-05-29T04:46:52.430 回答
4

cpowel2 解决了他自己的问题:

已解决:以防万一其他人遇到同样的问题(网上似乎有很多帖子),我可以通过将文件的部分 .txt 部分更改为部分 .text 和 gdb 来解决问题马上。

于 2012-09-16T12:20:50.683 回答
0

部分 .text

; 在 nasm 中 - 文本部分必须为小写,gdb 才能获取它。

于 2013-05-09T16:00:28.570 回答