This is the mail archive of the gdb-cvs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] new-op.c: Add comment about -fsanitize=address


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=e4426cb42f082b0dc1298a173014f18ff0ff7ea7

commit e4426cb42f082b0dc1298a173014f18ff0ff7ea7
Author: Pedro Alves <palves@redhat.com>
Date:   Tue Oct 25 13:32:26 2016 +0100

    new-op.c: Add comment about -fsanitize=address
    
    gdb/ChangeLog:
    2016-10-25  Pedro Alves  <palves@redhat.com>
    
    	* common/new-op.c: Add comment about -fsanitize=address.

Diff:
---
 gdb/ChangeLog       | 4 ++++
 gdb/common/new-op.c | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 40fab9b..c2a8579 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
 2016-10-25  Pedro Alves  <palves@redhat.com>
 
+	* common/new-op.c: Add comment about -fsanitize=address.
+
+2016-10-25  Pedro Alves  <palves@redhat.com>
+
        * common/common-defs.h (__STDC_CONSTANT_MACROS)
        (__STDC_LIMIT_MACROS): Define.
 
diff --git a/gdb/common/new-op.c b/gdb/common/new-op.c
index f04c5cb..1eb4f94 100644
--- a/gdb/common/new-op.c
+++ b/gdb/common/new-op.c
@@ -33,6 +33,12 @@
    new-handler function instead (std::set_new_handler) because we want
    to catch allocation errors from within global constructors too.
 
+   Skip overriding if building with -fsanitize=address though.
+   Address sanitizer wants to override operator new/delete too in
+   order to detect malloc+delete and new+free mismatches.  Our
+   versions would mask out ASan's, with the result of losing that
+   useful mismatch detection.
+
    Note that C++ implementations could either have their throw
    versions call the nothrow versions (libstdc++), or the other way
    around (clang/libc++).  For that reason, we replace both throw and


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]