]> git.cworth.org Git - apitrace/blobdiff - retrace_stdc.cpp
Support const methods.
[apitrace] / retrace_stdc.cpp
index feb06b23d6cf7711e5034279cd02cdf9af085fd2..03c38653819bef94e826241ac1f8a46f6f0540cf 100644 (file)
@@ -77,6 +77,12 @@ upperBound(unsigned long long address) {
 void
 addRegion(unsigned long long address, void *buffer, unsigned long long size)
 {
+    if (!address) {
+        // Ignore NULL pointer
+        assert(!buffer);
+        return;
+    }
+
     // Forget all regions that intersect this new one.
     if (0) {
         RegionMap::iterator start = lowerBound(address);
@@ -153,22 +159,22 @@ lookupAddress(unsigned long long address) {
 }
 
 
-class Translator : protected Trace::Visitor
+class Translator : protected trace::Visitor
 {
 protected:
     bool bind;
 
     void *result;
 
-    void visit(Trace::Null *) {
+    void visit(trace::Null *) {
         result = NULL;
     }
 
-    void visit(Trace::Blob *blob) {
+    void visit(trace::Blob *blob) {
         result = blob->toPointer(bind);
     }
 
-    void visit(Trace::Pointer *p) {
+    void visit(trace::Pointer *p) {
         result = lookupAddress(p->value);
     }
 
@@ -178,7 +184,7 @@ public:
         result(NULL)
     {}
 
-    void * operator() (Trace::Value *node) {
+    void * operator() (trace::Value *node) {
         _visit(node);
         return result;
     }
@@ -186,12 +192,12 @@ public:
 
 
 void *
-toPointer(Trace::Value &value, bool bind) {
+toPointer(trace::Value &value, bool bind) {
     return Translator(bind) (&value);
 }
 
 
-static void retrace_malloc(Trace::Call &call) {
+static void retrace_malloc(trace::Call &call) {
     size_t size = call.arg(0).toUInt();
     unsigned long long address = call.ret->toUIntPtr();
 
@@ -209,7 +215,7 @@ static void retrace_malloc(Trace::Call &call) {
 }
 
 
-static void retrace_memcpy(Trace::Call &call) {
+static void retrace_memcpy(trace::Call &call) {
     void * dest = toPointer(call.arg(0));
     void * src  = toPointer(call.arg(1));
     size_t n    = call.arg(2).toUInt();