OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/crash_handler_host_linux.h" | 5 #include "chrome/browser/crash_handler_host_linux.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <stdlib.h> | 8 #include <stdlib.h> |
9 #include <sys/socket.h> | 9 #include <sys/socket.h> |
10 #include <sys/syscall.h> | 10 #include <sys/syscall.h> |
11 #include <unistd.h> | 11 #include <unistd.h> |
12 | 12 |
13 #include "base/eintr_wrapper.h" | 13 #include "base/eintr_wrapper.h" |
14 #include "base/file_path.h" | 14 #include "base/file_path.h" |
15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
16 #include "base/linux_util.h" | 16 #include "base/linux_util.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/memory/singleton.h" | 18 #include "base/memory/singleton.h" |
19 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/rand_util.h" | 21 #include "base/rand_util.h" |
22 #include "base/string_util.h" | 22 #include "base/string_util.h" |
| 23 #include "base/stringprintf.h" |
23 #include "base/task.h" | 24 #include "base/task.h" |
24 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
25 #include "breakpad/src/client/linux/handler/exception_handler.h" | 26 #include "breakpad/src/client/linux/handler/exception_handler.h" |
26 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" | 27 #include "breakpad/src/client/linux/minidump_writer/linux_dumper.h" |
27 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" | 28 #include "breakpad/src/client/linux/minidump_writer/minidump_writer.h" |
28 #include "chrome/app/breakpad_linux.h" | 29 #include "chrome/app/breakpad_linux.h" |
29 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
30 #include "chrome/common/env_vars.h" | 31 #include "chrome/common/env_vars.h" |
31 #include "content/browser/browser_thread.h" | 32 #include "content/browser/browser_thread.h" |
32 | 33 |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 char* crash_context, | 327 char* crash_context, |
327 int signal_fd) { | 328 int signal_fd) { |
328 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); | 329 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
329 | 330 |
330 FilePath dumps_path("/tmp"); | 331 FilePath dumps_path("/tmp"); |
331 PathService::Get(base::DIR_TEMP, &dumps_path); | 332 PathService::Get(base::DIR_TEMP, &dumps_path); |
332 if (!info->upload) | 333 if (!info->upload) |
333 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); | 334 PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path); |
334 const uint64 rand = base::RandUint64(); | 335 const uint64 rand = base::RandUint64(); |
335 const std::string minidump_filename = | 336 const std::string minidump_filename = |
336 StringPrintf("%s/chromium-%s-minidump-%016" PRIx64 ".dmp", | 337 base::StringPrintf("%s/chromium-%s-minidump-%016" PRIx64 ".dmp", |
337 dumps_path.value().c_str(), process_type_.c_str(), rand); | 338 dumps_path.value().c_str(), |
| 339 process_type_.c_str(), |
| 340 rand); |
338 if (!google_breakpad::WriteMinidump(minidump_filename.c_str(), | 341 if (!google_breakpad::WriteMinidump(minidump_filename.c_str(), |
339 crashing_pid, crash_context, | 342 crashing_pid, crash_context, |
340 kCrashContextSize)) { | 343 kCrashContextSize)) { |
341 LOG(ERROR) << "Failed to write crash dump for pid " << crashing_pid; | 344 LOG(ERROR) << "Failed to write crash dump for pid " << crashing_pid; |
342 } | 345 } |
343 delete[] crash_context; | 346 delete[] crash_context; |
344 | 347 |
345 // Freed in CrashDumpTask(); | 348 // Freed in CrashDumpTask(); |
346 char* minidump_filename_str = new char[minidump_filename.length() + 1]; | 349 char* minidump_filename_str = new char[minidump_filename.length() + 1]; |
347 minidump_filename.copy(minidump_filename_str, minidump_filename.length()); | 350 minidump_filename.copy(minidump_filename_str, minidump_filename.length()); |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
461 } | 464 } |
462 | 465 |
463 void RendererCrashHandlerHostLinux::SetProcessType() { | 466 void RendererCrashHandlerHostLinux::SetProcessType() { |
464 process_type_ = "renderer"; | 467 process_type_ = "renderer"; |
465 } | 468 } |
466 | 469 |
467 // static | 470 // static |
468 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { | 471 RendererCrashHandlerHostLinux* RendererCrashHandlerHostLinux::GetInstance() { |
469 return Singleton<RendererCrashHandlerHostLinux>::get(); | 472 return Singleton<RendererCrashHandlerHostLinux>::get(); |
470 } | 473 } |
OLD | NEW |