Ostatnio zauważyłem, że kompilując z nasm i ld, gdb nie widzi nagłówków debugowania
tomasz@tomasz-K50IN:
$ nasm -f elf -g test.asm$ ld -o testx test.o
tomasz@tomasz-K50IN:
tomasz@tomasz-K50IN:~$ objdump -g testxtestx: file format elf32-i386
test.asm:
/* file test.asm line 6 addr 0x8048080 /
/ file test.asm line 7 addr 0x8048085 /
/ file test.asm line 8 addr 0x804808a /
/ file test.asm line 9 addr 0x804808f /
/ file test.asm line 12 addr 0x8048094 /
/ file test.asm line 13 addr 0x8048099 /
/ file test.asm line 14 addr 0x804809b */
tomasz@tomasz-K50IN:~$ objdump -S testxtestx: file format elf32-i386
Disassembly of section .text:
08048080 <_start>:
global _startsection .text
_start:mov eax, SYS_WRITE
8048080: b8 04 00 00 00 mov $0x4,%eax
mov ebx, FD_STDOUT
8048085: bb 00 00 00 00 mov $0x0,%ebx
mov ecx, tekst
804808a: b9 a0 90 04 08 mov $0x80490a0,%ecx
mov edx, tekst_dl
804808f: ba 0c 00 00 00 mov $0xc,%edxmov eax, 1
8048094: b8 01 00 00 00 mov $0x1,%eax
xor ebx, ebx
8048099: 31 db xor %ebx,%ebx
int 80h
804809b: cd 80 int $0x80
tomasz@tomasz-K50IN:~$ gdb ./testx
GNU gdb (GDB) 7.2-ubuntu
Copyright (C) 2010 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-linux-gnu".
For bug reporting instructions, please see:
http://www.gnu.org/software/gdb/bugs/...
Reading symbols from /home/tomasz/testx...done.
(gdb) break _start
Breakpoint 1 at 0x8048080
(gdb) r
Starting program: /home/tomasz/testx
Trying host libthread_db library: libthread_db.so.1.
Host libthread_db.so.1 resolved to: /lib/libthread_db.so.1.
td_ta_new failed: application not linked with libthreadBreakpoint 1, 0x08048080 in _start ()
=> 0x08048080 <_start+0>: b8 04 00 00 00 mov eax,0x4
(gdb) step
Single stepping until exit from function _start,
which has no line number information.Program exited normally.
(gdb) quit
Ktoś może wie co robię, nie tak? Czyżby objdump widział nagłówki debug, a gdb już nie?