Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: pedro@codesourcery.com
Cc: gdb-patches@sourceware.org, jan.kratochvil@redhat.com, drow@false.org
Subject: Re: Overlay support broken (Re: [patch] [2/2] Discontiguous PSYMTABs (psymtabs->symtabs by addrmap))
Date: Wed, 14 May 2008 01:11:00 -0000	[thread overview]
Message-ID: <200805132112.m4DLCKfr018490@d12av02.megacenter.de.ibm.com> (raw)

Pedro Alves wrote:

> Please also make sure that you're setting SYMBOL_CLASS
> before calling fixup_*symbol_section everywhere.  This will break
> dwarf2read.c, for example:

Ah, thanks for pointing that out!

> +  struct minimal_symbol *msym = NULL;
> +  if (addr != ~(CORE_ADDR) 0)
> +    /* If we have an address to lookup, use it.  */
> +    msym = lookup_minimal_symbol_by_pc (addr);
> +
> +  if (!msym
> +      || addr != SYMBOL_VALUE_ADDRESS (msym)
> +      || strcmp (DEPRECATED_SYMBOL_NAME (msym), ginfo->name) != 0)
> +    /* Try by looking up by name.  Not perfect, since it can match the
> +       wrong symbol.  */
> +    msym = lookup_minimal_symbol (ginfo->name, NULL, objfile);

Hmm, I guess there is the possibility that even though there is
a msymbol at ADDR with name NAME, both 
  lookup_minimal_symbol_by_pc (ADDR)
and
  lookup_minimal_symbol (NAME)

might fail to find it ...   E.g. if there are minimal symbols
  ADDR' NAME
  ADDR  NAME'
  ADDR  NAME
lookup by pc might find NAME', but lookup by name might find ADDR'.

Maybe we need a lookup_minimal_symbol_by_pc_name or so?

> +  /* We either have an OBJFILE, or we can get at it from the sym's
> +     symtab.  Anything else is a bug.  */
> +  gdb_assert (objfile || (sym->symtab && sym->symtab->objfile));
> +
> +  if (objfile == NULL)
> +    objfile = sym->symtab->objfile;

Huh.  If that's true, why does fixup_symbol_section even have an
OBJFILE argument?  Is there ever a situation where we cannot use
sym->symtab->objfile?

> +  switch (SYMBOL_CLASS (sym))
> +    {
> +    case LOC_UNRESOLVED:
> +      addr = ~(CORE_ADDR) 0;
> +      break;

Why do we need to fixup the section for an LOC_UNRESOLVED symbol?

I understand that every time we want to use the address of a
LOC_UNRESOLVED, the user needs to look up the msymbol anyway.
They should then use the section from the msymbol too, right?


> +  switch (SYMBOL_CLASS (psym))
> +    {
> +    case LOC_STATIC:
> +    case LOC_BLOCK:
> +      addr = SYMBOL_VALUE_ADDRESS (psym);
> +      break;
> +    default:
> +      /* Nothing else will be listed in the minsyms -- no use looking
> +	 it up.  */
> +      return psym;
> +    }

Any reason for not supporting LOC_LABEL or LOC_INDIRECT for psymbols?

(Well, except from the fact that apparently none of the symbol readers
left in GDB will ever generate LOC_INDIRECT ...  But at least mdebugread.c
will generate LOC_LABEL psymbols, it seems.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


             reply	other threads:[~2008-05-13 21:12 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-14  1:11 Ulrich Weigand [this message]
2008-05-14  8:07 ` Pedro Alves
2008-05-15 18:19   ` [patch] " Ulrich Weigand
2008-05-15 18:55     ` Pedro Alves
2008-05-16 15:58       ` Ulrich Weigand
  -- strict thread matches above, loose matches on Subject: below --
2008-04-23 22:24 [patch] [2/2] Discontiguous PSYMTABs (psymtabs->symtabs by addrmap) Jan Kratochvil
2008-05-12 22:24 ` Overlay support broken (Re: [patch] [2/2] Discontiguous PSYMTABs (psymtabs->symtabs by addrmap)) Ulrich Weigand
2008-05-12 22:37   ` Michael Snyder
2008-05-13  1:39     ` Daniel Jacobowitz
2008-05-13  3:17       ` Jan Kratochvil
2008-05-13 15:37       ` Doug Evans
2008-05-13 15:42       ` Michael Snyder
2008-05-13 15:31     ` Doug Evans
2008-05-12 23:52   ` Jan Kratochvil
2008-05-13 18:45     ` Ulrich Weigand
2008-05-13 19:08       ` Pedro Alves
2008-05-13 19:01         ` Pedro Alves
2008-05-13 19:11         ` Michael Snyder
2008-05-15 16:39       ` Jan Kratochvil
2008-05-15 18:16         ` Ulrich Weigand
2008-05-15 18:44           ` Daniel Jacobowitz
2008-05-15 19:06             ` Ulrich Weigand
2008-05-16 18:32             ` Ulrich Weigand
2008-05-15 19:18         ` Michael Snyder

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=200805132112.m4DLCKfr018490@d12av02.megacenter.de.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=pedro@codesourcery.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