From: Arnab Bhaduri <arnab@cadence.com>
To: "gdb@sourceware.org" <gdb@sourceware.org>
Subject: gdb not detecting function sections correctly for functions in overlays
Date: Fri, 06 Sep 2013 20:02:00 -0000 [thread overview]
Message-ID: <D3CD0638AD056342925227F12D6A2AB50913A859FE@MAILSJ3.global.cadence.com> (raw)
Hello,
I'm working with the Xtensa version of gdb, based off version 7.5.91. There are local patches applied, but as far as I can tell they do not affect the problem here.
While debugging overlays, I created an executable with two overlays, which are each in their own section (say .overlay0 and .overlay1). The first, .overlay0, has a function foo(), the second has a function bar(). Since the overlays are mapped at the same VMA, both functions have the same start address. When I set a breakpoint on bar(), gdb sets the breakpoint at the correct address. It also (correctly) does not set the breakpoint to the target right away. When it detects the overlay being changed, it sets the breakpoints, but in the wrong overlay. As far as I can tell, it does this because it looks up the function's address from its name, then uses the address to find the function's section (fixup_section() in symtab.c). But, since all the overlay sections share the same starting VMA address, this lookup finds the first matching section which is not always the correct one.
Since objdump --syms does show the section name for foo() and bar() correctly, I assume the information exists somewhere. It seems like gdb should be using somewhat different logic to map a function in an overlay to the correct section. Did I understand things correctly so far, or have I missed something else that is supposed to handle this case ? I am not very familiar with gdb sources so the latter is entirely possible. Any advice would be most welcome.
Thanks
Arnab
next reply other threads:[~2013-09-06 20:02 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-06 20:02 Arnab Bhaduri [this message]
2013-10-10 18:03 ` Tom Tromey
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=D3CD0638AD056342925227F12D6A2AB50913A859FE@MAILSJ3.global.cadence.com \
--to=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