public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Keith Seitz <keiths@redhat.com>
To: Tom Tromey <tom@tromey.com>, gdb-patches@sourceware.org
Subject: Re: [RFA 2/6] Change representation of psymbol to flush out accessors
Date: Fri, 01 Jun 2018 19:19:00 -0000	[thread overview]
Message-ID: <15d0da9f-93fa-5d23-ce4e-43d5befe48e7@redhat.com> (raw)
In-Reply-To: <20180503223621.22544-3-tom@tromey.com>

On 05/03/2018 03:36 PM, Tom Tromey wrote:
> ChangeLog
> 2018-05-03  Tom Tromey  <tom@tromey.com>
> 
> 	* dwarf-index-write.c (write_psymbols, debug_names::insert)
> 	(debug_names::write_psymbols): Update.
> 	* psympriv.h (struct partial_symbol) <pginfo>: Rename from
> 	'ginfo'.
> 	(PSYMBOL_VALUE, PSYMBOL_VALUE_ADDRESS, PSYMBOL_LANGUAGE)
> 	(PSYMBOL_SECTION, PSYMBOL_OBJ_SECTION, PSYMBOL_SET_LANGUAGE)
> 	(PSYMBOL_SET_NAMES, PSYMBOL_LINKAGE_NAME, PSYMBOL_DEMANGLED_NAME)
> 	(PSYMBOL_SEARCH_NAME, PSYMBOL_MATCHES_SEARCH_NAME): New macros.
> 	* psymtab.c (find_pc_sect_psymtab_closer, find_pc_sect_psymtab)
> 	(find_pc_sect_psymbol, fixup_psymbol_section)
> 	(match_partial_symbol, lookup_partial_symbol, relocate_psymtabs)
> 	(print_partial_symbols, recursively_search_psymtabs)
> 	(compare_psymbols, psymbol_hash, psymbol_compare)
> 	(add_psymbol_to_bcache, maintenance_check_psymtabs)
> 	(psymbol_name_matches, psym_fill_psymbol_map): Update.

One trivial comment, otherwise IANAM, but LGTM.

Keith

> diff --git a/gdb/psymtab.c b/gdb/psymtab.c
> index ac0ee0a5a6..e9a6a23b9d 100644
> --- a/gdb/psymtab.c
> +++ b/gdb/psymtab.c
> @@ -1621,17 +1623,17 @@ psymbol_hash (const void *addr, int length)
>  {
>    unsigned long h = 0;
>    struct partial_symbol *psymbol = (struct partial_symbol *) addr;
> -  unsigned int lang = psymbol->ginfo.language;
> +  unsigned int lang = PSYMBOL_LANGUAGE (psymbol);
>    unsigned int domain = PSYMBOL_DOMAIN (psymbol);
>    unsigned int theclass = PSYMBOL_CLASS (psymbol);
>  
> -  h = hash_continue (&psymbol->ginfo.value, sizeof (psymbol->ginfo.value), h);
> +  h = hash_continue (&psymbol->pginfo.value, sizeof (psymbol->pginfo.value), h);
>    h = hash_continue (&lang, sizeof (unsigned int), h);
>    h = hash_continue (&domain, sizeof (unsigned int), h);
>    h = hash_continue (&theclass, sizeof (unsigned int), h);
>    /* Note that psymbol names are interned via symbol_set_names, so
>       there's no need to hash the contents of the name here.  */
> -  h = hash_continue (&psymbol->ginfo.name, sizeof (psymbol->ginfo.name), h);
> +  h = hash_continue (&psymbol->pginfo.name, sizeof (psymbol->pginfo.name), h);

I realize this is just a renaming of the existing code, but since there is an accessor for `name', I think it better to use it (in case someone ends up grepping for this).

>  
>    return h;
>  }
> @@ -1646,15 +1648,15 @@ psymbol_compare (const void *addr1, const void *addr2, int length)
>    struct partial_symbol *sym1 = (struct partial_symbol *) addr1;
>    struct partial_symbol *sym2 = (struct partial_symbol *) addr2;
>  
> -  return (memcmp (&sym1->ginfo.value, &sym2->ginfo.value,
> -                  sizeof (sym1->ginfo.value)) == 0
> -	  && sym1->ginfo.language == sym2->ginfo.language
> +  return (memcmp (&sym1->pginfo.value, &sym2->pginfo.value,
> +                  sizeof (sym1->pginfo.value)) == 0
> +	  && sym1->pginfo.language == sym2->pginfo.language
>            && PSYMBOL_DOMAIN (sym1) == PSYMBOL_DOMAIN (sym2)
>            && PSYMBOL_CLASS (sym1) == PSYMBOL_CLASS (sym2)
>  	  /* Note that psymbol names are interned via
>  	     symbol_set_names, so there's no need to compare the
>  	     contents of the name here.  */
> -          && sym1->ginfo.name == sym2->ginfo.name);
> +          && sym1->pginfo.name == sym2->pginfo.name);
>  }

Same here for PSYMBOL_LANGUAGE and PSYMBOL_LINKAGE_NAME?

>  /* Initialize a partial symbol bcache.  */
Keith

  reply	other threads:[~2018-06-01 19:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-03 22:36 [RFA 0/6] Make psymbols independent of the progspace Tom Tromey
2018-05-03 22:36 ` [RFA 1/6] Remove dead code in end_psymtab Tom Tromey
2018-06-01 18:55   ` Keith Seitz
2018-06-05 19:41     ` Simon Marchi
2018-05-03 22:36 ` [RFA 3/6] Make PSYMBOL_VALUE_ADDRESS take objfile argument Tom Tromey
2018-06-01 20:06   ` Keith Seitz
2018-06-01 21:03     ` Tom Tromey
2018-06-05 20:50       ` Simon Marchi
2018-05-03 22:36 ` [RFA 4/6] Introduce accessors for psymtab high and low fields Tom Tromey
2018-06-01 20:48   ` Keith Seitz
2018-06-04 18:14     ` Tom Tromey
2018-06-05 21:03   ` Simon Marchi
2018-05-03 22:36 ` [RFA 2/6] Change representation of psymbol to flush out accessors Tom Tromey
2018-06-01 19:19   ` Keith Seitz [this message]
2018-06-04 18:11     ` Tom Tromey
2018-06-05 19:49       ` Simon Marchi
2018-06-05 22:56         ` Tom Tromey
2018-06-05 23:31           ` Simon Marchi
2018-05-03 22:36 ` [RFA 6/6] Make psymbols and psymtabs independent of the program space Tom Tromey
2018-06-05 20:34   ` Keith Seitz
2018-05-03 22:36 ` [RFA 5/6] Add validity bits for psymtab high and low fields Tom Tromey
2018-06-01 21:23   ` Keith Seitz
2018-06-05 17:25     ` Tom Tromey
2018-06-05 17:38       ` Keith Seitz
2018-05-25 17:58 ` [RFA 0/6] Make psymbols independent of the progspace Tom Tromey

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=15d0da9f-93fa-5d23-ce4e-43d5befe48e7@redhat.com \
    --to=keiths@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tom@tromey.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).