Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: David Carlton <carlton@math.stanford.edu>
To: Elena Zannoni <ezannoni@redhat.com>
Cc: gdb-patches@sources.redhat.com, Jim Blandy <jimb@redhat.com>
Subject: Re: [rfa] delete 'force_return' from lookup_symbol_aux_minsyms
Date: Tue, 10 Dec 2002 11:28:00 -0000	[thread overview]
Message-ID: <ro1el8pwxhz.fsf@jackfruit.Stanford.EDU> (raw)
In-Reply-To: <15861.1750.232869.77936@localhost.redhat.com>

On Mon, 9 Dec 2002 16:10:46 -0500, Elena Zannoni <ezannoni@redhat.com> said:

> I am tempted to accept it, but could you first look at the
> archeological diggings below?

Interesting.  How did you track that down?  I couldn't get CVS to go
back that far when I just tried it.

> I see that this bit:

> +         else if (MSYMBOL_TYPE (msymbol) != mst_text
> +                  && MSYMBOL_TYPE (msymbol) != mst_file_text
> +                  && !STREQ (name, SYMBOL_NAME (msymbol)))
> +           {
> +             /* This is a mangled variable, look it up by its
> +                mangled name.  */
> +             return lookup_symbol (SYMBOL_NAME (msymbol), block,
> +                                   namespace, is_a_field_of_this, symtab);
> +           }
> +         /* There are no debug symbols for this file, or we are looking
> +            for an unmangled variable.
> +            Try to find a matching static symbol below. */

> and this bit:

> @@ -2629,13 +2684,20 @@ list_symbols (regexp, class, bpt, from_t
>         }
>      }
 
> -  /* Here, we search through the minimal symbol tables for functions that
> -     match, and call find_pc_symtab on them to force their symbols to
> -     be read.  The symbol will then be found during the scan of symtabs
> -     below.  If find_pc_symtab fails, set found_misc so that we will
> -     rescan to print any matching symbols without debug info.  */
> +  /* Here, we search through the minimal symbol tables for functions
> +     and variables that match, and force their symbols to be read.
> +     This is in particular necessary for demangled variable names,
> +     which are no longer put into the partial symbol tables.
> +     The symbol will then be found during the scan of symtabs below.
> +
> +     For functions, find_pc_symtab should succeed if we have debug info
> +     for the function, for variables we have to call lookup_symbol
> +     to determine if the variable has debug info.
> +     If the lookup fails, set found_misc so that we will rescan to print
> +     any matching symbols without debug info.
> +  */
 
> -  if (class == 1)
> +  if (class == 0 || class == 1)
>      {
>        ALL_MSYMBOLS (objfile, msymbol)
>         {
> @@ -2648,7 +2710,12 @@ list_symbols (regexp, class, bpt, from_t
>                 {
>                   if (0 == find_pc_symtab (SYMBOL_VALUE_ADDRESS (msymbol)))
>                     {
> -                     found_misc = 1;
> +                     if (class == 1
> +                         || lookup_symbol (SYMBOL_NAME (msymbol), 
> +                                           (struct block *) NULL,
> +                                           VAR_NAMESPACE,
> +                                           0, (struct symtab **) NULL) == NULL)
> +                       found_misc = 1;
>                     }
>                 }
>             }

> were added together in 94. the changelog was:

> date: 1994/10/08 11:54:20;  author: schauer;  state: Exp;  lines: +87 -20
>         Speed up GDB startup time by not demangling partial symbols.
>         * symfile.h (ADD_PSYMBOL_VT_TO_LIST),
>         symfile.c (add_psymbol_to_list, add_psymbol_addr_to_list):
>         No longer demangle partial symbols.
>         * symtab.c (lookup_symbol, list_symbols): Handle mangled
>         variables, e.g. C++ static members, via the minimal symbols.

Hmm.  What's 'class'?  Does that refer to a variable/function
distinction, or a mangled/demangled distinction?  'found_misc' also
seems to have gone away; maybe that was a hint that callers should
follow up a failed call to lookup_symbol by one to
lookup_minimal_symbol, whereas we now always expect callers to do so
if appropriate, even without the hint.  At any rate, I'm particularly
interested by this part of the comment:

> +     For functions, find_pc_symtab should succeed if we have debug info
> +     for the function, for variables we have to call lookup_symbol
> +     to determine if the variable has debug info.
> +     If the lookup fails, set found_misc so that we will rescan to print
> +     any matching symbols without debug info.

So, at some point, this code had explicit assumptions about when there
should be a symbol corresponding to a minimal symbol, and set
found_misc appropriately.  But then, at some point, 'found_misc' went
away; it left, as a legacy, a somewhat strange flow of control that
wasn't at all explicit until I had to introduce 'force_return' to
mimic it.  

Also, the line

> +     The symbol will then be found during the scan of symtabs below.

makes me wonder if, at this time, the minimal symbol search happened
before the symtab search; I'm not sure how relevant that is.

At any rate, this was certainly interesting in terms of giving an idea
as to how the current flow of control might have arisen.  I still
think my patch is okay, though.

David Carlton
carlton@math.stanford.edu


  reply	other threads:[~2002-12-10 18:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-05 15:44 David Carlton
2002-12-09 13:35 ` Elena Zannoni
2002-12-10 11:28   ` David Carlton [this message]
2002-12-10 11:37     ` Daniel Jacobowitz
2002-12-10 11:56       ` Elena Zannoni
2002-12-19  8:54     ` Elena Zannoni
2002-12-19 11:47       ` David Carlton
2002-12-19 15:39         ` Elena Zannoni
2002-12-19 15:41           ` David Carlton
2002-12-19 16:06             ` Elena Zannoni
2002-12-20 13:02               ` David Carlton
2002-12-21 10:54 Michael Elizabeth Chastain
2002-12-21 11:59 ` Elena Zannoni
2002-12-21 20:20   ` David Carlton
2002-12-23  8:55     ` David Carlton
2002-12-21 22:16 Michael Elizabeth Chastain
2002-12-22 16:01 Michael Elizabeth Chastain
2002-12-23  0:46 Michael Elizabeth Chastain

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=ro1el8pwxhz.fsf@jackfruit.Stanford.EDU \
    --to=carlton@math.stanford.edu \
    --cc=ezannoni@redhat.com \
    --cc=gdb-patches@sources.redhat.com \
    --cc=jimb@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