Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode: GDB and signal handlers

Tags:

xcode

signals

gdb

I'm using signal handlers in an Objective-C application to catch fatal errors, as SIGSEGV, SIGBUS and the like.

When such an signal is raised, I'm writing a log file, with a backtrace and details about the error (I know I can have reentrancy issues, but that's not the point).

This way, I can know on the next launch that the application has crashed, and I can ask the user if he want to fill a bug report.

It works fine when I launch the app manually.

But when I run it from Xcode (with GDB), the signal handlers are not called.

I've try to set them with signal or sigaction, but there's no difference.

I've also checked with info signals that those signals are set to pass, meaning they should be passed to the application.

That's not a big deal, as I only got this problem when I'm debugging my application, but it will be very nice to have that working also with GDB.

Has anyone experienced and solved such a problem?

like image 816
Macmade Avatar asked Nov 14 '22 17:11

Macmade


1 Answers

You might want to try to set these signals to nostop in gdb, so it is managed by your application.

like image 78
steve Avatar answered Dec 31 '22 01:12

steve