* bfd.c (union tdata): Add nlm_obj_data;
[deliverable/binutils-gdb.git] / gdb / rs6000-tdep.c
index 4d1b73a492938dbe9feb7572d22bffdc5ae7619c..e8d9af84c8b69364638bbda5b3a155b7a0339df7 100644 (file)
@@ -106,8 +106,15 @@ branch_dest (opcode, instr, pc, safety)
          dest = read_register (LR_REGNUM) & ~3;
 
        else if (ext_op == 528)                 /* br cond to count reg */
-         dest = read_register (CTR_REGNUM) & ~3;
-
+         {
+           dest = read_register (CTR_REGNUM) & ~3;
+
+           /* If we are about to execute a system call, dest is something
+              like 0x22fc or 0x3b00.  Upon completion the system call
+              will return to the address in the link register.  */
+           if (dest < TEXT_SEGMENT_BASE)
+             dest = read_register (LR_REGNUM) & ~3;
+         }
        else return -1; 
        break;
        
@@ -180,12 +187,13 @@ single_step (signal)
 skip_prologue (pc)
 CORE_ADDR pc;
 {
+  char buf[4];
   unsigned int tmp;
-  unsigned int op;    /* FIXME, assumes instruction size matches host int!!! */
+  unsigned long op;
 
-  if (target_read_memory (pc, (char *)&op, sizeof (op)))
+  if (target_read_memory (pc, buf, 4))
     return pc;                 /* Can't access it -- assume no prologue. */
-  SWAP_TARGET_AND_HOST (&op, sizeof (op));
+  op = extract_unsigned_integer (buf, 4);
 
   /* Assume that subsequent fetches can fail with low probability.  */
 
@@ -892,23 +900,6 @@ extract_return_value (valtype, regbuf, valbuf)
 CORE_ADDR rs6000_struct_return_address;
 
 
-/* Throw away this debugging code. FIXMEmgo. */
-void
-print_frame(fram)
-int fram;
-{
-  int ii, val;
-  for (ii=0; ii<40; ++ii) {
-    if ((ii % 4) == 0)
-      printf ("\n");
-    val = read_memory_integer (fram + ii * 4, 4);
-    printf ("0x%08x\t", val);
-  }
-  printf ("\n");
-}
-
-
-
 /* Indirect function calls use a piece of trampoline code to do context
    switching, i.e. to set the new TOC table. Skip such code if we are on
    its first instruction (as when we have single-stepped to here). 
@@ -1091,6 +1082,32 @@ frame_initial_stack_address (fi)
   return fi->initial_sp = read_register (fdata.alloca_reg);     
 }
 
+FRAME_ADDR
+rs6000_frame_chain (thisframe)
+     struct frame_info *thisframe;
+{
+  FRAME_ADDR fp;
+  if (inside_entry_file ((thisframe)->pc))
+    return 0;
+  if (thisframe->signal_handler_caller)
+    {
+      /* This was determined by experimentation on AIX 3.2.  Perhaps
+        it corresponds to some offset in /usr/include/sys/user.h or
+        something like that.  Using some system include file would
+        have the advantage of probably being more robust in the face
+        of OS upgrades, but the disadvantage of being wrong for
+        cross-debugging.  */
+
+#define SIG_FRAME_FP_OFFSET 284
+      fp = read_memory_integer (thisframe->frame + SIG_FRAME_FP_OFFSET, 4);
+    }
+  else
+    fp = read_memory_integer ((thisframe)->frame, 4);
+
+  return fp;
+}
+
+\f
 /* xcoff_relocate_symtab -     hook for symbol table relocation.
    also reads shared libraries.. */
 
This page took 0.02418 seconds and 4 git commands to generate.