Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/external/gpl3/gcc/dist/libsanitizer/asan simplify and add mo...



details:   https://anonhg.NetBSD.org/src/rev/47bcd2df239e
branches:  trunk
changeset: 803339:47bcd2df239e
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Oct 23 00:25:54 2014 +0000

description:
simplify and add more architectures.

diffstat:

 external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc |  51 ++++++++---------
 1 files changed, 25 insertions(+), 26 deletions(-)

diffs (68 lines):

diff -r 0675fe3add22 -r 47bcd2df239e external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc
--- a/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc    Wed Oct 22 23:25:11 2014 +0000
+++ b/external/gpl3/gcc/dist/libsanitizer/asan/asan_linux.cc    Thu Oct 23 00:25:54 2014 +0000
@@ -50,39 +50,38 @@
 
 void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
 #ifdef __NetBSD__
-# if defined(__arm__)
-#  define REG_PC _REG_PC
-#  define REG_BP _REG_FP
-#  define REG_SP _REG_SP
+# define __UC_MACHINE_FP(ucontext, r) \
+    (ucontext)->uc_mcontext.__gregs[(r)]
+/*
+ * Unfortunately we don't have a portable frame pointer (yet)
+ */
+# if defined(__alpha__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_X15)
+# elif defined(__arm__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_FP)
 # elif defined(__x86_64__)
-#  define REG_PC _REG_RIP
-#  define REG_BP _REG_RBP
-#  define REG_SP _REG_RSP
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_RBP)
 # elif defined(__i386__)
-#  define REG_PC _REG_EIP
-#  define REG_BP _REG_EBP
-#  define REG_SP _REG_ESP
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_EBP)
+# elif defined(__m68k__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_A6)
+# elif defined(__mips__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_S8)
 # elif defined(__powerpc__) || defined(__powerpc64__)
-#  define REG_PC _REG_PC
-#  define REG_BP _REG_R1
-#  define REG_SP _REG_R31
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_R1)
 # elif defined(__sparc__)
+#  define _UC_MACHINE_FP(ucontext) sp[15]
+# elif defined(__sh3__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_R14)
+# elif defined(__vax__)
+#  define _UC_MACHINE_FP(ucontext) __UC_MACHINE_FP(ucontext, _REG_FP)
+# else
+#  define _UC_MACHINE_FP(ucontext) 0
+# endif
   ucontext_t *ucontext = (ucontext_t*)context;
   *pc = _UC_MACHINE_PC(ucontext);
   *sp = _UC_MACHINE_SP(ucontext);
-  *bp = sp[15]; // XXX: christos
-# else
-  // Lot's are missing, please add more.
-#endif
-
-# ifdef REG_PC
-  ucontext_t *ucontext = (ucontext_t*)context;
-  *pc = ucontext->uc_mcontext.__gregs[REG_PC];
-  *bp = ucontext->uc_mcontext.__gregs[REG_BP];
-  *sp = ucontext->uc_mcontext.__gregs[REG_SP];
-# else
-  *pc = *bp = *sp = 0;
-# endif
+  *bp = _UC_MACHINE_FP(ucontext);
 #elif ASAN_ANDROID
   *pc = *sp = *bp = 0;
 #elif defined(__arm__)



Home | Main Index | Thread Index | Old Index