mirror of
https://github.com/yuzu-emu/breakpad.git
synced 2025-07-19 14:47:42 +00:00
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
This commit is contained in:
parent
6c05f5ddd9
commit
e41dc09252
|
@ -33,9 +33,12 @@
|
||||||
// Author: Mark Mentovai
|
// Author: Mark Mentovai
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "client/linux/minidump_writer/minidump_extension_linux.h"
|
||||||
#include "google_breakpad/processor/minidump.h"
|
#include "google_breakpad/processor/minidump.h"
|
||||||
#include "processor/logging.h"
|
#include "processor/logging.h"
|
||||||
|
#include "processor/scoped_ptr.h"
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
@ -49,6 +52,42 @@ using google_breakpad::MinidumpSystemInfo;
|
||||||
using google_breakpad::MinidumpMiscInfo;
|
using google_breakpad::MinidumpMiscInfo;
|
||||||
using google_breakpad::MinidumpBreakpadInfo;
|
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) {
|
static bool PrintMinidumpDump(const char *minidump_file) {
|
||||||
Minidump minidump(minidump_file);
|
Minidump minidump(minidump_file);
|
||||||
if (!minidump.Read()) {
|
if (!minidump.Read()) {
|
||||||
|
@ -121,6 +160,27 @@ static bool PrintMinidumpDump(const char *minidump_file) {
|
||||||
breakpad_info->Print();
|
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;
|
return errors == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue