[v2,00/10] Enable undefined behavior sanitizer
Commit Message
>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:
Tom> This is v2 of the series to enable the undefined behavior sanitizer
Tom> for gdb. This is done by default in development mode, but can be
Tom> disabled.
Update on this series...
Tom> I believe this version addresses all the review comments.
For the record, subsequently, Pedro and I discussed the need to document
this a bit more. I'll include a patch for this in the next revision of
the series.
Tom> Tested (*) by the buildbot.
Tom> (*) However, as I mentioned in another thread, the s390 builders do
Tom> not like this series. I get many, many failures. Looking at the
Tom> gdb.log, though, the failures seem to be coming from libstdc++ debug
Tom> mode -- which this series does not enable.
This is all explained now.
Sergio pointed out that the builders are enabling -D_GLIBCXX_DEBUG. I'm
glad that mystery is solved.
A failure with -D_GLIBCXX_DEBUG enabled just results in a crash, without
much useful information to go by. This is often fine, but in this case
I could only reproduce on s390, where I couldn't log in to reproduce for
myself.
So, I hacked the testsuite Makefile to run just a single test .exp that
I knew to fail, and then arranged to get a real stack trace. See the
appended patch.
This pointed out that there was a bug in one of the patches in the series.
Namely, this code in dwarf2-frame.c:
struct dwarf2_frame_state_reg *retaddr_reg =
&fs.regs.reg[fs.retaddr_column];
... will reference past the end of the array in some cases. When reg is
just an ordinary pointer this is "ok" -- possibly undefined behavior
depending on the index in use, but not likely to cause a crash. But the
series changes reg to a std::vector, where this is invalid.
Tom
@@ -48,7 +48,7 @@ EXPECT = `if [ "$${READ1}" != "" ] ; then \
RUNTEST = $(RUNTEST_FOR_TARGET)
-RUNTESTFLAGS =
+override RUNTESTFLAGS := gdb.cp/extern-c.exp
FORCE_PARALLEL =
@@ -153,7 +153,11 @@ CHECK_TARGET = $(if $(RACY_ITER),$(addsuffix -racy,$(CHECK_TARGET_TMP)),$(CHECK_
# because GNU make 3.82 has a bug preventing MAKEFLAGS from being used
# in conditions.
check: all $(abs_builddir)/site.exp
- $(MAKE) $(CHECK_TARGET)
+ -$(MAKE) $(CHECK_TARGET)
+ cat gdb.log
+ /bin/gdb -batch -ex 'run' -ex 'bt' \
+ --args ../gdb -batch -ex 'file outputs/gdb.cp/extern-c/extern-c' \
+ -ex 'break c_func' -ex 'run' -ex 'rbreak c_funcs'
check-read1:
$(MAKE) READ1="1" check