status on --enable-debug, --debug-libraries=c,c++
Benjamin Kosnik
bkoz@redhat.com
Fri Dec 6 11:41:00 GMT 2002
Last month, there was a thread on libstdc++ on options to increase
debuggability of linked C++ library code. There is ongoing work in
both g++ and gdb (interested people should seriously look into the -r
carlton_dictionary-branch of the current gdb sources), but there is
also work that needs to be done in libstdc++ to improve debugability.
This thread was called "[RFC] --enable-debug" and can be found
starting here:
http://gcc.gnu.org/ml/libstdc++/2002-10/msg00223.html
A summary of this thread is as follows:
Configure options:
--enable-debug
would build a debug version of libstdc++, in addition
to the normal (optimized) build done currently
--enable-debug-flags=FLAGS
would specify the (non-default) flags with with to build said debug library
Library name
same as non-debug library.
or
something else
Install location
(prefix)/lib/debug/(name)
(Debian already does this for libstdc++, other linux distros
including Red Hat do this with glibc and other system libraries)
or
something else, if name is different. One possibility would be
(prefix)/lib/(name)_debug
Using it
manually adding -L to compiler. no relinking should be necessary.
or
specifying a flag on the compile line that automatically selects
the correct library, like -static, or -pthread, but
--debug-libraries=c,stdc++. This involves dealing with
gcc/cp/g++spec.c's LIBSTDCXX and LIBSTDCXX_PROFILE, adding
something like LIBSTDCXX_DEBUG. Sketch by Loren:
http://gcc.gnu.org/ml/libstdc++/2002-11/msg00010.html
no relinking should be necessary.
I've screwed around this week with an implementation, and didn't get
very far. Of the "or" branches above, I think the second one is more
involved but way, way more slick.
However, I'm having problems just getting a library + debug library built.
Possible implementation scenarios are as follows:
1) use the multilib infrastructure
2) make a separate 'debug' directory in the build tree and use that
3) try to hack something up with using an 'all-local' rule in src/Makefile.am
4) try to do conditional compilation hacks in src/Makefile.am a la
if GLIBCPP_BUILD_DEBUG
debug_library = libstdc++_debug.la
else
debug_library =
endif
toolexeclib_LTLIBRARIES = libstdc++.la $(debug_library)
(I can't figure out how to have CXXFLAGS or equivalent be different
for libstdc++ and libstdc++_debug)
Right now, I'm leaning towards 1 or 2. Am I missing an approach that
would be easier? Does this sound like something that would generally
be useful?
-benjamin
More information about the Libstdc++
mailing list