ATLAS Offline Software
Control
CxxUtils
Root
PtrAccessSEGVHandler.cxx
Go to the documentation of this file.
1
/*
2
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3
*/
4
5
#define DEBUG 1
6
7
#include "
CxxUtils/PtrAccessSEGVHandler.h
"
8
#include "
CxxUtils/PageAccessControl.h
"
9
#include <cstdio>
10
#include <cstdlib>
11
12
void
13
PtrAccessSEGVHandler::handle
(
int
/*signal_number*/
,
siginfo_t
*sigi,
void
*
/*unused*/
) {
14
void
*addr=sigi->si_addr;
15
#ifdef DEBUG
16
printf(
"page fault @address=%p\n"
,sigi->si_addr);
17
#ifdef __ARCH_SI_TRAPNO
18
printf(
"page fault trapno=%d\n"
,sigi->si_trapno);
19
#endif
20
printf(
"page fault signo=%d\n"
,sigi->si_signo);
21
printf(
"page fault errno=%d\n"
,sigi->si_errno);
22
printf(
"this page fault failed because "
);
23
if
(SEGV_MAPERR == sigi->si_code)
24
printf(
"you tried to access an invalid address\n"
);
25
else
if
(SEGV_ACCERR == sigi->si_code) {
26
printf(
"you tried to access a protected address\n"
);
27
}
else
printf(
" an unknown reason. Page fault code=%d\n"
,sigi->si_code);
28
#endif
29
//record the access and restore page protection
30
if
(SEGV_ACCERR == sigi->si_code) {
31
m_pac
.restorePageProt(addr);
32
m_accessed
.push_back(addr);
33
}
else
abort();
34
}
siginfo_t
Definition:
SealSignal.h:77
PtrAccessSEGVHandler.h
This class provides a handle function that logs the addresses that had an access violation....
PageAccessControl.h
PtrAccessSEGVHandler::m_pac
PageAccessControl & m_pac
used to restore protection of the page which segfaulted
Definition:
PtrAccessSEGVHandler.h:50
PtrAccessSEGVHandler::handle
void handle(int signal_number, siginfo_t *sigi, void *unused)
the actual signal handler
Definition:
PtrAccessSEGVHandler.cxx:13
PtrAccessSEGVHandler::m_accessed
accessed_t m_accessed
the addresses accessed since last reset
Definition:
PtrAccessSEGVHandler.h:52
Generated on Thu Nov 7 2024 21:24:15 for ATLAS Offline Software by
1.8.18