| From 3e7704b2e1cade513ef8918a060d3ee8ae5911e5 Mon Sep 17 00:00:00 2001 |
| From: Jon Turney <jon.turney@dronecode.org.uk> |
| Date: Thu, 16 Oct 2014 00:53:55 +0100 |
| Subject: [PATCH 19/29] Fallback to synthesizing a debug-id from version and |
| architecture, if possible |
| |
| Based on an idea by Ivan Gubarev |
| |
| Ideally there would be a similar change in PeCoffFileIdentifierFromMappedFile(), |
| but that is not written yet... |
| |
| Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk> |
| --- |
| src/processor/minidump.cc | 32 +++++++++++++++++++++++++++++--- |
| 1 file changed, 29 insertions(+), 3 deletions(-) |
| |
| diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc |
| index cbf18404..49498b78 100644 |
| --- a/src/processor/minidump.cc |
| +++ b/src/processor/minidump.cc |
| @@ -2181,9 +2181,35 @@ string MinidumpModule::debug_identifier() const { |
| |
| // TODO(mmentovai): on the Mac, provide fallbacks as in code_identifier(). |
| |
| - // XXX: PE generated with gcc don't currently have CV records, so the Windows |
| - // minidumper can't record any identifier information, so there's no useful |
| - // identifier for us to match with. Fallback to a default debug_identifier. |
| + // If possible, synthesize a debug_identifier from the version and |
| + // architecture. |
| + if (identifier.empty()) { |
| + std::string ver = version(); |
| + if (ver.compare("") != 0) { |
| + identifier = ""; |
| + for (std::string::const_iterator i = ver.begin(); i != ver.end(); i++) { |
| + if (isxdigit(*i)) { |
| + identifier += *i; |
| + } |
| + } |
| + |
| + MinidumpSystemInfo *minidump_system_info = minidump_->GetSystemInfo(); |
| + if (minidump_system_info) { |
| + std::string cpu = minidump_system_info->GetCPU(); |
| + for (std::string::const_iterator i = cpu.begin(); i != cpu.end(); i++) { |
| + char ashex[4]; |
| + snprintf(ashex, sizeof(ashex), "%02x", *i); |
| + identifier += ashex; |
| + } |
| + } |
| + |
| + while (identifier.size() < 33) { |
| + identifier += "0"; |
| + } |
| + } |
| + } |
| + |
| + // Fallback to a default debug_identifier |
| if (identifier.empty()) |
| { |
| identifier = "000000000000000000000000000000000"; |
| -- |
| 2.15.0 |
| |