along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
-#include <stdio.h>
-#include <string.h>
#include "defs.h"
+#include <string.h>
#include "frame.h"
#include "symtab.h"
+#include "gdbtypes.h"
#include "value.h"
#include "language.h"
#include "expression.h"
#include "gdbcore.h"
#include "gdbcmd.h"
#include "target.h"
+#include "breakpoint.h"
+#include "demangle.h"
extern int asm_demangle; /* Whether to demangle syms in asm printouts */
extern int addressprint; /* Whether to print hex addresses in HLL " */
-extern struct block *get_current_block ();
-
-static void print_frame_nameless_args ();
-
struct format_data
{
int count;
int inspect_it = 0;
-static void do_one_display ();
+struct display
+{
+ /* Chain link to next auto-display item. */
+ struct display *next;
+ /* Expression to be evaluated and displayed. */
+ struct expression *exp;
+ /* Item number of this auto-display item. */
+ int number;
+ /* Display format specified. */
+ struct format_data format;
+ /* Innermost block required by this expression when evaluated */
+ struct block *block;
+ /* Status of this display (enabled or disabled) */
+ enum enable status;
+};
+
+/* Chain of expressions whose values should be displayed
+ automatically each time the program stops. */
+
+static struct display *display_chain;
+
+static int display_number;
+
+/* Prototypes for local functions */
+
+static void
+delete_display PARAMS ((int));
+
+static void
+enable_display PARAMS ((char *, int));
+
+static void
+disable_display_command PARAMS ((char *, int));
+
+static void
+disassemble_command PARAMS ((char *, int));
+
+static int
+containing_function_bounds PARAMS ((CORE_ADDR, CORE_ADDR *, CORE_ADDR *));
+
+static void
+printf_command PARAMS ((char *, int));
+
+static void
+print_frame_nameless_args PARAMS ((CORE_ADDR, long, int, int, FILE *));
+
+static void
+display_info PARAMS ((char *, int));
+
+static void
+do_one_display PARAMS ((struct display *));
+
+static void
+undisplay_command PARAMS ((char *, int));
+
+static void
+free_display PARAMS ((struct display *));
+
+static void
+display_command PARAMS ((char *, int));
+
+static void
+ptype_command PARAMS ((char *, int));
+
+static struct type *
+ptype_eval PARAMS ((struct expression *));
+
+static void
+whatis_command PARAMS ((char *, int));
+
+static void
+whatis_exp PARAMS ((char *, int));
+
+static void
+x_command PARAMS ((char *, int));
+
+static void
+address_info PARAMS ((char *, int));
+
+static void
+set_command PARAMS ((char *, int));
+
+static void
+output_command PARAMS ((char *, int));
+
+static void
+call_command PARAMS ((char *, int));
+
+static void
+inspect_command PARAMS ((char *, int));
-void do_displays ();
-void print_scalar_formatted ();
+static void
+print_command PARAMS ((char *, int));
+
+static void
+print_command_1 PARAMS ((char *, int, int));
+
+static void
+validate_format PARAMS ((struct format_data, char *));
+
+static void
+do_examine PARAMS ((struct format_data, CORE_ADDR));
+
+static void
+print_formatted PARAMS ((value, int, int));
+
+static struct format_data
+decode_format PARAMS ((char **, int, int));
\f
/* Decode a format specification. *STRING_PTR should point to it.
found in the specification. In addition, *STRING_PTR is advanced
past the specification and past all whitespace following it. */
-struct format_data
+static struct format_data
decode_format (string_ptr, oformat, osize)
char **string_ptr;
- char oformat;
- char osize;
+ int oformat;
+ int osize;
{
struct format_data val;
register char *p = *string_ptr;
static void
print_formatted (val, format, size)
register value val;
- register char format;
- char size;
+ register int format;
+ int size;
{
int len = TYPE_LENGTH (VALUE_TYPE (val));
print_scalar_formatted (valaddr, type, format, size, stream)
char *valaddr;
struct type *type;
- char format;
+ int format;
int size;
FILE *stream;
{
char *leadin;
{
int name_location;
- register int i = find_pc_misc_function (addr);
+ register struct minimal_symbol *msymbol = lookup_minimal_symbol_by_pc (addr);
/* If nothing comes out, don't print anything symbolic. */
- if (i < 0)
+ if (msymbol == NULL)
return;
fputs_filtered (leadin, stream);
fputs_filtered ("<", stream);
if (do_demangle)
- fputs_demangled (misc_function_vector[i].name, stream, 1);
+ fputs_demangled (msymbol -> name, stream, DMGL_ANSI | DMGL_PARAMS);
else
- fputs_filtered (misc_function_vector[i].name, stream);
- name_location = misc_function_vector[i].address;
+ fputs_filtered (msymbol -> name, stream);
+ name_location = msymbol -> address;
if (addr - name_location)
fprintf_filtered (stream, "+%d>", addr - name_location);
else
CORE_ADDR addr;
FILE *stream;
{
+#ifdef ADDR_BITS_REMOVE
+ fprintf_filtered (stream, local_hex_format(), ADDR_BITS_REMOVE(addr));
+#else
fprintf_filtered (stream, local_hex_format(), addr);
+#endif
print_address_symbolic (addr, stream, asm_demangle, " ");
}
type = VALUE_TYPE (val);
if (objectprint
- && (TYPE_CODE (type) == TYPE_CODE_PTR
+ && ( TYPE_CODE (type) == TYPE_CODE_PTR
|| TYPE_CODE (type) == TYPE_CODE_REF)
- && TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT)
+ && ( TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_STRUCT
+ || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_UNION))
{
value v;
{
exp++;
fmt = decode_format (&exp, 0, 0);
- validate_format (fmt, "print");
+ validate_format (fmt, "output");
format = fmt.format;
}
int from_tty;
{
register struct symbol *sym;
+ register struct minimal_symbol *msymbol;
register long val;
+ register long basereg;
int is_a_field_of_this; /* C++: lookup_symbol sets this to nonzero
if exp is a field of `this'. */
&is_a_field_of_this, (struct symtab **)NULL);
if (sym == 0)
{
- register int i;
-
if (is_a_field_of_this)
{
printf ("Symbol \"%s\" is a field of the local class variable `this'\n", exp);
return;
}
- for (i = 0; i < misc_function_count; i++)
- if (!strcmp (misc_function_vector[i].name, exp))
- break;
+ msymbol = lookup_minimal_symbol (exp, (struct objfile *) NULL);
- if (i < misc_function_count)
+ if (msymbol != NULL)
printf ("Symbol \"%s\" is at %s in a file compiled without debugging.\n",
- exp, local_hex_string(misc_function_vector[i].address));
+ exp, local_hex_string(msymbol -> address));
else
error ("No symbol \"%s\" in current context.", exp);
return;
printf ("Symbol \"%s\" is ", SYMBOL_NAME (sym));
val = SYMBOL_VALUE (sym);
+ basereg = SYMBOL_BASEREG (sym);
switch (SYMBOL_CLASS (sym))
{
break;
case LOC_ARG:
- printf ("an argument at offset %ld", val);
+ if (SYMBOL_BASEREG_VALID (sym))
+ {
+ printf ("an argument at offset %ld from register %s",
+ val, reg_names[basereg]);
+ }
+ else
+ {
+ printf ("an argument at offset %ld", val);
+ }
break;
case LOC_LOCAL_ARG:
- printf ("an argument at frame offset %ld", val);
+ if (SYMBOL_BASEREG_VALID (sym))
+ {
+ printf ("an argument at offset %ld from register %s",
+ val, reg_names[basereg]);
+ }
+ else
+ {
+ printf ("an argument at frame offset %ld", val);
+ }
break;
case LOC_LOCAL:
- printf ("a local variable at frame offset %ld", val);
+ if (SYMBOL_BASEREG_VALID (sym))
+ {
+ printf ("a local variable at offset %ld from register %s",
+ val, reg_names[basereg]);
+ }
+ else
+ {
+ printf ("a local variable at frame offset %ld", val);
+ }
break;
case LOC_REF_ARG:
{
exp++;
fmt = decode_format (&exp, last_format, last_size);
- last_size = fmt.size;
- last_format = fmt.format;
}
/* If we have an expression, evaluate it and use it as the address. */
do_examine (fmt, next_address);
+ /* If the examine succeeds, we remember its size and format for next time. */
+ last_size = fmt.size;
+ last_format = fmt.format;
+
/* Set a couple of internal variables if appropriate. */
if (last_examine_value)
{
whatis_exp (typename, 1);
}
\f
-enum display_status {disabled, enabled};
-
-struct display
-{
- /* Chain link to next auto-display item. */
- struct display *next;
- /* Expression to be evaluated and displayed. */
- struct expression *exp;
- /* Item number of this auto-display item. */
- int number;
- /* Display format specified. */
- struct format_data format;
- /* Innermost block required by this expression when evaluated */
- struct block *block;
- /* Status of this display (enabled or disabled) */
- enum display_status status;
-};
-
-/* Chain of expressions whose values should be displayed
- automatically each time the program stops. */
-
-static struct display *display_chain;
-
-static int display_number;
-
/* Add an expression to the auto-display chain.
Specify the expression. */
free_display (d)
struct display *d;
{
- free (d->exp);
- free (d);
+ free ((PTR)d->exp);
+ free ((PTR)d);
}
/* Clear out the display_chain.
while (d = display_chain)
{
- free (d->exp);
+ free ((PTR)d->exp);
display_chain = d->next;
- free (d);
+ free ((PTR)d);
}
}
/* Delete the auto-display number NUM. */
-void
+static void
delete_display (num)
int num;
{
Specify the element numbers. */
static void
-undisplay_command (args)
+undisplay_command (args, from_tty)
char *args;
+ int from_tty;
{
register char *p = args;
register char *p1;
}
static void
-display_info ()
+display_info (ignore, from_tty)
+ char *ignore;
+ int from_tty;
{
register struct display *d;
}
}
-void
-enable_display (args)
+static void
+enable_display (args, from_tty)
char *args;
+ int from_tty;
{
register char *p = args;
register char *p1;
}
/* ARGSUSED */
-void
+static void
disable_display_command (args, from_tty)
char *args;
int from_tty;
two entries (one a parameter, one a register or local), and the one
we want is the non-parm, which lookup_symbol will find for
us. After this, sym could be any SYMBOL_CLASS... */
+#ifdef IBM6000_TARGET
+ /* AIX/RS6000 implements a concept of traceback tables, in which case
+ it creates nameless parameters. Looking for those parameter symbols
+ will result in an error. */
+
+ if ( *SYMBOL_NAME (sym))
+#endif
sym = lookup_symbol (SYMBOL_NAME (sym),
b, VAR_NAMESPACE, (int *)NULL, (struct symtab **)NULL);
{
char *s1;
if (nargs == allocated_args)
- val_args = (value *) xrealloc (val_args,
+ val_args = (value *) xrealloc ((char *) val_args,
(allocated_args *= 2)
* sizeof (value));
s1 = s;