]> git.cworth.org Git - apitrace/commitdiff
os: Be more concise with the semantics of os::abort.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 23 Apr 2013 16:56:08 +0000 (17:56 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 23 Apr 2013 16:56:08 +0000 (17:56 +0100)
common/os.hpp
common/os_posix.cpp
common/os_win32.cpp
retrace/glretrace_egl.cpp

index 91c819fca55f09a516a746d23283bd0ab81766de..985ff6b9ccb84e8a291941017f76f4f9f7c873dc 100644 (file)
@@ -73,6 +73,12 @@ void log(const char *format, ...)
   #endif
 #endif
 
+/**
+ * Exit immediately.
+ *
+ * This should be called only from the wrappers, when there is no safe way of
+ * failing gracefully.
+ */
 void abort(void);
 
 void setExceptionCallback(void (*callback)(void));
index 0d93b31bcafa6e56604fa639a7656d20128835ca..bd15bbac43db16710075fff3afaa59bf11e3e15c 100644 (file)
@@ -174,6 +174,7 @@ log(const char *format, ...)
     __android_log_vprint(ANDROID_LOG_DEBUG, "apitrace", format, ap);
 #else
     vfprintf(stderr, format, ap);
+    fflush(stderr);
 #endif
     va_end(ap);
     logging = false;
@@ -186,7 +187,7 @@ long long timeFrequency = 0LL;
 void
 abort(void)
 {
-    exit(0);
+    _exit(1);
 }
 
 
index e9306cdc6dfa0168b3bca328d5511b66bb551932..f297a5551357f5b7631519374bc4ad36149090a6 100644 (file)
@@ -229,11 +229,7 @@ long long timeFrequency = 0LL;
 void
 abort(void)
 {
-#ifndef NDEBUG
-    DebugBreak();
-#else
-    ExitProcess(0);
-#endif
+    TerminateProcess(GetCurrentProcess(), 1);
 }
 
 
@@ -299,7 +295,7 @@ unhandledExceptionHandler(PEXCEPTION_POINTERS pExceptionInfo)
 
     static int recursion_count = 0;
     if (recursion_count) {
-        fprintf(stderr, "apitrace: warning: recursion handling exception\n");
+        fputs("apitrace: warning: recursion handling exception\n", stderr);
     } else {
         if (gCallback) {
             ++recursion_count;
index 45855643f5b55272e494be1bcef8a799e26c928f..42f7b3867a783756d93cdb7d1a26724764bf7d51 100644 (file)
@@ -188,7 +188,7 @@ static void retrace_eglCreateContext(trace::Call &call) {
         }
 
         retrace::warning(call) << "Failed to create " << name << " context.\n";
-        os::abort();
+        exit(1);
     }
 
     context_map[orig_context] = context;