public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC] regresssion(internal-error) printing subprogram argument
Date: Mon, 29 Jan 2018 15:33:00 -0000	[thread overview]
Message-ID: <250976c6-6e7a-6a8e-b9f2-a57f5b92b965@redhat.com> (raw)
In-Reply-To: <20180129103841.kdkomcjbuwiat5b4@adacore.com>

On 01/29/2018 10:38 AM, Joel Brobecker wrote:
>> Indeed, looks like I don't have that.  I have "interfacesS".
>> I've attached the whole file.
> 
> That explains it :).
> 
>> So it may be that we still need to add another special case
>> for Ada somewhere.  Would old GDB from before the C++
>> wildmatching pass this test for you?
> 
> I went binary searching for the source of the regression and
> when I found that it was "caused" by the change requiring variables
> without debugging information to be cast before they can be printed,
> I gently head-slapped myself, adjusted the testcase to use something
> other than an integer variable, and voila - even GDB 7.10 suffers
> from the problem.  We just didn't see it for integer variables simply
> because we were lucky!
> 
> I ran out of time again today, but at least the WIP patch got
> augmented with a testcase that currently fails before the patch
> is applied.
> 
> I think the patch itself is probably correct, although I'd like
> to do some archeology to understand the comment attached to
> that location. I'm pretty confused by it, when we could simply
> say that symbols from languages that do not follow the C++ mangling
> should not be demangled by gdb_demangle -- at least for as long
> as gdb_demangle is equivalent to cplusplus_demangle in practice...

Yeah, the commentary around that code isn't exactly clear.
Why doesn't that code use language->la_demangle instead,
for example.

The other day I noticed that gdb_demangle -> bfd_demangle ->
cplus_demangle does have support for demangling other languages.
For Ada, see the GNAT_DEMANGLING handling in
libiberty.c:cplus-dem.c:cplus_demangle, which takes you to:

 /* Demangle ada names.  The encoding is documented in gcc/ada/exp_dbug.ads.  */

 char *
 ada_demangle (const char *mangled, int option ATTRIBUTE_UNUSED)
 {


When I saw that, I wondered why is it that GDB has a separate
implementation of Ada decoding in gdb/ada-lang.c.  The only plausible
explanation I came up with is that gdb's version decodes into a
buffer that is shared between invocations while libiberty's version
always heap-allocates the result.  Maybe it was an efficiency thing?
Do you know?

I ran into that around this discussion
<https://sourceware.org/ml/gdb/2017-11/msg00029.html> where I
was wondering whether we could speed up demangling by letting
bfd_demangle / cplus_demangle try all languages and return back
which one worked:

 ~~~
 An idea I had would be to try to combine most the language_sniff_from_mangled_name
 implementations in one call, by deferring to cplus_demangle which seems
 like could take care of gnu v3, rust, java, gnat, dlang and old C++ mangling
 schemes all at once.  This would avoid the overhead of gdb_demangle and
 bfd_demangle for each language-specific demangling call, at least.  Not sure.
 ~~~

Because ada_decode comes up high in profiles today...

> 
> And just as a reminder for myself, I said in my other email
> last week that I wanted also to review all the calls to gdb_demangle.

Thanks,
Pedro Alves

  reply	other threads:[~2018-01-29 15:33 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13 10:37 Joel Brobecker
2017-12-14 19:02 ` Pedro Alves
2017-12-14 19:41   ` Pedro Alves
2017-12-15  9:48     ` Joel Brobecker
2017-12-15 11:02       ` Pedro Alves
2017-12-15 18:57         ` Pedro Alves
2018-01-03  4:33           ` Joel Brobecker
2018-01-04  9:48             ` Joel Brobecker
2018-01-04 12:39               ` Pedro Alves
2018-01-05 16:28             ` Pedro Alves
2018-01-16 11:54               ` Pedro Alves
2018-01-17  9:13                 ` Joel Brobecker
2018-01-26  3:51                   ` Joel Brobecker
2018-01-26 11:28                     ` Pedro Alves
2018-01-29 10:38                       ` Joel Brobecker
2018-01-29 15:33                         ` Pedro Alves [this message]
2018-01-29 15:52                           ` Joel Brobecker
2018-01-30  3:56                           ` Joel Brobecker
2018-02-05  9:57                             ` Joel Brobecker
2018-02-09  9:09                               ` [RFA/RFC] fix PR gdb/22670 (pb looking up some symbols when they have a linkage name) (was: "Re: [RFC] regresssion(internal-error) printing subprogram argument") Joel Brobecker
2018-02-21  3:02                                 ` PING: " Joel Brobecker
2018-03-19 21:22                                   ` PING^2: " Joel Brobecker
2018-03-26 14:26                                     ` PING^2: [RFA/RFC] fix PR gdb/22670 (pb looking up some symbols when they have a linkage name) Pedro Alves
2018-03-27 14:02                                       ` Joel Brobecker
2018-01-26  4:50                   ` [RFC] regresssion(internal-error) printing subprogram argument Joel Brobecker
2017-12-15 18:31       ` Pedro Alves
2017-12-15  7:54   ` Joel Brobecker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=250976c6-6e7a-6a8e-b9f2-a57f5b92b965@redhat.com \
    --to=palves@redhat.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).