This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
wrong section when using find_pc_section
- From: freenix <van dot freenix at gmail dot com>
- To: gdb at sourceware dot org
- Date: Fri, 09 Aug 2013 19:46:22 +0800
- Subject: wrong section when using find_pc_section
Hi,
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.