Closed Bug 524522 Opened 15 years ago Closed 13 years ago

Tinderbox debug build unit tests don't capture a stack trace for JS_ASSERT assertion failure

Categories

(Core :: JavaScript Engine, defect)

Other Branch
defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: jorendorff, Assigned: jorendorff)

Details

(Whiteboard: fixed-in-tracemonkey)

Attachments

(1 file, 1 obsolete file)

A JS_ASSERT failure does asm("int $3"), which raises SIGTRAP, which breakpad doesn't consider a report-worthy crash.

The reason we do this is bug 308395. It's hard to get a program to continue running in GDB once abort() has been called.

I propose calling raise(SIGABRT) instead of "int $3" or abort(). This will cause breakpad to engage, but unlike abort() it's resumable:

  Assertion failure: "oops" == "ugh", at ../jstracer.cpp:9250

  Program received signal SIGABRT, Aborted.
  0xb7fe1430 in __kernel_vsyscall ()
  (gdb) signal 0
  Continuing with no signal.
  js>
Attached patch v1 (obsolete) — Splinter Review
Removing OS2 cruft as I don't think OS2 folks are debugging JS assertions much these days.

Still needs testing on Mac, hang on.
Assignee: general → jorendorff
Status: NEW → ASSIGNED
Attached patch v2Splinter Review
Works fine on Mac.

Let's do this on all platforms except Windows.

This would be the right thing to do on Windows too (<signal.h> and raise are supported there), but I'm not sure it would work. Bug 345118 comment 0 says that a comment in the CRT source code says it wouldn't work; the MSDN documentation for raise() seems to say it would. Windows users, feel free to try it.
Attachment #408444 - Attachment is obsolete: true
Attachment #408451 - Flags: review?(mrbkap)
I assume on Windows you'd want DebugBreak for the debugger, but I don't know what that does to Breakpad:
http://msdn.microsoft.com/en-us/library/ms679297%28VS.85%29.aspx
Oh, apparently Breakpad can handle them, but you have to explicitly ask for it, precisely so it doesn't interfere with your debugger:
http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/client/windows/handler/exception_handler.cc#408
Attachment #408451 - Flags: review?(mrbkap) → review+
I pushed this change directly to m-c.

http://hg.mozilla.org/mozilla-central/rev/cf193e9f7eaa

This is debug-only but I think we probably want it in 1.9.2 anyway after a little baking.
Flags: wanted1.9.2?
Ted, how should I test this?

I tried building a browser with --enable-crashreporter and a manually added bogus JS_ASSERT, and ran it locally with MOZ_CRASHREPORTER=1 in my environment, but the crash reporter didn't engage.
That should be sufficient. If you'd like a more formal test, I have unit tests in attachment 400154 [details] [diff] [review] that actually test our exception handler. You could replace the guts of nsTestCrasher::Crash(), and then run make && make check in toolkit/crashreporter/test.
Per comment 6 and some discussion with Ted on IRC, I think this still isn't fixed on Mac, where breakpad does not respond to signals (!).

The solution, I think, is to write to NULL, on Mac only, before calling raise(SIGABRT).
Pushed the change suggested in comment 8 paragraph 2 to m-c:

http://hg.mozilla.org/mozilla-central/rev/eba15b3faf31
Flags: wanted1.9.2?
Summary: Tinderbox debug build unit tests don't capture a stack for JS_ASSERT assertion failure → Tinderbox debug build unit tests don't capture a stack trace for JS_ASSERT assertion failure
These bugs are all part of a search I made for js bugs that are getting lost in
transit:

http://tinyurl.com/jsDeadEndBugs

They all have a review+'ed, non-obsoleted patch and are not marked
fixed-in-tracemonkey or checkin-needed but have not seen any activity in 300
days. Some of these got lost simply because the assignee/patch provider never
requested a checkin, or just because they were forgotten about.
This landed, jorendorff just forgot to update the status.
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Whiteboard: fixed-in-tracemonkey
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: