public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
* _GLIBCXX_DEBUG_BACKTRACE broken
@ 2024-01-29  6:12 François Dumont
  2024-01-29 10:10 ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: François Dumont @ 2024-01-29  6:12 UTC (permalink / raw)
  To: libstdc++

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.

François




^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _GLIBCXX_DEBUG_BACKTRACE broken
  2024-01-29  6:12 _GLIBCXX_DEBUG_BACKTRACE broken François Dumont
@ 2024-01-29 10:10 ` Jonathan Wakely
  2024-01-29 18:29   ` François Dumont
  0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2024-01-29 10:10 UTC (permalink / raw)
  To: François Dumont; +Cc: libstdc++

On Mon, 29 Jan 2024 at 06:13, François Dumont <frs.dumont@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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _GLIBCXX_DEBUG_BACKTRACE broken
  2024-01-29 10:10 ` Jonathan Wakely
@ 2024-01-29 18:29   ` François Dumont
  2024-01-29 19:14     ` Jonathan Wakely
  0 siblings, 1 reply; 4+ messages in thread
From: François Dumont @ 2024-01-29 18:29 UTC (permalink / raw)
  To: Jonathan Wakely; +Cc: libstdc++, gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1348 bytes --]

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.dumont@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
>

[-- Attachment #2: debug_mode_doc_patch.txt --]
[-- Type: text/plain, Size: 887 bytes --]

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>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: _GLIBCXX_DEBUG_BACKTRACE broken
  2024-01-29 18:29   ` François Dumont
@ 2024-01-29 19:14     ` Jonathan Wakely
  0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2024-01-29 19:14 UTC (permalink / raw)
  To: François Dumont; +Cc: libstdc++, gcc-patches

On Mon, 29 Jan 2024 at 18:30, François Dumont <frs.dumont@gmail.com> wrote:
>
> 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 ?

Yes please - thanks.


>
> François
>
> On 29/01/2024 11:10, Jonathan Wakely wrote:
> > On Mon, 29 Jan 2024 at 06:13, François Dumont <frs.dumont@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
> >


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-01-29 19:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-29  6:12 _GLIBCXX_DEBUG_BACKTRACE broken François Dumont
2024-01-29 10:10 ` Jonathan Wakely
2024-01-29 18:29   ` François Dumont
2024-01-29 19:14     ` Jonathan Wakely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).