Closed Bug 1104682 Opened 7 years ago Closed 5 years ago
_CRASH messages should be treated as crash annotations
At the moment, if we `MOZ_CRASH("Some reason for the crash")`, the information "Some reason for the crash" is lost. We should add it to the crash report.
There are only two possible kinks here: 1) Can we verify that MOZ_CRASH is only going to be used in situations where we don't have memory corruption or other unsafe situations that would make it unsafe to use AnnotateCrashReport (which allocates)? This might be a problem: http://hg.mozilla.org/mozilla-central/annotate/acde07cb4e4d/mfbt/Assertions.h#l245 2) Can everything that uses MOZ_CRASH link to the crashreporter code? I'm pretty sure with it being in MFBT that it gets used in things like JS which do not have the crashreporter. We could maybe work around these by special-casing this, maybe something like: mfbt/Assertions.h extern char moz_crash_msg; ... in the guts of MOZ_CRASH ... memcpy(moz_crash_msg, msg); in nsExceptionHandler.cpp or somewhere: char moz_crash_msg; ... and then write it out in MinidumpCallback.
Could we just assign to a char* and have MinidumpCallback write that?
MOZ_CRASH() is meant to be entirely, 100% safe to use no matter how corrupted your memory is. (At least, assuming page 0 faults on write.) Assume unsafe situations. Copying into a side scratchpad is the most that seems feasible to me, so long as the copying uses entirely-constant parameters at each location.
As long as we have file and line number information (via crash dump or generated stack trace) there's no benefit to including this message in the dump is there? You can just look at the source.
Well, there is the benefit that it makes crash triaging simpler.
I believe this has been fixed. There is a "MozCrashReason" field that gets added to crash reports when they are triggered by MOZ_CRASH. See CrashReporter::AnnotateMozCrashReason() for details. Here's an example crash report with this field: https://crash-stats.mozilla.com/report/index/fa4646d9-1cc8-4a81-9843-722252160524 You can see the field in the "Metadata" tab.
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → WORKSFORME
I guess duplicate is better, although it's not great that we have 2 different mechanisms for this...
Resolution: WORKSFORME → DUPLICATE
Duplicate of bug: 1183355
You need to log in before you can comment on or make changes to this bug.