linux: Put crash dumps under "/tmp/ProductName Crashes/"

This commit is contained in:
Cheng Zhao 2014-11-11 12:51:16 +08:00
parent 739c432c98
commit f13d8407ee
3 changed files with 7 additions and 8 deletions

View file

@ -12,9 +12,9 @@
#include "base/debug/crash_logging.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
#include "base/linux_util.h"
#include "base/logging.h"
#include "base/path_service.h"
#include "base/process/memory.h"
#include "base/memory/singleton.h"
#include "vendor/breakpad/src/client/linux/handler/exception_handler.h"
@ -61,7 +61,7 @@ void CrashReporterLinux::InitBreakpad(const std::string& product_name,
const std::string& submit_url,
bool auto_submit,
bool skip_system_crash_handler) {
EnableCrashDumping();
EnableCrashDumping(product_name);
crash_keys_.SetKeyValue("prod", "Atom-Shell");
crash_keys_.SetKeyValue("ver", version.c_str());
@ -76,11 +76,11 @@ void CrashReporterLinux::SetUploadParameters() {
upload_parameters_["platform"] = "linux";
}
void CrashReporterLinux::EnableCrashDumping() {
base::FilePath tmp_path("/tmp");
PathService::Get(base::DIR_TEMP, &tmp_path);
void CrashReporterLinux::EnableCrashDumping(const std::string& product_name) {
std::string dump_dir = "/tmp/" + product_name + " Crashes";
base::FilePath dumps_path(dump_dir);
base::CreateDirectory(dumps_path);
base::FilePath dumps_path(tmp_path);
MinidumpDescriptor minidump_descriptor(dumps_path.value());
minidump_descriptor.set_size_limit(kMaxMinidumpFileSize);

View file

@ -39,7 +39,7 @@ class CrashReporterLinux : public CrashReporter {
CrashReporterLinux();
virtual ~CrashReporterLinux();
void EnableCrashDumping();
void EnableCrashDumping(const std::string& product_name);
static bool CrashDone(const google_breakpad::MinidumpDescriptor& minidump,
void* context,

View file

@ -414,7 +414,6 @@ bool IsValidCrashReportId(const char* buf, size_t bytes_read,
// |buf| should be |expected_len| + 1 characters in size and NULL terminated.
void HandleCrashReportId(const char* buf, size_t bytes_read,
size_t expected_len) {
WriteNewline();
if (!IsValidCrashReportId(buf, bytes_read, expected_len)) {
static const char msg[] = "Failed to get crash dump id.";
WriteLog(msg, sizeof(msg) - 1);