I had missed it, thanks.

Here is a patch to fix debug mode doc then.

libstdc++: Fix _GLIBCXX_DEBUG_BACKTRACE macro documentation

libstdc++-v3/ChangeLog:

    * doc/xml/manual/debug_mode.xml: Link against libstdc++exp.a to use
    _GLIBCXX_DEBUG_BACKTRACE macro.

Ok to commit ?

François

On 29/01/2024 11:10, Jonathan Wakely wrote:
On Mon, 29 Jan 2024 at 06:13, François Dumont <frs.dum...@gmail.com> wrote:
Hi

I'm trying to use _GLIBCXX_DEBUG_BACKTRACE to debug some crash in debug
mode.

So I buit library with --enable-libstdcxx-backtrace=yes

But when I build any test I have:

/usr/bin/ld: /tmp/cctvPvlb.o: in function
`__gnu_debug::_Error_formatter::_Error_formatter(char const*, unsigned
int, char const*)':
/home/fdumont/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/formatter.h:597:
undefined reference to `__glibcxx_backtrace_create_state'
/usr/bin/ld:
/home/fdumont/dev/gcc/build/x86_64-pc-linux-gnu/libstdc++-v3/include/debug/formatter.h:598:
undefined reference to `__glibcxx_backtrace_full'

-lstdc++_libbacktrace does not help as it cannot find it.
You need to use -lstdc++exp.a instead, as documented at
https://gcc.gnu.org/gcc-14/changes.html#libstdcxx

I changed this with
https://gcc.gnu.org/g:b96b554592c5cbb6a2c1797ffcb5706fd295f4fd
diff --git a/libstdc++-v3/doc/xml/manual/debug_mode.xml 
b/libstdc++-v3/doc/xml/manual/debug_mode.xml
index dadc0cd1bb4..ac15ef6f6d0 100644
--- a/libstdc++-v3/doc/xml/manual/debug_mode.xml
+++ b/libstdc++-v3/doc/xml/manual/debug_mode.xml
@@ -165,8 +165,8 @@ which always works correctly.
   It requires that you configure libstdc++ build with
   <option>--enable-libstdcxx-backtrace=yes</option>.
   Use <code>-D_GLIBCXX_DEBUG_BACKTRACE</code> to activate it.
-  You'll then have to link with libstdc++_libbacktrace static library
-  (<option>-lstdc++_libbacktrace</option>) to build your application.</para>
+  You'll then have to link against libstdc++exp static library
+  (<option>-lstdc++exp</option>) to build your application.</para>
 </section>
 
 <section xml:id="debug_mode.using.specific" xreflabel="Using 
Specific"><info><title>Using a Specific Debug Container</title></info>

Reply via email to