aboutsummaryrefslogtreecommitdiff
path: root/src/processor/minidump_dump.cc
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2016-10-25 20:12:09 -0400
committerMike Frysinger <vapier@chromium.org>2017-03-24 16:22:21 +0000
commite1b3620ec763cf3cd116570556cc3d7ca1771ad2 (patch)
tree1236c1cb0f5cd2abb637bde41b85122f03b68525 /src/processor/minidump_dump.cc
parentminidump_dump: add proper cli processing (diff)
downloadbreakpad-e1b3620ec763cf3cd116570556cc3d7ca1771ad2.tar.xz
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 <mark@chromium.org>
Diffstat (limited to 'src/processor/minidump_dump.cc')
-rw-r--r--src/processor/minidump_dump.cc17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/processor/minidump_dump.cc b/src/processor/minidump_dump.cc
index d6342cc4..a21ae5a7 100644
--- a/src/processor/minidump_dump.cc
+++ b/src/processor/minidump_dump.cc
@@ -55,9 +55,11 @@ using google_breakpad::MinidumpBreakpadInfo;
struct Options {
Options()
- : minidumpPath() {}
+ : minidumpPath(), hexdump(false), hexdump_width(hexdump_width) {}
string minidumpPath;
+ bool hexdump;
+ unsigned int hexdump_width;
};
static void DumpRawStream(Minidump *minidump,
@@ -99,8 +101,9 @@ static void DumpRawStream(Minidump *minidump,
printf("\n\n");
}
-static bool PrintMinidumpDump(const string& minidump_file) {
- Minidump minidump(minidump_file);
+static bool PrintMinidumpDump(const Options& options) {
+ Minidump minidump(options.minidumpPath,
+ options.hexdump);
if (!minidump.Read()) {
BPLOG(ERROR) << "minidump.Read() failed";
return false;
@@ -218,6 +221,7 @@ Usage(int argc, const char *argv[], bool error) {
"\n"
"Options:\n"
" <minidump> should be a minidump.\n"
+ " -x:\t Display memory in a hexdump like format\n"
" -h:\t Usage\n",
argv[0]);
}
@@ -227,8 +231,11 @@ static void
SetupOptions(int argc, const char *argv[], Options *options) {
int ch;
- while ((ch = getopt(argc, (char * const *)argv, "h")) != -1) {
+ while ((ch = getopt(argc, (char * const *)argv, "xh")) != -1) {
switch (ch) {
+ case 'x':
+ options->hexdump = true;
+ break;
case 'h':
Usage(argc, argv, false);
exit(0);
@@ -254,5 +261,5 @@ int main(int argc, const char *argv[]) {
Options options;
BPLOG_INIT(&argc, &argv);
SetupOptions(argc, argv, &options);
- return PrintMinidumpDump(options.minidumpPath) ? 0 : 1;
+ return PrintMinidumpDump(options) ? 0 : 1;
}