Hi Matthias, On Mon, 2020-05-11 at 17:24 +0200, Matthias Maennich via Libabigail wrote: > When exporting ABIGAIL_DEBUG=1, the binaries compiled are especially > suitable for debugging. The CFLAGS and CXXFLAGS that are added disable > optimization and increase debug information levels. > > * configure.ac: add ABIGAIL_DEBUG environment variable for > improved debugging capabilities > > Signed-off-by: Matthias Maennich > --- > configure.ac | 5 +++++ > 1 file changed, 5 insertions(+) > > diff --git a/configure.ac b/configure.ac > index 9f30ea38cf86..9aea79f49e9a 100644 > --- a/configure.ac > +++ b/configure.ac > @@ -621,6 +621,11 @@ if test x$ABIGAIL_DEVEL != x; then > CXXFLAGS="-g -Wall -Wextra -Werror" > fi > > +if test x$ABIGAIL_DEBUG != x; then > + CFLAGS="$CFLAGS -O0 -g3 -ggdb" > + CXXFLAGS="$CXXFLAGS -O0 -g3 -ggdb" > +fi > + I think you either want -O0 plus -fno-inline to make debugging even easier. Or (better IMHO) use -Og so you do get some optimization, just none that makes debugging harder. The advantage of -Og is that you can then also add -D_FORTIFY_SOURCE=2 to detect various memory and string operation bugger overflows early (or even at compile time). You also will want to add -D_GLIBCXX_DEBUG which catches various illegal uses of std iterators and algorithms. In fact I just tried it and while running make check it found: safe_iterator.h:360:error: attempt to advance signed char dereferenceable (start-of-sequence) iterator -1 steps, which falls outside its valid range. Objects involved in the operation: iterator @ 0x0x7fffffffc740 { type = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator > >, std::__debug::vector > > (constant iterator); state = dereferenceable (start-of-sequence); references sequence with type `std::__debug::vector >' @ 0x0x7fffffffc740 } Poking around in gdb found that in compute_diff () the a_base RandomAccessOutputIterator could go back (-1) and then forward (+1) again because there were missing brackets. That is undefined behavior if we are at the beginning of the iterator. Proposed fix attached. Cheers, Mark