Cleanups and signal handler backtrace fix for GNU/Linux PPC port.
[deliverable/binutils-gdb.git] / gdb / h8500-tdep.c
index 2ed8e37c061f455b31c021aac6dbfeedef4ad631..b6ac28c0868177fef95ab5918544b44a340776a7 100644 (file)
@@ -1,25 +1,26 @@
 /* Target-dependent code for Hitachi H8/500, for GDB.
    Copyright 1993, 1994, 1995 Free Software Foundation, Inc.
 
-This file is part of GDB.
+   This file is part of GDB.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
 
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
 
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
 
 /*
- Contributed by Steve Chamberlain
-                sac@cygnus.com
  Contributed by Steve Chamberlain
+   sac@cygnus.com
  */
 
 #include "defs.h"
@@ -45,20 +46,20 @@ static int data_size = 2;
    arg-2
    arg-1
    return address <2 or 4 bytes>
-   old fp        <2 bytes>
+   old fp         <2 bytes>
    auto-n
    ..
    auto-1
    saved registers
 
-*/
+ */
 
 /* an easy to debug H8 stack frame looks like:
-0x6df6         push    r6
-0x0d76         mov.w   r7,r6
-0x6dfn          push    reg
-0x7905 nnnn    mov.w  #n,r5    or   0x1b87  subs #2,sp
-0x1957         sub.w  r5,sp
+   0x6df6               push    r6
+   0x0d76       mov.w   r7,r6
+   0x6dfn          push    reg
+   0x7905 nnnn          mov.w  #n,r5    or   0x1b87  subs #2,sp
+   0x1957               sub.w  r5,sp
 
  */
 
@@ -98,6 +99,13 @@ h8500_skip_prologue (start_pc)
   return start_pc;
 }
 
+CORE_ADDR
+h8500_addr_bits_remove (addr)
+     CORE_ADDR addr;
+{
+  return ((addr) & 0xffffff);
+}
+
 /* Given a GDB frame, determine the address of the calling function's frame.
    This will be used to create a new GDB frame struct, and then
    INIT_EXTRA_FRAME_INFO and INIT_FRAME_PC will be called for the new frame.
@@ -118,7 +126,7 @@ h8500_frame_chain (thisframe)
 /* Fetch the instruction at ADDR, returning 0 if ADDR is beyond LIM or
    is not the address of a valid instruction, the address of the next
    instruction beyond ADDR otherwise.  *PWORD1 receives the first word
-   of the instruction.*/
+   of the instruction. */
 
 CORE_ADDR
 NEXT_PROLOGUE_INSN (addr, lim, pword1)
@@ -154,7 +162,7 @@ frame_saved_pc (frame)
   return read_memory_integer (FRAME_FP (frame) + 2, PTR_SIZE);
 }
 
-void 
+void
 h8500_pop_frame ()
 {
   unsigned regnum;
@@ -321,9 +329,9 @@ frame_find_saved_regs (frame_info, frame_saved_regs)
     {
       pc = get_pc_function_start ((frame_info)->pc);
       /* Verify we have a link a6 instruction next;
-        if not we lose.  If we win, find the address above the saved
-        regs using the amount of storage from the link instruction.
-        */
+         if not we lose.  If we win, find the address above the saved
+         regs using the amount of storage from the link instruction.
+       */
 
       thebyte = read_memory_integer (pc, 1);
       if (0x1f == thebyte)
@@ -395,38 +403,6 @@ saved_pc_after_call ()
   return x;
 }
 
-#if 0  /* never called */
-/* Nonzero if instruction at PC is a return instruction.  */
-
-int
-about_to_return (pc)
-     CORE_ADDR pc;
-{
-  int b1 = read_memory_integer (pc, 1);
-
-  switch (b1)
-    {
-    case 0x14:                 /* rtd #8 */
-    case 0x1c:                 /* rtd #16 */
-    case 0x19:                 /* rts */
-    case 0x1a:                 /* rte */
-      return 1;
-    case 0x11:
-      {
-       int b2 = read_memory_integer (pc + 1, 1);
-       switch (b2)
-         {
-         case 0x18:            /* prts */
-         case 0x14:            /* prtd #8 */
-         case 0x16:            /* prtd #16 */
-           return 1;
-         }
-      }
-    }
-  return 0;
-}
-#endif
-
 void
 h8500_set_pointer_size (newsize)
      int newsize;
@@ -548,7 +524,7 @@ h8500_value_of_trapped_internalvar (var)
   regval = regbuf[0] << 16;
 
   get_saved_register (regbuf, NULL, NULL, selected_frame, regnum, NULL);
-  regval |= regbuf[0] << 8 | regbuf[1];        /* XXX host/target byte order */
+  regval |= regbuf[0] << 8 | regbuf[1];                /* XXX host/target byte order */
 
   free (var->value);           /* Free up old value */
 
@@ -572,14 +548,14 @@ h8500_set_trapped_internalvar (var, newval, bitpos, bitsize, offset)
   struct type *type;
   enum type_code newval_type_code;
 
-  type = VALUE_TYPE (newval);
+  type = check_typedef (VALUE_TYPE (newval));
   newval_type_code = TYPE_CODE (type);
 
   if ((newval_type_code != TYPE_CODE_INT
        && newval_type_code != TYPE_CODE_PTR)
       || TYPE_LENGTH (type) != sizeof (new_regval))
     error ("Illegal type (%s) for assignment to $%s\n",
-          TYPE_NAME (type), var->name);
+          TYPE_NAME (VALUE_TYPE (newval)), var->name);
 
   new_regval = *(long *) VALUE_CONTENTS_RAW (newval);
 
@@ -664,15 +640,15 @@ _initialize_h8500_tdep ()
                  &setlist);
 
   add_cmd ("small", class_support, small_command,
-          "Set small memory model. (16 bit code, 16 bit data)", &setmemorylist);
+      "Set small memory model. (16 bit code, 16 bit data)", &setmemorylist);
 
   add_cmd ("big", class_support, big_command,
-          "Set big memory model. (32 bit code, 32 bit data)", &setmemorylist);
+       "Set big memory model. (32 bit code, 32 bit data)", &setmemorylist);
 
   add_cmd ("medium", class_support, medium_command,
-          "Set medium memory model. (32 bit code, 16 bit data)", &setmemorylist);
+     "Set medium memory model. (32 bit code, 16 bit data)", &setmemorylist);
 
   add_cmd ("compact", class_support, compact_command,
-          "Set compact memory model. (16 bit code, 32 bit data)", &setmemorylist);
+    "Set compact memory model. (16 bit code, 32 bit data)", &setmemorylist);
 
 }
This page took 0.042323 seconds and 4 git commands to generate.