On 08/08/22 15:29, Jonathan Wakely wrote: > On Wed, 13 Jul 2022 at 18:28, François Dumont via Libstdc++ > wrote: >> libstdc++: [_GLIBCXX_DEBUG] Add backtrace generation on demand >> >> Add _GLIBCXX_DEBUG_BACKTRACE macro to activate backtrace generation >> on _GLIBCXX_DEBUG assertions. Prerequisite is to have configure the lib >> with: >> >> --enable-libstdcxx-backtrace=yes >> >> libstdc++-v3/ChangeLog: >> >> * include/debug/formatter.h >> [_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_state): Declare. >> [_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_create_state): Declare. >> [_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_full_callback): Define. >> [_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_error_callback): Define. >> [_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_full_func): Define. >> [_GLIBCXX_HAVE_STACKTRACE](__glibcxx_backtrace_full): Declare. >> [_GLIBCXX_HAVE_STACKTRACE](_Error_formatter::_M_backtrace_state): New. >> [_GLIBCXX_HAVE_STACKTRACE](_Error_formatter::_M_backtrace_full): New. >> * src/c++11/debug.cc (pretty_print): Rename into... >> (print_function): ...that. > This does more than just rename it, what are the other changes for? Nothing, I'm starting to remember what you did on this, reverted. > > >> [_GLIBCXX_HAVE_STACKTRACE](print_backtrace): New. >> (_Error_formatter::_M_error()): Adapt. >> * src/libbacktrace/Makefile.am: Add backtrace.c. >> * src/libbacktrace/Makefile.in: Regenerate. >> * src/libbacktrace/backtrace-rename.h (backtrace_full): New. >> * testsuite/23_containers/vector/debug/assign4_neg.cc: Add backtrace >> generation. >> * doc/xml/manual/debug_mode.xml: Document _GLIBCXX_DEBUG_BACKTRACE. >> * doc/xml/manual/using.xml: Likewise. >> >> Tested under Linux x86_64 normal and _GLIBCXX_DEBUG modes. >> >> Ok to commit ? > >> --- a/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc >> +++ b/libstdc++-v3/testsuite/23_containers/vector/debug/assign4_neg.cc >> @@ -16,6 +16,7 @@ >> // . >> // >> // { dg-do run { xfail *-*-* } } >> +// { dg-options "-D_GLIBCXX_DEBUG_BACKTRACE -lstdc++_libbacktrace" } >> >> #include >> #include > This will fail to link if the static lib isn't available. > Good point ! So I am introducing a new test case with the necessary dg directive. It is a 'run' test case even if what is really tested is only the compilation/link part. For the run part someone has to look at the log file. François