Open Bug 753759 Opened 12 years ago Updated 2 years ago

MOZ_ASSERT should dump a stack whenever NS_ASSERTION would

Categories

(Core :: MFBT, enhancement)

enhancement

Tracking

()

People

(Reporter: ayg, Unassigned)

Details

In my debug builds, NS_ASSERTION prints a stack trace.  MOZ_ASSERT does not.  This is annoying -- usually all I need to fix the problem is a stack trace, and it's extra effort (and slower) to run in a debugger.  It's not obvious how to run in a debugger at all when running tests, although I'm sure it's simple enough if I knew how.  Could we just have MOZ_ASSERT print a backtrace?
Ted is of the opinion we shouldn't do this; I'm kind of thinking about the same -- lots of code, hard to get right, often easy to spin up again with a debugger.
Debug builds by default should still have the ah_crap_handler which gives you time to attach a debugger, no?
That doesn't seem to work properly when running mochitests, at least in my experience.  It just exits with no further info.  I wouldn't mind so much if I could easily detach a debugger after the fact if MOZ_ASSERT is hit during a test run -- i.e., I don't want to have to run it in a debugger to start with.

I don't see why MOZ_ASSERT shouldn't have feature parity with NS_ASSERTION, though, if the idea is to replace it.  Stack trace on a fatal assertion is a pretty reasonable feature to want, and will only become more useful as MOZ_ASSERT is used more.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.