Look at the ChangeLog for Apr 30 and May 1.
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,^\./,,'`
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,^\./,,'`
/* Manage the vector of line numbers. */
-static
+static void
record_line (line, pc)
int line;
CORE_ADDR pc;
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;
}
+/* 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! */
/* 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)
/* 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;
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>
return c;
}
+/* ARGSUSED */
void
not_just_help_class_command (args, from_tty, c)
char *args;
}
}
-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").
}
}
+/* ARGSUSED */
static void
shell_escape (arg, from_tty)
char *arg;
/* Discard all vestiges of any previous core file
and mark data and stack spaces as empty. */
+/* ARGSUSED */
void
core_close (quitting)
int quitting;
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;
#include <stdio.h>
#include <ctype.h>
+/* GDB-specific, FIXME. */
+#include "defs.h"
+#include "param.h"
+
#ifdef USG
#include <memory.h>
#include <string.h>
#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;
}
success = 0;
*type += 2;
while (n-- > 0)
- do_type (type, result);
+ do_type (type, result, arg_mode);
break;
case 'P':
int foo;
{
struct pending *next, *next1;
+#if 0
struct pending_block *bnext, *bnext1;
+#endif
for (next = free_pendings; next; next = next1)
{
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"
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. */
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. */
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;
}
else
{
- struct type *type;
+ struct type *type_read;
synonym = *p == 't';
if (synonym)
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)
/* Special GNU C++ name. */
if (*++p == 'v')
{
- char *prefix, *name = 0;
+ const char *prefix;
+ char *name = 0;
struct type *context;
switch (*++p)
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 ();
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 ();
#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
#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 */
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
{
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);
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);
{ $$ = $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;
}
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));
}
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;
}
struct frame_info *fi;
struct type *type = SYMBOL_TYPE (var);
CORE_ADDR addr;
- int val;
register int len;
v = allocate_value (type);
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;
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:
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
{
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);
}
/* 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) ();
{
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. */
}
{
double dfrom = *from;
unsigned long twolongs[2];
- unsigned long mant0, mant1, exp;
+ unsigned long mant0, mant1, exponent;
unsigned char twobytes[2];
bzero (to, TOTALSIZE);
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);
void breakpoint_clear_ignore_counts ();
\f
+/* ARGSUSED */
void
tty_command (file, from_tty)
char *file;
/* Step until outside of current statement. */
static void step_1 ();
+/* ARGSUSED */
static void
step_command (count_string, from_tty)
char * count_string;
/* Likewise, but skip over subroutine calls as if single instructions. */
+/* ARGSUSED */
static void
next_command (count_string, from_tty)
char * count_string;
/* Likewise, but step only one instruction. */
+/* ARGSUSED */
static void
stepi_command (count_string, from_tty)
char * count_string;
step_1 (0, 1, count_string);
}
+/* ARGSUSED */
static void
nexti_command (count_string, from_tty)
char * count_string;
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;
}
}
\f
+/* ARGSUSED */
static void
program_info (args, from_tty)
char *args;
const static char path_var_name[] = "PATH";
+/* ARGSUSED */
void
path_info (args, from_tty)
char *args;
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
\f
/* Things to clean up if we QUIT out of resume (). */
+/* ARGSUSED */
static void
resume_cleanups (arg)
int arg;
/* 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;
/* 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;
attach_flag? "attached": "child", inferior_pid);
}
+/* ARGSUSED */
static void
child_open (arg, from_tty)
char *arg;
error ("Argument required (%s).", why);
}
+/* ARGSUSED */
static void
help_command (command, from_tty)
char *command;
under certain conditions; type \"info copying\" to see the conditions.\n");
}
+/* ARGSUSED */
static void
show_version (args, from_tty)
char *args;
return (instream == stdin) & caution;
}
\f
+/* ARGSUSED */
static void
pwd_command (args, from_tty)
char *args;
pwd_command ((char *) 0, 1);
}
\f
+/* ARGSUSED */
static void
source_command (args, from_tty)
char *args;
}
/* Called by do_setshow_command. */
+/* ARGSUSED */
static void
set_history_size_command (args, from_tty, c)
char *args;
stifle_history (history_size);
}
+/* ARGSUSED */
static void
set_history (args, from_tty)
char *args;
help_list (sethistlist, "set history ", -1, stdout);
}
+/* ARGSUSED */
static void
show_history (args, from_tty)
char *args;
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;
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"
break;
case 'a':
- print_address ((CORE_ADDR) val_long, stream);
+ print_address (unpack_pointer (type, valaddr), stream);
break;
case 'c':
inspect_it = 0; /* Reset print routines to normal */
}
+/* ARGSUSED */
static void
print_command (exp, from_tty)
char *exp;
}
/* Same as print, except in epoch, it gets its own window */
+/* ARGSUSED */
static void
inspect_command (exp, from_tty)
char *exp;
}
/* Same as print, except it doesn't print void results. */
+/* ARGSUSED */
static void
call_command (exp, from_tty)
char *exp;
print_command_1 (exp, 0, 0);
}
+/* ARGSUSED */
static void
output_command (exp, from_tty)
char *exp;
do_cleanups (old_chain);
}
+/* ARGSUSED */
static void
set_command (exp, from_tty)
char *exp;
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'. */
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:
&& 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);
}
do_cleanups (old_chain);
}
+/* ARGSUSED */
static void
whatis_command (exp, from_tty)
char *exp;
}
/* TYPENAME is either the name of a type, or an expression. */
+/* ARGSUSED */
static void
ptype_command (typename, from_tty)
char *typename;
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);
}
}
+/* ARGSUSED */
void
disable_display_command (args, from_tty)
char *args;
/* 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;
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));
enough about the stack to find them. */
if (num != -1)
{
- int start;
+ long start;
CORE_ADDR addr;
if (highest_offset == -1)
static void
print_frame_nameless_args (argsaddr, start, num, first, stream)
CORE_ADDR argsaddr;
- int start;
+ long start;
int num;
int first;
FILE *stream;
}
}
\f
+/* ARGSUSED */
static void
printf_command (arg, from_tty)
char *arg;
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++)
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);
}
}
}
Two arguments are interpeted as bounds within which to dump
assembly. */
+/* ARGSUSED */
static void
disassemble_command (arg, from_tty)
char *arg;
/* Clean up connection to a remote debugger. */
+/* ARGSUSED */
void
remote_close (quitting)
int quitting;
#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
}
/* 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)
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;
/* 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;
}
\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;
else
xfersize = len;
- if (write)
+ if (should_write)
remote_write_bytes(memaddr, myaddr, xfersize);
else
remote_read_bytes (memaddr, myaddr, xfersize);
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;
return values_printed;
}
+/* ARGSUSED */
static void
locals_info (args, from_tty)
char *args;
/* 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;
/* 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;
/* 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. */
}
}
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. */
/* This function allows the addition of incrementally linked object files. */
+/* ARGSUSED */
void
add_syms_addr_command (arg_string, from_tty)
char* arg_string;
/* Delete the specified psymtab, and any others that reference it. */
+static void
cashier_psymtab (pst)
struct partial_symtab *pst;
{
register struct symtab *s;
register struct symtab *prev;
register struct partial_symtab *ps;
- register struct partial_symtab *pprev;
struct blockvector *bv;
int blewit = 0;
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,
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. */
/* 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 ();
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. */
error ("You can't do that without a process to debug");
}
+/* ARGSUSED */
static int
nosymbol (name, addrp)
char *name;
return 1; /* Symbol does not exist in target env */
}
+/* ARGSUSED */
static void
default_terminal_info (args, from_tty)
char *args;
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)
}
+/* ARGSUSED */
static void
target_info (args, from_tty)
char *args;
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). */
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
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.
(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))))
return 10;
}
+/* ARGSUSED */
static void
set_width_command (args, from_tty, c)
char *args;
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;
}
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)
{
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++)
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;
}
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);
}
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)
{
}
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)
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
}
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)
{
{
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
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:
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;
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))));
}
}
\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;
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;
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
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));
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 */
}
else
{
error ("Unexpected type of floating point number.");
+ return 0; /* Placate lint. */
}
}
else if (nosign) {
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,
/* 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;
/* 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;
/* 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';
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,
{
char *baddr;
- baddr = baseclass_addr (type, i, valaddr, valuep);
+ baddr = baseclass_addr (type, i, valaddr, valuep, errp);
if (baddr)
return baddr;
}
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);