diff options
author | Joel Brobecker <brobecker@gnat.com> | 2008-06-02 03:12:33 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2008-06-02 03:12:33 +0000 |
commit | 40adab563498d4bf43511b99c5dba55e241ecf58 (patch) | |
tree | f23b785979806fac0a42d0178565938a3c7bd10c /gdb | |
parent | 4e53207b5246a815f09374adef7b7b680e18a44f (diff) | |
download | gdb-40adab563498d4bf43511b99c5dba55e241ecf58.zip gdb-40adab563498d4bf43511b99c5dba55e241ecf58.tar.gz gdb-40adab563498d4bf43511b99c5dba55e241ecf58.tar.bz2 |
* 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')
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/rs6000-aix-tdep.c | 19 |
2 files changed, 21 insertions, 4 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 55ac929..7061b8d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2008-06-01 Joel Brobecker <brobecker@adacore.com> + + * 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. + 2008-05-30 Joel Brobecker <brobecker@adacore.com> * alpha-tdep.c (alpha_heuristic_frame_unwind_cache): Set diff --git a/gdb/rs6000-aix-tdep.c b/gdb/rs6000-aix-tdep.c index 43a3a0a..6edea05 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; } |