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]

gdb not detecting function sections correctly for functions in overlays


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


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