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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
|
changeset: 649910:59994b59eb51
tag: tip
parent: 649905:058997a8167d
user: Gabriele Svelto <gsvelto@mozilla.com>
date: Wed Mar 31 16:25:34 2021 +0200
summary: Bug 1702043 - Print out the list of unloaded modules when processing a minidump
diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h
--- a/src/google_breakpad/processor/minidump.h
+++ b/src/google_breakpad/processor/minidump.h
@@ -792,16 +792,19 @@ class MinidumpUnloadedModule : public Mi
string debug_file() const override;
string debug_identifier() const override;
string version() const override;
CodeModule* Copy() const override;
bool is_unloaded() const override { return true; }
uint64_t shrink_down_delta() const override;
void SetShrinkDownDelta(uint64_t shrink_down_delta) override;
+ // Print a human-readable representation of the object to stdout.
+ void Print();
+
protected:
explicit MinidumpUnloadedModule(Minidump* minidump);
private:
// These objects are managed by MinidumpUnloadedModuleList
friend class MinidumpUnloadedModuleList;
// This works like MinidumpStream::Read, but is driven by
@@ -850,16 +853,19 @@ class MinidumpUnloadedModuleList : publi
const MinidumpUnloadedModule* GetMainModule() const override;
const MinidumpUnloadedModule*
GetModuleAtSequence(unsigned int sequence) const override;
const MinidumpUnloadedModule*
GetModuleAtIndex(unsigned int index) const override;
const CodeModules* Copy() const override;
vector<linked_ptr<const CodeModule>> GetShrunkRangeModules() const override;
+ // Print a human-readable representation of the object to stdout.
+ void Print();
+
protected:
explicit MinidumpUnloadedModuleList(Minidump* minidump_);
private:
friend class Minidump;
typedef vector<MinidumpUnloadedModule> MinidumpUnloadedModules;
diff --git a/src/processor/minidump.cc b/src/processor/minidump.cc
--- a/src/processor/minidump.cc
+++ b/src/processor/minidump.cc
@@ -3727,16 +3727,46 @@ MinidumpUnloadedModule::MinidumpUnloaded
name_(NULL) {
}
MinidumpUnloadedModule::~MinidumpUnloadedModule() {
delete name_;
}
+void MinidumpUnloadedModule::Print() {
+ if (!valid_) {
+ BPLOG(ERROR) << "MinidumpUnloadedModule cannot print invalid data";
+ return;
+ }
+
+ printf("MDRawUnloadedModule\n");
+ printf(" base_of_image = 0x%" PRIx64 "\n",
+ unloaded_module_.base_of_image);
+ printf(" size_of_image = 0x%x\n",
+ unloaded_module_.size_of_image);
+ printf(" checksum = 0x%x\n",
+ unloaded_module_.checksum);
+ printf(" time_date_stamp = 0x%x %s\n",
+ unloaded_module_.time_date_stamp,
+ TimeTToUTCString(unloaded_module_.time_date_stamp).c_str());
+ printf(" module_name_rva = 0x%x\n",
+ unloaded_module_.module_name_rva);
+
+ printf(" (code_file) = \"%s\"\n", code_file().c_str());
+ printf(" (code_identifier) = \"%s\"\n",
+ code_identifier().c_str());
+
+ printf(" (debug_file) = \"%s\"\n", debug_file().c_str());
+ printf(" (debug_identifier) = \"%s\"\n",
+ debug_identifier().c_str());
+ printf(" (version) = \"%s\"\n", version().c_str());
+ printf("\n");
+}
+
string MinidumpUnloadedModule::code_file() const {
if (!valid_) {
BPLOG(ERROR) << "Invalid MinidumpUnloadedModule for code_file";
return "";
}
return *name_;
}
@@ -3911,16 +3941,34 @@ MinidumpUnloadedModuleList::MinidumpUnlo
range_map_->SetMergeStrategy(MergeRangeStrategy::kTruncateLower);
}
MinidumpUnloadedModuleList::~MinidumpUnloadedModuleList() {
delete range_map_;
delete unloaded_modules_;
}
+void MinidumpUnloadedModuleList::Print() {
+ if (!valid_) {
+ BPLOG(ERROR) << "MinidumpUnloadedModuleList cannot print invalid data";
+ return;
+ }
+
+ printf("MinidumpUnloadedModuleList\n");
+ printf(" module_count = %d\n", module_count_);
+ printf("\n");
+
+ for (unsigned int module_index = 0;
+ module_index < module_count_;
+ ++module_index) {
+ printf("module[%d]\n", module_index);
+
+ (*unloaded_modules_)[module_index].Print();
+ }
+}
bool MinidumpUnloadedModuleList::Read(uint32_t expected_size) {
range_map_->Clear();
delete unloaded_modules_;
unloaded_modules_ = NULL;
module_count_ = 0;
valid_ = false;
diff --git a/src/processor/minidump_dump.cc b/src/processor/minidump_dump.cc
--- a/src/processor/minidump_dump.cc
+++ b/src/processor/minidump_dump.cc
@@ -40,16 +40,17 @@
#include "google_breakpad/processor/minidump.h"
#include "processor/logging.h"
namespace {
using google_breakpad::Minidump;
using google_breakpad::MinidumpThreadList;
using google_breakpad::MinidumpModuleList;
+using google_breakpad::MinidumpUnloadedModuleList;
using google_breakpad::MinidumpMemoryInfoList;
using google_breakpad::MinidumpMemoryList;
using google_breakpad::MinidumpException;
using google_breakpad::MinidumpAssertion;
using google_breakpad::MinidumpSystemInfo;
using google_breakpad::MinidumpMiscInfo;
using google_breakpad::MinidumpBreakpadInfo;
using google_breakpad::MinidumpCrashpadInfo;
@@ -127,16 +128,25 @@ static bool PrintMinidumpDump(const Opti
MinidumpModuleList *module_list = minidump.GetModuleList();
if (!module_list) {
++errors;
BPLOG(ERROR) << "minidump.GetModuleList() failed";
} else {
module_list->Print();
}
+ MinidumpUnloadedModuleList::set_max_modules(UINT32_MAX);
+ MinidumpUnloadedModuleList *unloaded_module_list = minidump.GetUnloadedModuleList();
+ if (!unloaded_module_list) {
+ ++errors;
+ BPLOG(ERROR) << "minidump.GetUnloadedModuleList() failed";
+ } else {
+ unloaded_module_list->Print();
+ }
+
MinidumpMemoryList *memory_list = minidump.GetMemoryList();
if (!memory_list) {
++errors;
BPLOG(ERROR) << "minidump.GetMemoryList() failed";
} else {
memory_list->Print();
}
diff --git a/src/processor/stackwalk_common.cc b/src/processor/stackwalk_common.cc
--- a/src/processor/stackwalk_common.cc
+++ b/src/processor/stackwalk_common.cc
@@ -777,16 +777,46 @@ static void PrintModulesMachineReadable(
StripSeparator(module->debug_identifier()).c_str(),
kOutputSeparator, base_address,
kOutputSeparator, base_address + module->size() - 1,
kOutputSeparator,
main_module != NULL && base_address == main_address ? 1 : 0);
}
}
+// PrintUnloadedModulesMachineReadable outputs a list of loaded modules,
+// one per line, in the following machine-readable pipe-delimited
+// text format:
+// UnloadedModule|{Module Filename}|{Base Address}|{Max Address}|{Main}
+static void PrintUnloadedModulesMachineReadable(const CodeModules* modules) {
+ if (!modules)
+ return;
+
+ uint64_t main_address = 0;
+ const CodeModule* main_module = modules->GetMainModule();
+ if (main_module) {
+ main_address = main_module->base_address();
+ }
+
+ unsigned int module_count = modules->module_count();
+ for (unsigned int module_sequence = 0;
+ module_sequence < module_count;
+ ++module_sequence) {
+ const CodeModule* module = modules->GetModuleAtSequence(module_sequence);
+ uint64_t base_address = module->base_address();
+ printf("UnloadedModule%c%s%c0x%08" PRIx64 "%c0x%08" PRIx64 "%c%d\n",
+ kOutputSeparator,
+ StripSeparator(PathnameStripper::File(module->code_file())).c_str(),
+ kOutputSeparator, base_address,
+ kOutputSeparator, base_address + module->size() - 1,
+ kOutputSeparator,
+ main_module != NULL && base_address == main_address ? 1 : 0);
+ }
+}
+
} // namespace
void PrintProcessState(const ProcessState& process_state,
bool output_stack_contents,
SourceLineResolverInterface* resolver) {
// Print OS and CPU information.
string cpu = process_state.system_info()->cpu;
string cpu_info = process_state.system_info()->cpu_info;
@@ -921,16 +951,17 @@ void PrintProcessStateMachineReadable(co
if (requesting_thread != -1) {
printf("%d\n", requesting_thread);
} else {
printf("\n");
}
PrintModulesMachineReadable(process_state.modules());
+ PrintUnloadedModulesMachineReadable(process_state.unloaded_modules());
// blank line to indicate start of threads
printf("\n");
// If the thread that requested the dump is known, print it first.
if (requesting_thread != -1) {
PrintStackMachineReadable(requesting_thread,
process_state.threads()->at(requesting_thread));
|