[llvm-commits] [poolalloc] r133680 - /poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Wed Jun 22 20:24:32 PDT 2011


Author: aggarwa4
Date: Wed Jun 22 22:24:32 2011
New Revision: 133680

URL: http://llvm.org/viewvc/llvm-project?rev=133680&view=rev
Log:
Add a few more functions, needed by newer version of sqlite.
Fix printing in VAArgCheck.

Modified:
    poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp

Modified: poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp?rev=133680&r1=133679&r2=133680&view=diff
==============================================================================
--- poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp (original)
+++ poolalloc/trunk/runtime/DynamicTypeChecks/TypeRuntime.cpp Wed Jun 22 22:24:32 2011
@@ -6,6 +6,7 @@
 #include <string.h>
 #include <netdb.h>
 #include <poll.h>
+#include <pwd.h>
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <sys/mman.h>
@@ -77,6 +78,7 @@
   void trackStrcpyInst(void *dst, void *src, uint32_t tag) ;
   void trackStrcatInst(void *dst, void *src, uint32_t tag) ;
   void trackgetcwd(void *ptr, uint32_t tag) ;
+  void trackgetpwuid(void *ptr, uint32_t tag) ;
   void trackgethostname(void *ptr, uint32_t tag) ;
   void trackgetaddrinfo(void *ptr, uint32_t tag) ;
   void trackaccept(void *ptr, uint32_t tag) ;
@@ -166,7 +168,6 @@
 #if DEBUG
   printf("Store(%d): %p, %p = %u | %lu bytes | \n", tag, ptr, (void *)p, typeNumber, size);
 #endif
-
 }
 
 /**
@@ -181,7 +182,7 @@
  */
 void compareTypes(TypeTagTy typeNumberSrc, TypeTagTy typeNumberDest, uint32_t tag) {
   if(typeNumberSrc != typeNumberDest) {
-    printf("Type mismatch(%u): expecting %s, found %s! \n", tag, typeNames[typeNumberDest], typeNames[typeNumberSrc]);
+    printf("Type mismatch(%u): expecting %s, found %s! \n", tag, typeNames[typeNumberSrc], typeNames[typeNumberDest]);
   }
 }
 
@@ -222,7 +223,7 @@
  * Compare the typeNumber with the type info(for given size) stored at the metadata ptr.
  * ptr and tag are for debugging
  */
-void __attribute__((always_inline))
+void 
 checkType(TypeTagTy typeNumber, uint64_t size, TypeTagTy *metadata, void *ptr, uint32_t tag) {
   /* Check if this an initialized but untyped memory.*/
   if (typeNumber != metadata[0]) {
@@ -362,6 +363,14 @@
   trackInitInst(ptr, strlen((const char *)ptr) + 1, tag);
 }
 
+void trackgetpwuid(void *ptr, uint32_t tag) {
+  struct passwd *p = (struct passwd *)ptr;
+  trackInitInst(p->pw_name, strlen(p->pw_name) + 1, tag);
+  trackInitInst(p->pw_dir, strlen(p->pw_dir) + 1, tag);
+  trackInitInst(p->pw_shell, strlen(p->pw_shell) + 1, tag);
+  trackInitInst(p, sizeof(struct passwd), tag);
+}
+
 void trackgethostname(void *ptr, uint32_t tag) {
   trackInitInst(ptr, strlen((const char *)ptr) + 1, tag);
 }





More information about the llvm-commits mailing list