diff options
-rw-r--r-- | src/tools/linux/md2core/minidump-2-core.cc | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/src/tools/linux/md2core/minidump-2-core.cc b/src/tools/linux/md2core/minidump-2-core.cc index e796dfe4..92bd41e7 100644 --- a/src/tools/linux/md2core/minidump-2-core.cc +++ b/src/tools/linux/md2core/minidump-2-core.cc @@ -86,6 +86,7 @@ using google_breakpad::MinidumpMemoryRange; static const MDRVA kInvalidMDRVA = static_cast<MDRVA>(-1); static bool verbose; +static std::string g_custom_so_basedir; static int usage(const char* argv0) { fprintf(stderr, "Usage: %s [-v] <minidump file>\n", argv0); @@ -365,7 +366,7 @@ ParseThreadRegisters(CrashedProcess::Thread* thread, for (int i = 0; i < MD_CONTEXT_MIPS_GPR_COUNT; ++i) thread->regs.regs[i] = rawregs->iregs[i]; - + thread->regs.lo = rawregs->mdlo; thread->regs.hi = rawregs->mdhi; thread->regs.epc = rawregs->epc; @@ -375,7 +376,7 @@ ParseThreadRegisters(CrashedProcess::Thread* thread, for (int i = 0; i < MD_FLOATINGSAVEAREA_MIPS_FPR_COUNT; ++i) thread->fpregs.regs[i] = rawregs->float_save.regs[i]; - + thread->fpregs.fpcsr = rawregs->float_save.fpcsr; thread->fpregs.fir = rawregs->float_save.fir; } @@ -575,7 +576,7 @@ static void ParseEnvironment(CrashedProcess* crashinfo, const MinidumpMemoryRange& range) { if (verbose) { fputs("MD_LINUX_ENVIRON:\n", stderr); - char *env = new char[range.length()]; + char* env = new char[range.length()]; memcpy(env, range.data(), range.length()); int nul_count = 0; for (char *ptr = env;;) { @@ -814,8 +815,13 @@ ParseModuleStream(CrashedProcess* crashinfo, const MinidumpMemoryRange& range, std::string basename = slash == std::string::npos ? filename : filename.substr(slash + 1); if (strcmp(guid, "00000000-0000-0000-0000-000000000000")) { - crashinfo->signatures[rawmodule->base_of_image] = - std::string("/var/lib/breakpad/") + guid + "-" + basename; + std::string prefix; + if (!g_custom_so_basedir.empty()) + prefix = g_custom_so_basedir; + else + prefix = std::string("/var/lib/breakpad/") + guid + "-" + basename; + + crashinfo->signatures[rawmodule->base_of_image] = prefix + basename; } if (verbose) { @@ -974,6 +980,14 @@ main(int argc, char** argv) { while (argi < argc && argv[argi][0] == '-') { if (!strcmp(argv[argi], "-v")) { verbose = true; + } else if (!strcmp(argv[argi], "--sobasedir")) { + argi++; + if (argi >= argc) { + fprintf(stderr, "--sobasedir expects an argument."); + return usage(argv[0]); + } + + g_custom_so_basedir = argv[argi]; } else { return usage(argv[0]); } |