* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Improve the heuristic
authorJoel Brobecker <brobecker@gnat.com>
Thu, 29 May 2008 00:19:33 +0000 (00:19 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Thu, 29 May 2008 00:19:33 +0000 (00:19 +0000)
        that identifies function descriptors outside of the .opd section.

gdb/ChangeLog
gdb/ia64-tdep.c

index b32c75e3acb346beaac8780f7de08d14821425f0..39bef3c7ba8cee301536eb523aa379dad14d0def 100644 (file)
@@ -1,3 +1,8 @@
+2008-05-28  Joel Brobecker  <brobecker@adacore.com>
+
+       * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Improve the heuristic
+       that identifies function descriptors outside of the .opd section.
+
 2008-05-28  Aleksandar Ristovski  <aristovski@qnx.com>
 
        * breakpoint.c (print_exception_catchpoint): In CLI add 'Temporary' for
index ec0d14ebbae05f3bc0bbb8a2d948b317f0a0eb90..32e0f699284f2edf1b5348d0bfd2a654d414efc5 100644 (file)
@@ -3229,11 +3229,18 @@ ia64_convert_from_func_ptr_addr (struct gdbarch *gdbarch, CORE_ADDR addr,
   if (s && strcmp (s->the_bfd_section->name, ".opd") == 0)
     return read_memory_unsigned_integer (addr, 8);
 
-  /* If ADDR points to a section that is not executable, then it cannot
-     be pointing to a function.  So it must be pointing to a function
-     descriptor.  */
+  /* 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)
-    return read_memory_unsigned_integer (addr, 8);
+    {
+      CORE_ADDR pc = read_memory_unsigned_integer (addr, 8);
+      struct obj_section *pc_section = find_pc_section (pc);
+
+      if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
+        return pc;
+    }
 
   /* There are also descriptors embedded in vtables.  */
   if (s)
This page took 0.02794 seconds and 4 git commands to generate.