Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1388)

Unified Diff: tools/pnacl-llc/srpc_main.cpp

Issue 23753003: Report fatal translator errors to the browser (Closed) Base URL: http://git.chromium.org/native_client/pnacl-llvm.git@master
Patch Set: split errors from streamable readBytes and Header ReadPrefix Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/pnacl-llc/pnacl-llc.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/pnacl-llc/srpc_main.cpp
diff --git a/tools/pnacl-llc/srpc_main.cpp b/tools/pnacl-llc/srpc_main.cpp
index 87178c203871054c3693845f6a160cdf8cfdb986..46d79ce4418a103e8cdd8efe02efdb8b58b4312e 100644
--- a/tools/pnacl-llc/srpc_main.cpp
+++ b/tools/pnacl-llc/srpc_main.cpp
@@ -32,6 +32,7 @@
#include "llvm/ADT/OwningPtr.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/Option/Option.h"
+#include "llvm/Support/ErrorHandling.h"
#include "llvm/Support/system_error.h"
using namespace llvm;
@@ -202,8 +203,10 @@ void *run_streamed(void *arg) {
StreamingThreadData *data = reinterpret_cast<StreamingThreadData *>(arg);
data->CmdLineVec()->push_back("-streaming-bitcode");
if (DoTranslate(data->CmdLineVec(), data->ObjectFD()) != 0) {
- fprintf(stderr, "DoTranslate failed.\n");
- srpc_streamer->setError();
+ // llc_main only returns 1 (as opposed to calling report_fatal_error)
+ // in conditions we never expect to see in the browser (e.g. bad
+ // command-line flags).
+ srpc_streamer->setFatalError("llc_main unspecified failure");
return NULL;
}
delete data;
@@ -351,6 +354,14 @@ int getObjectFileFD() { return object_file_fd; }
DataStreamer *getNaClBitcodeStreamer() { return NaClBitcodeStreamer; }
+// Called from the compilation thread
+void FatalErrorHandler(void *user_data, const std::string& reason,
+ bool gen_crash_diag) {
+ srpc_streamer->setFatalError(reason);
+}
+
+fatal_error_handler_t getSRPCErrorHandler() { return FatalErrorHandler; }
+
int srpc_main(int argc, char **argv) {
if (!NaClSrpcModuleInit()) {
return 1;
« no previous file with comments | « tools/pnacl-llc/pnacl-llc.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698