aboutsummaryrefslogtreecommitdiff
path: root/src/google_breakpad
diff options
context:
space:
mode:
authorMark Mentovai <mark@chromium.org>2017-09-27 17:13:47 -0400
committerMark Mentovai <mark@chromium.org>2017-09-27 21:27:17 +0000
commit6d0287851fabc21a90838ae068b11f2d777393d5 (patch)
tree03856988e14c91ebea985095ecdb2da66b478d5a /src/google_breakpad
parentOnly run GYP for Windows targets on Windows (diff)
downloadbreakpad-6d0287851fabc21a90838ae068b11f2d777393d5.tar.xz
Dump Crashpad extension structures in minidump_dump
This is currently mostly useful to expose the annotations that Crashpad stores in minidumps. Example output: MDRawCrashpadInfo version = 1 report_id = 01234567-89ab-cdef-0123-456789abcdef client_id = fedcba98-7654-3210-fedc-ba9876543210 simple_annotations["channel"] = canary simple_annotations["plat"] = OS X simple_annotations["prod"] = Chrome_Mac simple_annotations["ver"] = 59.0.3069.0 module_list[0].minidump_module_list_index = 0 module_list[0].version = 1 module_list[0].simple_annotations["ptype"] = crashpad-handler module_list[1].minidump_module_list_index = 28 module_list[1].version = 1 module_list[1].list_annotations[0] = abort() called Change-Id: I00ba291f93ea3a37fc3754c651b3ccc542e5b8b2 Reviewed-on: https://chromium-review.googlesource.com/688416 Reviewed-by: Robert Sesek <rsesek@chromium.org>
Diffstat (limited to 'src/google_breakpad')
-rw-r--r--src/google_breakpad/common/minidump_format.h42
-rw-r--r--src/google_breakpad/processor/minidump.h42
2 files changed, 82 insertions, 2 deletions
diff --git a/src/google_breakpad/common/minidump_format.h b/src/google_breakpad/common/minidump_format.h
index b99c8f7c..225433bb 100644
--- a/src/google_breakpad/common/minidump_format.h
+++ b/src/google_breakpad/common/minidump_format.h
@@ -346,7 +346,11 @@ typedef enum {
MD_LINUX_ENVIRON = 0x47670007, /* /proc/$x/environ */
MD_LINUX_AUXV = 0x47670008, /* /proc/$x/auxv */
MD_LINUX_MAPS = 0x47670009, /* /proc/$x/maps */
- MD_LINUX_DSO_DEBUG = 0x4767000A /* MDRawDebug{32,64} */
+ MD_LINUX_DSO_DEBUG = 0x4767000A, /* MDRawDebug{32,64} */
+
+ /* Crashpad extension types. 0x4350 = "CP"
+ * See Crashpad's minidump/minidump_extensions.h. */
+ MD_CRASHPAD_INFO_STREAM = 0x43500001, /* MDRawCrashpadInfo */
} MDStreamType; /* MINIDUMP_STREAM_TYPE */
@@ -1051,6 +1055,42 @@ typedef struct {
uint64_t dynamic;
} MDRawDebug64;
+/* Crashpad extension types. See Crashpad's minidump/minidump_extensions.h. */
+
+typedef struct {
+ MDRVA key;
+ MDRVA value;
+} MDRawSimpleStringDictionaryEntry;
+
+typedef struct {
+ uint32_t count;
+ MDRawSimpleStringDictionaryEntry entries[0];
+} MDRawSimpleStringDictionary;
+
+typedef struct {
+ uint32_t version;
+ MDLocationDescriptor list_annotations;
+ MDLocationDescriptor simple_annotations; /* MDRawSimpleStringDictionary */
+} MDRawModuleCrashpadInfo;
+
+typedef struct {
+ uint32_t minidump_module_list_index;
+ MDLocationDescriptor location; /* MDRawModuleCrashpadInfo */
+} MDRawModuleCrashpadInfoLink;
+
+typedef struct {
+ uint32_t count;
+ MDLocationDescriptor modules[0]; /* MDRawModuleCrashpadInfoLink */
+} MDRawModuleCrashpadInfoList;
+
+typedef struct {
+ uint32_t version;
+ MDGUID report_id;
+ MDGUID client_id;
+ MDLocationDescriptor simple_annotations; /* MDRawSimpleStringDictionary */
+ MDLocationDescriptor module_list; /* MDRawModuleCrashpadInfoList */
+} MDRawCrashpadInfo;
+
#if defined(_MSC_VER)
#pragma warning(pop)
#endif /* _MSC_VER */
diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h
index 34a2a44d..26b8b8da 100644
--- a/src/google_breakpad/processor/minidump.h
+++ b/src/google_breakpad/processor/minidump.h
@@ -1103,6 +1103,37 @@ class MinidumpLinuxMapsList : public MinidumpStream {
DISALLOW_COPY_AND_ASSIGN(MinidumpLinuxMapsList);
};
+// MinidumpCrashpadInfo wraps MDRawCrashpadInfo, which is an optional stream in
+// a minidump that provides additional information about the process state
+// at the time the minidump was generated.
+class MinidumpCrashpadInfo : public MinidumpStream {
+ public:
+ const MDRawCrashpadInfo* crashpad_info() const {
+ return valid_ ? &crashpad_info_ : NULL;
+ }
+
+ // Print a human-readable representation of the object to stdout.
+ void Print();
+
+ private:
+ friend class Minidump;
+
+ static const uint32_t kStreamType = MD_CRASHPAD_INFO_STREAM;
+
+ explicit MinidumpCrashpadInfo(Minidump* minidump_);
+
+ bool Read(uint32_t expected_size);
+
+ MDRawCrashpadInfo crashpad_info_;
+ std::vector<uint32_t> module_crashpad_info_links_;
+ std::vector<MDRawModuleCrashpadInfo> module_crashpad_info_;
+ std::vector<std::vector<std::string>> module_crashpad_info_list_annotations_;
+ std::vector<std::map<std::string, std::string>>
+ module_crashpad_info_simple_annotations_;
+ std::map<std::string, std::string> simple_annotations_;
+};
+
+
// Minidump is the user's interface to a minidump file. It wraps MDRawHeader
// and provides access to the minidump's top-level stream directory.
class Minidump {
@@ -1164,6 +1195,7 @@ class Minidump {
virtual MinidumpMiscInfo* GetMiscInfo();
virtual MinidumpBreakpadInfo* GetBreakpadInfo();
virtual MinidumpMemoryInfoList* GetMemoryInfoList();
+ MinidumpCrashpadInfo* GetCrashpadInfo();
// The next method also calls GetStream, but is exclusive for Linux dumps.
virtual MinidumpLinuxMapsList *GetLinuxMapsList();
@@ -1191,13 +1223,21 @@ class Minidump {
// Returns the current position of the minidump file.
off_t Tell();
- // The next 2 methods are medium-level I/O routines.
+ // Medium-level I/O routines.
// ReadString returns a string which is owned by the caller! offset
// specifies the offset that a length-encoded string is stored at in the
// minidump file.
string* ReadString(off_t offset);
+ bool ReadUTF8String(off_t offset, string* string_utf8);
+
+ bool ReadStringList(off_t offset, std::vector<std::string>* string_list);
+
+ bool ReadSimpleStringDictionary(
+ off_t offset,
+ std::map<std::string, std::string>* simple_string_dictionary);
+
// SeekToStreamType positions the file at the beginning of a stream
// identified by stream_type, and informs the caller of the stream's
// length by setting *stream_length. Because stream_map maps each stream