* hppa-tdep.c (hppa_push_arguments): Allocate enough space for
[deliverable/binutils-gdb.git] / gdb / convex-tdep.c
index c206e1ed78c8c816416859a02bdab5ac833e4122..bd1a6b7fe379536a5a01e251fec7ab8277384c14 100644 (file)
@@ -1,25 +1,23 @@
 /* Convex stuff for GDB.
-   Copyright (C) 1990 Free Software Foundation, Inc.
+   Copyright (C) 1990, 1991 Free Software Foundation, Inc.
 
 This file is part of GDB.
 
-GDB is free software; you can redistribute it and/or modify
+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 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
 
-GDB is distributed in the hope that it will be useful,
+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 GDB; see the file COPYING.  If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
-#include <stdio.h>
 #include "defs.h"
-#include "param.h"
 #include "command.h"
 #include "symtab.h"
 #include "value.h"
@@ -318,9 +316,9 @@ is_trapped_internalvar (name)
 
   if ((name[0] == 'v' || name[0] == 'V')
       && (((name[1] & -8) == '0' && name[2] == '\0')
-         || !strcmp (name, "vl")
-         || !strcmp (name, "vs") 
-         || !strcmp (name, "vm")))
+         || STREQ (name, "vl")
+         || STREQ (name, "vs") 
+         || STREQ (name, "vm")))
     return 1;
   else return 0;
 }
@@ -334,25 +332,29 @@ value_of_trapped_internalvar (var)
   char *name = var->name;
   value val;
   struct type *type;
+  struct type *range_type;
   long len = *read_vector_register (VL_REGNUM);
   if (len <= 0 || len > 128) len = 128;
 
-  if (!strcmp (name, "vl"))
+  if (STREQ (name, "vl"))
     {
-      val = value_from_long (builtin_type_int,
+      val = value_from_longest (builtin_type_int,
                             (LONGEST) *read_vector_register_1 (VL_REGNUM));
     }
-  else if (!strcmp (name, "vs"))
+  else if (STREQ (name, "vs"))
     {
-      val = value_from_long (builtin_type_int,
+      val = value_from_longest (builtin_type_int,
                             (LONGEST) *read_vector_register_1 (VS_REGNUM));
     }
-  else if (!strcmp (name, "vm"))
+  else if (STREQ (name, "vm"))
     {
       long vm[4];
       long i, *p;
       bcopy (read_vector_register_1 (VM_REGNUM), vm, sizeof vm);
-      type = vector_type (builtin_type_int, len);
+      range_type =
+       create_range_type ((struct type *) NULL, builtin_type_int, 0, len - 1);
+      type =
+       create_array_type ((struct type *) NULL, builtin_type_int, range_type);
       val = allocate_value (type);
       p = (long *) VALUE_CONTENTS (val);
       for (i = 0; i < len; i++) 
@@ -360,7 +362,11 @@ value_of_trapped_internalvar (var)
     }
   else if (name[0] == 'V')
     {
-      type = vector_type (builtin_type_long_long, len);
+      range_type =
+       create_range_type ((struct type *) NULL, builtin_type_int 0, len - 1);
+      type =
+       create_array_type ((struct type *) NULL, builtin_type_long_long,
+                          range_type);
       val = allocate_value (type);
       bcopy (read_vector_register_1 (name[1] - '0'),
             VALUE_CONTENTS (val), TYPE_LENGTH (type));
@@ -368,7 +374,11 @@ value_of_trapped_internalvar (var)
   else if (name[0] == 'v')
     {
       long *p1, *p2;
-      type = vector_type (builtin_type_long, len);
+      range_type =
+       create_range_type ((struct type *) NULL, builtin_type_int 0, len - 1);
+      type =
+       create_array_type ((struct type *) NULL, builtin_type_long,
+                          range_type);
       val = allocate_value (type);
       p1 = read_vector_register_1 (name[1] - '0');
       p2 = (long *) VALUE_CONTENTS (val);
@@ -376,10 +386,10 @@ value_of_trapped_internalvar (var)
     }
 
   else if (name[0] == 'c')
-    val = value_from_long (builtin_type_int,
+    val = value_from_longest (builtin_type_int,
                           read_comm_register (atoi (&name[1])));
   else if (name[0] == 'C')
-    val = value_from_long (builtin_type_long_long,
+    val = value_from_longest (builtin_type_long_long,
                           read_comm_register (atoi (&name[1])));
 
   VALUE_LVAL (val) = lval_internalvar;
@@ -387,22 +397,6 @@ value_of_trapped_internalvar (var)
   return val;
 }
 
-/* Construct the type for a vector register's value --
-   array[LENGTH] of ELEMENT_TYPE.  */
-
-static struct type *
-vector_type (element_type, length)
-     struct type *element_type;
-     long length;
-{
-  struct type *type = (struct type *) xmalloc (sizeof (struct type));
-  bzero (type, sizeof type);
-  TYPE_CODE (type) = TYPE_CODE_ARRAY;
-  TYPE_TARGET_TYPE (type) = element_type;
-  TYPE_LENGTH (type) = length * TYPE_LENGTH (TYPE_TARGET_TYPE (type));
-  return type;
-}
-
 /* Handle a new value assigned to a trapped internal variable */
 
 void
@@ -414,13 +408,13 @@ set_trapped_internalvar (var, val, bitpos, bitsize, offset)
   char *name = var->name;
   long long newval = value_as_long (val);
 
-  if (!strcmp (name, "vl")) 
+  if (STREQ (name, "vl")) 
     write_vector_register (VL_REGNUM, 0, newval);
-  else if (!strcmp (name, "vs"))
+  else if (STREQ (name, "vs"))
     write_vector_register (VS_REGNUM, 0, newval);
   else if (name[0] == 'c' || name[0] == 'C')
     write_comm_register (atoi (&name[1]), newval);
-  else if (!strcmp (name, "vm"))
+  else if (STREQ (name, "vm"))
     error ("can't assign to $vm");
   else
     {
@@ -504,9 +498,9 @@ set_pipelining_command (arg)
       sequential = !sequential;
       printf_filtered ("%s\n", sequential ? "off" : "on");
     }
-  else if (!strcmp (arg, "on"))
+  else if (STREQ (arg, "on"))
     sequential = 0;
-  else if (!strcmp (arg, "off"))
+  else if (STREQ (arg, "off"))
     sequential = 1;
   else error ("valid args are `on', to allow instructions to overlap, or\n\
 `off', to prevent it and thereby pinpoint exceptions.");
@@ -523,9 +517,9 @@ set_parallel_command (arg)
 
   if (!strncmp (arg, "fixed", strlen (arg)))
     parallel = 2;  
-  else if (!strcmp (arg, "on"))
+  else if (STREQ (arg, "on"))
     parallel = 1;
-  else if (!strcmp (arg, "off"))
+  else if (STREQ (arg, "off"))
     parallel = 0;
   else error ("valid args are `on', to allow multiple threads, or\n\
 `fixed', to force multiple threads, or\n\
@@ -666,8 +660,10 @@ subsig_name (signo, subcode)
     {0, 0, 0, 0, subsig4, subsig5, 0, 0, subsig8, 0, subsig10, subsig11, 0};
 
   int i;
-  char *p = signo < NSIG ? sys_siglist[signo] : "unknown";
+  char *p;
 
+  if ((p = strsignal (signo)) == NULL)
+    p = "unknown";
   if (signo >= (sizeof subsig_list / sizeof *subsig_list)
       || !subsig_list[signo])
     return p;
@@ -723,7 +719,7 @@ set_thread_command (arg)
     set_current_frame (create_new_frame (read_register (FP_REGNUM),
                                         read_pc ()));
     select_frame (get_current_frame (), 0);
-    print_sel_frame (1);
+    print_stack_frame (selected_frame, selected_frame_level, -1);
 }
 
 /* Here on CONT command; gdb's dispatch address is changed to come here.
@@ -760,18 +756,15 @@ comm_registers_info (arg)
 
   if (arg)
     {
-      if (sscanf (arg, "0x%x", &regnum) == 1
-         || sscanf (arg, "%d", &regnum) == 1)
-       {
-         if (regnum > 0)
-           regnum &= ~0x8000;
-       }
-      else if (sscanf (arg, "$c%d", &regnum) == 1)
+             if (sscanf (arg, "$c%d", &regnum) == 1) {
        ;
-      else if (sscanf (arg, "$C%d", &regnum) == 1)
+      } else if (sscanf (arg, "$C%d", &regnum) == 1) {
        ;
-      else
+      } else {
        regnum = parse_and_eval_address (arg);
+       if (regnum > 0)
+         regnum &= ~0x8000;
+      }
 
       if (regnum >= 64)
        error ("%s: invalid register name.", arg);
This page took 0.026743 seconds and 4 git commands to generate.