void assert_hook(void);
+#ifdef CONFIG_ASSERT
#define ASSERT(expr) \
do { \
if (!(expr)) { \
exit(EXIT_FAILURE); \
} \
} while (0)
+#else
+#define ASSERT(expr) \
+ do { } while (0)
+#endif /* CONFIG_ASSERT */
#define error_msg(...) fprintf(stderr, "Error: " __VA_ARGS__)
break;
}
}
- (*argc) -= optind;
- (*argv) += optind;
+ (*argv)[optind - 1] = (*argv)[0];
+ (*argc) -= (optind - 1);
+ (*argv) += (optind - 1);
+ optind = 1;
if (error)
print_usage(params);
#include <iostream>
#include <fstream>
#include <unistd.h>
-#include <sys/types.h>
#include <sstream>
#include <cstring>
#include <string>
#define MYBINARYNAME "model"
#define MYLIBRARYNAME "libmodel.so"
-#define MAPFILE_FORMAT "/proc/%d/maps"
+#define MAPFILE "/proc/self/maps"
SnapshotStack * snapshotObject;
* 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);