sim: profile: implement --profile-file backend
[deliverable/binutils-gdb.git] / gdb / rs6000-aix-tdep.c
index 643d625dbe70731eedea6e9750e8553842f3a832..b7ffc8e51d3b6ce669ff89937cc75d3f15a92742 100644 (file)
@@ -1,6 +1,6 @@
 /* Native support code for PPC AIX, for GDB the GNU debugger.
 
-   Copyright (C) 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright (C) 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
 
    Free Software Foundation, Inc.
 
@@ -34,6 +34,7 @@
 #include "breakpoint.h"
 #include "rs6000-tdep.h"
 #include "ppc-tdep.h"
+#include "exceptions.h"
 
 /* Hook for determining the TOC address when calling functions in the
    inferior under AIX. The initialization code in rs6000-nat.c sets
@@ -582,9 +583,22 @@ rs6000_convert_from_func_ptr_addr (struct gdbarch *gdbarch,
      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, tdep->wordsize, byte_order);
-      struct obj_section *pc_section = find_pc_section (pc);
+      CORE_ADDR pc = 0;
+      struct obj_section *pc_section;
+      struct gdb_exception e;
+
+      TRY_CATCH (e, RETURN_MASK_ERROR)
+        {
+          pc = read_memory_unsigned_integer (addr, tdep->wordsize, byte_order);
+        }
+      if (e.reason < 0)
+        {
+          /* An error occured during reading.  Probably a memory error
+             due to the section not being loaded yet.  This address
+             cannot be a function descriptor.  */
+          return addr;
+        }
+      pc_section = find_pc_section (pc);
 
       if (pc_section && (pc_section->the_bfd_section->flags & SEC_CODE))
         return pc;
@@ -671,6 +685,7 @@ static int
 rs6000_software_single_step (struct frame_info *frame)
 {
   struct gdbarch *gdbarch = get_frame_arch (frame);
+  struct address_space *aspace = get_frame_address_space (frame);
   enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
   int ii, insn;
   CORE_ADDR loc;
@@ -697,7 +712,7 @@ rs6000_software_single_step (struct frame_info *frame)
       /* ignore invalid breakpoint. */
       if (breaks[ii] == -1)
        continue;
-      insert_single_step_breakpoint (gdbarch, breaks[ii]);
+      insert_single_step_breakpoint (gdbarch, aspace, breaks[ii]);
     }
 
   errno = 0;                   /* FIXME, don't ignore errors! */
This page took 0.028386 seconds and 4 git commands to generate.