debugging - 显示 "No function contains program counter for selected frame"时如何强制 GDB 反汇编代码?

标签 debugging assembly x86 gdb portable-executable

How to force GDB to disassemble code when it says "No function contains program counter for selected frame"?



调试程序,从绝对地址0x00402200开始, 尝试反汇编此地址处的代码时得到以下输出:
[New Thread 65212.0x10378]

Breakpoint 1, 0x00402200 in ?? ()
(gdb) stepi
0x00402202 in ?? ()
(gdb) stepi
0x00402207 in ?? ()
(gdb) stepi
0x0040220a in ?? ()
(gdb) stepi
0x0040220f in ?? ()
(gdb) disassemble
No function contains program counter for selected frame.
(gdb) stepi
0x00401000 in start ()

被调试的文件是一个用于教育目的的 Win32 PE(逆向工程)。

有没有办法告诉GDB在地址开始反汇编?否则,我的替代品是什么(即其他工具)?

最佳答案

disassemble 的文档:(gdb) help disassemble说:

Disassemble a specified section of memory.
Default is the function surrounding the pc of the selected frame.
...
With a single argument, the function surrounding that address is dumped.
Two arguments (separated by a comma) are taken as a range of memory to dump,
  in the form of "start,end", or "start,+length".

因此,在您的情况下,由于它们不是围绕程序计数器 (PE) 的功能,您应该使用双参数形式,例如:
disassemble 0x00402200, +16disassemble 0x00402200, 0x00402210 .

希望这可以帮助!

关于debugging - 显示 "No function contains program counter for selected frame"时如何强制 GDB 反汇编代码?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39016138/

相关文章:

c# - 为什么调试器会遇到默认情况?

html - 媒体查询之一不起作用

c++ - 浮点舍入为 80 位寄存器和 64 位 double : ill-formed code or gcc/clang bug? 提供不同的结果

c - 使用 GDB 在 x86 机器上进行 MIPS 反汇编;可能的?

debugging - 在 VS2017 中调试 Aurelia webpack typescript 应用程序

debugging - 启动windbg用户模式远程调试 session 的最佳技术

c++ - 内联汇编分支目标超出范围

memory - GDB 中的 x86 标签和 LEA

手动将C语言的汇编代码转换为机器代码

assembly - 在程序集中添加有符号数字