projects
/
model-checker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
snapshot: read from /proc/self/maps
[model-checker.git]
/
snapshot-interface.cc
diff --git
a/snapshot-interface.cc
b/snapshot-interface.cc
index 072c1f959ac07c256129248174665a33fb5e7b30..c22b8712b32937cbd415fb9f2ab7d1039e8c97a8 100644
(file)
--- a/
snapshot-interface.cc
+++ b/
snapshot-interface.cc
@@
-3,7
+3,6
@@
#include <iostream>
#include <fstream>
#include <unistd.h>
#include <iostream>
#include <fstream>
#include <unistd.h>
-#include <sys/types.h>
#include <sstream>
#include <cstring>
#include <string>
#include <sstream>
#include <cstring>
#include <string>
@@
-16,7
+15,7
@@
#define MYBINARYNAME "model"
#define MYLIBRARYNAME "libmodel.so"
#define MYBINARYNAME "model"
#define MYLIBRARYNAME "libmodel.so"
-#define MAPFILE
_FORMAT "/proc/%d
/maps"
+#define MAPFILE
"/proc/self
/maps"
SnapshotStack * snapshotObject;
SnapshotStack * snapshotObject;
@@
-73,12
+72,10
@@
static void SnapshotGlobalSegments(){
* library to snapshot them.
*/
static void SnapshotGlobalSegments(){
* library to snapshot them.
*/
static void SnapshotGlobalSegments(){
- int pid = getpid();
- char buf[9000], filename[100];
+ char buf[9000];
FILE *map;
FILE *map;
- sprintf(filename, MAPFILE_FORMAT, pid);
- map = fopen(filename, "r");
+ map = fopen(MAPFILE, "r");
if (!map) {
perror("fopen");
exit(EXIT_FAILURE);
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);
size_t len = ((uintptr_t)end - (uintptr_t)begin) / PAGESIZE;
if (len != 0)
addMemoryRegionToSnapShot(begin, len);
- DEBUG("%
4
5s: %18p - %18p\t%c%c%c%c\n", regionname, begin, end, r, w, x, p);
+ DEBUG("%
5
5s: %18p - %18p\t%c%c%c%c\n", regionname, begin, end, r, w, x, p);
}
}
fclose(map);
}
}
fclose(map);
@@
-124,13
+121,13
@@
int SnapshotStack::backTrackBeforeStep(int seqindex) {
}
struct stackEntry *tmp=stack;
stack=stack->next;
}
struct stackEntry *tmp=stack;
stack=stack->next;
-
MYFREE
(tmp);
+
model_free
(tmp);
}
}
/** This method takes a snapshot at the given sequence number. */
void SnapshotStack::snapshotStep(int seqindex) {
}
}
/** 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();
tmp->next=stack;
tmp->index=seqindex;
tmp->snapshotid=takeSnapshot();