【发布时间】:2014-04-24 16:09:13
【问题描述】:
我试图在模块加载到 gdb 后立即停止。假设二进制完全去掉了所有符号信息,所以没有main。
理想情况下,我会在入口点设置断点,但这个想法由于重定位而失效:
(gdb) info target
Symbols from "./application".
Local exec file:
`./application', file type elf64-x86-64.
Entry point: 0xc154
...
(gdb) break *0xc154
Breakpoint 1 at 0xc154
(gdb) r
Starting program: ./application
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0xc154: Input/output error.
(gdb) info target
Symbols from "./application".
Unix child process:
Using the running image of child process 22835.
While running this, GDB does not access memory from...
Local exec file:
`./application', file type elf64-x86-64.
Entry point: 0x555555560154
即使这种方法有效(我可以在新地址上设置一个新断点并禁用原始地址),它也不能通过 gdb 脚本/批处理模式轻松执行,因为它中间有一条失败的指令。
有没有办法做到这一点?理想情况下,像“运行单指令”而不是“运行”这样的东西会很有用。
【问题讨论】:
标签: gdb breakpoints