From e1b3620ec763cf3cd116570556cc3d7ca1771ad2 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Tue, 25 Oct 2016 20:12:09 -0400 Subject: minidump_dump: dump stack memory like hexdump The current stack output is one line byte string which is not easy for humans to parse. Extend the print mode to support a hexdump-like view and switch to that by default. Now we get something like: Stack 00000000 20 67 7b 53 94 7f 00 00 01 00 00 00 00 00 00 00 | g{S...........| 00000010 00 70 c4 44 9a 25 00 00 08 65 7a 53 94 7f 00 00 |.p.D.%...ezS...| BUG=chromium:598947 Change-Id: I868e1cf4faa435a14c5f1c35f94a5db4a49b6a6d Reviewed-on: https://chromium-review.googlesource.com/404008 Reviewed-by: Mark Mentovai --- src/google_breakpad/processor/minidump.h | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/google_breakpad/processor') diff --git a/src/google_breakpad/processor/minidump.h b/src/google_breakpad/processor/minidump.h index a5d32c8b..2651a323 100644 --- a/src/google_breakpad/processor/minidump.h +++ b/src/google_breakpad/processor/minidump.h @@ -236,6 +236,7 @@ class MinidumpMemoryRegion : public MinidumpObject, // Print a human-readable representation of the object to stdout. void Print() const; + void SetPrintMode(bool hexdump, unsigned int width); protected: explicit MinidumpMemoryRegion(Minidump* minidump); @@ -252,6 +253,10 @@ class MinidumpMemoryRegion : public MinidumpObject, template bool GetMemoryAtAddressInternal(uint64_t address, T* value) const; + // Knobs for controlling display of memory printing. + bool hexdump_; + unsigned int hexdump_width_; + // The largest memory region that will be read from a minidump. The // default is 1MB. static uint32_t max_bytes_; @@ -1104,7 +1109,9 @@ class MinidumpLinuxMapsList : public MinidumpStream { class Minidump { public: // path is the pathname of a file containing the minidump. - explicit Minidump(const string& path); + explicit Minidump(const string& path, + bool hexdump=false, + unsigned int hexdump_width=16); // input is an istream wrapping minidump data. Minidump holds a // weak pointer to input, and the caller must ensure that the stream // is valid as long as the Minidump object is. @@ -1214,6 +1221,9 @@ class Minidump { // Is the OS Android. bool IsAndroid(); + // Get current hexdump display settings. + unsigned int HexdumpMode() const { return hexdump_ ? hexdump_width_ : 0; } + private: // MinidumpStreamInfo is used in the MinidumpStreamMap. It lets // the Minidump object locate interesting streams quickly, and @@ -1275,6 +1285,10 @@ class Minidump { // Read(). bool valid_; + // Knobs for controlling display of memory printing. + bool hexdump_; + unsigned int hexdump_width_; + DISALLOW_COPY_AND_ASSIGN(Minidump); }; -- cgit v1.2.1