summaryrefslogtreecommitdiffstats
path: root/chrome/app
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 18:03:55 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-28 18:03:55 +0000
commit9ba8f8dd3bf0184eb46cb9f58e1560be1a789fe5 (patch)
tree6d9559338bc419fc6d665ed0dd5ab3721c436a65 /chrome/app
parente967b2de9ea805ef40840280eae686040b8a5c94 (diff)
downloadchromium_src-9ba8f8dd3bf0184eb46cb9f58e1560be1a789fe5.zip
chromium_src-9ba8f8dd3bf0184eb46cb9f58e1560be1a789fe5.tar.gz
chromium_src-9ba8f8dd3bf0184eb46cb9f58e1560be1a789fe5.tar.bz2
Linux: remove --google-internal-crash-reporting.
It's time to kill this. It's been marginally useful, but only marginally. http://codereview.chromium.org/222021 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27375 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app')
-rw-r--r--chrome/app/breakpad_linux.cc169
-rw-r--r--chrome/app/breakpad_linux.h17
-rw-r--r--chrome/app/chrome_dll_main.cc18
3 files changed, 0 insertions, 204 deletions
diff --git a/chrome/app/breakpad_linux.cc b/chrome/app/breakpad_linux.cc
index 6945a12..3b4ec65 100644
--- a/chrome/app/breakpad_linux.cc
+++ b/chrome/app/breakpad_linux.cc
@@ -4,14 +4,10 @@
#include "chrome/app/breakpad_linux.h"
-#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>
-#include <sys/wait.h>
#include <unistd.h>
#include <algorithm>
@@ -21,14 +17,10 @@
#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"
-#include "base/json_writer.h"
#include "base/path_service.h"
#include "base/rand_util.h"
-#include "base/scoped_fd.h"
#include "base/string_util.h"
-#include "base/values.h"
#include "breakpad/linux/directory_reader.h"
#include "breakpad/linux/exception_handler.h"
#include "breakpad/linux/linux_libc_support.h"
@@ -664,164 +656,3 @@ void InitCrashReporter() {
EnableRendererCrashDumping();
}
}
-
-// -----------------------------------------------------------------------------
-
-#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
- // setups by simulating the kernel's code, but it's extra complexity and we
- // only intend for this code to be run internally.
- static const char kCorePatternFd[] = "/proc/sys/kernel/core_pattern";
-
- ScopedFd core_pattern_fd(open(kCorePatternFd, O_RDONLY));
- if (core_pattern_fd.get() < 0) {
- LOG(WARNING) << "Cannot open " << kCorePatternFd << ": " << strerror(errno);
- return false;
- }
-
- char buf[6];
- if (read(core_pattern_fd.get(), buf, sizeof(buf)) != 5 ||
- memcmp(buf, "core\n", 5)) {
- LOG(WARNING) << "Your core pattern is not set to 'core\n', cannot dump";
- return false;
- }
- core_pattern_fd.Close();
-
- // We check that the rlimit on core file size is unlimited.
- struct rlimit core_dump_limit;
- if (getrlimit(RLIMIT_CORE, &core_dump_limit)) {
- LOG(WARNING) << "Failed to get core dump limit: " << strerror(errno);
- return false;
- }
-
- if (core_dump_limit.rlim_cur != RLIM_INFINITY) {
- if (core_dump_limit.rlim_max != RLIM_INFINITY) {
- LOG(WARNING) << "Cannot core dump: hard limit on core dumps found";
- return false;
- }
-
- core_dump_limit.rlim_cur = RLIM_INFINITY;
- if (setrlimit(RLIMIT_CORE, &core_dump_limit)) {
- LOG(WARNING) << "Failed to set core dump limit: " << strerror(errno);
- return false;
- }
- }
-
- // Finally, we move the current directory into a temp dir and return the path
- // to the temp dir so that we can clean up afterwards.
- char temp_dir_template[] = "/tmp/chromium-core-dump-XXXXXX";
- if (mkdtemp(temp_dir_template) == NULL) {
- LOG(WARNING) << "Failed to create temp dir for core dumping: "
- << strerror(errno);
- return false;
- }
-
- if (chdir(temp_dir_template)) {
- LOG(WARNING) << "Cannot chdir into temp directory: " << strerror(errno);
- return false;
- }
-
- *core_dump_directory = temp_dir_template;
-
- return true;
-}
-
-static void UploadCoreFile(const pid_t child, std::string* core_filename) {
- *core_filename = "core";
- ScopedFd fd(open(core_filename->c_str(), O_RDONLY));
- if (fd.get() < 0) {
- *core_filename = StringPrintf("core.%d", child);
- fd.Set(open(core_filename->c_str(), O_RDONLY));
- if (fd.get() < 0) {
- LOG(WARNING) << "Cannot open resulting core dump from browser: "
- << strerror(errno);
- return;
- }
- }
-
- struct stat st;
- if (fstat(fd.get(), &st)) {
- LOG(WARNING) << "Failed to stat core file: " << strerror(errno);
- return;
- }
-
- const uint32_t core_size = st.st_size;
-
- static const char kMyBinary[] = "/proc/self/exe";
- ScopedFd self_fd(open(kMyBinary, O_RDONLY));
- if (self_fd.get() < 0) {
- LOG(WARNING) << "Cannot open " << kMyBinary << ": " << strerror(errno);
- return;
- }
-
- if (fstat(self_fd.get(), &st)) {
- LOG(WARNING) << "Failed to stat " << kMyBinary << ": " << strerror(errno);
- return;
- }
-
- const uint64_t binary_size = st.st_size;
-
- DictionaryValue header;
- header.SetString(L"core-size", StringPrintf("%" PRIu32, core_size));
- header.SetString(L"chrome-version", FILE_VERSION);
- header.SetString(L"binary-size", StringPrintf("%" PRIu64, binary_size));
- header.SetString(L"user", getenv("USER"));
- header.SetBoolean(L"offical-build", true);
-
- std::string json;
- JSONWriter::Write(&header, true /* pretty print */, &json);
- const uint32_t json_size = json.size();
-
- ScopedFd sock(socket(PF_INET, SOCK_STREAM, 0));
- if (sock.get() < 0) {
- LOG(WARNING) << "Cannot open socket: " << strerror(errno);
- return;
- }
-
- static const char kUploadIP[] = "172.22.68.141";
- static const uint16_t kUploadPort = 9999;
-
- struct sockaddr_in sin;
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = inet_addr(kUploadIP);
- sin.sin_port = htons(kUploadPort);
-
- if (connect(sock.get(), (struct sockaddr*) &sin, sizeof(sin))) {
- LOG(WARNING) << "Failed to connect to upload server (" << kUploadIP
- << ":" << kUploadPort << "): " << strerror(errno);
- return;
- }
-
- if (HANDLE_EINTR(write(sock.get(), &json_size, sizeof(json_size))) !=
- static_cast<ssize_t>(sizeof(json_size)) ||
- HANDLE_EINTR(write(sock.get(), json.data(), json_size)) !=
- static_cast<ssize_t>(json_size) ||
- HANDLE_EINTR(write(sock.get(), &core_size, sizeof(core_size))) !=
- static_cast<ssize_t>(sizeof(core_size)) ||
- HANDLE_EINTR(sendfile(sock.get(), fd.get(), NULL, core_size)) !=
- static_cast<ssize_t>(core_size)) {
- LOG(WARNING) << "Failed to write all data to server";
- return;
- }
-}
-
-void MonitorForCoreDumpsAndReport(const std::string& core_dump_directory,
- const pid_t child) {
- int status;
- const pid_t result = HANDLE_EINTR(waitpid(child, &status, 0));
- if (result < 1) {
- LOG(ERROR) << "Failed to wait for browser child: " << strerror(errno);
- return;
- }
-
- if (WIFSIGNALED(status) && WCOREDUMP(status)) {
- std::string core_filename;
- UploadCoreFile(child, &core_filename);
- unlink(core_filename.c_str());
- }
-
- rmdir(core_dump_directory.c_str());
-}
-#endif
diff --git a/chrome/app/breakpad_linux.h b/chrome/app/breakpad_linux.h
index e7dfebb..6c4a7e2 100644
--- a/chrome/app/breakpad_linux.h
+++ b/chrome/app/breakpad_linux.h
@@ -5,8 +5,6 @@
#ifndef CHROME_APP_BREAKPAD_LINUX_H_
#define CHROME_APP_BREAKPAD_LINUX_H_
-#include <string>
-
extern void InitCrashReporter();
static const size_t kMaxActiveURLSize = 1024;
@@ -28,19 +26,4 @@ struct BreakpadInfo {
extern int HandleCrashDump(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
-// process.
-bool EnableCoreDumping(std::string* core_dump_directory);
-// Blocks until the given child has exited. If the kernel indicates that the
-// child dumped core, then the core is expected a file called "core" and is
-// uploaded to a collection server. The core file is deleted and the given
-// directory is removed.
-void MonitorForCoreDumpsAndReport(const std::string& core_dump_directory,
- const pid_t child);
-
-#endif // defined(GOOGLE_CHROME_BUILD)
-
#endif // CHROME_APP_BREAKPAD_LINUX_H_
diff --git a/chrome/app/chrome_dll_main.cc b/chrome/app/chrome_dll_main.cc
index 9f135b5..ecf2640 100644
--- a/chrome/app/chrome_dll_main.cc
+++ b/chrome/app/chrome_dll_main.cc
@@ -57,9 +57,6 @@
#if defined(OS_LINUX)
#include "base/nss_init.h"
#endif
-#if defined(USE_LINUX_BREAKPAD)
-#include "chrome/app/breakpad_linux.h"
-#endif
#include "chrome/app/scoped_ole_initializer.h"
#include "chrome/browser/renderer_host/render_process_host.h"
#include "chrome/common/chrome_constants.h"
@@ -378,21 +375,6 @@ int ChromeMain(int argc, char** argv) {
int ret = execlp("man", "man", binary.BaseName().value().c_str(), NULL);
LOG(FATAL) << "execlp failed: " << strerror(ret);
}
-
-#if defined(GOOGLE_CHROME_BUILD)
- if (parsed_command_line.HasSwitch(switches::kGoogleInternalCrashReporting)) {
- // Enable full core dump reporting. Internal only.
- std::string core_dump_directory;
- if (EnableCoreDumping(&core_dump_directory)) {
- LOG(WARNING) << "Full core dump reporting enabled.";
- const pid_t child = fork();
- if (child != 0) {
- MonitorForCoreDumpsAndReport(core_dump_directory, child);
- _exit(0);
- }
- }
- }
-#endif
#endif
#if defined(OS_POSIX)