]> git.cworth.org Git - apitrace/commitdiff
Abstract process termination.
authorJosé Fonseca <jfonseca@vmware.com>
Mon, 22 Nov 2010 13:24:45 +0000 (13:24 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Mon, 22 Nov 2010 13:24:45 +0000 (13:24 +0000)
base.py
dl.py
glx.py
log.cpp
log.hpp
os.hpp
os_posix.cpp
os_win32.cpp

diff --git a/base.py b/base.py
index c7d18afae33239307fbda307556e8577bb99ec96..4afcb577b94e593c845359fe1e790c83a3033ae5 100644 (file)
--- a/base.py
+++ b/base.py
@@ -444,7 +444,7 @@ class Function:
         raise NotImplementedError
 
     def exit_impl(self):
-        print '            ExitProcess(0);'
+        print '            Log::Abort();'
 
     def fail_impl(self):
         if self.fail is not None:
diff --git a/dl.py b/dl.py
index 14b8b9f8249b245caf53f70d5338f9cb793722e8..acf328b4687b6ffa900de37c65f0e87ff7ee04fc 100644 (file)
--- a/dl.py
+++ b/dl.py
 
 """dl"""
 
+
 from base import *
 
+
 class DllFunction(Function):
 
     def __init__(self, type, name, args, call = '', fail = None):
         Function.__init__(self, type, name, args, call=call, fail=fail)
         
-    def exit_impl(self):
-        print '            exit(0);'
-
     def get_true_pointer(self):
         ptype = self.pointer_type()
         pvalue = self.pointer_value()
diff --git a/glx.py b/glx.py
index 99d07f4b5e124d1704f564bd049ce748320b38e0..79f39f2ef1643d9067269c88821dfdefa62d3e34 100644 (file)
--- a/glx.py
+++ b/glx.py
@@ -477,9 +477,6 @@ class GlxFunction(Function):
     def __init__(self, type, name, args, call = '', fail = None):
         Function.__init__(self, type, name, args, call=call, fail=fail)
         
-    def exit_impl(self):
-        print '            exit(0);'
-
     def get_true_pointer(self):
         ptype = self.pointer_type()
         pvalue = self.pointer_value()
diff --git a/log.cpp b/log.cpp
index 4762db9bce3b07ce2779c67a258db57c0fdb3683..ea306de5b4b8786405851ba061af9ab56911fd37 100644 (file)
--- a/log.cpp
+++ b/log.cpp
@@ -281,4 +281,9 @@ void LiteralOpaque(const void *addr) {
    WriteUInt((size_t)addr);
 }
 
+void Abort(void) {
+    Close();
+    OS::Abort();
+}
+
 } /* namespace Log */
diff --git a/log.hpp b/log.hpp
index c82de5d65bcdf2858f25d5a3eb5812d02a0c1684..33fe4776ce8743adeba7105d39fdb742dcdc602b 100644 (file)
--- a/log.hpp
+++ b/log.hpp
@@ -69,6 +69,8 @@ namespace Log {
     void LiteralNamedConstant(const char *name, long long value);
     void LiteralNull(void);
     void LiteralOpaque(const void *ptr);
+
+    void Abort(void);
 }
 
 #endif /* _LOG_HPP_ */
diff --git a/os.hpp b/os.hpp
index 8e1c2957a66b7e87b88805bf4382467b901e7fae..3c244625079627edb50e5f71a45cddddacc9ee30 100644 (file)
--- a/os.hpp
+++ b/os.hpp
@@ -47,6 +47,8 @@ void ReleaseMutex(void);
 
 bool GetProcessName(char *str, size_t size);
 
+void Abort(void);
+
 } /* namespace OS */
 
 #endif /* _OS_HPP_ */
index b13646fec755e653717576f8b00ba3974f2c4f90..a5be47dc42928a167477ce4e1de02ba28145b8e7 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <string.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <pthread.h>
 
 #include "os.hpp"
@@ -76,4 +77,11 @@ GetProcessName(char *str, size_t size)
 }
 
 
+void
+Abort(void)
+{
+    exit(0);
+}
+
+
 } /* namespace OS */
index 98e397bbc5b28c9e0e9c095a2bedf92544f4fa8f..04c03438f28243e9b36782e0520700441f817b08 100755 (executable)
@@ -78,4 +78,11 @@ GetProcessName(char *str, size_t size)
 }
 
 
+void
+Abort(void)
+{
+    ExitProcess(0);
+}
+
+
 } /* namespace OS */