summaryrefslogtreecommitdiff
path: root/lib/sanitizer_common/sanitizer_win.cc
diff options
context:
space:
mode:
authorMarcos Pividori <mpividori@google.com>2017-02-02 23:01:59 +0000
committerMarcos Pividori <mpividori@google.com>2017-02-02 23:01:59 +0000
commit2488ff1e2c5f7f792f8af3b76df65d863f7d3363 (patch)
tree36402bdbb5098fa3bd17818067f12a4a714b6d0e /lib/sanitizer_common/sanitizer_win.cc
parent48eacb03179d302ffd4b4e7670965993cff82cd0 (diff)
[sanitizer] Move DescribeSignalOrException to sanitizer_common.
Differential Revision: https://reviews.llvm.org/D29459 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@293956 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/sanitizer_common/sanitizer_win.cc')
-rw-r--r--lib/sanitizer_common/sanitizer_win.cc26
1 files changed, 26 insertions, 0 deletions
diff --git a/lib/sanitizer_common/sanitizer_win.cc b/lib/sanitizer_common/sanitizer_win.cc
index 247ad8a08..66504d909 100644
--- a/lib/sanitizer_common/sanitizer_win.cc
+++ b/lib/sanitizer_common/sanitizer_win.cc
@@ -863,6 +863,32 @@ bool IsHandledDeadlyException(DWORD exceptionCode) {
return false;
}
+const char *DescribeSignalOrException(int signo) {
+ unsigned code = signo;
+ // Get the string description of the exception if this is a known deadly
+ // exception.
+ switch (code) {
+ case EXCEPTION_ACCESS_VIOLATION: return "access-violation";
+ case EXCEPTION_ARRAY_BOUNDS_EXCEEDED: return "array-bounds-exceeded";
+ case EXCEPTION_STACK_OVERFLOW: return "stack-overflow";
+ case EXCEPTION_DATATYPE_MISALIGNMENT: return "datatype-misalignment";
+ case EXCEPTION_IN_PAGE_ERROR: return "in-page-error";
+ case EXCEPTION_ILLEGAL_INSTRUCTION: return "illegal-instruction";
+ case EXCEPTION_PRIV_INSTRUCTION: return "priv-instruction";
+ case EXCEPTION_BREAKPOINT: return "breakpoint";
+ case EXCEPTION_FLT_DENORMAL_OPERAND: return "flt-denormal-operand";
+ case EXCEPTION_FLT_DIVIDE_BY_ZERO: return "flt-divide-by-zero";
+ case EXCEPTION_FLT_INEXACT_RESULT: return "flt-inexact-result";
+ case EXCEPTION_FLT_INVALID_OPERATION: return "flt-invalid-operation";
+ case EXCEPTION_FLT_OVERFLOW: return "flt-overflow";
+ case EXCEPTION_FLT_STACK_CHECK: return "flt-stack-check";
+ case EXCEPTION_FLT_UNDERFLOW: return "flt-underflow";
+ case EXCEPTION_INT_DIVIDE_BY_ZERO: return "int-divide-by-zero";
+ case EXCEPTION_INT_OVERFLOW: return "int-overflow";
+ }
+ return "unknown exception";
+}
+
bool IsAccessibleMemoryRange(uptr beg, uptr size) {
SYSTEM_INFO si;
GetNativeSystemInfo(&si);