This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Put a breakpoint on __asan_report_error for ASAN
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 29 Nov 2012 09:42:20 -0800
- Subject: [PATCH] Put a breakpoint on __asan_report_error for ASAN
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
Hi,
This patch puts a breakpoint on __asan_report_error if CFLAGS contains
-fsanitize=address, similar to fancy_abort and internal_error. OK to
install?
H.J.
--
2012-11-24 H.J. Lu <hongjiu.lu@intel.com>
* configure.ac: Append gdbasan.in to .gdbinit if CFLAGS contains
-fsanitize=address.
* configure: Regenerated.
* gdbasan.in: New file.
diff --git a/gcc/configure b/gcc/configure
index e2c119e..004910f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -27032,6 +27032,14 @@ if test "x$subdirs" != x; then
fi
echo "source ${srcdir}/gdbinit.in" >> .gdbinit
+# Put a breakpoint on __asan_report_error to help with debugging buffer
+# overflow.
+case "$CFLAGS" in
+*-fsanitize=address*)
+ echo "source ${srcdir}/gdbasan.in" >> .gdbinit
+ ;;
+esac
+
gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)'
diff --git a/gcc/configure.ac b/gcc/configure.ac
index c6f57bd..b9aaadb 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -5017,6 +5017,14 @@ if test "x$subdirs" != x; then
fi
echo "source ${srcdir}/gdbinit.in" >> .gdbinit
+# Put a breakpoint on __asan_report_error to help with debugging buffer
+# overflow.
+case "$CFLAGS" in
+*-fsanitize=address*)
+ echo "source ${srcdir}/gdbasan.in" >> .gdbinit
+ ;;
+esac
+
gcc_tooldir='$(libsubdir)/$(libsubdir_to_prefix)$(target_noncanonical)'
AC_SUBST(gcc_tooldir)
AC_SUBST(dollar)
diff --git a/gcc/gdbasan.in b/gcc/gdbasan.in
new file mode 100644
index 0000000..cf05825
--- /dev/null
+++ b/gcc/gdbasan.in
@@ -0,0 +1,3 @@
+# Put a breakpoint on __asan_report_error to help with debugging buffer
+# overflow.
+b __asan_report_error
--
1.7.11.7