Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Paul Hilfinger <hilfingr@gnat.com>
To: drow@false.org
Cc: gdb-patches@sources.redhat.com
Subject: Re: [RFA] Introduce notion of "search name"
Date: Fri, 19 Mar 2004 00:09:00 -0000	[thread overview]
Message-ID: <20040305103925.A4815F2EE4@nile.gnat.com> (raw)
Message-ID: <20040319000900.GLk6FcdoPSFiwNmUIQ8Oi6AXHV359-GCuAAftHhTCEo@z> (raw)
In-Reply-To: <20040305035955.GH5320@nevyn.them.org> (message from Daniel Jacobowitz on Thu, 4 Mar 2004 22:59:55 -0500)


Daniel,

> It doesn't address on of the thornier problems I hit when doing the
> same thing, namely that of allocation.  OK, someone uses
> SYMBOL_DEMANGLED_NAME, we lazily allocate a demangled name - where? The
> objfile is not available.  I think there may be no option but to
> pass the objfile to SYMBOL_DEMANGLED_NAME.  What did you do for Ada?

You're right, I did not address this in the patch proper.  I had
prepared a patch in which I used that extra byte in struct symtab to
tag the union and allow an objfile member.  However, I was aware from
correspondence with you that you were working in this area, and that
some of what you proposed to do might eventually allow us to re-do Ada
symbol lookup.  So I decided not to modify the symtab struct for the
moment, and instead submit a patch that would change as little as
possible.  I figured it would be better not to do anything just now
that might interfere with on-going work on the symbol table.

So as an interim measure, I use your suggestion of 21 Jan and first
try to find an objfile via the BFD section.  When that doesn't work, I
simply use a global hashtable to hold the demangled strings.  Yes,
that is a memory leak, but on consideration, I realized that it's only
REALLY a memory leak if (a) I routinely change the entire set of
demangled names numerous times during a single GDB session, or (b)
demangle entirely different, large sets of names each time I reload
the symbol tables.  Yeah, I know, it's not pretty, but again I am hoping
it will ensure that demangled names behave until the next interation of
symtab modifications allow an entirely different strategy.

> You define SYMBOL_DEMANGLED_SEARCH_NAME.  What's it really good for,
> and how does it do any good?  You only use it for the minimal symbol
> hash tables; the fundamental problem with minimal symbols is that we
> don't know their language, so I don't know how you can reliably make a
> language-specific decision like this one.

The relevant code now reads

      if (SYMBOL_DEMANGLED_NAME (msym) != NULL)
	add_minsym_to_demangled_hash_table (msym,
                                            objfile->msymbol_demangled_hash);

Ada does demangle; SYMBOL_DEMANGLED_NAME does have to return a
demangled name, if there is one.  Therefore the test here will
precipitate computing and caching the demangled name prematurely (once
symbol_demangled_name is extended to include the Ada case).  This code
also adds the demangled name to the hash table.  But we never look for
demangled names, so that is a waste.

As to your question about how this can work: Ada doesn't really change
your question.  I could just as well ask "How can
SYMBOL_DEMANGLED_NAME work on minimal symbols, given that it doesn't
know what language to use for demangling?" The answer is that if it
quacks like a duck ... excuse me, I mean if ObjC demangling works,
assume you have an ObjC symbol, if C++ demangling works, then assume
it is a C++ symbol, etc., and hope that the demangling schemes don't
collide.  That's what the code says now.  You'll have to argue the 
sensibility of this strategy with others.

> SYMBOL_DEMANGLED_SEARCH_NAME also codifies more than necessary of the
> difference between the other SYMBOL_*_NAME macros and
> SYMBOL_SEARCH_NAME.  Something that I think may be useful is to use
> just the basename for the search name and then have language-specific
> code to cherry-pick the resulting matches afterwards; one big advantage
> of this is that it lets me sidestep the Java vs. C++ demangling issues.
> I suspect it is possible (for all supported languages) to unambiguously
> and efficiently identify the basename. I need to look at some of the
> other in-use manglings to follow up on that idea though, particularly
> g++ v2 and ObjC.

Yes, I know: you discussed that before and I eagerly await these changes.
For the nonce, I still think I've found a reasonably small hook that 
accomplishes our purposes.

> Oh, and two spaces after a full stop in comments.

Oh, woe: of all your comments, this will be the most difficult to
accommodate.  You see, ACT is full of these confounded Europeans who
insist on single spaces after periods and yell whenever I do things
properly instead.  No doubt they will relent when they hear how this
practice will slow up these patches.  :->).

Paul Hilfinger
Ada Core Technologies, Inc.


  parent reply	other threads:[~2004-03-05 10:39 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-03 19:15 Paul Hilfinger
2004-03-19  0:09 ` David Carlton
2004-03-03 19:26   ` David Carlton
2004-03-19  0:09   ` Paul Hilfinger
2004-03-04  8:45     ` Paul Hilfinger
2004-03-19  0:09 ` Paul Hilfinger
2004-03-19  0:09 ` Daniel Jacobowitz
2004-03-05  3:59   ` Daniel Jacobowitz
2004-03-05 10:39   ` Paul Hilfinger [this message]
2004-03-19  0:09     ` Paul Hilfinger
2004-03-31 22:12     ` Daniel Jacobowitz
2004-04-01 14:53       ` Jim Blandy
2004-04-01 15:00         ` Daniel Jacobowitz
2004-04-01 15:21           ` Jim Blandy
2004-04-02  9:30             ` Paul Hilfinger
2004-04-02 22:27               ` Jim Blandy
2004-04-03 12:04                 ` Paul Hilfinger
2004-04-06 14:37                   ` Jim Blandy
2004-04-02  9:33         ` Paul Hilfinger
2004-04-02  8:29       ` Paul Hilfinger
2004-04-09 22:40         ` Daniel Jacobowitz
2004-04-12  8:22           ` Paul Hilfinger
2004-04-16  4:11             ` Jim Blandy
2004-04-29 10:37               ` Paul Hilfinger
     [not found]                 ` <20040429211458.GB27523@nevyn.them.org>
     [not found]                   ` <vt2n04umj8b.fsf@zenia.home>
     [not found]                     ` <20040430084538.ECDE1F2E1C@nile.gnat.com>
     [not found]                       ` <20040430134955.GA15786@nevyn.them.org>
2004-05-03  8:49                         ` Paul Hilfinger
2004-05-11 19:48                           ` Daniel Jacobowitz
2004-05-12 11:00                             ` Paul Hilfinger
2004-05-12 13:27                               ` Daniel Jacobowitz
2004-05-12 14:14                                 ` Andrew Cagney
2004-05-12 14:23                                   ` Daniel Jacobowitz
2004-05-12 15:11                                     ` Andrew Cagney
2004-05-12 16:59                                       ` Joel Brobecker
2004-05-13 14:29                                         ` Andrew Cagney
2004-05-13  9:30                                   ` Paul Hilfinger
2004-05-13 13:49                                     ` Daniel Jacobowitz
2004-05-18 21:59                                     ` Jim Blandy
2004-05-19  9:55                                       ` Paul Hilfinger
2004-05-19 13:00                                         ` Daniel Jacobowitz
2004-05-19 15:21                                       ` Andrew Cagney
2004-05-20 10:18                                         ` Abstracting "name" Paul Hilfinger
2004-05-21 19:10                                           ` Andrew Cagney
2004-05-21 20:01                                             ` Jim Blandy
2004-03-30  9:37 [RFA] Introduce notion of "search name" Paul Hilfinger

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=20040305103925.A4815F2EE4@nile.gnat.com \
    --to=hilfingr@gnat.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sources.redhat.com \
    /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