Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* Demangling in backtraces
@ 2021-03-06 18:56 Eli Zaretskii via Gdb
  2021-03-13  8:55 ` Eli Zaretskii via Gdb
  2021-03-14  7:28 ` Andreas Schwab
  0 siblings, 2 replies; 12+ messages in thread
From: Eli Zaretskii via Gdb @ 2021-03-06 18:56 UTC (permalink / raw)
  To: gdb

I have built a C program linked against libgccjit.  When it crashes,
the backtrace shows mangled names, like this:

 #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
    from D:\usr\bin\libgccjit-0.dll
 #1  0x7190fa7b in libgccjit-0!_ZN19evrp_range_analyzer5leaveEP15basic_block_def
 () from D:\usr\bin\libgccjit-0.dll
 #2  0x71910eef in libgccjit-0!_Z36stmt_uses_0_or_null_in_undefined_wayP6gimple
     () from D:\usr\bin\libgccjit-0.dll
 #3  0x710fba2c in libgccjit-0!_Z16execute_one_passP8opt_pass ()
    from D:\usr\bin\libgccjit-0.dll

(This is because libgccjit is written in C++, and because the DLL is
stripped.)

How can I cause GDB to demangle the function names when showing the
backtrace in this case?  I tried setting language to c++, but that
didn't help.

TIA

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

* Re: Demangling in backtraces
  2021-03-06 18:56 Demangling in backtraces Eli Zaretskii via Gdb
@ 2021-03-13  8:55 ` Eli Zaretskii via Gdb
  2021-03-14  2:46   ` Simon Marchi via Gdb
  2021-03-14  7:28 ` Andreas Schwab
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii via Gdb @ 2021-03-13  8:55 UTC (permalink / raw)
  To: gdb

Ping!  Does the silence mean we don't have such a feature in GDB?

> Date: Sat, 06 Mar 2021 20:56:13 +0200
> From: Eli Zaretskii via Gdb <gdb@sourceware.org>
> 
> I have built a C program linked against libgccjit.  When it crashes,
> the backtrace shows mangled names, like this:
> 
>  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
>     from D:\usr\bin\libgccjit-0.dll
>  #1  0x7190fa7b in libgccjit-0!_ZN19evrp_range_analyzer5leaveEP15basic_block_def
>  () from D:\usr\bin\libgccjit-0.dll
>  #2  0x71910eef in libgccjit-0!_Z36stmt_uses_0_or_null_in_undefined_wayP6gimple
>      () from D:\usr\bin\libgccjit-0.dll
>  #3  0x710fba2c in libgccjit-0!_Z16execute_one_passP8opt_pass ()
>     from D:\usr\bin\libgccjit-0.dll
> 
> (This is because libgccjit is written in C++, and because the DLL is
> stripped.)
> 
> How can I cause GDB to demangle the function names when showing the
> backtrace in this case?  I tried setting language to c++, but that
> didn't help.
> 
> TIA
> 

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

* Re: Demangling in backtraces
  2021-03-13  8:55 ` Eli Zaretskii via Gdb
@ 2021-03-14  2:46   ` Simon Marchi via Gdb
  2021-03-14  5:45     ` Eli Zaretskii via Gdb
  0 siblings, 1 reply; 12+ messages in thread
From: Simon Marchi via Gdb @ 2021-03-14  2:46 UTC (permalink / raw)
  To: Eli Zaretskii, gdb



On 2021-03-13 3:55 a.m., Eli Zaretskii via Gdb wrote:
> Ping!  Does the silence mean we don't have such a feature in GDB?
> 
>> Date: Sat, 06 Mar 2021 20:56:13 +0200
>> From: Eli Zaretskii via Gdb <gdb@sourceware.org>
>>
>> I have built a C program linked against libgccjit.  When it crashes,
>> the backtrace shows mangled names, like this:
>>
>>  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
>>     from D:\usr\bin\libgccjit-0.dll
>>  #1  0x7190fa7b in libgccjit-0!_ZN19evrp_range_analyzer5leaveEP15basic_block_def
>>  () from D:\usr\bin\libgccjit-0.dll
>>  #2  0x71910eef in libgccjit-0!_Z36stmt_uses_0_or_null_in_undefined_wayP6gimple
>>      () from D:\usr\bin\libgccjit-0.dll
>>  #3  0x710fba2c in libgccjit-0!_Z16execute_one_passP8opt_pass ()
>>     from D:\usr\bin\libgccjit-0.dll
>>
>> (This is because libgccjit is written in C++, and because the DLL is
>> stripped.)
>>
>> How can I cause GDB to demangle the function names when showing the
>> backtrace in this case?  I tried setting language to c++, but that
>> didn't help.
>>
>> TIA
>>

I don't really know.  I've tried making a toy program and shared library
on Linux in C++, without debug symbols, and it "just works":

    #0  0x00007ffff7fc00ed in foo(int) () from ./libfoo.so
    #1  0x0000555555555147 in main ()

So maybe it's supposed to "just work" on Windows as well and it doesn't?
I don't really have time to dig into it further.

Simon


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

* Re: Demangling in backtraces
  2021-03-14  2:46   ` Simon Marchi via Gdb
@ 2021-03-14  5:45     ` Eli Zaretskii via Gdb
  2021-03-14  7:29       ` Andreas Schwab
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii via Gdb @ 2021-03-14  5:45 UTC (permalink / raw)
  To: Simon Marchi, Hannes Domani; +Cc: gdb

> From: Simon Marchi <simon.marchi@polymtl.ca>
> Date: Sat, 13 Mar 2021 21:46:32 -0500
> 
> >> I have built a C program linked against libgccjit.  When it crashes,
> >> the backtrace shows mangled names, like this:
> >>
> >>  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
> >>     from D:\usr\bin\libgccjit-0.dll
> >>  #1  0x7190fa7b in libgccjit-0!_ZN19evrp_range_analyzer5leaveEP15basic_block_def
> >>  () from D:\usr\bin\libgccjit-0.dll
> >>  #2  0x71910eef in libgccjit-0!_Z36stmt_uses_0_or_null_in_undefined_wayP6gimple
> >>      () from D:\usr\bin\libgccjit-0.dll
> >>  #3  0x710fba2c in libgccjit-0!_Z16execute_one_passP8opt_pass ()
> >>     from D:\usr\bin\libgccjit-0.dll
> >>
> >> (This is because libgccjit is written in C++, and because the DLL is
> >> stripped.)
> >>
> >> How can I cause GDB to demangle the function names when showing the
> >> backtrace in this case?  I tried setting language to c++, but that
> >> didn't help.
> >>
> >> TIA
> >>
> 
> I don't really know.  I've tried making a toy program and shared library
> on Linux in C++, without debug symbols, and it "just works":
> 
>     #0  0x00007ffff7fc00ed in foo(int) () from ./libfoo.so
>     #1  0x0000555555555147 in main ()
> 
> So maybe it's supposed to "just work" on Windows as well and it doesn't?
> I don't really have time to dig into it further.

Thanks.  So does this mean we don't have any kind of "manual
demangler" in GDB that could be turned on in cases like this, when
"just works" doesn't?  Hannes, any ideas?

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

* Re: Demangling in backtraces
  2021-03-06 18:56 Demangling in backtraces Eli Zaretskii via Gdb
  2021-03-13  8:55 ` Eli Zaretskii via Gdb
@ 2021-03-14  7:28 ` Andreas Schwab
  2021-03-14  7:36   ` Eli Zaretskii via Gdb
  2021-03-14  7:54   ` Jeffrey Walton via Gdb
  1 sibling, 2 replies; 12+ messages in thread
From: Andreas Schwab @ 2021-03-14  7:28 UTC (permalink / raw)
  To: Eli Zaretskii via Gdb

On Mär 06 2021, Eli Zaretskii via Gdb wrote:

> I have built a C program linked against libgccjit.  When it crashes,
> the backtrace shows mangled names, like this:
>
>  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()

Is this prefix part of the symbol name?  A valid mangled name must start
with _Z.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: Demangling in backtraces
  2021-03-14  5:45     ` Eli Zaretskii via Gdb
@ 2021-03-14  7:29       ` Andreas Schwab
  2021-03-14  7:43         ` Eli Zaretskii via Gdb
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2021-03-14  7:29 UTC (permalink / raw)
  To: Eli Zaretskii via Gdb

On Mär 14 2021, Eli Zaretskii via Gdb wrote:

> Thanks.  So does this mean we don't have any kind of "manual
> demangler" in GDB that could be turned on in cases like this, when
> "just works" doesn't?  Hannes, any ideas?

(gdb) help demangle 
Demangle a mangled name.
Usage: demangle [-l LANGUAGE] [--] NAME
If LANGUAGE is not specified, NAME is demangled in the current language.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: Demangling in backtraces
  2021-03-14  7:28 ` Andreas Schwab
@ 2021-03-14  7:36   ` Eli Zaretskii via Gdb
  2021-03-14  8:26     ` Andreas Schwab
  2021-03-14  7:54   ` Jeffrey Walton via Gdb
  1 sibling, 1 reply; 12+ messages in thread
From: Eli Zaretskii via Gdb @ 2021-03-14  7:36 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Eli Zaretskii <eliz@gnu.org>
> Date: Sun, 14 Mar 2021 08:28:36 +0100
> 
> >  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
> 
> Is this prefix part of the symbol name?  A valid mangled name must start
> with _Z.

No, that's the name of the shared library.  This is a known
peculiarity on Windows, see "Non-debug DLL Symbols" in the GDB manual.

Are you saying that if those prefixes weren't there, GDB would have
demangled the names automatically?

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

* Re: Demangling in backtraces
  2021-03-14  7:29       ` Andreas Schwab
@ 2021-03-14  7:43         ` Eli Zaretskii via Gdb
  2021-03-14  8:09           ` Nagmat Nazarov via Gdb
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii via Gdb @ 2021-03-14  7:43 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: Simon Marchi <simon.marchi@polymtl.ca>,  Hannes Domani
>  <ssbssa@yahoo.de>,  Eli Zaretskii <eliz@gnu.org>
> Date: Sun, 14 Mar 2021 08:29:59 +0100
> 
> On Mär 14 2021, Eli Zaretskii via Gdb wrote:
> 
> > Thanks.  So does this mean we don't have any kind of "manual
> > demangler" in GDB that could be turned on in cases like this, when
> > "just works" doesn't?  Hannes, any ideas?
> 
> (gdb) help demangle 
> Demangle a mangled name.
> Usage: demangle [-l LANGUAGE] [--] NAME
> If LANGUAGE is not specified, NAME is demangled in the current language.

Sure, I know.  I thought there could be some "set FOO" knob that would
demangle automatically in the backtraces.

The above works, of course (one must use "-l c++", btw), but not if I
submit the "decorated" name, such as
"libgccjit-0!_Z17gimple_build_callP9tree_nodejz".

Thanks.

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

* Re: Demangling in backtraces
  2021-03-14  7:28 ` Andreas Schwab
  2021-03-14  7:36   ` Eli Zaretskii via Gdb
@ 2021-03-14  7:54   ` Jeffrey Walton via Gdb
  1 sibling, 0 replies; 12+ messages in thread
From: Jeffrey Walton via Gdb @ 2021-03-14  7:54 UTC (permalink / raw)
  To: gdb

On Sun, Mar 14, 2021 at 3:48 AM Andreas Schwab <schwab@linux-m68k.org> wrote:
>
> On Mär 06 2021, Eli Zaretskii via Gdb wrote:
>
> > I have built a C program linked against libgccjit.  When it crashes,
> > the backtrace shows mangled names, like this:
> >
> >  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
>
> Is this prefix part of the symbol name?  A valid mangled name must start
> with _Z.

It looks like the prefix 'libgccjit-0!' is causing trouble:

$ echo '_Z17gimple_build_callP9tree_nodejz' | c++filt
gimple_build_call(tree_node*, unsigned int, ...)

$ echo 'libgccjit-0!_Z17gimple_build_callP9tree_nodejz'
libgccjit-0!_Z17gimple_build_callP9tree_nodejz

Jeff

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

* Re: Demangling in backtraces
  2021-03-14  7:43         ` Eli Zaretskii via Gdb
@ 2021-03-14  8:09           ` Nagmat Nazarov via Gdb
  0 siblings, 0 replies; 12+ messages in thread
From: Nagmat Nazarov via Gdb @ 2021-03-14  8:09 UTC (permalink / raw)
  To: Reuben Thomas via Gdb

How to unsubscribe from gdb@sourceware.org ?

On Sun, Mar 14, 2021 at 5:04 PM Eli Zaretskii via Gdb <gdb@sourceware.org>
wrote:

> > From: Andreas Schwab <schwab@linux-m68k.org>
> > Cc: Simon Marchi <simon.marchi@polymtl.ca>,  Hannes Domani
> >  <ssbssa@yahoo.de>,  Eli Zaretskii <eliz@gnu.org>
> > Date: Sun, 14 Mar 2021 08:29:59 +0100
> >
> > On Mär 14 2021, Eli Zaretskii via Gdb wrote:
> >
> > > Thanks.  So does this mean we don't have any kind of "manual
> > > demangler" in GDB that could be turned on in cases like this, when
> > > "just works" doesn't?  Hannes, any ideas?
> >
> > (gdb) help demangle
> > Demangle a mangled name.
> > Usage: demangle [-l LANGUAGE] [--] NAME
> > If LANGUAGE is not specified, NAME is demangled in the current language.
>
> Sure, I know.  I thought there could be some "set FOO" knob that would
> demangle automatically in the backtraces.
>
> The above works, of course (one must use "-l c++", btw), but not if I
> submit the "decorated" name, such as
> "libgccjit-0!_Z17gimple_build_callP9tree_nodejz".
>
> Thanks.
>

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

* Re: Demangling in backtraces
  2021-03-14  7:36   ` Eli Zaretskii via Gdb
@ 2021-03-14  8:26     ` Andreas Schwab
  2021-03-14  9:40       ` Eli Zaretskii via Gdb
  0 siblings, 1 reply; 12+ messages in thread
From: Andreas Schwab @ 2021-03-14  8:26 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb

On Mär 14 2021, Eli Zaretskii wrote:

>> From: Andreas Schwab <schwab@linux-m68k.org>
>> Cc: Eli Zaretskii <eliz@gnu.org>
>> Date: Sun, 14 Mar 2021 08:28:36 +0100
>> 
>> >  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
>> 
>> Is this prefix part of the symbol name?  A valid mangled name must start
>> with _Z.
>
> No, that's the name of the shared library.  This is a known
> peculiarity on Windows, see "Non-debug DLL Symbols" in the GDB manual.

So it _is_ part of the symbol name?

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

* Re: Demangling in backtraces
  2021-03-14  8:26     ` Andreas Schwab
@ 2021-03-14  9:40       ` Eli Zaretskii via Gdb
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii via Gdb @ 2021-03-14  9:40 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb

> From: Andreas Schwab <schwab@linux-m68k.org>
> Cc: gdb@sourceware.org
> Date: Sun, 14 Mar 2021 09:26:02 +0100
> 
> On Mär 14 2021, Eli Zaretskii wrote:
> 
> >> From: Andreas Schwab <schwab@linux-m68k.org>
> >> Cc: Eli Zaretskii <eliz@gnu.org>
> >> Date: Sun, 14 Mar 2021 08:28:36 +0100
> >> 
> >> >  #0  0x70f5ac3e in libgccjit-0!_Z17gimple_build_callP9tree_nodejz ()
> >> 
> >> Is this prefix part of the symbol name?  A valid mangled name must start
> >> with _Z.
> >
> > No, that's the name of the shared library.  This is a known
> > peculiarity on Windows, see "Non-debug DLL Symbols" in the GDB manual.
> 
> So it _is_ part of the symbol name?

AFAIU, it's how the symbol is recorded in minsyms, yes.

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

end of thread, other threads:[~2021-03-14  9:40 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-06 18:56 Demangling in backtraces Eli Zaretskii via Gdb
2021-03-13  8:55 ` Eli Zaretskii via Gdb
2021-03-14  2:46   ` Simon Marchi via Gdb
2021-03-14  5:45     ` Eli Zaretskii via Gdb
2021-03-14  7:29       ` Andreas Schwab
2021-03-14  7:43         ` Eli Zaretskii via Gdb
2021-03-14  8:09           ` Nagmat Nazarov via Gdb
2021-03-14  7:28 ` Andreas Schwab
2021-03-14  7:36   ` Eli Zaretskii via Gdb
2021-03-14  8:26     ` Andreas Schwab
2021-03-14  9:40       ` Eli Zaretskii via Gdb
2021-03-14  7:54   ` Jeffrey Walton via Gdb

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox