diff options
author | Derek Schuff <dschuff@chromium.org> | 2013-09-13 14:29:09 -0700 |
---|---|---|
committer | Derek Schuff <dschuff@chromium.org> | 2013-09-13 14:29:09 -0700 |
commit | f8cb03fe2634ee927b3b6aa6ecbdd824cd0bc940 (patch) | |
tree | a7130af309bd2ec767774b3dad12d956e9e1b009 /include/llvm | |
parent | 156e8330e6df89812148f8e1b22cd883391deedc (diff) |
Report fatal translator errors to the browser
Install a fatal error handler for the translator, which stores the error
string, signals an error to the RPC thread, and terminates the thread
(instead of terminating the whole program). This will cause the error to
go to the Javascript console in Chrome
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3519
R=jvoung@chromium.org
Review URL: https://codereview.chromium.org/23753003
Diffstat (limited to 'include/llvm')
-rw-r--r-- | include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h b/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h index 4f5f83a17a..214971e701 100644 --- a/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h +++ b/include/llvm/Bitcode/NaCl/NaClBitcodeHeader.h @@ -16,6 +16,7 @@ #ifndef LLVM_BITCODE_NACL_NACLBITCODEHEADER_H #define LLVM_BITCODE_NACL_NACLBITCODEHEADER_H +#include "llvm/ADT/StringRef.h" #include "llvm/Support/Compiler.h" #include "llvm/Support/DataTypes.h" #include <string> @@ -148,7 +149,7 @@ public: ~NaClBitcodeHeader(); /// \brief Installs the fields of the header, defining if the header - /// is readable and supported. + /// is readable and supported. Sets UnsupportedMessage on failure. void InstallFields(); /// \brief Adds a field to the list of fields in a header. Takes ownership @@ -209,15 +210,21 @@ private: // Reads and verifies the first 8 bytes of the header, consisting // of the magic number 'PEXE', and the value defining the number // of fields and number of bytes used to hold fields. - // Returns false if successful. + // Returns false if successful, sets UnsupportedMessage otherwise. bool ReadPrefix(const unsigned char *BufPtr, const unsigned char *BufEnd, unsigned &NumFields, unsigned &NumBytes); // Reads and verifies the fields in the header. - // Returns false if successful. + // Returns false if successful, sets UnsupportedMessage otherwise. bool ReadFields(const unsigned char *BufPtr, const unsigned char *BufEnd, unsigned NumFields, unsigned NumBytes); + // Sets the Unsupported error message and returns true. + bool UnsupportedError(StringRef Message) { + UnsupportedMessage = Message.str(); + return true; + } + }; } // namespace llvm |