Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Arnab Bhaduri <arnab@cadence.com>
Cc: "gdb\@sourceware.org" <gdb@sourceware.org>
Subject: Re: gdb not detecting function sections correctly for functions in overlays
Date: Thu, 10 Oct 2013 18:03:00 -0000	[thread overview]
Message-ID: <8761t580mi.fsf@fleche.redhat.com> (raw)
In-Reply-To: <D3CD0638AD056342925227F12D6A2AB50913A859FE@MAILSJ3.global.cadence.com>	(Arnab Bhaduri's message of "Fri, 6 Sep 2013 13:01:56 -0700")

>>>>> "Arnab" == Arnab Bhaduri <arnab@cadence.com> writes:

Arnab> When it detects the overlay being changed, it sets the
Arnab> breakpoints, but in the wrong overlay. As far as I can tell, it
Arnab> does this because it looks up the function's address from its
Arnab> name, then uses the address to find the function's section
Arnab> (fixup_section() in symtab.c). But, since all the overlay
Arnab> sections share the same starting VMA address, this lookup finds
Arnab> the first matching section which is not always the correct one.

Arnab> Since objdump --syms does show the section name for foo() and bar()
Arnab> correctly, I assume the information exists somewhere. It seems like
Arnab> gdb should be using somewhat different logic to map a function in an
Arnab> overlay to the correct section. Did I understand things correctly so
Arnab> far, or have I missed something else that is supposed to handle this
Arnab> case ?

objdump --syms will show the ELF symbols, but not the DWARF symbols.
But if you have debuginfo, gdb will generally prefer the DWARF.
This may explain the discrepancy there.

Maybe this is a regression from my patch series to change how symbol
sections are represented.  That would be my guess, anyway, if earlier
versions of gdb worked.

Anyway, there is no high road to fixing this -- just debugging gdb.

I don't think there's a good way of associating a DWARF symbol with a
particular overlay.  That seems to be the root of the problem to me.

Tom


  reply	other threads:[~2013-10-10 18:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-06 20:02 Arnab Bhaduri
2013-10-10 18:03 ` Tom Tromey [this message]
2013-10-14 16:29   ` Arnab Bhaduri
2013-10-22 16:53     ` Tom Tromey
2013-10-22 17:32       ` Pedro Alves
2013-10-22 17:38         ` Arnab Bhaduri

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=8761t580mi.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=arnab@cadence.com \
    --cc=gdb@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