This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: gdb not detecting function sections correctly for functions in overlays


Thanks for your reply. Yes, I came to the same conclusion after digging around in the DWARF information. I had not been familiar with DWARF, or else I might have reached that conclusion much sooner.

I have made a couple of local changes that make things work better for me. Perhaps you could give me your opinion on these (described below).

1) add_location_to_breakpoint() (breakpoint.c) - this calls set_breakpoint_location_function() which sets the function name incorrectly because it uses the PC-to-section lookup. I modified this like so: if the "symtab_and_line * sal" argument's section is an overlay section, and sal->symtab is not null, then walk over all the symbols in the symtab and find the one with a line number that is closest to (but not larger than) the line number specified in the sal. With this best match symbol, search all the overlay sections for a name match. If there is a match, select that overlay section and update the bp_location. Of course this will not work if e.g. I define two functions with the same name in two different overlays. In that case I warn the user and arbitrarily choose the first one found.

2) find_function_start_sal() (symtab.c) - this calls find_pc_sect_line() to look up the section, and fails when the PC-to-section lookup fails for overlays. It was not clear to me why it does not use the symtab in the symbol itself, which is passed in as an argument. I made a change here to use the symbol's symtab if it has one.

Arnab

> -----Original Message-----
> From: Tom Tromey [mailto:tromey@redhat.com]
> Subject: Re: gdb not detecting function sections correctly for functions
> in overlays
> 
> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]