forked from msys2/MINGW-packages
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0021-Fallback-to-synthesizing-a-debug-id-from-version-and.patch
62 lines (55 loc) · 2.08 KB
/
0021-Fallback-to-synthesizing-a-debug-id-from-version-and.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 87b47575d002f2a542a408490b5f7c963cb43dc9 Mon Sep 17 00:00:00 2001
From: Jon TURNEY <[email protected]>
Date: Thu, 16 Oct 2014 00:53:55 +0100
Subject: [PATCH 21/24] 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 <[email protected]>
---
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 fe86478..c143e89 100644
--- a/src/processor/minidump.cc
+++ b/src/processor/minidump.cc
@@ -2044,9 +2044,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.1.1