Commit 6784252a authored by cstefansen@google.com's avatar cstefansen@google.com

Enable Breakpad for crashes in trusted code in Native Client on Chrome for Linux.

This change ensures that the appropriate command line flag (SetCrashReporterCommandLine())
is set for the NaCl process and read by the NaCl main process when it starts.

TEST=
0. Ensure that Native Client is DEPS'ed in at revision 4097 or higher
1. From src/ issue
    ./build/gyp_chromim -f make -dlinux_breakpad=1
2. Build Chromium (debug build)
3. With env. variable CHROME_HEADLESS=1 and NACL_CRASH_TEST=1 run
    out/Debug/chrome --enable-nacl --enable-crash-reporter
4. Visit a page that attempts to load a NaCl module, e.g.,
    http://naclports.googlecode.com/svn/trunk/src/gallery/index.html
5. Observe that a .dmp file is created in ~/.config/chromium/Crash\ Reports/

BUG= http://code.google.com/p/nativeclient/issues/detail?id=206

Review URL: http://codereview.chromium.org/6193005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71459 0039d316-1c4b-4281-b951-d872f2087c98
parent 08392d8b
......@@ -646,7 +646,7 @@ void EnableCrashDumping(const bool unattended) {
}
}
// Currently Non-Browser = Renderer and Plugins
// Currently Non-Browser = Renderer, Plugins and Native Client
static bool
NonBrowserCrashHandler(const void* crash_context, size_t crash_context_size,
void* context) {
......@@ -747,7 +747,8 @@ void InitCrashReporter() {
EnableCrashDumping(getenv(env_vars::kHeadless) != NULL);
} else if (process_type == switches::kRendererProcess ||
process_type == switches::kPluginProcess ||
process_type == switches::kZygoteProcess) {
process_type == switches::kZygoteProcess ||
process_type == switches::kNaClLoaderProcess) {
// We might be chrooted in a zygote or renderer process so we cannot call
// GetCollectStatsConsent because that needs access the the user's home
// dir. Instead, we set a command line flag for these processes.
......
......@@ -140,6 +140,8 @@ bool NaClProcessHost::LaunchSelLdr() {
cmd_line->AppendSwitchASCII(switches::kProcessChannelID, channel_id());
SetCrashReporterCommandLine(cmd_line);
// On Windows we might need to start the broker process to launch a new loader
#if defined(OS_WIN)
if (running_on_wow64_) {
......
......@@ -6,6 +6,7 @@ include_rules = [
# sandbox support code out of chrome/renderer. (Previously, this
# header was #included from the native_client directory, which was
# worse.)
"+chrome/app",
"+chrome/renderer",
"+chrome/test",
"+sandbox/src",
......
......@@ -13,6 +13,11 @@
#include "base/command_line.h"
#include "base/message_loop.h"
#include "base/string_util.h"
#if defined(USE_LINUX_BREAKPAD)
#include "chrome/app/breakpad_linux.h"
#endif
#include "chrome/common/child_process.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_switches.h"
......@@ -90,6 +95,10 @@ static void HandleNaClTestParameters(const CommandLine& command_line) {
// main() routine for the NaCl loader process.
int NaClMain(const MainFunctionParams& parameters) {
#if defined(USE_LINUX_BREAKPAD)
// Needs to be called after we have chrome::DIR_USER_DATA.
InitCrashReporter();
#endif
const CommandLine& parsed_command_line = parameters.command_line_;
// This function allows pausing execution using the --nacl-startup-dialog
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment