Index: ppc-linux-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v retrieving revision 1.81 diff -a -u -r1.81 ppc-linux-tdep.c --- ppc-linux-tdep.c 9 Jan 2007 17:58:55 -0000 1.81 +++ ppc-linux-tdep.c 8 Feb 2007 01:11:15 -0000 @@ -753,11 +753,57 @@ CORE_ADDR addr, struct target_ops *targ) { + CORE_ADDR addr2deref = 0; struct section_table *s = target_section_by_addr (targ, addr); + char buf[sizeof (ULONGEST)]; + struct objfile *objfile; + struct obj_section *osect; + asection *sect; + CORE_ADDR sect_addr; /* Check if ADDR points to a function descriptor. */ - if (s && strcmp (s->the_bfd_section->name, ".opd") == 0) - return get_target_memory_unsigned (targ, addr, 8); + + + if (s) + { + if (strcmp (s->the_bfd_section->name, ".opd") != 0) + /* Found a the section, but it's not an .opd section. */ + return addr; + addr2deref = addr; + } + else + /* The followin table search has been copied from printcmd.c */ + ALL_OBJSECTIONS (objfile, osect) + { + /* Only process each object file once, even if there's a separate + debug file. */ + if (objfile->separate_debug_objfile_backlink) + continue; + + sect = osect->the_bfd_section; + sect_addr = overlay_mapped_address (addr, sect); + + if (osect->addr <= sect_addr && sect_addr < osect->endaddr) + { + if (strcmp (sect->name, ".opd") != 0) + /* Found the section, but it's not an .opd section. */ + return addr; + addr2deref = addr; + break; + } + } + + if (addr2deref) + { + if (targ != ¤t_target) + return get_target_memory_unsigned (targ, addr2deref, 8); + else + { + gdb_assert (8 <= sizeof (buf)); + target_read_memory(addr, buf, 8); + return extract_unsigned_integer (buf, 8); + } + } return addr; }