summaryrefslogtreecommitdiff
path: root/gdb/rs6000-aix-tdep.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-06-02 03:12:33 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-06-02 03:12:33 +0000
commit3c487c78fc460c6853fe53ca38a93f55c386f5fa (patch)
treea4d904a41efced69f8417fad44a0c9f89b689c68 /gdb/rs6000-aix-tdep.c
parentf86c291251ab2a7c0a46b80919adf0d2bac7c424 (diff)
downloadgdb-3c487c78fc460c6853fe53ca38a93f55c386f5fa.tar.gz
* rs6000-aix-tdep.c (rs6000_convert_from_func_ptr_addr): Do not
treat pointers in data space as function descriptors if the target address is also in the data space.
Diffstat (limited to 'gdb/rs6000-aix-tdep.c')
-rw-r--r--gdb/rs6000-aix-tdep.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c
index 43a3a0a1bb3..6edea05666b 100644
--- a/gdb/rs6000-aix-tdep.c
+++ b/gdb/rs6000-aix-tdep.c
@@ -570,11 +570,22 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
struct obj_section *s;
s = find_pc_section (addr);
- if (s && s->the_bfd_section->flags & SEC_CODE)
- return addr;
- /* ADDR is in the data space, so it's a special function pointer. */
- return read_memory_unsigned_integer (addr, gdbarch_tdep (gdbarch)->wordsize);
+ /* Normally, functions live inside a section that is executable.
+ So, if ADDR points to a non-executable section, then treat it
+ as a function descriptor and return the target address iff
+ the target address itself points to a section that is executable. */
+ if (s && (s->the_bfd_section->flags & SEC_CODE) == 0)
+ {
+ CORE_ADDR pc =
+ read_memory_unsigned_integer (addr, gdbarch_tdep (gdbarch)->wordsize);
+ struct obj_section *pc_section = find_pc_section (pc);
+
+ if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
+ return pc;
+ }
+
+ return addr;
}