How do you debug SIGBUS?

I’m working on a project with a lot of lines of code and a lot of activity (NPC characters fighting each other) and get the inevitable SIGBUS where it’s not clear what game event triggered it. The logging we have in place usually isn’t enough to track things down. I’ve even added different levels of conditional logging, but the most useful level of logging enter/exit on the important branches of the code slows things down way too much to be useful.

So I’m wondering if anybody has any special tricks for hunting down the wily SIGBUS… or if I’ve missed some obvious feature of XCode that I’ll be slapping myself about shortly.

Hi,

  • Build your Xcode project in “Debug” configuration
  • Run on the device
  • When it stops with SIGBUS, go to Xcode GDB Console (Run->Console)
  • type “bt”

It will print stack trace, function names of very top stack frames will give a clue what script_method is causing a problem.

Good luck!

Okay, great - thanks much!

OK, so I’m debugging SIGBUS on an iPad with Xcode set for: Active Configuration: Debug, and Active Architecture: armv6

When I got a SIGBUS, I typed “bt” in the Xcode console:

Program received signal: “SIGBUS”.
(gd) bt
#0 0x005753c0 in start ()

I was hoping for a function list from Unity, but all I got was the Object-C (?) start() function. Any ideas?

means that you won’t get any further than that within xcode normally and that you will likely find out more if you test it with remote in the editor where you commonly will get some kind of exception you don’t handle for example

but they can be very straining on hunt down …