From a1af0549d928135538c0577c991d1ab675ea8533 Mon Sep 17 00:00:00 2001 From: Jon Turney Date: Thu, 16 Oct 2014 00:53:55 +0100 Subject: [PATCH 16/19] 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 --- 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 1b08ba3f..7d1c5327 100644 --- a/src/processor/minidump.cc +++ b/src/processor/minidump.cc @@ -2248,9 +2248,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.28.0