This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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]

[libstdc++ PATCH] libstdc++ debug mode


The attached patch implements a "debug mode" for libstdc++, which provides additional checking of the use of the C++ standard library, including "safe" iterators for standard containers and algorithm precondition checking.

This patch contains the entire debug mode, with the exception of:
1) A minor change to g++specs that is required to use the debug-mode library, which I'll provide in a separate patch.
2) A negative testsuite that exercises the various erroneous uses of the standard library that this patch will find. I'll provide this as a separate patch in the near future.


When testing this patch, be sure to:
1) Apply the above-mentioned g++specs patch.
2) Rerun autoconf and automake in gcc/libstdc++-v3.
3) Pass "--enable-libstdcxx-debug" to configure
4) If running the libstdc++ testsuite, add the flag "-D_GLIBCXX_DEBUG" into the flags returned from --build_cxx in the script libstdc++-v3/scripts/testsuite_flags.


For those that don't want to apply the patch and rerun autoconf/automake, there's a patched gcc/libstdc++-v3 available here:
http://www.cs.rpi.edu/~gregod/libstdc++-debug-mode-full-20030714.tgz
Just extract it into a mainline CVS checkout just above the toplevel directory and it will overwrite your libstdc++-v3 directory with the debug-mode version.


Tested on i686-pc-linux-gnu and powerpc-apple-darwin; no regressions on either platform in normal (release) mode or debug mode. ChangeLog follows.

Okay to commit? <g>

Doug

2003-07-14 Doug Gregor <dgregor@apple.com>

	* Makefile.am: Optionally recurse into 'debug' subdir.
	* configure.in: Generate debug/Makefile.
	* docs/html/configopts.html: Document new semantics of
	--enable-libstdcxx-debug.
	* docs/html/debug.html: Document libstdc++ debug mode.
	* docs/html/17_intro/howto.html: Document debug-mode macros.
	* include/Makefile.am: Install debug-mode headers.
	* src/Makefile.am: Include debug.cc; removed old debug libstdc++.
	* src/misc-inst.cc: Instantiate with release-mode strings.
	* src/string-inst.cc: Ditto.
	* include/bits/basic_string.h: Defines for release-mode containers.
	* include/bits/basic_string.tcc: Defines for release-mode
	containers.
	  (basic_string::_S_construct): Fix NULL pointer check.
	* include/bits/deque.tcc: Ditto.
	* include/bits/istream.tcc: Ditto.
	* include/bits/list.tcc: Ditto.
	* include/bits/ostream.tcc: Ditto.
	* include/bits/stl_bvector.h: Ditto.
	* include/bits/stl_deque.h: Ditto.
	* include/bits/stl_list.h: Ditto.
	* include/bits/stl_map.h: Ditto.
	* include/bits/stl_multimap.h: Ditto.
	* include/bits/stl_multiset.h: Ditto.
	* include/bits/stl_set.h: Ditto.
	* include/bits/stl_vector.h: Ditto.
	* include/bits/stringfwd.h: Ditto.
	* include/bits/vector.tcc: Ditto.
	* include/ext/hash_map: Ditto.
	* include/ext/hash_set: Ditto.
	* include/std/std_bitset.h: Ditto.
	* include/bits/stl_algo.h: Added algorithm precondition
	annotations.
	* include/bits/stl_algobase.h: Ditto.
	* include/ext/algorithm: Ditto.
	* testsuite/Makefile.am: Ditto.
	* testsuite/23_containers/list_operators.cc: Don't verify
	performance guarantees when in debug mode.
	* testsuite/lib/libstdc++-v3-dg.exp: Link against the debug
	libraries when checking with debug mode.
	* include/bits/debug/basic_string.h: New.
	* include/bits/debug/bitset.h: New.
	* include/bits/debug/debug.h: New.
	* include/bits/debug/deque.h: New.
	* include/bits/debug/formatter.h: New.
	* include/bits/debug/hash_map.h: New.
	* include/bits/debug/hash_multimap.h: New.
	* include/bits/debug/hash_multiset.h: New.
	* include/bits/debug/hash_set.h: New.
	* include/bits/debug/list.h: New.
	* include/bits/debug/map.h: New.
	* include/bits/debug/multimap.h: New.
	* include/bits/debug/multiset.h: New.
	* include/bits/debug/safe_base.h: New.
	* include/bits/debug/safe_iterator.h: New.
	* include/bits/debug/safe_iterator.tcc: New.
	* include/bits/debug/safe_sequence.h: New.
	* include/bits/debug/set.h: New.
	* include/bits/debug/support.h: New.
	* include/bits/debug/vector.h: New.
	* include/ext/debug/bitset: New.
	* include/ext/debug/deque: New.
	* include/ext/debug/hash_map: New.
	* include/ext/debug/hash_set: New.
	* include/ext/debug/list: New.
	* include/ext/debug/map: New.
	* include/ext/debug/set: New.
	* include/ext/debug/string: New.
	* include/ext/debug/vector: New.
	* src/debug.cc: New.
	* debug/Makefile.am: New.
	* include/bits/gnu-cxx-utility.h: New.

Attachment: debugmode.patch.gz
Description: GNU Zip compressed data




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