aboutsummaryrefslogtreecommitdiff
path: root/src/processor/synth_minidump.h
diff options
context:
space:
mode:
authorJoshua Peraza <jperaza@chromium.org>2016-12-16 12:10:33 -0800
committerJoshua Peraza <jperaza@chromium.org>2016-12-16 20:15:04 +0000
commitc2d969cb1050803961a53cfdbbcff5c69e579ebb (patch)
treed820694a130c38d7ab4898e26db38b13d606434b /src/processor/synth_minidump.h
parentFix unit tests expecting no output when a microdump is suppressed. (diff)
downloadbreakpad-c2d969cb1050803961a53cfdbbcff5c69e579ebb.tar.xz
Added classes to support reading unloaded module lists in minidumps.
The implementations of Module/UnloadedModule and ModuleList/UnloadedModuleList are very similar. They have been made separate classes because they operate on different structs, complicating factoring code into a base class and have sufficiently different implementation that templates would not be suitable. When unloaded modules have partially overlapping ranges, the module shrink down feature is used to move the start of the higher range to the end of the lower range. If two unloaded modules overlap identically, the second module will not be added to the range map and the failure ignored. Places where MinidumpUnloadedModule differs from MinidumpModule: code_identifier: the android/linux case is deleted since cv_records never exist. debug_file/debug_identifier/version: always return empty strings. Read: an expected size is provided as opposed to MD_MODULE_SIZE. A seek is used if there are extra, unused bytes. Places where MinidumpUnloadedModuleList differs from MinidumpModuleList: Read: entry and header size is provided in the header in addition to count. This changes the checks and handling of padding. Failures from StoreRange are ignored. GetMainModule: always returns NULL. BUG= Change-Id: I52e93d3ccc38483f50a6418fede8b506ec879aaa Reviewed-on: https://chromium-review.googlesource.com/421566 Reviewed-by: Joshua Peraza <jperaza@chromium.org>
Diffstat (limited to 'src/processor/synth_minidump.h')
-rw-r--r--src/processor/synth_minidump.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/processor/synth_minidump.h b/src/processor/synth_minidump.h
index f1635b93..8f49cfff 100644
--- a/src/processor/synth_minidump.h
+++ b/src/processor/synth_minidump.h
@@ -138,6 +138,13 @@ class Section: public test_assembler::Section {
explicit Section(const Dump &dump);
// Append an MDLocationDescriptor referring to this section to SECTION.
+ // If 'this' is NULL, append a descriptor with a zero length and MDRVA.
+ //
+ // (I couldn't find the language in the C++ standard that says that
+ // invoking member functions of a NULL pointer to a class type is
+ // bad, if such language exists. Having this function handle NULL
+ // 'this' is convenient, but if it causes trouble, it's not hard to
+ // do differently.)
void CiteLocationIn(test_assembler::Section *section) const;
// Note that this section's contents are complete, and that it has
@@ -263,6 +270,16 @@ class Module: public Section {
static const MDVSFixedFileInfo stock_version_info;
};
+class UnloadedModule: public Section {
+ public:
+ UnloadedModule(const Dump &dump,
+ uint64_t base_of_image,
+ uint32_t size_of_image,
+ const String &name,
+ uint32_t checksum = 0,
+ uint32_t time_date_stamp = 1262805309);
+};
+
class Exception : public Stream {
public:
Exception(const Dump &dump,
@@ -301,9 +318,20 @@ class List: public Stream {
private:
size_t count_;
+
+ protected:
+ // This constructor allows derived lists to specify their own layout
+ // rather than starting with count as specified in the public constructor.
+ List(const Dump &dump, uint32_t type, bool) : Stream(dump, type), count_(0) {}
+
Label count_label_;
};
+class UnloadedModuleList : public List<UnloadedModule> {
+ public:
+ UnloadedModuleList(const Dump &dump, uint32_t type);
+};
+
class Dump: public test_assembler::Section {
public:
@@ -326,6 +354,7 @@ class Dump: public test_assembler::Section {
Dump &Add(Memory *object); // append, record in memory list
Dump &Add(Thread *object); // append, record in thread list
Dump &Add(Module *object); // append, record in module list
+ Dump &Add(UnloadedModule *object); // append, record in unloaded module list
// Complete the construction of the minidump, given the Add calls
// we've seen up to this point. After this call, this Dump's
@@ -352,6 +381,10 @@ class Dump: public test_assembler::Section {
// Add(Module *) calls.
List<Module> module_list_;
+ // This minidump's unloaded module list. We construct this incrementally from
+ // Add(UnloadedModule *) calls.
+ UnloadedModuleList unloaded_module_list_;
+
// This minidump's memory list. We construct this incrementally from
// Add(Memory *) calls. This is actually a list of MDMemoryDescriptors,
// not memory ranges --- thus the odd type.