void WTFReportFatalError(const char* file, int line, const char* function, const char* format, ...) { va_list args; va_start(args, format); vprintf_stderr_with_prefix("FATAL ERROR: ", format, args); va_end(args); printf_stderr_common("\n"); printCallSite(file, line, function); }
void WTFReportAssertionFailureWithMessage(const char* file, int line, const char* function, const char* assertion, const char* format, ...) { va_list args; va_start(args, format); vprintf_stderr_with_prefix("ASSERTION FAILED: ", format, args); va_end(args); printf_stderr_common("\n%s\n", assertion); printCallSite(file, line, function); }
static void printCallSite(const char* file, int line, const char* function) { #if OS(WINDOWS) && !OS(WINCE) && defined(_DEBUG) _CrtDbgReport(_CRT_WARN, file, line, NULL, "%s\n", function); #else // By using this format, which matches the format used by MSVC for compiler errors, developers // using Visual Studio can double-click the file/line number in the Output Window to have the // editor navigate to that line of code. It seems fine for other developers, too. printf_stderr_common("%s(%d) : %s\n", file, line, function); #endif }
void WTFPrintBacktrace(void** stack, int size) { for (int i = 0; i < size; ++i) { const char* mangledName = 0; char* cxaDemangled = 0; #if OS(MACOSX) || OS(LINUX) Dl_info info; if (dladdr(stack[i], &info) && info.dli_sname) mangledName = info.dli_sname; if (mangledName) cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0); #endif const int frameNumber = i + 1; if (mangledName || cxaDemangled) printf_stderr_common("%-3d %p %s\n", frameNumber, stack[i], cxaDemangled ? cxaDemangled : mangledName); else printf_stderr_common("%-3d %p\n", frameNumber, stack[i]); free(cxaDemangled); } }
void WTFLog(WTFLogChannel* channel, const char* format, ...) { if (channel->state != WTFLogChannelOn) return; va_list args; va_start(args, format); vprintf_stderr_common(format, args); va_end(args); if (format[strlen(format) - 1] != '\n') printf_stderr_common("\n"); }
void WTFLogVerbose(const char* file, int line, const char* function, WTFLogChannel* channel, const char* format, ...) { if (channel->state != WTFLogChannelOn) return; va_list args; va_start(args, format); vprintf_stderr_common(format, args); va_end(args); if (format[strlen(format) - 1] != '\n') printf_stderr_common("\n"); printCallSite(file, line, function); }
void WTFLog(WTFLogChannel* channel, const char* format, ...) { if (channel->state != WTFLogChannelOn) return; va_list args; va_start(args, format); vprintf_stderr_common(false, format, args); va_end(args); size_t formatLength = strlen(format); if (formatLength && format[formatLength - 1] != '\n') printf_stderr_common(false, "\n"); }
void WTFReportArgumentAssertionFailure(const char* file, int line, const char* function, const char* argName, const char* assertion) { printf_stderr_common("ARGUMENT BAD: %s, %s\n", argName, assertion); printCallSite(file, line, function); }
void ReportBrollyionFailureWithMessage(const char* file, int line, const char* function, const char *message) { printf_stderr_common("ASSERTION FAILED: %s\n", message); printCallSite(file, line, function); }
void ReportSegmentationFault(void *address, int ip) { printf_stderr_common("SEGMENTATION FAULT: faulty address is %p, from 0x%x\n", address, ip); }