This question has been asked several times on StackOverflow but I tried all the answers and I still cannot get NASM to include DWARF debugging symbols.
I am using NASM 2.13.02 under Ubuntu 18.04 64-bit. I am not sure if I am still missing something?
In case it matters, I would actually like to use both LLDB and GDB.
Thanks.
Here is my code:
section .bss
section .text
global _start
_start:
mov ebx, 0
mov eax, 1
int 80h
Here is how I build and link it:
nasm -g -F dwarf -f elf64 hello.asm
ld -s -o hello hello.o
The resulting file is:
$ ls -la hello
-rwxr-xr-x 1 terry terry 352 Sep 4 18:21 hello
$
Trying to check if DWARF data is included:
$ dwarfdump hello
No DWARF information present in hello
$
Running it under gdb:
$ gdb ./hello
GNU gdb (Ubuntu 8.1-0ubuntu3.2) 8.1.0.20180409-git
[... snip copyright ...]
Reading symbols from ./hello...(no debugging symbols found)...done.
(gdb)