]> khamidou — GitHub mirrors - electron.git/commitdiff
linux: Put crash dumps under "/tmp/ProductName Crashes/"
authorCheng Zhao <zcbenz@gmail.com>
Tue, 11 Nov 2014 04:51:16 +0000 (12:51 +0800)
committerCheng Zhao <zcbenz@gmail.com>
Tue, 11 Nov 2014 05:03:47 +0000 (13:03 +0800)
atom/common/crash_reporter/crash_reporter_linux.cc
atom/common/crash_reporter/crash_reporter_linux.h
atom/common/crash_reporter/linux/crash_dump_handler.cc

index ab12869ba740be7477b641cad022cdda6608966f..dd7b6b41ba9aa801f5d54954056ea778f6168cb9 100644 (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);
 
index 660c471d2a0226780fb7ce31d1ba5c3581b5d98c..c1055aded11035300ff93248911409dfe86a0b21 100644 (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,
index 2e7de5bf51ea9fd02644fc8d66abd04a2b9d7fdf..4403d1d803faf492e0220ba96d24007abd347496 100644 (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);