user2293382
user2293382

Reputation: 1

gdb can't step, but can break on lines nasm

I have a file compiled with nasm, with nasm -f elf64 -g helloworld.asm, and here is the output of objdump -g -d -M intel helloworld.o:

helloworld.e:     file format elf64-x86-64


Disassembly of section .text:

00000000004000b0 <_start>:
  4000b0:       b8 04 00 00 00          mov    eax,0x4
  4000b5:       bb 01 00 00 00          mov    ebx,0x1
  4000ba:       48 b9 d8 00 60 00 00    movabs rcx,0x6000d8
  4000c1:       00 00 00
  4000c4:       ba 0b 00 00 00          mov    edx,0xb
  4000c9:       cd 80                   int    0x80
  4000cb:       b8 01 00 00 00          mov    eax,0x1
  4000d0:       bb 00 00 00 00          mov    ebx,0x0
  4000d5:       cd 80                   int    0x80
helloworld.asm:
/* file helloworld.asm line 9 addr 0x4000b0 */
/* file helloworld.asm line 10 addr 0x4000b5 */
/* file helloworld.asm line 11 addr 0x4000ba */
/* file helloworld.asm line 12 addr 0x4000c4 */
/* file helloworld.asm line 13 addr 0x4000c9 */
/* file helloworld.asm line 14 addr 0x4000cb */
/* file helloworld.asm line 15 addr 0x4000d0 */
/* file helloworld.asm line 16 addr 0x4000d5 */

so, at least to me, it looks like it has debug information. when I run gdb, I can set a breakpoint at any line, and it breaks at the proper memory address [and every register is updated as expected] yet I cannot step, since I get the horrible

Single stepping until exit from function _start,
which has no line number information.

My gdb version is 7.7.1 and nasm version is 2.10.9.

Anyone has any idea?

Upvotes: 0

Views: 330

Answers (1)

Oleg Gopkolov
Oleg Gopkolov

Reputation: 1684

It seems to be, in your case, the problem is version skew between nasm and gdb.

Try to update your gdb version at least to 7.8.

Upvotes: 1

Related Questions