diff options
Diffstat (limited to 'deps/v8/src/base/logging.cc')
-rw-r--r-- | deps/v8/src/base/logging.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/deps/v8/src/base/logging.cc b/deps/v8/src/base/logging.cc index 740f1fa987..13fbec0e90 100644 --- a/deps/v8/src/base/logging.cc +++ b/deps/v8/src/base/logging.cc @@ -17,8 +17,12 @@ namespace base { namespace { +void DefaultDcheckHandler(const char* file, int line, const char* message); + void (*g_print_stack_trace)() = nullptr; +void (*g_dcheck_function)(const char*, int, const char*) = DefaultDcheckHandler; + void PrettyPrintChar(std::ostream& os, int ch) { switch (ch) { #define CHAR_PRINT_CASE(ch) \ @@ -48,12 +52,20 @@ void PrettyPrintChar(std::ostream& os, int ch) { } } +void DefaultDcheckHandler(const char* file, int line, const char* message) { + V8_Fatal(file, line, "Debug check failed: %s.", message); +} + } // namespace void SetPrintStackTrace(void (*print_stack_trace)()) { g_print_stack_trace = print_stack_trace; } +void SetDcheckFunction(void (*dcheck_function)(const char*, int, const char*)) { + g_dcheck_function = dcheck_function ? dcheck_function : &DefaultDcheckHandler; +} + // Define specialization to pretty print characters (escaping non-printable // characters) and to print c strings as pointers instead of strings. #define DEFINE_PRINT_CHECK_OPERAND_CHAR(type) \ @@ -125,3 +137,7 @@ void V8_Fatal(const char* file, int line, const char* format, ...) { fflush(stderr); v8::base::OS::Abort(); } + +void V8_Dcheck(const char* file, int line, const char* message) { + v8::base::g_dcheck_function(file, line, message); +} |