X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=snapshot.cc;h=66faacd8e445510f57c7714ce9ccd60a1ee95f3c;hb=130a35155171503883aaf18e57f8957ce63d06e8;hp=1b5b4cb6c5c285079e37bf5bdf9627cbf9a6da57;hpb=2d4e6777ac44943c0efeb9869b2a100e87229b7a;p=model-checker.git diff --git a/snapshot.cc b/snapshot.cc index 1b5b4cb..66faacd 100644 --- a/snapshot.cc +++ b/snapshot.cc @@ -106,10 +106,10 @@ mprot_snapshotter::~mprot_snapshotter() static void mprot_handle_pf(int sig, siginfo_t *si, void *unused) { if (si->si_code == SEGV_MAPERR) { - model_print("Real Fault at %p\n", si->si_addr); - print_trace(); + model_print("Segmentation fault at %p\n", si->si_addr); model_print("For debugging, place breakpoint at: %s:%d\n", __FILE__, __LINE__); + // print_trace(); // Trace printing may cause dynamic memory allocation exit(EXIT_FAILURE); } void* addr = ReturnPageAlignedAddress(si->si_addr); @@ -148,12 +148,12 @@ static void mprot_snapshot_init(unsigned int numbackingpages, sa.sa_sigaction = mprot_handle_pf; #ifdef MAC if (sigaction(SIGBUS, &sa, NULL) == -1) { - model_print("SIGACTION CANNOT BE INSTALLED\n"); + perror("sigaction(SIGBUS)"); exit(EXIT_FAILURE); } #endif if (sigaction(SIGSEGV, &sa, NULL) == -1) { - model_print("SIGACTION CANNOT BE INSTALLED\n"); + perror("sigaction(SIGSEGV)"); exit(EXIT_FAILURE); } @@ -190,6 +190,9 @@ static void mprot_add_to_snapshot(void *addr, unsigned int numPages) exit(EXIT_FAILURE); } + DEBUG("snapshot region %p-%p (%u page%s)\n", + addr, (char *)addr + numPages * PAGESIZE, numPages, + numPages > 1 ? "s" : ""); mprot_snap->regionsToSnapShot[memoryregion].basePtr = addr; mprot_snap->regionsToSnapShot[memoryregion].sizeInPages = numPages; }