【问题标题】:gdb can't step, but can break on lines nasmgdb 不能跨步,但可以断行 nasm
【发布时间】:2015-09-12 04:58:40
【问题描述】:

我有一个用 nasm 编译的文件,带有 nasm -f elf64 -g helloworld.asm,这里是 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 */

所以,至少在我看来,它看起来有调试信息。当我运行 gdb 时,我可以在任何行设置一个断点,它会在正确的内存地址处中断 [并且每个寄存器都按预期更新] 但我无法步进,因为我得到了可怕的

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

我的 gdb 版本是 7.7.1,nasm 版本是 2.10.9。

有人知道吗?

【问题讨论】:

  • 也不适用于 gdb 7.9
  • 在nasm命令行中添加-F dwarf是否有效?
  • 好吧,我以为我已经尝试过但没有用,但现在可以了。我想我在某个地方搞混了,抱歉打扰了!

标签: gdb nasm debug-symbols


【解决方案1】:

在您的情况下,问题似乎是 nasm 和 gdb 之间的版本偏差。

尝试将您的 gdb 版本至少更新到 7.8。

【讨论】:

  • 我已经升级到7.9,问题依旧
猜你喜欢
  • 2023-01-28
  • 2014-05-03
  • 2017-03-26
  • 2020-07-23
  • 2018-12-20
  • 2011-11-19
  • 1970-01-01
  • 1970-01-01
  • 2014-05-15
相关资源
最近更新 更多