This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: gdb not detecting function sections correctly for functions in overlays
- From: Tom Tromey <tromey at redhat dot com>
- To: Arnab Bhaduri <arnab at cadence dot com>
- Cc: "gdb\ at sourceware dot org" <gdb at sourceware dot org>
- Date: Thu, 10 Oct 2013 12:03:01 -0600
- Subject: Re: gdb not detecting function sections correctly for functions in overlays
- Authentication-results: sourceware.org; auth=none
- References: <D3CD0638AD056342925227F12D6A2AB50913A859FE at MAILSJ3 dot global dot cadence dot com>
>>>>> "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