* MAINTAINERS: Change my e-mail address.
[deliverable/binutils-gdb.git] / gdb / s390-tdep.c
index 69463ab83cae30340afe63696ee683dce27820db..bc82646b57f4ad4987a055f283d0a6cf49a2be3e 100644 (file)
@@ -39,7 +39,7 @@
 #include "regcache.h"
 #include "value.h"
 #include "gdb_assert.h"
-
+#include "dis-asm.h"
 
 
 
@@ -113,6 +113,7 @@ struct frame_extra_info
   CORE_ADDR sig_fixed_saved_pc_valid;
   CORE_ADDR sig_fixed_saved_pc;
   CORE_ADDR frame_pointer_saved_pc;    /* frame pointer needed for alloca */
+  CORE_ADDR stack_bought_valid;
   CORE_ADDR stack_bought;      /* amount we decrement the stack pointer by */
   CORE_ADDR sigcontext;
 };
@@ -121,8 +122,7 @@ struct frame_extra_info
 static CORE_ADDR s390_frame_saved_pc_nofix (struct frame_info *fi);
 
 static int
-s390_readinstruction (bfd_byte instr[], CORE_ADDR at,
-                     struct disassemble_info *info)
+s390_readinstruction (bfd_byte instr[], CORE_ADDR at)
 {
   int instrlen;
 
@@ -132,12 +132,12 @@ s390_readinstruction (bfd_byte instr[], CORE_ADDR at,
     4,
     6
   };
-  if ((*info->read_memory_func) (at, &instr[0], 2, info))
+  if (target_read_memory (at, &instr[0], 2))
     return -1;
   instrlen = s390_instrlen[instr[0] >> 6];
   if (instrlen > 2)
     {
-      if ((*info->read_memory_func) (at + 2, &instr[2], instrlen - 2, info))
+      if (target_read_memory (at + 2, &instr[2], instrlen - 2))
         return -1;
     }
   return instrlen;
@@ -935,9 +935,6 @@ s390_get_frame_info (CORE_ADDR start_pc,
      -1 if we got an error trying to read memory.  */
   int result = 0;
 
-  /* We just use this for reading instructions.  */
-  disassemble_info info;
-
   /* The current PC for our abstract interpretation.  */
   CORE_ADDR pc;
 
@@ -965,8 +962,6 @@ s390_get_frame_info (CORE_ADDR start_pc,
      the SP, FP, or back chain.  */
   CORE_ADDR after_last_frame_setup_insn = start_pc;
 
-  info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
-
   /* Set up everything's initial value.  */
   {
     int i;
@@ -990,7 +985,7 @@ s390_get_frame_info (CORE_ADDR start_pc,
   for (pc = start_pc; ; pc = next_pc)
     {
       bfd_byte insn[S390_MAX_INSTR_SIZE];
-      int insn_len = s390_readinstruction (insn, pc, &info);
+      int insn_len = s390_readinstruction (insn, pc);
 
       /* Fields for various kinds of instructions.  */
       unsigned int b2, r1, r2, d2, x2, r3;
@@ -1392,6 +1387,7 @@ s390_get_frame_info (CORE_ADDR start_pc,
 
         if (frame_size != -1)
           {
+            fextra_info->stack_bought_valid = 1;
             fextra_info->stack_bought = frame_size;
           }
 
@@ -1485,11 +1481,9 @@ static int
 s390_check_function_end (CORE_ADDR pc)
 {
   bfd_byte instr[S390_MAX_INSTR_SIZE];
-  disassemble_info info;
   int regidx, instrlen;
 
-  info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
-  instrlen = s390_readinstruction (instr, pc, &info);
+  instrlen = s390_readinstruction (instr, pc);
   if (instrlen < 0)
     return -1;
   /* check for BR */
@@ -1498,7 +1492,7 @@ s390_check_function_end (CORE_ADDR pc)
   regidx = instr[1] & 0xf;
   /* Check for LMG or LG */
   instrlen =
-    s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 6 : 4), &info);
+    s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 6 : 4));
   if (instrlen < 0)
     return -1;
   if (GDB_TARGET_IS_ESAME)
@@ -1515,8 +1509,7 @@ s390_check_function_end (CORE_ADDR pc)
     return 0;
   if (regidx == 14)
     return 1;
-  instrlen = s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 12 : 8),
-                                  &info);
+  instrlen = s390_readinstruction (instr, pc - (GDB_TARGET_IS_ESAME ? 12 : 8));
   if (instrlen < 0)
     return -1;
   if (GDB_TARGET_IS_ESAME)
@@ -1604,7 +1597,8 @@ s390_frameless_function_invocation (struct frame_info *fi)
          s390_get_frame_info (s390_sniff_pc_function_start (get_frame_pc (fi), fi),
                               fextra_info_ptr, fi, 1);
        }
-      frameless = ((fextra_info_ptr->stack_bought == 0));
+      frameless = (fextra_info_ptr->stack_bought_valid
+                   && fextra_info_ptr->stack_bought == 0);
     }
   return frameless;
 
@@ -1616,7 +1610,6 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi,
                   CORE_ADDR *sregs, CORE_ADDR *sigcaller_pc)
 {
   bfd_byte instr[S390_MAX_INSTR_SIZE];
-  disassemble_info info;
   int instrlen;
   CORE_ADDR scontext;
   int retval = 0;
@@ -1625,8 +1618,7 @@ s390_is_sigreturn (CORE_ADDR pc, struct frame_info *sighandler_fi,
 
   scontext = temp_sregs = 0;
 
-  info.read_memory_func = deprecated_tm_print_insn_info.read_memory_func;
-  instrlen = s390_readinstruction (instr, pc, &info);
+  instrlen = s390_readinstruction (instr, pc);
   if (sigcaller_pc)
     *sigcaller_pc = 0;
   if (((instrlen == S390_SYSCALL_SIZE) &&
@@ -1968,26 +1960,6 @@ s390_store_return_value (struct type *valtype, char *valbuf)
                                       value, arglen);
     }
 }
-static int
-gdb_print_insn_s390 (bfd_vma memaddr, disassemble_info * info)
-{
-  bfd_byte instrbuff[S390_MAX_INSTR_SIZE];
-  int instrlen, cnt;
-
-  instrlen = s390_readinstruction (instrbuff, (CORE_ADDR) memaddr, info);
-  if (instrlen < 0)
-    {
-      (*info->memory_error_func) (instrlen, memaddr, info);
-      return -1;
-    }
-  for (cnt = 0; cnt < instrlen; cnt++)
-    info->fprintf_func (info->stream, "%02X ", instrbuff[cnt]);
-  for (cnt = instrlen; cnt < S390_MAX_INSTR_SIZE; cnt++)
-    info->fprintf_func (info->stream, "   ");
-  instrlen = print_insn_s390 (memaddr, info);
-  return instrlen;
-}
-
 
 
 /* Not the most efficent code in the world */
@@ -2564,7 +2536,7 @@ s390_addr_bits_remove (CORE_ADDR addr)
 static CORE_ADDR
 s390_push_return_address (CORE_ADDR pc, CORE_ADDR sp)
 {
-  write_register (S390_RETADDR_REGNUM, CALL_DUMMY_ADDRESS ());
+  write_register (S390_RETADDR_REGNUM, entry_point_address ());
   return sp;
 }
 
@@ -2719,6 +2691,8 @@ s390_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* Should be using push_dummy_call.  */
   set_gdbarch_deprecated_dummy_write_sp (gdbarch, deprecated_write_sp);
 
+  set_gdbarch_print_insn (gdbarch, print_insn_s390);
+
   return gdbarch;
 }
 
@@ -2732,6 +2706,4 @@ _initialize_s390_tdep (void)
 
   /* Hook us into the gdbarch mechanism.  */
   register_gdbarch_init (bfd_arch_s390, s390_gdbarch_init);
-  if (!deprecated_tm_print_insn)       /* Someone may have already set it */
-    deprecated_tm_print_insn = gdb_print_insn_s390;
 }
This page took 0.02619 seconds and 4 git commands to generate.