Re: Xcode interferes with signal handler (was: Sending SIGUSR1 to a process)
site_archiver@lists.apple.com Delivered-To: cocoa-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mac.com; s=1a1hai; t=1706712883; bh=Hx5yl0jFk5+QnEYSm80srOAvc4yIm3bwVKhY00tX5NU=; h=From:Content-Type:Mime-Version:Subject:Date:To:Message-Id; b=kol72LMGIhR0Jw3P22YY+k1mFoznobSTkwryVbKMQibBp9TlyavpS53iELTTOdv2E 29mSPrU5NneJf3jpr9LSfPw/jI2e+J0E8WY+2YXiglgr2j7YuMnvty0ine6azcFbzQ lbpIfGvWaZMVjdx2oaPN3D5Ln/kHU3W4rd9VO/AoTPuFlecbFhlbfTjgWTYssq299p ZDbP7K8yyLSC/I19WwKcjKca057ISMql/q89gWUzsX92otLlfPfdcKowE6518SLeu3 VEmCUnl0pLsXMrr6+tzDM1JdpMMMQyomVhk6dKCywOSYqm20xo4BLa3xXEqOE/F05C 6MOMaBs4AMJ8Q== That’s a great tip Jens. Gabriel, if you build your app with different dev/release schemes, you could detect your build scheme and then execute the desired process based on if you’re able to debug or not. Just expose the environment variable for $CONFIGURATION in an info.plist file, read it into a variable and then manage your response based on what the value is. If you want details on that, contact me off list and I’ll show you. Reference: https://developer.apple.com/library/archive/documentation/DeveloperTools/Ref... Hopefully, Jens’s tip will get you what you need! Best, Alex Zavatone
On Jan 31, 2024, at 12:20 AM, Jens Miltner via Cocoa-dev <cocoa-dev@lists.apple.com> wrote:
Xcode intercepts signals in the process being debugged (for good reason). You can ignore specific signals in Xcode (i.e. pass them through to the process being debugged) by breaking into the debugger, then enter in the Xcode console part (example for SIGUSR1):
process handle SIGUSR1 -s false process handle SIGUSR1 -p true
HTH, -jens
Von: Gabriel Zachmann <zach@cs.uni-bremen.de> Betreff: Xcode interferes with signal handler (was: Sending SIGUSR1 to a process) Datum: 30. Januar 2024 um 20:31:45 MEZ An: "cocoa-dev@lists.apple.com" <cocoa-dev@lists.apple.com>
I am setting up a signal handler in my app like this:
void *e = signal( SIGUSR1, signal_handler ); if ( e == SIG_ERR ) ...
It works (i can 'kill -30 <pid>'), BUT ONLY, if I run my app outside of Xcode.
When I launch it from Xcode, and I send a SIGUSR1 to my app, it always breaks at mach_msg2_trap. Obviously, this is a bit tedious for developing, since now I always have to go through Product / Archive / Distribute ...
Any ideas, how I can prevent this from happening?
And it's unclear to me what's going on. Can Xcode really prevent signal(3) from installing a signal handler? Or does a kill on the command line deliver the signal to several processes, one of them, maybe, an ancillary process from Xcode?
Best regards, Gabriel
_______________________________________________
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
This email sent to zav@mac.com
_______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Alex Zavatone via Cocoa-dev