зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1135543 - Part 3: Create events file format crash.main.2 which contains metadata; r=bsmedberg
--HG-- extra : rebase_source : 26de3cac35f9e5a5398f912f36f3d3cc0b286806
This commit is contained in:
Родитель
5de2cde13f
Коммит
267318954e
|
@ -519,10 +519,16 @@ this.CrashManager.prototype = Object.freeze({
|
|||
entry.path);
|
||||
return this.EVENT_FILE_ERROR_MALFORMED;
|
||||
}
|
||||
|
||||
let [crashID] = lines;
|
||||
// fall-through
|
||||
case "crash.main.2":
|
||||
let crashID = lines[0];
|
||||
let metadata = {};
|
||||
for (let i = 1; i < lines.length; i++) {
|
||||
let [key, val] = lines[i].split("=");
|
||||
metadata[key] = val;
|
||||
}
|
||||
store.addCrash(this.PROCESS_TYPE_MAIN, this.CRASH_TYPE_CRASH,
|
||||
crashID, date);
|
||||
crashID, date, metadata);
|
||||
break;
|
||||
|
||||
case "crash.submission.1":
|
||||
|
|
|
@ -65,6 +65,17 @@ hangs in child processes can be easily recorded by the main process, we do not
|
|||
foresee the need for writing event files for child processes, design
|
||||
considerations below notwithstanding.
|
||||
|
||||
crash.main.2
|
||||
^^^^^^^^^^^^
|
||||
|
||||
This event is produced when the main process crashes.
|
||||
|
||||
The payload of this event is delimited by UNIX newlines (*\n*) and contains the
|
||||
following fields:
|
||||
|
||||
* The crash ID string, very likely a UUID
|
||||
* 0 or more lines of metadata, each containing one key=value pair of text
|
||||
|
||||
crash.main.1
|
||||
^^^^^^^^^^^^
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ add_task(function* test_malformed_files_deleted() {
|
|||
add_task(function* test_aggregate_ignore_unknown_events() {
|
||||
let m = yield getManager();
|
||||
|
||||
yield m.createEventsFile("1", "crash.main.1", DUMMY_DATE, "id1");
|
||||
yield m.createEventsFile("1", "crash.main.2", DUMMY_DATE, "id1");
|
||||
yield m.createEventsFile("2", "foobar.1", new Date(), "dummy");
|
||||
|
||||
let count = yield m.aggregateEventsFiles();
|
||||
|
@ -170,7 +170,7 @@ add_task(function* test_prune_old() {
|
|||
let m = yield getManager();
|
||||
let oldDate = new Date(Date.now() - 86400000);
|
||||
let newDate = new Date(Date.now() - 10000);
|
||||
yield m.createEventsFile("1", "crash.main.1", oldDate, "id1");
|
||||
yield m.createEventsFile("1", "crash.main.2", oldDate, "id1");
|
||||
yield m.addCrash(m.PROCESS_TYPE_PLUGIN, m.CRASH_TYPE_CRASH, "id2", newDate);
|
||||
|
||||
yield m.aggregateEventsFiles();
|
||||
|
@ -195,10 +195,10 @@ add_task(function* test_prune_old() {
|
|||
|
||||
add_task(function* test_schedule_maintenance() {
|
||||
let m = yield getManager();
|
||||
yield m.createEventsFile("1", "crash.main.1", DUMMY_DATE, "id1");
|
||||
yield m.createEventsFile("1", "crash.main.2", DUMMY_DATE, "id1");
|
||||
|
||||
let oldDate = new Date(Date.now() - m.PURGE_OLDER_THAN_DAYS * 2 * 24 * 60 * 60 * 1000);
|
||||
yield m.createEventsFile("2", "crash.main.1", oldDate, "id2");
|
||||
yield m.createEventsFile("2", "crash.main.2", oldDate, "id2");
|
||||
|
||||
yield m.scheduleMaintenance(25);
|
||||
let crashes = yield m.getCrashes();
|
||||
|
@ -208,7 +208,7 @@ add_task(function* test_schedule_maintenance() {
|
|||
|
||||
add_task(function* test_main_crash_event_file() {
|
||||
let m = yield getManager();
|
||||
yield m.createEventsFile("1", "crash.main.1", DUMMY_DATE, "id1");
|
||||
yield m.createEventsFile("1", "crash.main.2", DUMMY_DATE, "id1\nk1=v1\nk2=v2");
|
||||
let count = yield m.aggregateEventsFiles();
|
||||
Assert.equal(count, 1);
|
||||
|
||||
|
@ -216,6 +216,7 @@ add_task(function* test_main_crash_event_file() {
|
|||
Assert.equal(crashes.length, 1);
|
||||
Assert.equal(crashes[0].id, "id1");
|
||||
Assert.equal(crashes[0].type, "main-crash");
|
||||
Assert.deepEqual(crashes[0].metadata, { k1: "v1", k2: "v2"});
|
||||
Assert.deepEqual(crashes[0].crashDate, DUMMY_DATE);
|
||||
|
||||
count = yield m.aggregateEventsFiles();
|
||||
|
@ -224,7 +225,7 @@ add_task(function* test_main_crash_event_file() {
|
|||
|
||||
add_task(function* test_crash_submission_event_file() {
|
||||
let m = yield getManager();
|
||||
yield m.createEventsFile("1", "crash.main.1", DUMMY_DATE, "crash1");
|
||||
yield m.createEventsFile("1", "crash.main.2", DUMMY_DATE, "crash1");
|
||||
yield m.createEventsFile("1-submission", "crash.submission.1", DUMMY_DATE_2,
|
||||
"crash1\nfalse\n");
|
||||
|
||||
|
@ -279,7 +280,7 @@ add_task(function* test_high_water_mark() {
|
|||
let store = yield m._getStore();
|
||||
|
||||
for (let i = 0; i < store.HIGH_WATER_DAILY_THRESHOLD + 1; i++) {
|
||||
yield m.createEventsFile("m" + i, "crash.main.1", DUMMY_DATE, "m" + i);
|
||||
yield m.createEventsFile("m" + i, "crash.main.2", DUMMY_DATE, "m" + i);
|
||||
}
|
||||
|
||||
let count = yield m.aggregateEventsFiles();
|
||||
|
|
|
@ -160,7 +160,7 @@ static const XP_CHAR dumpFileExtension[] = XP_TEXT(".dmp");
|
|||
static const XP_CHAR extraFileExtension[] = XP_TEXT(".extra");
|
||||
static const XP_CHAR memoryReportExtension[] = XP_TEXT(".memory.json.gz");
|
||||
|
||||
static const char kCrashMainID[] = "crash.main.1\n";
|
||||
static const char kCrashMainID[] = "crash.main.2\n";
|
||||
|
||||
static google_breakpad::ExceptionHandler* gExceptionHandler = nullptr;
|
||||
|
||||
|
@ -712,6 +712,13 @@ bool MinidumpCallback(
|
|||
WriteFile(hFile, crashTimeString, crashTimeStringLen, &nBytes, nullptr);
|
||||
WriteFile(hFile, "\n", 1, &nBytes, nullptr);
|
||||
WriteFile(hFile, id_ascii, strlen(id_ascii), &nBytes, nullptr);
|
||||
if (oomAllocationSizeBufferLen) {
|
||||
WriteFile(hFile, "\n", 1, &nBytes, nullptr);
|
||||
WriteFile(hFile, kOOMAllocationSizeParameter,
|
||||
kOOMAllocationSizeParameterLen, &nBytes, nullptr);
|
||||
WriteFile(hFile, oomAllocationSizeBuffer, oomAllocationSizeBufferLen,
|
||||
&nBytes, nullptr);
|
||||
}
|
||||
CloseHandle(hFile);
|
||||
}
|
||||
#elif defined(XP_UNIX)
|
||||
|
@ -723,6 +730,13 @@ bool MinidumpCallback(
|
|||
unused << sys_write(fd, crashTimeString, crashTimeStringLen);
|
||||
unused << sys_write(fd, "\n", 1);
|
||||
unused << sys_write(fd, id_ascii, strlen(id_ascii));
|
||||
if (oomAllocationSizeBufferLen) {
|
||||
unused << sys_write(fd, "\n", 1);
|
||||
unused << sys_write(fd, kOOMAllocationSizeParameter,
|
||||
kOOMAllocationSizeParameterLen);
|
||||
unused << sys_write(fd, oomAllocationSizeBuffer,
|
||||
oomAllocationSizeBufferLen);
|
||||
}
|
||||
sys_close(fd);
|
||||
}
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче