summaryrefslogtreecommitdiffstats
path: root/ppapi/native_client
diff options
context:
space:
mode:
authorbsy@google.com <bsy@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-19 06:01:46 +0000
committerbsy@google.com <bsy@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-19 06:01:46 +0000
commit5c56b3a6c8c932d0b1e3fbd44cb97c5a597f2aef (patch)
treee73e49e2495422e60427183e25e52e49076f77a4 /ppapi/native_client
parentf7b8651bf8d82996dc9426553b13d35de413681e (diff)
downloadchromium_src-5c56b3a6c8c932d0b1e3fbd44cb97c5a597f2aef.zip
chromium_src-5c56b3a6c8c932d0b1e3fbd44cb97c5a597f2aef.tar.gz
chromium_src-5c56b3a6c8c932d0b1e3fbd44cb97c5a597f2aef.tar.bz2
Merge branch 'master' of http://git.chromium.org/chromium/src into mywork
Collect NaClLog messages from just prior to crash and display in JavaScript console. Test command line, after building chrome: NACLVERBOSITY=6 NACL_PLUGIN_DEBUG=1 NACL_FAULT_INJECTION=BeforeLoadIrt=GF2 out/Release/chrome --user-data-dir=/tmp/udd This causes the service runtime to abort just prior to loading the IRT. After this "crash", open up the JavaScript console and see the log messages, including those from the fault injection library. BUG= http://code.google.com/p/nativeclient/issues/detail?id=2776 TEST= manual, using the fault injection library Review URL: https://chromiumcodereview.appspot.com/10806005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147401 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc25
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.h6
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.cc9
-rw-r--r--ppapi/native_client/src/trusted/plugin/service_runtime.h2
4 files changed, 42 insertions, 0 deletions
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc
index 8a88489..496f135 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.cc
+++ b/ppapi/native_client/src/trusted/plugin/plugin.cc
@@ -1146,6 +1146,28 @@ void Plugin::NexeFileDidOpenContinuation(int32_t pp_error) {
NaClLog(4, "Leaving NexeFileDidOpenContinuation\n");
}
+static void LogLineToConsole(Plugin* plugin, nacl::string one_line) {
+ PLUGIN_PRINTF(("LogLineToConsole: %s\n",
+ one_line.c_str()));
+ plugin->AddToConsole(one_line);
+}
+
+void Plugin::CopyCrashLogToJsConsole() {
+ nacl::string fatal_msg(main_service_runtime()->GetCrashLogOutput());
+ size_t ix_start = 0;
+ size_t ix_end;
+
+ PLUGIN_PRINTF(("Plugin::CopyCrashLogToJsConsole: got %d bytes\n",
+ fatal_msg.size()));
+ while (nacl::string::npos != (ix_end = fatal_msg.find('\n', ix_start))) {
+ LogLineToConsole(this, fatal_msg.substr(ix_start, ix_end - ix_start));
+ ix_start = ix_end + 1;
+ }
+ if (ix_start != fatal_msg.size()) {
+ LogLineToConsole(this, fatal_msg.substr(ix_start));
+ }
+}
+
void Plugin::NexeDidCrash(int32_t pp_error) {
PLUGIN_PRINTF(("Plugin::NexeDidCrash (pp_error=%"NACL_PRId32")\n",
pp_error));
@@ -1172,6 +1194,7 @@ void Plugin::NexeDidCrash(int32_t pp_error) {
" suppressing\n"));
return;
}
+
if (nacl_ready_state() == DONE) {
ReportDeadNexe();
} else {
@@ -1180,6 +1203,8 @@ void Plugin::NexeDidCrash(int32_t pp_error) {
"Nexe crashed during startup");
ReportLoadError(error_info);
}
+
+ CopyCrashLogToJsConsole();
}
void Plugin::BitcodeDidTranslate(int32_t pp_error) {
diff --git a/ppapi/native_client/src/trusted/plugin/plugin.h b/ppapi/native_client/src/trusted/plugin/plugin.h
index 253cfd5..ce6df11 100644
--- a/ppapi/native_client/src/trusted/plugin/plugin.h
+++ b/ppapi/native_client/src/trusted/plugin/plugin.h
@@ -418,6 +418,12 @@ class Plugin : public pp::InstancePrivate {
// Shuts down the proxy for PPAPI nexes.
void ShutdownProxy(); // Nexe shutdown + proxy deletion.
+ // Copy the main service runtime's most recent NaClLog output to the
+ // JavaScript console. Valid to use only after a crash, e.g., via a
+ // detail level LOG_FATAL NaClLog entry. If the crash was not due
+ // to a LOG_FATAL this method will do nothing.
+ void CopyCrashLogToJsConsole();
+
ScriptablePlugin* scriptable_plugin_;
int argc_;
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.cc b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
index 5c3b4fd..76fb5789 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.cc
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.cc
@@ -412,6 +412,7 @@ void PluginReverseInterface::CloseManifestEntry_MainThreadContinuation(
void PluginReverseInterface::ReportCrash() {
NaClLog(4, "PluginReverseInterface::ReportCrash\n");
+
if (crash_cb_.pp_completion_callback().func != NULL) {
NaClLog(4, "PluginReverseInterface::ReportCrash: invoking CB\n");
pp::Module::Get()->core()->CallOnMainThread(0, crash_cb_, PP_OK);
@@ -741,4 +742,12 @@ void ServiceRuntime::set_exit_status(int exit_status) {
exit_status_ = exit_status & 0xff;
}
+nacl::string ServiceRuntime::GetCrashLogOutput() {
+ if (NULL != subprocess_.get()) {
+ return subprocess_->GetCrashLogOutput();
+ } else {
+ return "";
+ }
+}
+
} // namespace plugin
diff --git a/ppapi/native_client/src/trusted/plugin/service_runtime.h b/ppapi/native_client/src/trusted/plugin/service_runtime.h
index 554942a..5af0c51 100644
--- a/ppapi/native_client/src/trusted/plugin/service_runtime.h
+++ b/ppapi/native_client/src/trusted/plugin/service_runtime.h
@@ -235,6 +235,8 @@ class ServiceRuntime {
int exit_status(); // const, but grabs mutex etc.
void set_exit_status(int exit_status);
+ nacl::string GetCrashLogOutput();
+
// To establish quota callbacks the pnacl coordinator needs to communicate
// with the reverse interface.
PluginReverseInterface* rev_interface() const { return rev_interface_; }