Closed Bug 525296 Opened 15 years ago Closed 11 years ago

figure out how to trigger Breakpad from out of process on OS X

Categories

(Testing :: Mochitest, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ted, Assigned: ted)

References

Details

In bug 501034 I made automation.py able to detect process hangs (from lack of output) and kill the process in a way that triggers Breakpad. On Linux this is easy, you just kill -SEGV. On Windows, I wrote a horrible hack of an app that injects a DLL into the process and then crashes. We should figure out a way to do this on OS X.
Breakpad listens for Mach-O exceptions, and when you use "kill" to kill a process, apparently we don't get one. (You get the Apple crash reporter.) Maybe we can fix Breakpad to handle that, I don't know. On the flip side, getting code injected into another process requires a mach_task, and getting that requires task_for_pid, which has been locked down since 10.5:
http://www.mikeash.com/?page=pyblog/friday-qa-2009-01-30-code-injection.html
On mac, could we just install a signal handler for some signal (SIGTRAP perhaps) which then programmatically triggers breakpad? Ted, I'm not sure what's currently on your plate, but getting this fixed would be helpful for understanding the set of intermittent mochitest hang which are currently plaguing the plugin tests on mac. Do you have time for it?
Flags: needinfo?(ted)
There's actually code upstream now for handling SIGABRT properly, but I think it's only fully fleshed out for iOS. I did some fiddling a while ago, the patch is still in my Breakpad MQ:
http://hg.mozilla.org/users/tmielczarek_mozilla.com/breakpad-mq/file/74d48d4a037c/mac-sigabrt-test

I don't remember the details, but I think it just needed a little more work. I think it might have had some code paths that only handled ARM or something like that.
Assignee: nobody → ted
Flags: needinfo?(ted)
Note for myself, I think it was mostly just this block in MinidumpGenerator that needed to be fixed:
http://code.google.com/p/google-breakpad/source/browse/trunk/src/client/mac/handler/minidump_generator.cc#782
OS: Windows XP → Mac OS X
Hardware: x86 → All
I finished up that patch. I'll use bug 717758 to track landing that, and this bug to track teaching our test harnesses to know that they can use SIGABRT to get a stack on Mac.
Depends on: 717758
Hardware: All → x86
I was lazy and just fixed it in bug 717758.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.