wrong section when using find_pc_section

freenix van.freenix@gmail.com
Fri Aug 9 11:48:00 GMT 2013


I am trying add gdb support for dynamically loaded files for RTEMS. But 
when 'disas' a function, it `disas` a wrong function, but not the 
function name passed to `disas`.

I found that `disas` uses find_pc_section to locate the section which 
contains the symbol passed to disas. It uses a bsearch function to do 
the searching.
But if two sections are overlapped, find_pc_section can not correctly 
return the section contains the address.

For example, the start address of section s1 is 0x2000, end address is 
0x5000; the start address of section s2 is 0x3000, end address is 
0x4000. Thus section s2 is inside section s1.
The address passed to find_pc_section is 0x3500, which section should 
find_pc_section return?
I think it may return s1 or s2.
To my platform, it always return s1, but not s2 which is what i want.
is this a bug?  any advices? many thanks.

More information about the Gdb mailing list