aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkmixter@chromium.org <kmixter@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-12-08 18:48:28 +0000
committerkmixter@chromium.org <kmixter@chromium.org@4c0a9323-5329-0410-9bdc-e9ce6186880e>2010-12-08 18:48:28 +0000
commite41dc092521c602a6c45545966cb7d2ae4292f34 (patch)
treed143bd6eb721359262c48b5aed8b9d630b1703fc
parentFix segv in network_source_line_resolver_server_unittest (diff)
downloadbreakpad-e41dc092521c602a6c45545966cb7d2ae4292f34.tar.xz
Enable dumping of the Linux extension streams.
We now dump information about process's environment/command line/status, Linux release, and CPU info. Review URL: http://breakpad.appspot.com/238001 git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@738 4c0a9323-5329-0410-9bdc-e9ce6186880e
-rw-r--r--src/processor/minidump_dump.cc60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/processor/minidump_dump.cc b/src/processor/minidump_dump.cc
index 6ec777f1..9581da9e 100644
--- a/src/processor/minidump_dump.cc
+++ b/src/processor/minidump_dump.cc
@@ -33,9 +33,12 @@
// Author: Mark Mentovai
#include <stdio.h>
+#include <string.h>
+#include "client/linux/minidump_writer/minidump_extension_linux.h"
#include "google_breakpad/processor/minidump.h"
#include "processor/logging.h"
+#include "processor/scoped_ptr.h"
namespace {
@@ -49,6 +52,42 @@ using google_breakpad::MinidumpSystemInfo;
using google_breakpad::MinidumpMiscInfo;
using google_breakpad::MinidumpBreakpadInfo;
+static void DumpRawStream(Minidump *minidump,
+ u_int32_t stream_type,
+ const char *stream_name,
+ int *errors) {
+ u_int32_t length = 0;
+ if (!minidump->SeekToStreamType(stream_type, &length)) {
+ return;
+ }
+
+ printf("Stream %s:\n", stream_name);
+
+ if (length == 0) {
+ printf("\n");
+ return;
+ }
+ std::vector<char> contents(length);
+ if (!minidump->ReadBytes(&contents[0], length)) {
+ ++*errors;
+ BPLOG(ERROR) << "minidump.ReadBytes failed";
+ return;
+ }
+ size_t current_offset = 0;
+ while (current_offset < length) {
+ size_t remaining = length - current_offset;
+ printf("%.*s", remaining, &contents[current_offset]);
+ char *next_null = reinterpret_cast<char *>(
+ memchr(&contents[current_offset], 0, remaining));
+ if (next_null == NULL)
+ break;
+ printf("\\0\n");
+ size_t null_offset = next_null - &contents[0];
+ current_offset = null_offset + 1;
+ }
+ printf("\n\n");
+}
+
static bool PrintMinidumpDump(const char *minidump_file) {
Minidump minidump(minidump_file);
if (!minidump.Read()) {
@@ -121,6 +160,27 @@ static bool PrintMinidumpDump(const char *minidump_file) {
breakpad_info->Print();
}
+ DumpRawStream(&minidump,
+ MD_LINUX_CMD_LINE,
+ "MD_LINUX_CMD_LINE",
+ &errors);
+ DumpRawStream(&minidump,
+ MD_LINUX_ENVIRON,
+ "MD_LINUX_ENVIRON",
+ &errors);
+ DumpRawStream(&minidump,
+ MD_LINUX_LSB_RELEASE,
+ "MD_LINUX_LSB_RELEASE",
+ &errors);
+ DumpRawStream(&minidump,
+ MD_LINUX_PROC_STATUS,
+ "MD_LINUX_PROC_STATUS",
+ &errors);
+ DumpRawStream(&minidump,
+ MD_LINUX_CPU_INFO,
+ "MD_LINUX_CPU_INFO",
+ &errors);
+
return errors == 0;
}