summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--breakpad/breakpad.gyp4
-rw-r--r--build/common.gypi28
-rw-r--r--chrome/app/breakpad_linux.cc110
-rw-r--r--chrome/app/breakpad_linux.h7
-rw-r--r--chrome/browser/renderer_host/render_crash_handler_host_linux.cc16
-rw-r--r--chrome/chrome.gyp14
-rw-r--r--chrome/common/child_process_host.cc3
7 files changed, 64 insertions, 118 deletions
diff --git a/breakpad/breakpad.gyp b/breakpad/breakpad.gyp
index a707851..1fc1440 100644
--- a/breakpad/breakpad.gyp
+++ b/breakpad/breakpad.gyp
@@ -216,8 +216,8 @@
}],
[ 'OS=="linux"', {
'conditions': [
- # Tools needed for archiving build symbols.
- ['branding=="Chrome" or linux_breakpad==1', {
+ # Tools needed for archiving official build symbols.
+ ['branding=="Chrome"', {
'targets': [
{
'target_name': 'symupload',
diff --git a/build/common.gypi b/build/common.gypi
index 694dd32..5b7790d 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -31,10 +31,6 @@
# on 'buildtype' (i.e. we don't care about saving symbols for non-Official
# builds).
'buildtype%': 'Dev',
-
- # We do want to build Chromium with Breakpad support in certain
- # situations. I.e. for Chrome bot.
- 'linux_chromium_breakpad%': 0,
},
# Define branding and buildtype on the basis of their settings within the
@@ -76,9 +72,9 @@
# Once all vsprops settings are migrated into gyp, this can go away.
'msvs_use_common_release%': 1,
- # TODO(bradnelson): eliminate this when possible.
- # To allow local gyp files to override additional linker options for msvs.
- # Yes(1) means set use the common linker options.
+ # TODO(bradnelson): eliminate this when possible.
+ # To allow local gyp files to override additional linker options for msvs.
+ # Yes(1) means set use the common linker options.
'msvs_use_common_linker_extras%': 1,
# TODO(sgk): eliminate this if possible.
@@ -118,15 +114,6 @@
'linux_sandbox_chrome_path%': '/opt/google/chrome/chrome',
'conditions': [
- ['OS=="linux"', {
- 'conditions': [
- ['branding=="Chrome" or linux_chromium_breakpad==1', {
- 'linux_breakpad%': 1,
- }, {
- 'linux_breakpad%': 0,
- }],
- ],
- }], # OS=="linux"
['OS=="mac"', {
'conditions': [
# mac_product_name is set to the name of the .app bundle as it should
@@ -179,6 +166,11 @@
'conditions': [
['branding=="Chrome"', {
'defines': ['GOOGLE_CHROME_BUILD'],
+ 'conditions': [
+ ['OS=="linux"', {
+ 'cflags': [ '-gstabs' ],
+ }],
+ ],
}, { # else: branding!="Chrome"
'defines': ['CHROMIUM_BUILD'],
}],
@@ -547,10 +539,6 @@
'-fno-strict-aliasing',
],
}],
- ['linux_breakpad==1', {
- 'cflags': [ '-gstabs' ],
- 'defines': ['USE_LINUX_BREAKPAD'],
- }],
],
},
}],
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index 415db89..19c82ba 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -7,7 +7,6 @@
#include <arpa/inet.h>
#include <fcntl.h>
#include <netinet/in.h>
-#include <stdlib.h>
#include <sys/sendfile.h>
#include <sys/socket.h>
#include <sys/uio.h>
@@ -19,7 +18,6 @@
#include "base/command_line.h"
#include "base/eintr_wrapper.h"
-#include "base/file_path.h"
#include "base/file_version_info_linux.h"
#include "base/format_macros.h"
#include "base/global_descriptors_posix.h"
@@ -36,7 +34,6 @@
#include "breakpad/linux/linux_syscall_support.h"
#include "breakpad/linux/memory.h"
#include "chrome/common/chrome_descriptors.h"
-#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/installer/util/google_update_settings.h"
@@ -54,7 +51,7 @@ static void write_uint64_hex(char* output, uint64_t v) {
}
}
-pid_t HandleCrashDump(const BreakpadInfo& info) {
+pid_t UploadCrashDump(const BreakpadInfo& info) {
// WARNING: this code runs in a compromised context. It may not call into
// libc nor allocate memory normally.
@@ -98,39 +95,29 @@ pid_t HandleCrashDump(const BreakpadInfo& info) {
static const char temp_file_template[] =
"/tmp/chromium-upload-XXXXXXXXXXXXXXXX";
- char temp_file[sizeof(temp_file_template)];
- int fd = -1;
- if (info.upload) {
- memcpy(temp_file, temp_file_template, sizeof(temp_file_template));
-
- for (unsigned i = 0; i < 10; ++i) {
- uint64_t t;
- read(ufd, &t, sizeof(t));
- write_uint64_hex(temp_file + sizeof(temp_file) - (16 + 1), t);
+ char buf[sizeof(temp_file_template)];
+ memcpy(buf, temp_file_template, sizeof(temp_file_template));
- fd = sys_open(temp_file, O_WRONLY | O_CREAT | O_EXCL, 0600);
- if (fd >= 0)
- break;
- }
+ int fd = -1;
+ for (unsigned i = 0; i < 10; ++i) {
+ uint64_t t;
+ read(ufd, &t, sizeof(t));
+ write_uint64_hex(buf + sizeof(buf) - (16 + 1), t);
+
+ fd = sys_open(buf, O_WRONLY | O_CREAT | O_EXCL, 0600);
+ if (fd >= 0)
+ break;
+ }
- if (fd < 0) {
- static const char msg[] = "Failed to create temporary file in /tmp: "
- "cannot upload crash dump\n";
- sys_write(2, msg, sizeof(msg) - 1);
- sys_close(ufd);
- return -1;
- }
- } else {
- fd = sys_open(info.filename, O_WRONLY, 0600);
- if (fd < 0) {
- static const char msg[] = "Failed to save crash dump: failed to open\n";
- sys_write(2, msg, sizeof(msg) - 1);
- sys_close(ufd);
- return -1;
- }
+ if (fd == -1) {
+ static const char msg[] = "Failed to create temporary file in /tmp: cannot "
+ "upload crash dump\n";
+ sys_write(2, msg, sizeof(msg) - 1);
+ sys_close(ufd);
+ return -1;
}
- // The MIME boundary is 28 hyphens, followed by a 64-bit nonce and a NUL.
+ // The MIME boundary is 28 hypens, followed by a 64-bit nonce and a NUL.
char mime_boundary[28 + 16 + 1];
my_memset(mime_boundary, '-', 28);
uint64_t boundary_rand;
@@ -386,9 +373,6 @@ pid_t HandleCrashDump(const BreakpadInfo& info) {
sys_close(fd);
- if (!info.upload)
- return 0;
-
// The --header argument to wget looks like:
// --header=Content-Type: multipart/form-data; boundary=XYZ
// where the boundary has two fewer leading '-' chars
@@ -405,9 +389,9 @@ pid_t HandleCrashDump(const BreakpadInfo& info) {
// --post-file=/tmp/...
static const char post_file_msg[] = "--post-file=";
char* const post_file = reinterpret_cast<char*>(allocator.Alloc(
- sizeof(post_file_msg) - 1 + sizeof(temp_file)));
+ sizeof(post_file_msg) - 1 + sizeof(buf)));
memcpy(post_file, post_file_msg, sizeof(post_file_msg) - 1);
- memcpy(post_file + sizeof(post_file_msg) - 1, temp_file, sizeof(temp_file));
+ memcpy(post_file + sizeof(post_file_msg) - 1, buf, sizeof(buf));
const pid_t child = sys_fork();
if (!child) {
@@ -457,7 +441,7 @@ pid_t HandleCrashDump(const BreakpadInfo& info) {
sys_write(2, "\n", 1);
}
sys_unlink(info.filename);
- sys_unlink(temp_file);
+ sys_unlink(buf);
sys__exit(0);
}
@@ -474,7 +458,7 @@ pid_t HandleCrashDump(const BreakpadInfo& info) {
NULL,
};
- execv(kWgetBinary, const_cast<char**>(args));
+ execv("/usr/bin/wget", const_cast<char**>(args));
static const char msg[] = "Cannot upload crash dump: cannot exec "
"/usr/bin/wget\n";
sys_write(2, msg, sizeof(msg) - 1);
@@ -499,8 +483,8 @@ extern std::string linux_distro;
static bool CrashDone(const char* dump_path,
const char* minidump_id,
- const bool upload,
- const bool succeeded) {
+ void* context,
+ bool succeeded) {
// WARNING: this code runs in a compromised context. It may not call into
// libc nor allocate memory normally.
if (!succeeded)
@@ -528,39 +512,16 @@ static bool CrashDone(const char* dump_path,
info.guid_length = google_update::linux_guid.length();
info.distro = base::linux_distro.data();
info.distro_length = base::linux_distro.length();
- info.upload = upload;
- HandleCrashDump(info);
+ UploadCrashDump(info);
return true;
}
-// Wrapper script, do not add more code here.
-static bool CrashDoneNoUpload(const char* dump_path,
- const char* minidump_id,
- void* context,
- bool succeeded) {
- return CrashDone(dump_path, minidump_id, false, succeeded);
-}
-
-// Wrapper script, do not add more code here.
-static bool CrashDoneUpload(const char* dump_path,
- const char* minidump_id,
- void* context,
- bool succeeded) {
- return CrashDone(dump_path, minidump_id, true, succeeded);
-}
+void EnableCrashDumping() {
+ // We leak this object.
-void EnableCrashDumping(const bool unattended) {
- if (unattended) {
- FilePath dumps_path("/tmp");
- PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
- new google_breakpad::ExceptionHandler(dumps_path.value().c_str(), NULL,
- CrashDoneNoUpload, NULL,
- true /* install handlers */);
- } else {
- new google_breakpad::ExceptionHandler("/tmp", NULL, CrashDoneUpload, NULL,
- true /* install handlers */);
- }
+ new google_breakpad::ExceptionHandler("/tmp", NULL, CrashDone, NULL,
+ true /* install handlers */);
}
// This is defined in chrome/common/child_process_logging_linux.cc, it's the
@@ -640,12 +601,11 @@ void InitCrashReporter() {
const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess();
const std::wstring process_type =
parsed_command_line.GetSwitchValue(switches::kProcessType);
- const bool unattended = (getenv("CHROME_HEADLESS") != NULL);
if (process_type.empty()) {
- if (!(unattended || GoogleUpdateSettings::GetCollectStatsConsent()))
+ if (!GoogleUpdateSettings::GetCollectStatsConsent())
return;
base::GetLinuxDistro(); // Initialize base::linux_distro if needed.
- EnableCrashDumping(unattended);
+ EnableCrashDumping();
} else if (process_type == switches::kRendererProcess ||
process_type == switches::kZygoteProcess) {
// We might be chrooted in a zygote or renderer process so we cannot call
@@ -669,7 +629,6 @@ void InitCrashReporter() {
// -----------------------------------------------------------------------------
-#if defined(GOOGLE_CHROME_BUILD)
bool EnableCoreDumping(std::string* core_dump_directory) {
// First we check that the core files will get dumped to the
// current-directory in a file called 'core'. We could try to support other
@@ -770,7 +729,9 @@ static void UploadCoreFile(const pid_t child, std::string* core_filename) {
header.SetString(L"chrome-version", FILE_VERSION);
header.SetString(L"binary-size", StringPrintf("%" PRIu64, binary_size));
header.SetString(L"user", getenv("USER"));
+#if defined(GOOGLE_CHROME_BUILD)
header.SetBoolean(L"offical-build", true);
+#endif
std::string json;
JSONWriter::Write(&header, true /* pretty print */, &json);
@@ -826,4 +787,3 @@ void MonitorForCoreDumpsAndReport(const std::string& core_dump_directory,
rmdir(core_dump_directory.c_str());
}
-#endif
diff --git a/chrome/app/breakpad_linux.h b/chrome/app/breakpad_linux.h
index 53f43a1..d06c9a2 100644
--- a/chrome/app/breakpad_linux.h
+++ b/chrome/app/breakpad_linux.h
@@ -9,7 +9,7 @@
extern void InitCrashReporter();
-#if defined(USE_LINUX_BREAKPAD)
+#if defined(GOOGLE_CHROME_BUILD)
static const size_t kMaxActiveURLSize = 1024;
static const size_t kGuidSize = 32; // 128 bits = 32 chars in hex.
static const size_t kDistroSize = 128;
@@ -24,13 +24,10 @@ struct BreakpadInfo {
unsigned guid_length;
const char* distro;
unsigned distro_length;
- bool upload;
};
-extern int HandleCrashDump(const BreakpadInfo& info);
-#endif // defined(USE_LINUX_BREAKPAD)
+extern int UploadCrashDump(const BreakpadInfo& info);
-#if defined(GOOGLE_CHROME_BUILD)
// Checks that the kernel's core filename pattern is "core" and moves the
// current working directory to a temp directory.
// Returns true iff core dumping has been successfully enabled for the current
diff --git a/chrome/browser/renderer_host/render_crash_handler_host_linux.cc b/chrome/browser/renderer_host/render_crash_handler_host_linux.cc
index ec83663..5c99e5f 100644
--- a/chrome/browser/renderer_host/render_crash_handler_host_linux.cc
+++ b/chrome/browser/renderer_host/render_crash_handler_host_linux.cc
@@ -10,18 +10,15 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/uio.h>
-#include <stdlib.h>
#include <unistd.h>
#include <string>
#include <vector>
#include "base/eintr_wrapper.h"
-#include "base/file_path.h"
#include "base/format_macros.h"
#include "base/logging.h"
#include "base/message_loop.h"
-#include "base/path_service.h"
#include "base/rand_util.h"
#include "base/string_util.h"
#include "breakpad/linux/exception_handler.h"
@@ -29,7 +26,6 @@
#include "breakpad/linux/minidump_writer.h"
#include "chrome/app/breakpad_linux.h"
#include "chrome/browser/chrome_thread.h"
-#include "chrome/common/chrome_paths.h"
// expected prefix of the target of the /proc/self/fd/%d link for a socket
static const char kSocketLinkPrefix[] = "socket:[";
@@ -307,16 +303,9 @@ void RenderCrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) {
return;
}
- bool upload = true;
- FilePath dumps_path("/tmp");
- if (getenv("CHROME_HEADLESS")) {
- upload = false;
- PathService::Get(chrome::DIR_CRASH_DUMPS, &dumps_path);
- }
const uint64 rand = base::RandUint64();
const std::string minidump_filename =
- StringPrintf("%s/chromium-renderer-minidump-%016" PRIx64 ".dmp",
- dumps_path.value().c_str(), rand);
+ StringPrintf("/tmp/chromium-renderer-minidump-%016" PRIx64 ".dmp", rand);
if (!google_breakpad::WriteMinidump(minidump_filename.c_str(),
crashing_pid, crash_context,
kCrashContextSize)) {
@@ -345,8 +334,7 @@ void RenderCrashHandlerHostLinux::OnFileCanReadWithoutBlocking(int fd) {
info.guid_length = strlen(guid);
info.distro = distro;
info.distro_length = strlen(distro);
- info.upload = upload;
- HandleCrashDump(info);
+ UploadCrashDump(info);
}
void RenderCrashHandlerHostLinux::WillDestroyCurrentMessageLoop() {
diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp
index 97b2fed..c97fbf4 100644
--- a/chrome/chrome.gyp
+++ b/chrome/chrome.gyp
@@ -4722,6 +4722,20 @@
}, # target chrome_dll
], # targets
}], # OS=="mac" or OS=="win"
+ ['OS=="linux"', {
+ 'conditions': [
+ # Only Chrome builds get breakpad since crash processing is internal.
+ ['branding=="Chrome"', {
+ 'variables': {
+ 'linux_breakpad%': 1,
+ },
+ }, {
+ 'variables': {
+ 'linux_breakpad%': 0,
+ },
+ }],
+ ],
+ }],
['OS=="mac"',
{ 'targets': [
{
diff --git a/chrome/common/child_process_host.cc b/chrome/common/child_process_host.cc
index 89a7a56..1fa91f9 100644
--- a/chrome/common/child_process_host.cc
+++ b/chrome/common/child_process_host.cc
@@ -146,8 +146,7 @@ std::wstring ChildProcessHost::GetChildPath() {
// static
void ChildProcessHost::SetCrashReporterCommandLine(CommandLine* command_line) {
#if defined(OS_POSIX)
- const bool unattended = (getenv("CHROME_HEADLESS") != NULL);
- if (unattended || GoogleUpdateSettings::GetCollectStatsConsent()) {
+ if (GoogleUpdateSettings::GetCollectStatsConsent()) {
#if defined(OS_LINUX)
command_line->AppendSwitchWithValue(switches::kEnableCrashReporter,
ASCIIToWide(google_update::linux_guid +