Gdb + nasm debug not created

I am trying to debug a small .asm file that I wrote in Ubuntu. However, I ran into a problem when my character table did not load and was looking for some help.

I compile my program as follows.

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

which creates the bs executable on startup

 gdb bs 

I get a message that does not indicate debugging symbols, and when I try to set a breakpoint on

 b main 

he says that the function is not defined, even if it is in the file, and I can run it using. / bs

I read a couple of posts that suggested adding a -F dwarf when building, but that didn’t help, if anyone has an understanding, I would really appreciate your input.

+4
source share
3 answers

Build a 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,

+7
source

cpowel2 solved its problem:

SOLVED: just in case, someone had the same problem (it seems that there are a ton of messages on the network), I was able to solve the problem by changing the .txt section of my file to the .text section and gdb immediately recognized it.

+3
source

SECTION .text

; in nasm, the text section must be lowercase for gdb to raise it.

0
source

Source: https://habr.com/ru/post/1434410/


All Articles