Surfacing the process create time in google_breakpad::ProcessState

and updating minidump_stackwalk to show process uptime.

I tested this with a minidump from Chrome and I got a result that
is inline with what the Windows debugger is showing for that dump:

minidump_stackwalk output:
--------------------------
Process uptime: 601 seconds

WinDBG output:
--------------
Process Uptime: 0 days 0:10:01.000

I didn't update the machine readable output of minidump_stackwalk
on purpose in order to avoid breaking someone that uses it.
It can be added later to the machine output if needed.

R=mark@chromium.org

Review URL: https://breakpad.appspot.com/7754002

git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@1406 4c0a9323-5329-0410-9bdc-e9ce6186880e
This commit is contained in:
ivanpe@chromium.org 2014-11-25 22:45:23 +00:00
parent 57e5b074f6
commit 63919583ba
10 changed files with 123 additions and 15 deletions

View file

@ -87,6 +87,9 @@ ProcessResult MinidumpProcessor::Process(
}
process_state->time_date_stamp_ = header->time_date_stamp;
bool has_process_create_time =
GetProcessCreateTime(dump, &process_state->process_create_time_);
bool has_cpu_info = GetCPUInfo(dump, &process_state->system_info_);
bool has_os_info = GetOSInfo(dump, &process_state->system_info_);
@ -135,14 +138,15 @@ ProcessResult MinidumpProcessor::Process(
}
BPLOG(INFO) << "Minidump " << dump->path() << " has " <<
(has_cpu_info ? "" : "no ") << "CPU info, " <<
(has_os_info ? "" : "no ") << "OS info, " <<
(breakpad_info != NULL ? "" : "no ") << "Breakpad info, " <<
(exception != NULL ? "" : "no ") << "exception, " <<
(module_list != NULL ? "" : "no ") << "module list, " <<
(threads != NULL ? "" : "no ") << "thread list, " <<
(has_dump_thread ? "" : "no ") << "dump thread, and " <<
(has_requesting_thread ? "" : "no ") << "requesting thread";
(has_cpu_info ? "" : "no ") << "CPU info, " <<
(has_os_info ? "" : "no ") << "OS info, " <<
(breakpad_info != NULL ? "" : "no ") << "Breakpad info, " <<
(exception != NULL ? "" : "no ") << "exception, " <<
(module_list != NULL ? "" : "no ") << "module list, " <<
(threads != NULL ? "" : "no ") << "thread list, " <<
(has_dump_thread ? "" : "no ") << "dump thread, " <<
(has_requesting_thread ? "" : "no ") << "requesting thread, and " <<
(has_process_create_time ? "" : "no ") << "process create time";
bool interrupted = false;
bool found_requesting_thread = false;
@ -618,6 +622,32 @@ bool MinidumpProcessor::GetOSInfo(Minidump *dump, SystemInfo *info) {
return true;
}
// static
bool MinidumpProcessor::GetProcessCreateTime(Minidump* dump,
uint32_t* process_create_time) {
assert(dump);
assert(process_create_time);
*process_create_time = 0;
MinidumpMiscInfo* minidump_misc_info = dump->GetMiscInfo();
if (!minidump_misc_info) {
return false;
}
const MDRawMiscInfo* md_raw_misc_info = minidump_misc_info->misc_info();
if (!md_raw_misc_info) {
return false;
}
if (!(md_raw_misc_info->flags1 & MD_MISCINFO_FLAGS1_PROCESS_TIMES)) {
return false;
}
*process_create_time = md_raw_misc_info->process_create_time;
return true;
}
// static
string MinidumpProcessor::GetCrashReason(Minidump *dump, uint64_t *address) {
MinidumpException *exception = dump->GetException();