The list of changes is too long to fit in the cvs log (since it truncates!).
authorJim Kingdon <jkingdon@engr.sgi.com>
Thu, 2 May 1991 04:28:42 +0000 (04:28 +0000)
committerJim Kingdon <jkingdon@engr.sgi.com>
Thu, 2 May 1991 04:28:42 +0000 (04:28 +0000)
Look at the ChangeLog for Apr 30 and May 1.

30 files changed:
gdb/Makefile.dist
gdb/Makefile.in
gdb/coffread.c
gdb/command.c
gdb/core.c
gdb/cplus-dem.c
gdb/dbxread.c
gdb/defs.h
gdb/expread.y
gdb/findvar.c
gdb/gdbcore.h
gdb/ieee-float.c
gdb/infcmd.c
gdb/infrun.c
gdb/inftarg.c
gdb/main.c
gdb/param.h
gdb/printcmd.c
gdb/remote.c
gdb/solib.c
gdb/stack.c
gdb/symfile.c
gdb/symtab.c
gdb/symtab.h
gdb/target.c
gdb/tm-68k.h
gdb/tm-sparc.h
gdb/utils.c
gdb/valprint.c
gdb/values.c

index 6c5060b07295c5d0acc4a8570e9a93481e250789..fc7efb172c6483628f81aafa589e0c576bc41fff 100755 (executable)
@@ -488,14 +488,10 @@ gdb.cxref: $(SFILES)
 
 force_update :
 
-# When used with GDB, the demangler should never look for leading underscores
-# because GDB strips them off during symbol read-in.  Thus -Dnounderscore.
-# Adding "param.h" gets us the USG define without having to edit cplus-dem.c
-# (which is used by other programs which may or may not have a "param.h").
-# (no newline is added, so line numbers still work right).
+# When used with GDB, the demangler should never look for leading
+# underscores because GDB strips them off during symbol read-in.  Thus
+# -Dnounderscore.  
+
 cplus-dem.o : cplus-dem.c
-       sed <`echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'` \
-         >cplus.tmp.c \
-         '1s,^,#include "param.h" ,'
-       ${CC} -c ${CFLAGS} -Dnounderscore cplus.tmp.c
-       mv cplus.tmp.o cplus-dem.o
+       ${CC} -c ${CFLAGS} -Dnounderscore \
+         `echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'`
index 6c5060b07295c5d0acc4a8570e9a93481e250789..fc7efb172c6483628f81aafa589e0c576bc41fff 100644 (file)
@@ -488,14 +488,10 @@ gdb.cxref: $(SFILES)
 
 force_update :
 
-# When used with GDB, the demangler should never look for leading underscores
-# because GDB strips them off during symbol read-in.  Thus -Dnounderscore.
-# Adding "param.h" gets us the USG define without having to edit cplus-dem.c
-# (which is used by other programs which may or may not have a "param.h").
-# (no newline is added, so line numbers still work right).
+# When used with GDB, the demangler should never look for leading
+# underscores because GDB strips them off during symbol read-in.  Thus
+# -Dnounderscore.  
+
 cplus-dem.o : cplus-dem.c
-       sed <`echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'` \
-         >cplus.tmp.c \
-         '1s,^,#include "param.h" ,'
-       ${CC} -c ${CFLAGS} -Dnounderscore cplus.tmp.c
-       mv cplus.tmp.o cplus-dem.o
+       ${CC} -c ${CFLAGS} -Dnounderscore \
+         `echo ${srcdir}/cplus-dem.c | sed 's,^\./,,'`
index 0472591cca836caff2fea2fe8abe5edbfb754b83..9ef0092ec942adc62f046dcc193503f8763f76be 100644 (file)
@@ -394,7 +394,7 @@ make_blockvector ()
 
 /* Manage the vector of line numbers.  */
 
-static
+static void
 record_line (line, pc)
      int line;
      CORE_ADDR pc;
@@ -616,6 +616,7 @@ coff_symfile_init (sf)
    of the line table (minimum and maximum file offset) so that the
    mainline code can read the whole thing for efficiency.  */
 
+/* ARGSUSED */
 static void
 find_linenos (abfd, asect, vpinfo)
      bfd *abfd;
@@ -653,6 +654,11 @@ find_linenos (abfd, asect, vpinfo)
 }
 
 
+/* The BFD for this file -- only good while we're actively reading
+   symbols into a psymtab or a symtab.  */
+
+static bfd *symfile_bfd;
+
 /* Read a symbol file, after initialization by coff_symfile_init.  */
 /* FIXME!  Addr and Mainline are not used yet -- this will not work for
    shared libraries or add_file!  */
@@ -1897,6 +1903,7 @@ read_struct_type (index, length, lastsym)
 /* Read a definition of an enumeration type,
    and create and return a suitable type object.
    Also defines the symbols that represent the values of the type.  */
+/* Currently assumes it's sizeof (int) and doesn't use length.  */
 
 static struct type *
 read_enum_type (index, length, lastsym)
@@ -1960,6 +1967,7 @@ read_enum_type (index, length, lastsym)
 
   /* Now fill in the fields of the type-structure.  */
 
+  /* FIXME: Should be sizeof (int) on target, not host.  */
   TYPE_LENGTH (type) = sizeof (int);
   TYPE_CODE (type) = TYPE_CODE_ENUM;
   TYPE_NFIELDS (type) = nsyms;
index dc9d5fc0ff795a277956eb08469765a306a0661f..36661be44a78d2fb5f95714b9d692d40c80a3918 100644 (file)
    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 "command.h"
 #include "symtab.h"
 #include "value.h"
-#include <stdio.h>
 #include <ctype.h>
 #include <string.h>
 
@@ -160,6 +160,7 @@ add_abbrev_prefix_cmd (name, class, fun, doc, prefixlist, prefixname,
   return c;
 }
 
+/* ARGSUSED */
 void
 not_just_help_class_command (args, from_tty, c)
      char *args;
@@ -254,8 +255,6 @@ delete_cmd (name, list)
       }
 }
 
-void help_cmd (), help_list (), help_cmd_list ();
-
 /* This command really has to deal with two things:
  *     1) I want documentation on *this string* (usually called by
  * "help commandname").
@@ -1083,6 +1082,7 @@ cmd_show_list (list, from_tty, prefix)
   }
 }
 
+/* ARGSUSED */
 static void
 shell_escape (arg, from_tty)
      char *arg;
index 00d469fc06dc3de32872bd7f3a7701ed8bacdeab..2b506a7d829949dc69a34e97244b7107845835e0 100644 (file)
@@ -56,6 +56,7 @@ extern struct target_ops core_ops;
 /* Discard all vestiges of any previous core file
    and mark data and stack spaces as empty.  */
 
+/* ARGSUSED */
 void
 core_close (quitting)
      int quitting;
@@ -390,6 +391,8 @@ core_xfer_memory (memaddr, myaddr, len, write)
    independent part.  Fetch_core_registers is the machine-dependent
    part, typically implemented in the xm-file for each architecture.  */
 
+/* We just get all the registers, so we don't use regno.  */
+/* ARGSUSED */
 static int
 get_core_registers (regno)
      int regno;
index b01cb93d5adbc43c0b5790320c77ff6c5d61ba5a..95c4529dc456e790aa2736eccf7385a3118b0c78 100644 (file)
 #include <stdio.h>
 #include <ctype.h>
 
+/* GDB-specific, FIXME.  */
+#include "defs.h"
+#include "param.h"
+
 #ifdef USG
 #include <memory.h>
 #include <string.h>
@@ -194,21 +198,19 @@ static void remember_type ();
 #endif
 
 /* Takes operator name as e.g. "++" and returns mangled
-   operator name (e.g. "postincrement_expr").  */
+   operator name (e.g. "postincrement_expr"), or NULL if not found.  */
 char *
 cplus_mangle_opname (opname)
      char *opname;
 {
   int i, len = strlen (opname);
-  string name;
 
   for (i = 0; i < sizeof (optable)/sizeof (optable[0]); i++)
     {
       if (strlen (optable[i].out) == len
          && memcmp (optable[i].out, opname, len) == 0)
-       return optable[i].in;
+       return (char *)optable[i].in;
     }
-  error ("no mangling for `%s'", opname);
   return 0;
 }
 
@@ -440,7 +442,7 @@ do_type (type, result, arg_mode)
            success = 0;
          *type += 2;
          while (n-- > 0)
-           do_type (type, result);
+           do_type (type, result, arg_mode);
          break;
 
        case 'P':
index 5abe56e36a599fd5d48776248f6766603b8ab42c..6c799824d39b384d98c6b1fa9d32bd54eecc124c 100644 (file)
@@ -769,7 +769,9 @@ really_free_pendings (foo)
      int foo;
 {
   struct pending *next, *next1;
+#if 0
   struct pending_block *bnext, *bnext1;
+#endif
 
   for (next = free_pendings; next; next = next1)
     {
@@ -1252,6 +1254,11 @@ record_misc_function (name, address, type)
                             address, misc_type);
 }
 \f
+/* The BFD for this file -- only good while we're actively reading
+   symbols into a psymtab or a symtab.  */
+
+static bfd *symfile_bfd;
+
 /* Scan and build partial symbols for a symbol file.
    We have been initialized by a call to dbx_symfile_init, which 
    put all the relevant info into a "struct dbx_symfile_info"
@@ -2888,7 +2895,7 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
 
       if (type & N_STAB)
        {
-         short desc = bufp->n_desc;
+         short bufp_n_desc = bufp->n_desc;
          unsigned long valu = bufp->n_value;
 
          /* Check for a pair of N_SO symbols.  */
@@ -2912,15 +2919,15 @@ read_ofile_symtab (desc, stringtab, stringtab_size, sym_offset,
                           bufp->n_un.n_strx);
                  namestring2 = bufp->n_un.n_strx + stringtab;
 
-                 process_symbol_pair (N_SO, desc, valu, namestring,
+                 process_symbol_pair (N_SO, bufp_n_desc, valu, namestring,
                                       N_SO, bufp->n_desc, bufp->n_value,
                                       namestring2);
                }
              else
-               process_one_symbol(type, desc, valu, namestring);
+               process_one_symbol(type, bufp_n_desc, valu, namestring);
            }
          else
-           process_one_symbol (type, desc, valu, namestring);
+           process_one_symbol (type, bufp_n_desc, valu, namestring);
        }
       /* We skip checking for a new .o or -l file; that should never
          happen in this routine. */
@@ -3377,13 +3384,14 @@ define_symbol (valu, string, desc, type)
        case 'r':
          {
            double d = atof (p);
-           char *valu;
+           char *dbl_valu;
 
            SYMBOL_TYPE (sym) = builtin_type_double;
-           valu = (char *) obstack_alloc (symbol_obstack, sizeof (double));
-           bcopy (&d, valu, sizeof (double));
-           SWAP_TARGET_AND_HOST (valu, sizeof (double));
-           SYMBOL_VALUE_BYTES (sym) = valu;
+           dbl_valu =
+             (char *) obstack_alloc (symbol_obstack, sizeof (double));
+           bcopy (&d, dbl_valu, sizeof (double));
+           SWAP_TARGET_AND_HOST (dbl_valu, sizeof (double));
+           SYMBOL_VALUE_BYTES (sym) = dbl_valu;
            SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
          }
          break;
@@ -3433,7 +3441,7 @@ define_symbol (valu, string, desc, type)
     }
   else
     {
-      struct type *type;
+      struct type *type_read;
       synonym = *p == 't';
 
       if (synonym)
@@ -3443,13 +3451,13 @@ define_symbol (valu, string, desc, type)
                                            strlen (SYMBOL_NAME (sym)));
        }
 
-      type = read_type (&p);
+      type_read = read_type (&p);
 
       if ((deftype == 'F' || deftype == 'f')
-         && TYPE_CODE (type) != TYPE_CODE_FUNC)
-       SYMBOL_TYPE (sym) = lookup_function_type (type);
+         && TYPE_CODE (type_read) != TYPE_CODE_FUNC)
+       SYMBOL_TYPE (sym) = lookup_function_type (type_read);
       else
-       SYMBOL_TYPE (sym) = type;
+       SYMBOL_TYPE (sym) = type_read;
     }
 
   switch (deftype)
@@ -4330,7 +4338,8 @@ read_struct_type (pp, type)
          /* Special GNU C++ name.  */
          if (*++p == 'v')
            {
-             char *prefix, *name = 0;
+             const char *prefix;
+             char *name = 0;
              struct type *context;
 
              switch (*++p)
index 983eb7f43bce5b18db85f0616b63419c8c017b42..4228a4d6f833bdebf1c6c4b67567be3b05f2f866 100644 (file)
@@ -118,6 +118,11 @@ extern void free_current_contents ();
 extern int myread ();
 extern int query ();
 extern int lines_to_list ();
+extern void wrap_here (
+#ifdef __STDC__
+                      char *
+#endif
+                      );
 extern void reinitialize_more_filter ();
 extern void fputs_filtered ();
 extern void puts_filtered ();
@@ -136,6 +141,13 @@ extern void print_sys_errmsg ();
 extern void print_address_symbolic ();
 extern void print_address ();
 
+/* From source.c */
+void mod_path (
+#ifdef __STDC__
+              char *, char **
+#endif
+              );
+
 /* From readline (but not in any readline .h files).  */
 extern char *tilde_expand ();
 
@@ -170,6 +182,15 @@ char *baud_rate;
 #define LONG_MAX 0x7fffffff
 #endif
 
+#if !defined (INT_MAX)
+#define INT_MAX 0x7fffffff
+#endif
+
+#if !defined (INT_MIN)
+/* Two's complement, 32 bit.  */
+#define INT_MIN -0x80000000
+#endif
+
 /* Just like CHAR_BIT in <limits.h> but describes the target machine.  */
 #if !defined (TARGET_CHAR_BIT)
 #define TARGET_CHAR_BIT 8
@@ -181,4 +202,18 @@ char *baud_rate;
 #define TARGET_LONG_LONG_BIT 64
 #endif
 
+/* Convert a LONGEST to an int.  This is used in contexts (e.g. number
+   of arguments to a function, number in a value history, register
+   number, etc.) where the value must not be larger than can fit
+   in an int.  */
+#if !defined (longest_to_int)
+#if defined (LONG_LONG)
+#define longest_to_int(x) (((x) > INT_MAX || (x) < INT_MIN) \
+                          ? error ("Value out of range.") : (int) (x))
+#else /* No LONG_LONG.  */
+/* Assume sizeof (int) == sizeof (long).  */
+#define longest_to_int(x) ((int) (x))
+#endif /* No LONG_LONG.  */
+#endif /* No longest_to_int.  */
+
 #endif /* no DEFS_H */
index 44b1b5c6f3d9282844cb2a95cd8fac0252cb53b6..6772d79179d2175adcb918b798229707e38c2962 100755 (executable)
@@ -108,11 +108,18 @@ struct symtoken
    An array should be preceded in the list by the size of the array.  */
 enum type_pieces
   {tp_end = -1, tp_pointer, tp_reference, tp_array, tp_function};
-static enum type_pieces *type_stack;
+/* The stack can contain either an enum type_pieces or an int.  */
+union type_stack_elt {
+  enum type_pieces piece;
+  int int_val;
+};
+static union type_stack_elt *type_stack;
 static int type_stack_depth, type_stack_size;
 
 static void push_type ();
+static void push_type_int ();
 static enum type_pieces pop_type ();
+static int pop_type_int ();
 
 /* Allow debugging of parsing.  */
 #define YYDEBUG 1
@@ -646,12 +653,33 @@ variable: name_not_typename
                                {
                                case LOC_REGISTER:
                                case LOC_ARG:
+                               case LOC_REF_ARG:
+                               case LOC_REGPARM:
                                case LOC_LOCAL:
                                case LOC_LOCAL_ARG:
                                  if (innermost_block == 0 ||
                                      contained_in (block_found, 
                                                    innermost_block))
                                    innermost_block = block_found;
+                               case LOC_UNDEF:
+                               case LOC_CONST:
+                               case LOC_STATIC:
+                               case LOC_TYPEDEF:
+                               case LOC_LABEL:
+                               case LOC_BLOCK:
+                               case LOC_EXTERNAL:
+                               case LOC_CONST_BYTES:
+
+                                 /* In this case the expression can
+                                    be evaluated regardless of what
+                                    frame we are in, so there is no
+                                    need to check for the
+                                    innermost_block.  These cases are
+                                    listed so that gcc -Wall will
+                                    report types that may not have
+                                    been considered.  */
+
+                                 break;
                                }
                              write_exp_elt_opcode (OP_VAR_VALUE);
                              write_exp_elt_sym (sym);
@@ -732,7 +760,7 @@ ptype       :       typebase
                        follow_type = lookup_reference_type (follow_type);
                        break;
                      case tp_array:
-                       array_size = (int) pop_type ();
+                       array_size = pop_type_int ();
                        if (array_size != -1)
                          follow_type = create_array_type (follow_type,
                                                           array_size);
@@ -762,12 +790,12 @@ direct_abs_decl: '(' abs_decl ')'
                        { $$ = $2; }
        |       direct_abs_decl array_mod
                        {
-                         push_type ((enum type_pieces) $2);
+                         push_type_int ($2);
                          push_type (tp_array);
                        }
        |       array_mod
                        {
-                         push_type ((enum type_pieces) $1);
+                         push_type_int ($1);
                          push_type (tp_array);
                          $$ = 0;
                        }
@@ -1915,25 +1943,47 @@ push_type (tp)
   if (type_stack_depth == type_stack_size)
     {
       type_stack_size *= 2;
-      type_stack = (enum type_pieces *)
-       xrealloc (type_stack, type_stack_size * sizeof (enum type_pieces));
+      type_stack = (union type_stack_elt *)
+       xrealloc (type_stack, type_stack_size * sizeof (*type_stack));
+    }
+  type_stack[type_stack_depth++].piece = tp;
+}
+
+static void
+push_type_int (n)
+     int n;
+{
+  if (type_stack_depth == type_stack_size)
+    {
+      type_stack_size *= 2;
+      type_stack = (union type_stack_elt *)
+       xrealloc (type_stack, type_stack_size * sizeof (*type_stack));
     }
-  type_stack[type_stack_depth++] = tp;
+  type_stack[type_stack_depth++].int_val = n;
 }
 
 static enum type_pieces 
 pop_type ()
 {
   if (type_stack_depth)
-    return type_stack[--type_stack_depth];
+    return type_stack[--type_stack_depth].piece;
   return tp_end;
 }
 
+static int
+pop_type_int ()
+{
+  if (type_stack_depth)
+    return type_stack[--type_stack_depth].int_val;
+  /* "Can't happen".  */
+  return 0;
+}
+
 void
 _initialize_expread ()
 {
   type_stack_size = 80;
   type_stack_depth = 0;
-  type_stack = (enum type_pieces *)
-    xmalloc (type_stack_size * sizeof (enum type_pieces));
+  type_stack = (union type_stack_elt *)
+    xmalloc (type_stack_size * sizeof (*type_stack));
 }
index 5ac03bc448602c91c06d76445f8547379617eb10..106fadf2c06163837eb6cece721409a2a2591670 100644 (file)
@@ -177,7 +177,7 @@ read_relative_register_raw_bytes (regnum, myaddr)
       return 0;
     }
 
-  get_saved_register (myaddr, &optim, (CORE_ADDR) NULL, selected_frame,
+  get_saved_register (myaddr, &optim, (CORE_ADDR *) NULL, selected_frame,
                       regnum, (enum lval_type *)NULL);
   return optim;
 }
@@ -366,7 +366,6 @@ read_var_value (var, frame)
   struct frame_info *fi;
   struct type *type = SYMBOL_TYPE (var);
   CORE_ADDR addr;
-  int val;
   register int len;
 
   v = allocate_value (type);
@@ -378,8 +377,7 @@ read_var_value (var, frame)
   switch (SYMBOL_CLASS (var))
     {
     case LOC_CONST:
-      val = SYMBOL_VALUE (var);
-      bcopy (&val, VALUE_CONTENTS_RAW (v), len);
+      bcopy (&SYMBOL_VALUE (var), VALUE_CONTENTS_RAW (v), len);
       SWAP_TARGET_AND_HOST (VALUE_CONTENTS_RAW (v), len);
       VALUE_LVAL (v) = not_lval;
       return v;
@@ -430,7 +428,7 @@ read_var_value (var, frame)
        return 0;
       }
       addr += SYMBOL_VALUE (var);
-      addr = read_memory_integer (addr, sizeof (CORE_ADDR));
+      read_memory (addr, &addr, sizeof (CORE_ADDR));
       break;
       
     case LOC_LOCAL:
@@ -460,7 +458,7 @@ read_var_value (var, frame)
        
        v = value_from_register (type, SYMBOL_VALUE (var), frame);
 
-       if (REG_STRUCT_HAS_ADDR(b->gcc_compile_flag)
+       if (REG_STRUCT_HAS_ADDR (BLOCK_GCC_COMPILED (b))
            && TYPE_CODE (type) == TYPE_CODE_STRUCT)
          addr = *(CORE_ADDR *)VALUE_CONTENTS (v);
        else
@@ -665,7 +663,7 @@ locate_var_value (var, frame)
        {
          char *buf = alloca (TYPE_LENGTH (type));
          read_memory (addr, buf, TYPE_LENGTH (type));
-         addr = unpack_long (type, buf);
+         addr = unpack_pointer (type, buf);
          type = TYPE_TARGET_TYPE (type);
        }
 
index 991ce64ebdb44e9bb8ac78dff09738bcab3f035b..0be67bbaa25da570d97705c60ddfe99fd8d2f3b0 100644 (file)
@@ -45,6 +45,12 @@ void read_memory ();
 /* Read an integer from debugged memory, given address and number of bytes.  */
 long read_memory_integer ();
 
+void write_memory (
+#ifdef __STDC__
+                  CORE_ADDR, char *, int
+#endif
+                  );
+
 /* Hook for `exec_file_command' command to call.  */
 
 extern void (*exec_file_display_hook) ();
index 4a2c04c8fc07dd0140607c9618553e93f85ae905..224d0cfcab7d0aef9de18930483bc340a935262d 100644 (file)
@@ -34,30 +34,30 @@ ieee_extended_to_double (ext_format, from, to)
 {
   unsigned char *ufrom = (unsigned char *)from;
   double dto;
-  unsigned long mant0, mant1, exp;
+  unsigned long mant0, mant1, exponent;
   
   bcopy (&from[MANBYTE_H], &mant0, 4);
   bcopy (&from[MANBYTE_L], &mant1, 4);
-  exp = ((ufrom[EXPBYTE_H] & (unsigned char)~SIGNMASK) << 8) | ufrom[EXPBYTE_L];
+  exponent = ((ufrom[EXPBYTE_H] & (unsigned char)~SIGNMASK) << 8) | ufrom[EXPBYTE_L];
 
 #if 0
   /* We can't do anything useful with a NaN anyway, so ignore its
      difference.  It will end up as Infinity or something close.  */
-  if (exp == EXT_EXP_NAN) {
+  if (exponent == EXT_EXP_NAN) {
     /* We have a NaN source.  */
     dto = 0.123456789; /* Not much else useful to do -- we don't know if 
                           the host system even *has* NaNs, nor how to
                           generate an innocuous one if it does.  */
   } else
 #endif
-         if (exp == 0 && mant0 == 0 && mant1 == 0) {
+         if (exponent == 0 && mant0 == 0 && mant1 == 0) {
     dto = 0;
   } else {
     /* Build the result algebraically.  Might go infinite, underflow, etc;
        who cares. */
     mant0 |= 0x80000000;
-    dto = ldexp  ((double)mant0, exp - EXT_EXP_BIAS - 31);
-    dto += ldexp ((double)mant1, exp - EXT_EXP_BIAS - 31 - 32);
+    dto = ldexp  ((double)mant0, exponent - EXT_EXP_BIAS - 31);
+    dto += ldexp ((double)mant1, exponent - EXT_EXP_BIAS - 31 - 32);
     if (ufrom[EXPBYTE_H] & SIGNMASK)   /* If negative... */
       dto = -dto;                      /* ...negate.  */
   }
@@ -75,7 +75,7 @@ double_to_ieee_extended (ext_format, from, to)
 {
   double dfrom = *from;
   unsigned long twolongs[2];
-  unsigned long mant0, mant1, exp;
+  unsigned long mant0, mant1, exponent;
   unsigned char twobytes[2];
 
   bzero (to, TOTALSIZE);
@@ -97,27 +97,27 @@ double_to_ieee_extended (ext_format, from, to)
   bcopy (from, twolongs, 8);
   bcopy (from, twobytes, 2);
 #if HOST_BYTE_ORDER == BIG_ENDIAN
-  exp = ((twobytes[1] & 0xF0) >> 4) | (twobytes[0] & 0x7F) << 4;
+  exponent = ((twobytes[1] & 0xF0) >> 4) | (twobytes[0] & 0x7F) << 4;
   mant0 = (twolongs[0] << 11) | twolongs[1] >> 21;
   mant1 = (twolongs[1] << 11);
 #else
-  exp = ((twobytes[0] & 0xF0) >> 4) | (twobytes[1] & 0x7F) << 4;
+  exponent = ((twobytes[0] & 0xF0) >> 4) | (twobytes[1] & 0x7F) << 4;
   mant0 = (twolongs[1] << 11) | twolongs[0] >> 21;
   mant1 = (twolongs[0] << 11);
 #endif
 
   /* Fiddle with leading 1-bit, implied in double, explicit in extended. */
-  if (exp == 0)
+  if (exponent == 0)
     mant0 &= 0x7FFFFFFF;
   else
     mant0 |= 0x80000000;
 
-  exp -= DBL_EXP_BIAS;                         /* Get integer exp */
-  exp += EXT_EXP_BIAS;                         /* Offset for extended *&/
+  exponent -= DBL_EXP_BIAS;                            /* Get integer exp */
+  exponent += EXT_EXP_BIAS;                            /* Offset for extended */
 
   /* OK, now store it in extended format. */
-  to[EXPBYTE_H] |= (unsigned char)(exp >> 8);  /* Retain sign */
-  to[EXPBYTE_L] =  (unsigned char) exp;
+  to[EXPBYTE_H] |= (unsigned char)(exponent >> 8);     /* Retain sign */
+  to[EXPBYTE_L] =  (unsigned char) exponent;
   
   bcopy (&mant0, &to[MANBYTE_H], 4);
   bcopy (&mant1, &to[MANBYTE_L], 4);
index 2ebfb0b1c3c6f12b98fe45cd9465b981944c539c..f387ba0308cbe3c668a96e27374489eaaaab52d1 100644 (file)
@@ -122,6 +122,7 @@ CORE_ADDR read_pc ();
 void breakpoint_clear_ignore_counts ();
 
 \f
+/* ARGSUSED */
 void
 tty_command (file, from_tty)
      char *file;
@@ -218,6 +219,7 @@ continue_command (proc_count_exp, from_tty)
 /* Step until outside of current statement.  */
 static void step_1 ();
 
+/* ARGSUSED */
 static void
 step_command (count_string, from_tty)
      char * count_string;
@@ -228,6 +230,7 @@ step_command (count_string, from_tty)
 
 /* Likewise, but skip over subroutine calls as if single instructions.  */
 
+/* ARGSUSED */
 static void
 next_command (count_string, from_tty)
      char * count_string;
@@ -238,6 +241,7 @@ next_command (count_string, from_tty)
 
 /* Likewise, but step only one instruction.  */
 
+/* ARGSUSED */
 static void
 stepi_command (count_string, from_tty)
      char * count_string;
@@ -246,6 +250,7 @@ stepi_command (count_string, from_tty)
   step_1 (0, 1, count_string);
 }
 
+/* ARGSUSED */
 static void
 nexti_command (count_string, from_tty)
      char * count_string;
@@ -453,6 +458,7 @@ The expression which contained the function call has been discarded.");
    we set.  I'm going to postpone this until after a hopeful rewrite
    of wait_for_inferior and the proceed status code. -- randy */
 
+/* ARGSUSED */
 void
 until_next_command (from_tty)
      int from_tty;
@@ -584,6 +590,7 @@ finish_command (arg, from_tty)
     }
 }
 \f
+/* ARGSUSED */
 static void
 program_info (args, from_tty)
     char *args;
@@ -732,6 +739,7 @@ unset_environment_command (var, from_tty)
 
 const static char path_var_name[] = "PATH";
 
+/* ARGSUSED */
 void
 path_info (args, from_tty)
      char *args;
@@ -752,11 +760,11 @@ path_command (dirname, from_tty)
 
   dont_repeat ();
   exec_path = strsave (get_in_environ (inferior_environ, path_var_name));
-  mod_path (dirname, from_tty, &exec_path);
+  mod_path (dirname, &exec_path);
   set_in_environ (inferior_environ, path_var_name, exec_path);
   free (exec_path);
   if (from_tty)
-    path_info ();
+    path_info ((char *)NULL, from_tty);
 }
 \f
 CORE_ADDR
index c6117f751b8287d54cbc5cbd057eefe71bab8b22..acdcb7023bbb291c7c7970e4144e5641c2471712 100644 (file)
@@ -260,6 +260,7 @@ void normal_stop ();
 
 \f
 /* Things to clean up if we QUIT out of resume ().  */
+/* ARGSUSED */
 static void
 resume_cleanups (arg)
      int arg;
index 5b52fda0a62d8893ce7ef2b114615d008e2612e5..9e3f72980b1e3e6320bb17296f8af9b4a355652a 100644 (file)
@@ -123,6 +123,8 @@ child_prepare_to_store ()
 /* Convert data from raw format for register REGNUM
    to virtual format for register REGNUM.  */
 
+/* Some machines won't need to use regnum.  */
+/* ARGSUSED */
 void
 host_convert_to_virtual (regnum, from, to)
      int regnum;
@@ -135,6 +137,7 @@ host_convert_to_virtual (regnum, from, to)
 /* Convert data from virtual format for register REGNUM
    to raw format for register REGNUM.  */
 
+/* ARGSUSED */
 void
 host_convert_from_virtual (regnum, from, to)
      int regnum;
@@ -153,6 +156,7 @@ child_files_info ()
          attach_flag? "attached": "child", inferior_pid);
 }
 
+/* ARGSUSED */
 static void
 child_open (arg, from_tty)
      char *arg;
index 255a411f5ff24de7af985d744b607ab5ceb16a36..239eb02e1d3a8b09c3d635f14d2bc3fd67ff77bb 100644 (file)
@@ -1455,6 +1455,7 @@ error_no_arg (why)
   error ("Argument required (%s).", why);
 }
 
+/* ARGSUSED */
 static void
 help_command (command, from_tty)
      char *command;
@@ -1584,6 +1585,7 @@ GDB is free software and you are welcome to distribute copies of it\n\
  under certain conditions; type \"info copying\" to see the conditions.\n");
 }
 
+/* ARGSUSED */
 static void
 show_version (args, from_tty)
      char *args;
@@ -1629,6 +1631,7 @@ input_from_terminal_p ()
   return (instream == stdin) & caution;
 }
 \f
+/* ARGSUSED */
 static void
 pwd_command (args, from_tty)
      char *args;
@@ -1710,6 +1713,7 @@ cd_command (dir, from_tty)
     pwd_command ((char *) 0, 1);
 }
 \f
+/* ARGSUSED */
 static void
 source_command (args, from_tty)
      char *args;
@@ -1885,6 +1889,7 @@ show_commands (args, from_tty)
 }
 
 /* Called by do_setshow_command.  */
+/* ARGSUSED */
 static void
 set_history_size_command (args, from_tty, c)
      char *args;
@@ -1897,6 +1902,7 @@ set_history_size_command (args, from_tty, c)
     stifle_history (history_size);
 }
 
+/* ARGSUSED */
 static void
 set_history (args, from_tty)
      char *args;
@@ -1906,6 +1912,7 @@ set_history (args, from_tty)
   help_list (sethistlist, "set history ", -1, stdout);
 }
 
+/* ARGSUSED */
 static void
 show_history (args, from_tty)
      char *args;
@@ -1917,6 +1924,7 @@ show_history (args, from_tty)
 int info_verbose = 0;          /* Default verbose msgs off */
 
 /* Called by do_setshow_command.  An elaborate joke.  */
+/* ARGSUSED */
 static void 
 set_verbose (args, from_tty, c)
      char *args;
index a0b59e5cccc0df49d7a8185175cc4a7c2181a101..62eee1ca083b5611b36ba40c4a0d19f2c4fdf7f9 100755 (executable)
@@ -21,8 +21,7 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
    param-no-tm.h.  Any future inclusions of param.h will be protected
    against by the #if !defined stuff below.  */
 
-/* Some tm files need CORE_ADDR, for example.  */
-#include "defs.h"
+/* This file requires defs.h.  */
 
 #if !defined (PARAM_H)
 #include "tm.h"
index 3442e58b5ec18757092d1be7fa89ec3602f53756..149239ec85a99a183d0234cd5712e4ac97ec0caa 100644 (file)
@@ -363,7 +363,7 @@ print_scalar_formatted (valaddr, type, format, size, stream)
       break;
 
     case 'a':
-      print_address ((CORE_ADDR) val_long, stream);
+      print_address (unpack_pointer (type, valaddr), stream);
       break;
 
     case 'c':
@@ -670,6 +670,7 @@ print_command_1 (exp, inspect, voidprint)
   inspect_it = 0;      /* Reset print routines to normal */
 }
 
+/* ARGSUSED */
 static void
 print_command (exp, from_tty)
      char *exp;
@@ -679,6 +680,7 @@ print_command (exp, from_tty)
 }
 
 /* Same as print, except in epoch, it gets its own window */
+/* ARGSUSED */
 static void
 inspect_command (exp, from_tty)
      char *exp;
@@ -690,6 +692,7 @@ inspect_command (exp, from_tty)
 }
 
 /* Same as print, except it doesn't print void results. */
+/* ARGSUSED */
 static void
 call_command (exp, from_tty)
      char *exp;
@@ -698,6 +701,7 @@ call_command (exp, from_tty)
   print_command_1 (exp, 0, 0);
 }
 
+/* ARGSUSED */
 static void
 output_command (exp, from_tty)
      char *exp;
@@ -727,6 +731,7 @@ output_command (exp, from_tty)
   do_cleanups (old_chain);
 }
 
+/* ARGSUSED */
 static void
 set_command (exp, from_tty)
      char *exp;
@@ -739,13 +744,14 @@ set_command (exp, from_tty)
   do_cleanups (old_chain);
 }
 
+/* ARGSUSED */
 static void
 address_info (exp, from_tty)
      char *exp;
      int from_tty;
 {
   register struct symbol *sym;
-  register CORE_ADDR val;
+  register long val;
   int is_a_field_of_this;      /* C++: lookup_symbol sets this to nonzero
                                   if exp is a field of `this'. */
 
@@ -803,19 +809,19 @@ address_info (exp, from_tty)
       break;
       
     case LOC_ARG:
-      printf ("an argument at offset %d", (int)val);
+      printf ("an argument at offset %ld", val);
       break;
 
     case LOC_LOCAL_ARG:
-      printf ("an argument at frame offset %d", (int)val);
+      printf ("an argument at frame offset %ld", val);
       break;
 
     case LOC_LOCAL:
-      printf ("a local variable at frame offset %d", (int)val);
+      printf ("a local variable at frame offset %ld", val);
       break;
 
     case LOC_REF_ARG:
-      printf ("a reference argument at offset %d", (int)val);
+      printf ("a reference argument at offset %ld", val);
       break;
 
     case LOC_TYPEDEF:
@@ -882,7 +888,7 @@ x_command (exp, from_tty)
          && VALUE_LVAL (val) == lval_memory)
        next_address = VALUE_ADDRESS (val);
       else
-       next_address = (CORE_ADDR) value_as_long (val);
+       next_address = value_as_pointer (val);
       do_cleanups (old_chain);
     }
 
@@ -931,6 +937,7 @@ whatis_exp (exp, show)
     do_cleanups (old_chain);
 }
 
+/* ARGSUSED */
 static void
 whatis_command (exp, from_tty)
      char *exp;
@@ -943,6 +950,7 @@ whatis_command (exp, from_tty)
 }
 
 /* TYPENAME is either the name of a type, or an expression.  */
+/* ARGSUSED */
 static void
 ptype_command (typename, from_tty)
      char *typename;
@@ -1256,7 +1264,7 @@ do_one_display (d)
       else
        printf_filtered ("  ");
       
-      addr = (CORE_ADDR) value_as_long (evaluate_expression (d->exp));
+      addr = value_as_pointer (evaluate_expression (d->exp));
       if (d->format.format == 'i')
        addr = ADDR_BITS_REMOVE (addr);
       
@@ -1385,6 +1393,7 @@ enable_display (args)
       }
 }
 
+/* ARGSUSED */
 void
 disable_display_command (args, from_tty)
      char *args;
@@ -1454,7 +1463,7 @@ print_frame_args (func, fi, num, stream)
   /* Offset of next stack argument beyond the one we have seen that is
      at the highest offset.
      -1 if we haven't come to a stack argument yet.  */
-  int highest_offset = -1;
+  long highest_offset = -1;
   int arg_size;
   /* Number of ints of arguments that we have printed so far.  */
   int args_printed = 0;
@@ -1489,7 +1498,7 @@ print_frame_args (func, fi, num, stream)
       case LOC_ARG:
       case LOC_REF_ARG:
        {
-         int current_offset = SYMBOL_VALUE (sym);
+         long current_offset = SYMBOL_VALUE (sym);
 
          arg_size = TYPE_LENGTH (SYMBOL_TYPE (sym));
          
@@ -1536,7 +1545,7 @@ print_frame_args (func, fi, num, stream)
      enough about the stack to find them.  */
   if (num != -1)
     {
-      int start;
+      long start;
       CORE_ADDR addr;
 
       if (highest_offset == -1)
@@ -1559,7 +1568,7 @@ print_frame_args (func, fi, num, stream)
 static void
 print_frame_nameless_args (argsaddr, start, num, first, stream)
      CORE_ADDR argsaddr;
-     int start;
+     long start;
      int num;
      int first;
      FILE *stream;
@@ -1584,6 +1593,7 @@ print_frame_nameless_args (argsaddr, start, num, first, stream)
     }
 }
 \f
+/* ARGSUSED */
 static void
 printf_command (arg, from_tty)
      char *arg;
@@ -1740,8 +1750,9 @@ printf_command (arg, from_tty)
        if (argclass[i] == string_arg)
          {
            char *str;
-           int tem, j;
-           tem = value_as_long (val_args[i]);
+           CORE_ADDR tem;
+           int j;
+           tem = value_as_pointer (val_args[i]);
  
            /* This is a %s argument.  Find the length of the string.  */
            for (j = 0; ; j++)
@@ -1777,8 +1788,8 @@ printf_command (arg, from_tty)
          else
 #endif
            {
-             *((int *) &arg_bytes[argindex]) = value_as_long (val_args[i]);
-             argindex += sizeof (int);
+             *((long *) &arg_bytes[argindex]) = value_as_long (val_args[i]);
+             argindex += sizeof (long);
            }
       }
   }
@@ -1831,6 +1842,7 @@ containing_function_bounds (pc, low, high)
    Two arguments are interpeted as bounds within which to dump
    assembly.  */
 
+/* ARGSUSED */
 static void
 disassemble_command (arg, from_tty)
      char *arg;
index d3df38d87a91231226ce2f99e3392ebb364fa134..3f3d91ae5841179e4684a1c1b614da32134d6df5 100644 (file)
@@ -138,6 +138,7 @@ remote_start()
 
 /* Clean up connection to a remote debugger.  */
 
+/* ARGSUSED */
 void
 remote_close (quitting)
      int quitting;
@@ -196,7 +197,7 @@ device is attached to the remote system (e.g. /dev/ttya).");
 #endif
 
   /* Set up read timeout timer.  */
-  if ((void (*)) signal (SIGALRM, remote_timer) == (void (*)) -1)
+  if ((void (*)()) signal (SIGALRM, remote_timer) == (void (*)()) -1)
     perror ("remote_open: error in signal");
 #endif
 
@@ -276,7 +277,9 @@ remote_resume (step, siggnal)
 }
 
 /* Wait until the remote machine stops, then return,
-   storing status in STATUS just as `wait' would.  */
+   storing status in STATUS just as `wait' would.
+   Returns "pid" (though it's not clear what, if anything, that
+   means in the case of this target).  */
 
 int
 remote_wait (status)
@@ -291,10 +294,13 @@ remote_wait (status)
   if (buf[0] != 'S')
     error ("Invalid remote reply: %s", buf);
   WSETSTOP ((*status), (((fromhex (buf[1])) << 4) + (fromhex (buf[2]))));
+  return 0;
 }
 
 /* Read the remote registers into the block REGS.  */
 
+/* Currently we just read all the registers, so we don't use regno.  */
+/* ARGSUSED */
 int
 remote_fetch_registers (regno)
      int regno;
@@ -336,6 +342,7 @@ remote_prepare_to_store ()
 /* Store the remote registers from the contents of the block REGISTERS. 
    FIXME, eventually just store one register if that's all that is needed.  */
 
+/* ARGSUSED */
 int
 remote_store_registers (regno)
      int regno;
@@ -466,15 +473,15 @@ remote_read_bytes (memaddr, myaddr, len)
 }
 \f
 /* Read or write LEN bytes from inferior memory at MEMADDR, transferring
-   to or from debugger address MYADDR.  Write to inferior if WRITE is
+   to or from debugger address MYADDR.  Write to inferior if SHOULD_WRITE is
    nonzero.  Returns length of data written or read; 0 for error.  */
 
 int
-remote_xfer_inferior_memory(memaddr, myaddr, len, write)
+remote_xfer_inferior_memory(memaddr, myaddr, len, should_write)
      CORE_ADDR memaddr;
      char *myaddr;
      int len;
-     int write;
+     int should_write;
 {
   int origlen = len;
   int xfersize;
@@ -485,7 +492,7 @@ remote_xfer_inferior_memory(memaddr, myaddr, len, write)
       else
        xfersize = len;
 
-      if (write)
+      if (should_write)
         remote_write_bytes(memaddr, myaddr, xfersize);
       else
        remote_read_bytes (memaddr, myaddr, xfersize);
index 0faf26036641c854e2e8ffd36585d1cf08f23f78..66f5bea89820c8d28f5d92d79f353881cce7de72 100644 (file)
@@ -158,7 +158,7 @@ int i;
 
             status = target_read_memory (
                        (CORE_ADDR)so_list_ptr->inferior_lm_add,
-                       &so_list_ptr->inferior_lm,
+                       (char *)&so_list_ptr->inferior_lm,
                        sizeof(struct link_map));
             if (status == 0)
               inferior_lm = so_list_ptr->inferior_lm.lm_next;
index e8041fb8422aa0e2e3d26bda2c72d87fbac9068a..09a7f49e22fd949fabe8851a6bb48bfd4df75dd8 100644 (file)
@@ -756,6 +756,7 @@ print_frame_label_vars (frame, this_level_only, stream)
   return values_printed;
 }
 
+/* ARGSUSED */
 static void
 locals_info (args, from_tty)
      char *args;
@@ -972,6 +973,7 @@ frame_command (level_exp, from_tty)
 /* Select the frame up one or COUNT stack levels
    from the previously selected frame, and print it briefly.  */
 
+/* ARGSUSED */
 static void
 up_silently_command (count_exp, from_tty)
      char *count_exp;
@@ -1004,6 +1006,7 @@ up_command (count_exp, from_tty)
 /* Select the frame down one or COUNT stack levels
    from the previously selected frame, and print it briefly.  */
 
+/* ARGSUSED */
 static void
 down_silently_command (count_exp, from_tty)
      char *count_exp;
index e1345dbcb834318b16a7b88a71664c78a242a06c..734d36a7641fd75da2e6dd50d6f3d99678a18cbb 100644 (file)
@@ -82,7 +82,7 @@ char *symfile = 0;
 
 /* The modification date of the file when they were loaded.  */
 
-int symfile_mtime = 0;
+long /* really time_t */ symfile_mtime = 0;
 
 /* Structures with which to manage partial symbol allocation.  */
 
@@ -595,6 +595,7 @@ symfile_init (sym_bfd)
        }
     }
   error ("I'm sorry, Dave, I can't do that.  Symbol format unknown.");
+  return 0; /* Appease lint.  */
 }
 \f
 /* This function runs the load command of our current target.  */
@@ -623,6 +624,7 @@ add_symbol_file_command (args, from_tty)
 
 /* This function allows the addition of incrementally linked object files.  */
 
+/* ARGSUSED */
 void
 add_syms_addr_command (arg_string, from_tty)
      char* arg_string;
@@ -801,6 +803,7 @@ clear_symtab_users_once ()
 
 /* Delete the specified psymtab, and any others that reference it.  */
 
+static void
 cashier_psymtab (pst)
      struct partial_symtab *pst;
 {
@@ -859,7 +862,6 @@ free_named_symtabs (name)
   register struct symtab *s;
   register struct symtab *prev;
   register struct partial_symtab *ps;
-  register struct partial_symtab *pprev;
   struct blockvector *bv;
   int blewit = 0;
 
index 17cc62693dc560c9daad078753c348329bb33fba..7427300545597e09aa07dce119e3dec18c0ee474 100644 (file)
@@ -226,7 +226,7 @@ check_stub_type(type)
       struct symbol *sym;
       if (name == 0)
        {
-         complain (&stub_noname_complaint, 0, 0);
+         complain (&stub_noname_complaint, 0);
          return;
        }
       if (sym = lookup_symbol (name, 0, STRUCT_NAMESPACE, 0, 
index d9746e8baf884fc9d92db5c88311d79957daeefc..99e370ce8020b1699894f19822fd793171068384 100644 (file)
@@ -818,6 +818,11 @@ extern struct type *lookup_member_type ();
 extern struct type *lookup_method_type ();
 extern struct type *lookup_class ();
 extern void smash_to_method_type ();
+void smash_to_member_type (
+#ifdef __STDC__
+                          struct type *, struct type *, struct type *
+#endif
+                          );
 extern struct type *allocate_stub_method ();
 /* end of C++ stuff.  */
 
@@ -902,6 +907,16 @@ void symbol_file_add ();
 /* source.c */
 int identify_source_line ();
 void print_source_lines ();
+void forget_cached_source_info (
+#ifdef __STDC__
+                               void
+#endif
+                               );
+void select_source_symtab (
+#ifdef __STDC__
+                          struct symtab *
+#endif
+                          );
 
 char **make_symbol_completion_list ();
 
index 53e9de1acd2df961fb9a3402125dcd60f6f427be..a23c910944c319c2befcbc01758d231e5e231400 100644 (file)
@@ -76,18 +76,15 @@ struct target_ops **current_target_stack;
 
 static struct cmd_list_element *targetlist = NULL;
 
-/* Docstring for target (as in "help target").  */
-
-static char *target_doc = NULL;
-
 /* The user just typed 'target' without the name of a target.  */
 
+/* ARGSUSED */
 static void
 target_command (arg, from_tty)
      char *arg;
      int from_tty;
 {
-  fputs_filtered ("Argument required (target name).", stdout);
+  fputs_filtered ("Argument required (target name).\n", stdout);
 }
 
 /* Add a possible target architecture to the list.  */
@@ -160,6 +157,7 @@ noprocess ()
   error ("You can't do that without a process to debug");
 }
 
+/* ARGSUSED */
 static int
 nosymbol (name, addrp)
      char *name;
@@ -168,6 +166,7 @@ nosymbol (name, addrp)
   return 1;            /* Symbol does not exist in target env */
 }
 
+/* ARGSUSED */
 static void
 default_terminal_info (args, from_tty)
      char *args;
@@ -214,6 +213,7 @@ static void
 kill_or_be_killed (from_tty)
      int from_tty;
 {
+  /* FIXME: What is savecur for?  Why isn't it used?  */
   struct target_ops *savecur;
 
   if (target_has_execution)
@@ -467,6 +467,7 @@ bump:
 }
 
 
+/* ARGSUSED */
 static void
 target_info (args, from_tty)
      char *args;
index b3c6c375c514c0535adf9469dbe114167bb7bb67..af629c355dcb3918e41472968ff6430a106b5b40 100644 (file)
@@ -286,7 +286,7 @@ extern struct ext_format ext_format_68881 [];
    the address in which a function should return its structure value,
    as a CORE_ADDR (or an expression that can be used as one).  */
 
-#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(int *)(REGBUF))
+#define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) (*(CORE_ADDR *)(REGBUF))
 \f
 /* Describe the pointer in each stack frame to the previous stack frame
    (its caller).  */
index aa72a572d7693b1645c6aba9543b7451161418e7..f7acf3c3dc56c7d7ea2b3f8aeaca1ead15d852ad 100644 (file)
@@ -286,7 +286,12 @@ extern CORE_ADDR skip_prologue ();
    as a CORE_ADDR (or an expression that can be used as one).  */
 
 #define EXTRACT_STRUCT_VALUE_ADDRESS(REGBUF) \
-  (read_memory_integer (((int *)(REGBUF))[SP_REGNUM]+(16*4), 4))
+  (sparc_extract_struct_value_address (REGBUF))
+CORE_ADDR sparc_extract_struct_value_address (
+#ifdef __STDC__
+                                             char [REGISTER_BYTES]
+#endif
+                                             );
 
 \f
 /* Describe the pointer in each stack frame to the previous stack frame
@@ -296,9 +301,6 @@ extern CORE_ADDR skip_prologue ();
    of <sun4/reg.h> (also known as <machine/reg.h>).  */
 #include <sun4/reg.h>
 
-#define GET_RWINDOW_REG(FRAME, REG) \
-  (read_memory_integer ((CORE_ADDR)&((struct rwindow *)FRAME)->REG, 4))
-
 /* FRAME_CHAIN takes a frame's nominal address
    and produces the frame's chain-pointer.
 
@@ -337,8 +339,8 @@ extern CORE_ADDR skip_prologue ();
      (fci)->next->bottom : (fci)->next->frame) :       \
     read_register (SP_REGNUM));
 
-#define FRAME_CHAIN(thisframe) \
-   GET_RWINDOW_REG ((thisframe)->frame, rw_in[6])
+#define FRAME_CHAIN(thisframe) (sparc_frame_chain (thisframe))
+CORE_ADDR sparc_frame_chain ();
 
 #define FRAME_CHAIN_VALID(chain, thisframe) \
   (chain != 0 && (outside_startup_file (FRAME_SAVED_PC (thisframe))))
index cb1eb9cce8a5563cdff6d9eb69f8622d6a7c425c..b014d3c9576ab2062651ea6a12443856d9e5d8ea 100644 (file)
@@ -693,6 +693,7 @@ lines_to_list ()
   return 10;
 }
 
+/* ARGSUSED */
 static void 
 set_width_command (args, from_tty, c)
      char *args;
@@ -1205,11 +1206,11 @@ char *
 strstr (in, find)
      const char *in, *find;
 {
-  register char *p = in - 1;
+  register const char *p = in - 1;
 
   while (0 != (p = strchr (p+1, *find))) {
     if (strcmp (p, find))
-      return p;
+      return (char *)p;
   }
   return 0;
 }
index 4dc9778622664ef43fdc1ca46f53204548eff882..fc641397ef59c22ecb7ec6b064ec278806569b89 100644 (file)
@@ -669,6 +669,10 @@ val_print (type, valaddr, address, stream, format,
   switch (TYPE_CODE (type))
     {
     case TYPE_CODE_ARRAY:
+      /* FIXME: TYPE_LENGTH (type) is unsigned and therefore always
+        0.  Is "> 0" meant? I'm not sure what an "array of
+        unspecified length" (mentioned in the comment for the else-part
+        of this if) is.  */
       if (TYPE_LENGTH (type) >= 0
          && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
        {
@@ -762,9 +766,11 @@ val_print (type, valaddr, address, stream, format,
          struct fn_field *f;
          int j, len2;
          char *kind = "";
+         CORE_ADDR addr;
 
-         val = unpack_long (builtin_type_int, valaddr);
-         if (val < 128)
+         addr = unpack_pointer (lookup_pointer_type (builtin_type_void),
+                               valaddr);
+         if (addr < 128)
            {
              len = TYPE_NFN_FIELDS (domain);
              for (i = 0; i < len; i++)
@@ -775,7 +781,7 @@ val_print (type, valaddr, address, stream, format,
                  for (j = 0; j < len2; j++)
                    {
                      QUIT;
-                     if (TYPE_FN_FIELD_VOFFSET (f, j) == val)
+                     if (TYPE_FN_FIELD_VOFFSET (f, j) == addr)
                        {
                          kind = "virtual";
                          goto common;
@@ -785,7 +791,7 @@ val_print (type, valaddr, address, stream, format,
            }
          else
            {
-             struct symbol *sym = find_pc_function ((CORE_ADDR) val);
+             struct symbol *sym = find_pc_function (addr);
              if (sym == 0)
                error ("invalid pointer to member function");
              len = TYPE_NFN_FIELDS (domain);
@@ -821,7 +827,7 @@ val_print (type, valaddr, address, stream, format,
            }
          fprintf_filtered (stream, "(");
          type_print (type, "", stream, -1);
-         fprintf_filtered (stream, ") %d", (int) val >> 3);
+         fprintf_filtered (stream, ") %d", (int) addr >> 3);
        }
       else if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_MEMBER)
        {
@@ -869,7 +875,7 @@ val_print (type, valaddr, address, stream, format,
        }
       else
        {
-         CORE_ADDR addr = (CORE_ADDR) unpack_long (type, valaddr);
+         CORE_ADDR addr = unpack_pointer (type, valaddr);
          elttype = TYPE_TARGET_TYPE (type);
 
          if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
@@ -968,7 +974,7 @@ val_print (type, valaddr, address, stream, format,
          else /* print vtbl's nicely */
          if (is_vtbl_member(type))
            {
-             CORE_ADDR vt_address = (CORE_ADDR) unpack_long (type, valaddr);
+             CORE_ADDR vt_address = unpack_pointer (type, valaddr);
 
              int vt_index = find_pc_misc_function (vt_address);
              if (vt_index >= 0
@@ -981,11 +987,11 @@ val_print (type, valaddr, address, stream, format,
                }
              if (vtblprint)
                {
-                 value val;
+                 value vt_val;
 
-                 val = value_at (TYPE_TARGET_TYPE (type), vt_address);
-                 val_print (VALUE_TYPE (val), VALUE_CONTENTS (val),
-                            VALUE_ADDRESS (val), stream, format,
+                 vt_val = value_at (TYPE_TARGET_TYPE (type), vt_address);
+                 val_print (VALUE_TYPE (vt_val), VALUE_CONTENTS (vt_val),
+                            VALUE_ADDRESS (vt_val), stream, format,
                             deref_ref, recurse + 1, pretty);
                  if (pretty)
                    {
@@ -1018,11 +1024,13 @@ val_print (type, valaddr, address, stream, format,
        {
          if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_UNDEF)
            {
-             value val = value_at (TYPE_TARGET_TYPE (type),
-                                   (CORE_ADDR) unpack_long (builtin_type_int,
-                                                            valaddr));
-             val_print (VALUE_TYPE (val), VALUE_CONTENTS (val),
-                        VALUE_ADDRESS (val), stream, format,
+             value deref_val =
+               value_at
+                 (TYPE_TARGET_TYPE (type),
+                  unpack_pointer (lookup_pointer_type (builtin_type_void),
+                                  valaddr));
+             val_print (VALUE_TYPE (deref_val), VALUE_CONTENTS (deref_val),
+                        VALUE_ADDRESS (deref_val), stream, format,
                         deref_ref, recurse + 1, pretty);
            }
          else
@@ -1066,7 +1074,11 @@ val_print (type, valaddr, address, stream, format,
       if (i < len)
        fputs_filtered (TYPE_FIELD_NAME (type, i), stream);
       else
-       fprintf_filtered (stream, "%d", (int) val);
+#ifdef LONG_LONG
+       fprintf_filtered (stream, "%lld", val);
+#else
+       fprintf_filtered (stream, "%ld", val);
+#endif
       break;
 
     case TYPE_CODE_FUNC:
@@ -1100,7 +1112,7 @@ val_print (type, valaddr, address, stream, format,
              char *p;
              /* Pointer to first (i.e. lowest address) nonzero character.  */
              char *first_addr;
-             unsigned len = TYPE_LENGTH (type);
+             len = TYPE_LENGTH (type);
 
 #if TARGET_BYTE_ORDER == BIG_ENDIAN
              for (p = valaddr;
@@ -1442,8 +1454,8 @@ type_print_varspec_suffix (type, stream, show, passed_a_ptr)
        fprintf_filtered (stream, ")");
       
       fprintf_filtered (stream, "[");
-      if (TYPE_LENGTH (type) >= 0
-         && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
+      if (/* always true */ /* TYPE_LENGTH (type) >= 0
+         && */ TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
        fprintf_filtered (stream, "%d",
                          (TYPE_LENGTH (type)
                           / TYPE_LENGTH (TYPE_TARGET_TYPE (type))));
@@ -1763,10 +1775,12 @@ type_print_base (type, stream, show, level)
     }
 }
 \f
+#if 0
 /* Validate an input or output radix setting, and make sure the user
    knows what they really did here.  Radix setting is confusing, e.g.
    setting the input radix to "10" never changes it!  */
 
+/* ARGSUSED */
 static void
 set_input_radix (args, from_tty, c)
      char *args;
@@ -1779,7 +1793,9 @@ set_input_radix (args, from_tty, c)
     printf_filtered ("Input radix set to decimal %d, hex %x, octal %o\n",
        radix, radix, radix);
 }
+#endif
 
+/* ARGSUSED */
 static void
 set_output_radix (args, from_tty, c)
      char *args;
index 670ed245be28c71d9514ea7dd873d597e6928f35..5f41e642169fd643074671675ee1e8dec236cd76 100644 (file)
@@ -532,6 +532,19 @@ value_as_double (val)
     error ("Invalid floating value found in program.");
   return foo;
 }
+/* Extract a value as a C pointer.
+   Does not deallocate the value.  */
+CORE_ADDR
+value_as_pointer (val)
+     value val;
+{
+  /* This coerces arrays and functions, which is necessary (e.g.
+     in disassemble_command).  It also dereferences references, which
+     I suspect is the most logical thing to do.  */
+  if (TYPE_CODE (VALUE_TYPE (val)) != TYPE_CODE_ENUM)
+    COERCE_ARRAY (val);
+  return unpack_pointer (VALUE_TYPE (val), VALUE_CONTENTS (val));
+}
 \f
 /* Unpack raw data (copied from debugee, target byte order) at VALADDR
    as a long, or as a double, assuming the raw data is described
@@ -674,10 +687,13 @@ unpack_long (type, valaddr)
          error ("That operation is not possible on an integer of that size.");
        }
     }
+#if 0
+  /* There is no guarantee that a pointer can fit within a LONGEST.
+     Callers should use unpack_pointer instead.  */
   else if (code == TYPE_CODE_PTR
           || code == TYPE_CODE_REF)
     {
-      if (len == sizeof (char *))
+      if (len == sizeof (CORE_ADDR))
        {
          CORE_ADDR retval;
          bcopy (valaddr, &retval, sizeof (retval));
@@ -685,10 +701,15 @@ unpack_long (type, valaddr)
          return retval;
        }
     }
+#endif
   else if (code == TYPE_CODE_MEMBER)
     error ("not implemented: member types in unpack_long");
 
+#if 0
   error ("Value not integer or pointer.");
+#else
+  error ("Value not integer.");
+#endif
   return 0;    /* For lint -- never reached */
 }
 
@@ -735,6 +756,7 @@ unpack_double (type, valaddr, invp)
       else
        {
          error ("Unexpected type of floating point number.");
+         return 0; /* Placate lint.  */
        }
     }
   else if (nosign) {
@@ -749,6 +771,46 @@ unpack_double (type, valaddr, invp)
     return unpack_long (type, valaddr);
   }
 }
+
+/* Unpack raw data (copied from debugee, target byte order) at VALADDR
+   as a CORE_ADDR, assuming the raw data is described by type TYPE.
+   We don't assume any alignment for the raw data.  Return value is in
+   host byte order.
+
+   If you want functions and arrays to be coerced to pointers, and
+   references to be dereferenced, call value_as_pointer() instead.
+
+   C++: It is assumed that the front-end has taken care of
+   all matters concerning pointers to members.  A pointer
+   to member which reaches here is considered to be equivalent
+   to an INT (or some size).  After all, it is only an offset.  */
+
+CORE_ADDR
+unpack_pointer (type, valaddr)
+     struct type *type;
+     char *valaddr;
+{
+  register enum type_code code = TYPE_CODE (type);
+  register int len = TYPE_LENGTH (type);
+
+  if (code == TYPE_CODE_PTR
+      || code == TYPE_CODE_REF)
+    {
+      if (len == sizeof (CORE_ADDR))
+       {
+         CORE_ADDR retval;
+         bcopy (valaddr, &retval, sizeof (retval));
+         SWAP_TARGET_AND_HOST (&retval, sizeof (retval));
+         return retval;
+       }
+      error ("Unrecognized pointer size.");
+    }
+  else if (code == TYPE_CODE_MEMBER)
+    error ("not implemented: member types in unpack_pointer");
+
+  error ("Value is not a pointer.");
+  return 0;    /* For lint -- never reached */
+}
 \f
 /* Given a value ARG1 (offset by OFFSET bytes)
    of a struct or union type ARG_TYPE,
@@ -922,6 +984,7 @@ value_headof (arg, btype, dtype)
   /* First collect the vtables we must look at for this object.  */
   /* FIXME-tiemann: right now, just look at top-most vtable.  */
   value vtbl, entry, best_entry = 0;
+  /* FIXME: entry_type is never used.  */
   struct type *entry_type;
   int i, nelems;
   int offset, best_offset = 0;
@@ -954,11 +1017,11 @@ value_headof (arg, btype, dtype)
   /* Now search through the virtual function table.  */
   entry = value_ind (vtbl);
   entry_type = VALUE_TYPE (entry);
-  nelems = value_as_long (value_field (entry, 2));
+  nelems = longest_to_int (value_as_long (value_field (entry, 2)));
   for (i = 1; i <= nelems; i++)
     {
       entry = value_subscript (vtbl, value_from_long (builtin_type_int, i));
-      offset = value_as_long (value_field (entry, 0));
+      offset = longest_to_int (value_as_long (value_field (entry, 0)));
       if (offset < best_offset)
        {
          best_offset = offset;
@@ -970,7 +1033,7 @@ value_headof (arg, btype, dtype)
 
   /* Move the pointer according to BEST_ENTRY's offset, and figure
      out what type we should return as the new pointer.  */
-  pc_for_sym = value_as_long (value_field (best_entry, 2));
+  pc_for_sym = value_as_pointer (value_field (best_entry, 2));
   sym = find_pc_function (pc_for_sym);
   demangled_name = cplus_demangle (SYMBOL_NAME (sym), -1);
   *(strchr (demangled_name, ':')) = '\0';
@@ -1111,7 +1174,8 @@ baseclass_addr (type, index, valaddr, valuep, errp)
              CORE_ADDR addr;
              int status;
 
-             addr = unpack_long (TYPE_FIELD_TYPE (type, i),
+             addr
+               = unpack_pointer (TYPE_FIELD_TYPE (type, i),
                                  valaddr + (TYPE_FIELD_BITPOS (type, i) / 8));
 
              status = target_read_memory (addr,
@@ -1143,7 +1207,7 @@ baseclass_addr (type, index, valaddr, valuep, errp)
        {
          char *baddr;
 
-         baddr = baseclass_addr (type, i, valaddr, valuep);
+         baddr = baseclass_addr (type, i, valaddr, valuep, errp);
          if (baddr)
            return baddr;
        }
@@ -1190,6 +1254,8 @@ check_stub_method (type, i, j)
   if (OPNAME_PREFIX_P (field_name))
     {
       char *opname = cplus_mangle_opname (field_name + 3);
+      if (opname == NULL)
+       error ("No mangling for \"%s\"", field_name);
       mangled_name_len += strlen (opname);
       mangled_name = (char *)xmalloc (mangled_name_len);
 
This page took 0.070049 seconds and 4 git commands to generate.