NASM Forum > Programming with NASM

gdb and debug symbols

(1/2) > >>

decuser:
nasm newb here...

I have started using nasm and I am trying to debug my program. I did nasm -g and ld -g and when I open gdb, or ddd, it shows my listing and will let me step through the code and whatnot, yay! However, when I try to display a variable's address using 'info address bVar1' it says:
Symbol "bVar1" is at 0x402000 in a file compiled without debugging.

What it means, as I understand it, is that the file was not compiled with gnu debugging symbols. Obviously, there are debugging symbols present, but they're in whatever the default format is for nasm. Should I be worried, or just ignore it?

FWIW, stuff like:

(gdb) x/db &bVar1

seems to work:

0x402000 <bVar1>:       17


Thx!

Frank Kotler:
It may help to tell Nasm  "-F dwar"
Start your cide wuth a singke byte opcode  I like
"nop

st,
BeFrank

decuser:
Ok. I've since learned a lot more about what I'm doing with this stuff (assembly on Linux). I still have the same issue though.

I've tried adding nop as the first executable instruction:


--- Code: ---section .data
EOLs: db 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10

section .text

global _start
_start:
    nop
--- End code ---

When I fire up gdb, I'm able to debug fine. I can set breakpoints at my labels, step through code, display memory contents with x/, etc. But, if I try to use:


--- Code: ---info address EOLs
--- End code ---

I get


--- Code: ---Symbol "EOLs" is at 0x402000 in a file compiled without debugging.
--- End code ---

Sure enough EOLs is at 0x402000:


--- Code: ---(gdb) x/16bx &EOLs
0x402000 <EOLs>:        0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a
0x402008:       0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a
(gdb) x/16bx 0x402000
0x402000 <EOLs>:        0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a
0x402008:       0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a    0x0a
--- End code ---

Why does it report that it's in a file compiled without debugging?

decuser:
and I've tried it with no -F, -F stabs, and -Fdwarf, same result.

Frank Kotler:

""Code" is not a "known  section name". Try changing it to .text
Best,
Frank

Navigation

[0] Message Index

[#] Next page

Go to full version