From 2088928fb603d2671d57f5f6a300e3d4df591cb4 Mon Sep 17 00:00:00 2001 From: Aaron Eppert Date: Wed, 18 Mar 2015 11:15:38 -0400 Subject: [PATCH] A fatal error, especially in DEBUG, should result in a core. This issue is especially helpful in the case of the Val::CONVERTER error and having: "fatal error in : Val::CONVERTER ..." Nebulous error and sans location, it is extremely hard to figure out the culprit. Thus, if Bro is built DEBUG, fatal should provide a core. This subtle change prevents having to change FatalErrors to FatalErrorWithCore everywhere. --- src/Reporter.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Reporter.cc b/src/Reporter.cc index cd1aa09d4c..d138e23b88 100644 --- a/src/Reporter.cc +++ b/src/Reporter.cc @@ -88,7 +88,11 @@ void Reporter::FatalError(const char* fmt, ...) va_end(ap); set_processing_status("TERMINATED", "fatal_error"); +#ifdef DEBUG + abort(); +#else exit(1); +#endif // DEBUG } void Reporter::FatalErrorWithCore(const char* fmt, ...) @@ -393,4 +397,3 @@ void Reporter::DoLog(const char* prefix, EventHandlerPtr event, FILE* out, if ( alloced ) free(alloced); } -