diff options
author | chrisphan@chromium.org <chrisphan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 18:00:43 +0000 |
---|---|---|
committer | chrisphan@chromium.org <chrisphan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-11-02 18:00:43 +0000 |
commit | b49c2a5e16548b62d1f31a5a8290f23ce77b4a3c (patch) | |
tree | d817484e58a6f5342e8d771e4d4c27a0138e2ad8 /chrome/tools | |
parent | 5a593d25e0875cae1c5889118489d48db63b1fdc (diff) | |
download | chromium_src-b49c2a5e16548b62d1f31a5a8290f23ce77b4a3c.zip chromium_src-b49c2a5e16548b62d1f31a5a8290f23ce77b4a3c.tar.gz chromium_src-b49c2a5e16548b62d1f31a5a8290f23ce77b4a3c.tar.bz2 |
Add support for running multiple browser instances with reliability tests.
Originally, crash_service.exe dumps all encountered crash dump files into a single directory. But if multiple browser instances are running, we want to identify which crash belongs to which browser instance.
- Add a flag to crash service to archive the generated crash dumps under directory by the browser process id.
- Add a flag to page_load_tests to look for crashes under the directory by the process id.
For example:
%USERPROFILE%\AppData\Local\Google\CrashReports\pid\3f4233fhs.dmp
NOTRY=true
Review URL: https://chromiumcodereview.appspot.com/10836347
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165702 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/tools')
-rw-r--r-- | chrome/tools/crash_service/crash_service.cc | 30 | ||||
-rw-r--r-- | chrome/tools/crash_service/crash_service.h | 6 |
2 files changed, 30 insertions, 6 deletions
diff --git a/chrome/tools/crash_service/crash_service.cc b/chrome/tools/crash_service/crash_service.cc index 17f0116..75320af 100644 --- a/chrome/tools/crash_service/crash_service.cc +++ b/chrome/tools/crash_service/crash_service.cc @@ -14,6 +14,7 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" +#include "base/string_number_conversions.h" #include "base/win/windows_version.h" #include "breakpad/src/client/windows/crash_generation/client_info.h" #include "breakpad/src/client/windows/crash_generation/crash_generation_server.h" @@ -146,11 +147,14 @@ struct DumpJobInfo { } // namespace // Command line switches: -const char CrashService::kMaxReports[] = "max-reports"; -const char CrashService::kNoWindow[] = "no-window"; -const char CrashService::kReporterTag[] = "reporter"; -const char CrashService::kDumpsDir[] = "dumps-dir"; -const char CrashService::kPipeName[] = "pipe-name"; +const char CrashService::kMaxReports[] = "max-reports"; +const char CrashService::kNoWindow[] = "no-window"; +const char CrashService::kReporterTag[] = "reporter"; +const char CrashService::kDumpsDir[] = "dumps-dir"; +const char CrashService::kPipeName[] = "pipe-name"; +const char CrashService::kArchiveDumpsByPid[] = "archive-dumps-by-pid"; + +bool CrashService::archive_dumps_by_pid_ = false; CrashService::CrashService(const std::wstring& report_dir) : report_path_(report_dir), @@ -203,6 +207,9 @@ bool CrashService::Initialize(const std::wstring& command_line) { } } + if (cmd_line.HasSwitch(kArchiveDumpsByPid)) + archive_dumps_by_pid_ = true; + // We can override the send reports quota with a command line switch. if (cmd_line.HasSwitch(kMaxReports)) max_reports = _wtoi(cmd_line.GetSwitchValueNative(kMaxReports).c_str()); @@ -371,12 +378,23 @@ void CrashService::OnClientDumpRequest(void* context, LOG(ERROR) << "could not write custom info file"; } + // Move dump file to the directory under client pid. + FilePath dump_path = FilePath(*file_path); + if (archive_dumps_by_pid_) { + FilePath dump_path_with_pid(dump_path.DirName()); + dump_path_with_pid = dump_path_with_pid.Append(base::Int64ToString16(pid)); + file_util::CreateDirectoryW(dump_path_with_pid); + dump_path_with_pid = dump_path_with_pid.Append(dump_path.BaseName()); + file_util::Move(dump_path, dump_path_with_pid); + } + if (!self->sender_) return; // Send the crash dump using a worker thread. This operation has retry // logic in case there is no internet connection at the time. - DumpJobInfo* dump_job = new DumpJobInfo(pid, self, map, *file_path); + DumpJobInfo* dump_job = new DumpJobInfo(pid, self, map, + dump_path.value()); if (!::QueueUserWorkItem(&CrashService::AsyncSendDump, dump_job, WT_EXECUTELONGFUNCTION)) { LOG(ERROR) << "could not queue job"; diff --git a/chrome/tools/crash_service/crash_service.h b/chrome/tools/crash_service/crash_service.h index e7597df..d0fd971 100644 --- a/chrome/tools/crash_service/crash_service.h +++ b/chrome/tools/crash_service/crash_service.h @@ -62,6 +62,9 @@ class CrashService { // Override the name of the Windows named pipe on which we will // listen for crash dump request messages. static const char kPipeName[]; + // --archive-dumps-by-pid + // Archive crash dumps into separate directory by client process id. + static const char kArchiveDumpsByPid[]; // Returns number of crash dumps handled. int requests_handled() const { @@ -102,6 +105,9 @@ class CrashService { // LocalFree. PSECURITY_DESCRIPTOR GetSecurityDescriptorForLowIntegrity(); + // Whether to archive crash dumps by client process id. + static bool archive_dumps_by_pid_; + google_breakpad::CrashGenerationServer* dumper_; google_breakpad::CrashReportSender* sender_; |