mwag
mwag

Reputation: 4035

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

I am using GDB to debug a program on 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. 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:

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.

This problem seemed to start occurring after upgrading to Yosemite (from Lion), so I am inclined to think it is related to that. 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.

Any suggestions as to how to fix this? I am using emacs + gdb and would like to keep it that way. I'd probably be fine with emacs + lldb, but it seems there is some debate over whether/when that will be supported.

Upvotes: 1

Views: 298

Answers (1)

Employed Russian
Employed Russian

Reputation: 213646

Any suggestions as to how to fix this?

This looks like a bug in 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).

Upvotes: 1

Related Questions