X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=snapshot-interface.cc;h=c22b8712b32937cbd415fb9f2ab7d1039e8c97a8;hb=ff6281947505d1b5bf6491dbfeaa27d5d41ab964;hp=5d160e1a837da27677bf441efcdc956e8af8a687;hpb=bf7f7645131e1143b7ece3a74a827ace0c7a7304;p=model-checker.git diff --git a/snapshot-interface.cc b/snapshot-interface.cc index 5d160e1..c22b871 100644 --- a/snapshot-interface.cc +++ b/snapshot-interface.cc @@ -3,7 +3,6 @@ #include #include #include -#include #include #include #include @@ -16,7 +15,7 @@ #define MYBINARYNAME "model" #define MYLIBRARYNAME "libmodel.so" -#define MAPFILE_FORMAT "/proc/%d/maps" +#define MAPFILE "/proc/self/maps" SnapshotStack * snapshotObject; @@ -73,12 +72,10 @@ static void SnapshotGlobalSegments(){ * library to snapshot them. */ static void SnapshotGlobalSegments(){ - int pid = getpid(); - char buf[9000], filename[100]; + char buf[9000]; FILE *map; - sprintf(filename, MAPFILE_FORMAT, pid); - map = fopen(filename, "r"); + map = fopen(MAPFILE, "r"); if (!map) { perror("fopen"); exit(EXIT_FAILURE); @@ -93,7 +90,7 @@ static void SnapshotGlobalSegments(){ size_t len = ((uintptr_t)end - (uintptr_t)begin) / PAGESIZE; if (len != 0) addMemoryRegionToSnapShot(begin, len); - DEBUG("%45s: %18p - %18p\t%c%c%c%c\n", regionname, begin, end, r, w, x, p); + DEBUG("%55s: %18p - %18p\t%c%c%c%c\n", regionname, begin, end, r, w, x, p); } } fclose(map); @@ -123,14 +120,14 @@ int SnapshotStack::backTrackBeforeStep(int seqindex) { return stack->index; } struct stackEntry *tmp=stack; - MYFREE(tmp); stack=stack->next; + model_free(tmp); } } /** This method takes a snapshot at the given sequence number. */ void SnapshotStack::snapshotStep(int seqindex) { - struct stackEntry *tmp=(struct stackEntry *)MYMALLOC(sizeof(struct stackEntry)); + struct stackEntry *tmp=(struct stackEntry *)model_malloc(sizeof(struct stackEntry)); tmp->next=stack; tmp->index=seqindex; tmp->snapshotid=takeSnapshot();