我怎样才能截断损坏的 C++ GDB 的反汇编命令显示的标识符?
GDB 的反汇编命令非常适合短 C 标识符,例如 main。对于长的、损坏的 C++ 标识符来说,冗长是多余的。例如,使用 icpc,我
(gdb) disassemble 0x49de2f 0x49de5b
Dump of assembler code from 0x49de2f to 0x49de5b:
0x000000000049de2f <_ZN5pecos8suzerain16fftw_multi_array6detail18c2c_buffer_processIPA2_dPKSt7complexIdEilNS2_26complex_copy_differentiateIS4_EEEEvT_T1_T2_T0_SD_SE_RKT3_+167>: mov 0x18(%rsp),%rsi
在 CLI 中看到像“显示”这样的结果,很长很烦人。它们使 GDB 的 TUI 程序集显示几乎毫无用处。
有没有办法告诉 GDB 显示截断的标识符?比如说剪辑除 50 个字符之外的所有字符?
GDB's disassemble command is nice for short C identifiers, e.g. main. For long, mangled C++ identifiers the verbosity is overkill. For example, using icpc I see results like
(gdb) disassemble 0x49de2f 0x49de5b
Dump of assembler code from 0x49de2f to 0x49de5b:
0x000000000049de2f <_ZN5pecos8suzerain16fftw_multi_array6detail18c2c_buffer_processIPA2_dPKSt7complexIdEilNS2_26complex_copy_differentiateIS4_EEEEvT_T1_T2_T0_SD_SE_RKT3_+167>: mov 0x18(%rsp),%rsi
Displays that long are annoying in the CLI. They make GDB's TUI assembly display all but useless.
Is there a way to tell GDB to show a truncated identifier? Say clip all but 50 characters?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当 GDB 知道反汇编中只有一个函数时,CVS 的当前 GDB 会按照您想要的方式运行:
当 GDB 无法知道反汇编是否会跨越函数边界时,它仍然打印“长”形式:
这是 < a href="http://sourceware.org/ml/gdb-patches/2009-10/msg00505.html" rel="nofollow noreferrer">补丁 引入了“简短形式”。
Current GDB from CVS behaves the way you want when it knows that there is only one function in the disassembly:
When GDB can't know whether or not disassembly will cross function boundary, it still prints the "long" form:
Here is the patch which introduced the "short form".
这并不能真正回答你的问题,但你至少可以对事物进行分解,使它们不那么丑陋:
set print asm-demangle on
This doesn't really answer your question, but you might be able to at least demangle things to make them a little less ugly:
set print asm-demangle on