To: address@hidden Subject: BUG REPORT 1. GDB version 6.1 and lower 2. Native platform is `i686-pc-linux-gnu', target platform is `mips64-*-*' 3. GDB was compiled with GCC 3.2.2 4. The debugged program was compiled with GCC 3.4 5. Options used for compilation of the debugged program: "-g -G 0 -c" 6. The debugged program: a.c: int a() { return 0; } int __attribute__ ((section ("faraway"))) b() { return 1; } int c() { return 2; } b.c: int d() { return 3; } int main() { a(); b(); c(); d(); return 4; } 7. Compile a.c with DWARF2 debugging info and b.c without any debugging info: gcc -gdwarf-2 -O0 -o a.o a.c gcc -O2 -o b.o b.c And link it together: gcc -o ab a.o b.o Run GDB and try to set breakpoint on the function main (or d): (gdb) b main Breakpoint 1 at ... file a.c, line 14 But with DWARF1 debugging info we get the correct situation: (gdb) b main Breakpoint 1 at ... 8. I suppose that the cause of the problem is that we use this code in the file dwarf2read.c: ... static char * scan_partial_symbols (char *info_ptr, struct objfile *objfile, CORE_ADDR *lowpc, CORE_ADDR *highpc, const struct comp_unit_head *cu_header, const char *namespace) { ... struct partial_die_info pdi; ... switch (pdi.tag) { case DW_TAG_subprogram: if (pdi.has_pc_info) { if (pdi.lowpc < *lowpc) { *lowpc = pdi.lowpc; } if (pdi.highpc > *highpc) { *highpc = pdi.highpc; } if (!pdi.is_declaration) { add_partial_symbol (&pdi, objfile, cu_header, namespace); } } break; ... In our case, section "faraway" based after ".text" and so addresses of the functions d and main "belongs" to the "a.c" compilation unit. But it false! We need to correct this problem. I think that we must search through the "ranges" table and get proper ranges from there. Best regards, Konstantin Kostyuhin