Changes needed to run on OS X... Example runs on my laptop now. No need to push...
authorBrian Demsky <bdemsky@uci.edu>
Mon, 4 Jun 2012 05:35:41 +0000 (22:35 -0700)
committerBrian Demsky <bdemsky@uci.edu>
Mon, 4 Jun 2012 05:35:41 +0000 (22:35 -0700)
Out of time for fun hack, have to get back to real work now.  :(

snapshot-interface.cc
snapshot.cc
snapshot.h

index cece58d0d10240c813b1be515ddc1e33825a7a47..58e1dd2ff3ae036a2011a0db24e1f95db03dcc60 100644 (file)
@@ -56,11 +56,10 @@ void SnapshotGlobalSegments(){
                sscanf(buf, "%22s %p-%p [%5dK] %c%c%c/%c%c%c SM=%3s %200s\n", &type, &begin, &end, &size, &r, &w, &x, &mr, &mw, &mx, smstr, regionname);
 
                if (w == 'w' && (strstr(regionname, MYBINARYNAME) || strstr(regionname, MYLIBRARYNAME))) {
-                       printf("%s\n", buf);
-               
                        size_t len = ((uintptr_t)end - (uintptr_t)begin) / PAGESIZE;
                        if (len != 0)
                                addMemoryRegionToSnapShot(begin, len);
+                       DEBUG("%s\n", buf);
                        DEBUG("%45s: %18p - %18p\t%c%c%c%c\n", regionname, begin, end, r, w, x, p);
                }
        }
index e3ca558878d2a811bb1f639e6234e2c475023326..2440b6e8bda8a06afa040475266e69d02094981e 100644 (file)
@@ -68,6 +68,7 @@ void HandlePF( int sig, siginfo_t *si, void * unused){
                exit( EXIT_FAILURE );
        }
        void* addr = ReturnPageAlignedAddress(si->si_addr);
+
        unsigned int backingpage=snapshotrecord->lastBackingPage++; //Could run out of pages...
        if (backingpage==snapshotrecord->maxBackingPages) {
                printf("Out of backing pages at %p\n", si->si_addr);
@@ -155,6 +156,7 @@ void initSnapShotLibrary(unsigned int numbackingpages,
 
        siginfo_t si;
        si.si_addr=ss.ss_sp;
+       si.si_code = 0;
        HandlePF(SIGSEGV, &si, NULL);
        snapshotrecord->lastBackingPage--; //remove the fake page we copied
 
index 3b33a7ef5aeaa774af2501f8b32fe7d005b5886b..cc5e7e535408dd03a9002af41122ed5bfbe53476 100644 (file)
@@ -10,7 +10,7 @@
 #define USE_MPROTECT_SNAPSHOT 1
 
 /* Size of signal stack */
-#define SIGSTACKSIZE 16384
+#define SIGSTACKSIZE 32768
 
 void addMemoryRegionToSnapShot( void * ptr, unsigned int numPages );