简体   繁体   English

优胜美地上的gdb:在gdb命令行上调用函数时,SIGBUS错误

[英]gdb on Yosemite: SIGBUS error when calling function at gdb command line

I am using GDB to debug a program on Yosemite OSX. 我正在使用GDB在Yosemite OSX上调试程序。 At a breakpoint, I want to print out some information using an internal function, but I get a SIGBUS error even with a trivial function. 在断点处,我想使用内部函数打印一些信息,但是即使是平凡的函数,我也会遇到SIGBUS错误。 For example: 例如:

Breakpoint 1, ...
(gdb) print my_info_function()
Program received signal SIGBUS, Bus error.
<function called from gdb>
The program being debugged was signaled...

where my_info_function is: 其中my_info_function为:

const char *my_info_function() {
  return "hello";
}

In addition, if I run the program with gdb, then interrupt it while it is running, then, regardless of whether the interruption occurs before or after the above breakpoint, print my_info_function() works fine. 另外,如果我使用gdb运行该程序,然后在其运行时中断它,则无论中断发生在上述断点之前还是之后, print my_info_function()可以正常工作。

This problem seemed to start occurring after upgrading to Yosemite (from Lion), so I am inclined to think it is related to that. 从Lion升级到优胜美地后,似乎开始出现此问题,因此我倾向于认为与此有关。 I tried using different compilers (clang, gcc-4.9, brew vs macports), and using / reinstalling / rebuilding different gdb's (brew, macports, as well as this brew gdb version ), all to no avail. 我尝试使用不同的编译器(clang,gcc-4.9,brew vs macports),并使用/重新安装/重建不同的gdb(brew,macports以及该brew gdb版本 ),但都无济于事。

Any suggestions as to how to fix this? 关于如何解决此问题的任何建议? I am using emacs + gdb and would like to keep it that way. 我正在使用emacs + gdb,并希望保持这种状态。 I'd probably be fine with emacs + lldb, but it seems there is some debate over whether/when that will be supported. 我可能会对emacs + lldb感到满意,但似乎对于是否/何时支持该问题存在一些争论。

Any suggestions as to how to fix this? 关于如何解决此问题的任何建议?

This looks like a bug in GDB. 这看起来像是GDB中的错误。

You can either try to build GDB from source, debug GDB with itself, and send a patch to the gdb-patches mailing list , or just report it in GDB bugzilla (and hope that someone else fixes it). 您可以尝试从源代码构建GDB,使用自身调试GDB,然后将补丁发送到gdb-patches邮件列表 ,或者只是在GDB Bugzilla中报告它(并希望其他人对其进行修复)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM