зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1286005 - Don't include the PID in the NS_DebugBreak crash annotation. r=froydnj
Including the PID makes it impossible to aggregate crash reports on crash-stats. This also reduces buffer size to ensure that having two buffers does not increase total stack size, though that is unlikely to matter. 1000 characters is likely excessive in any event.
This commit is contained in:
Родитель
6dad001d7f
Коммит
b5c9f59859
|
@ -271,7 +271,7 @@ struct FixedBuffer
|
|||
buffer[0] = '\0';
|
||||
}
|
||||
|
||||
char buffer[1000];
|
||||
char buffer[500];
|
||||
uint32_t curlen;
|
||||
};
|
||||
|
||||
|
@ -306,6 +306,7 @@ EXPORT_XPCOM_API(void)
|
|||
NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
||||
const char* aFile, int32_t aLine)
|
||||
{
|
||||
FixedBuffer nonPIDBuf;
|
||||
FixedBuffer buf;
|
||||
const char* sevString = "WARNING";
|
||||
|
||||
|
@ -326,32 +327,31 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
|||
aSeverity = NS_DEBUG_WARNING;
|
||||
}
|
||||
|
||||
# define PrintToBuffer(...) PR_sxprintf(StuffFixedBuffer, &buf, __VA_ARGS__)
|
||||
|
||||
// Print "[PID]" or "[Desc PID]" at the beginning of the message.
|
||||
PrintToBuffer("[");
|
||||
if (sMultiprocessDescription) {
|
||||
PrintToBuffer("%s ", sMultiprocessDescription);
|
||||
}
|
||||
|
||||
PrintToBuffer("%d] ", base::GetCurrentProcId());
|
||||
|
||||
PrintToBuffer("%s: ", sevString);
|
||||
|
||||
#define PRINT_TO_NONPID_BUFFER(...) PR_sxprintf(StuffFixedBuffer, &nonPIDBuf, __VA_ARGS__)
|
||||
PRINT_TO_NONPID_BUFFER("%s: ", sevString);
|
||||
if (aStr) {
|
||||
PrintToBuffer("%s: ", aStr);
|
||||
PRINT_TO_NONPID_BUFFER("%s: ", aStr);
|
||||
}
|
||||
if (aExpr) {
|
||||
PrintToBuffer("'%s', ", aExpr);
|
||||
PRINT_TO_NONPID_BUFFER("'%s', ", aExpr);
|
||||
}
|
||||
if (aFile) {
|
||||
PrintToBuffer("file %s, ", aFile);
|
||||
PRINT_TO_NONPID_BUFFER("file %s, ", aFile);
|
||||
}
|
||||
if (aLine != -1) {
|
||||
PrintToBuffer("line %d", aLine);
|
||||
PRINT_TO_NONPID_BUFFER("line %d", aLine);
|
||||
}
|
||||
#undef PRINT_TO_NONPID_BUFFER
|
||||
|
||||
// Print "[PID]" or "[Desc PID]" at the beginning of the message.
|
||||
#define PRINT_TO_BUFFER(...) PR_sxprintf(StuffFixedBuffer, &buf, __VA_ARGS__)
|
||||
PRINT_TO_BUFFER("[");
|
||||
if (sMultiprocessDescription) {
|
||||
PRINT_TO_BUFFER("%s ", sMultiprocessDescription);
|
||||
}
|
||||
PRINT_TO_BUFFER("%d] %s", base::GetCurrentProcId(), nonPIDBuf.buffer);
|
||||
#undef PRINT_TO_BUFFER
|
||||
|
||||
# undef PrintToBuffer
|
||||
|
||||
// errors on platforms without a debugdlg ring a bell on stderr
|
||||
#if !defined(XP_WIN)
|
||||
|
@ -385,12 +385,14 @@ NS_DebugBreak(uint32_t aSeverity, const char* aStr, const char* aExpr,
|
|||
// really cause trouble if we're asserting from within IPC code. So we
|
||||
// have to do without the annotations in that case.
|
||||
if (XRE_IsParentProcess()) {
|
||||
// Don't include the PID in the crash report annotation to
|
||||
// allow faceting on crash-stats.mozilla.org.
|
||||
nsCString note("xpcom_runtime_abort(");
|
||||
note += buf.buffer;
|
||||
note += nonPIDBuf.buffer;
|
||||
note += ")";
|
||||
CrashReporter::AppendAppNotesToCrashReport(note);
|
||||
CrashReporter::AnnotateCrashReport(NS_LITERAL_CSTRING("AbortMessage"),
|
||||
nsDependentCString(buf.buffer));
|
||||
nsDependentCString(nonPIDBuf.buffer));
|
||||
}
|
||||
#endif // MOZ_CRASHREPORTER
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче