#include <stdio.h>
#include "defs.h"
+#include <string.h>
#include "bfd.h"
#include "symtab.h"
#include "symfile.h"
type = (struct type *) obstack_alloc (&objfile -> type_obstack,
sizeof (struct type));
}
- (void) memset (type, 0, sizeof (struct type));
+ (void) memset ((char *)type, 0, sizeof (struct type));
/* Initialize the fields that might not be zero. */
objfile = TYPE_OBJFILE (type);
- (void) memset (type, 0, sizeof (struct type));
+ (void) memset ((char *)type, 0, sizeof (struct type));
TYPE_OBJFILE (type) = objfile;
TYPE_TARGET_TYPE (type) = to_type;
TYPE_DOMAIN_TYPE (type) = domain;
objfile = TYPE_OBJFILE (type);
- (void) memset (type, 0, sizeof (struct type));
+ (void) memset ((char *)type, 0, sizeof (struct type));
TYPE_OBJFILE (type) = objfile;
TYPE_TARGET_TYPE (type) = to_type;
TYPE_DOMAIN_TYPE (type) = domain;
(struct symtab **) NULL);
if (sym)
{
- memcpy (type, SYMBOL_TYPE(sym), sizeof (struct type));
+ memcpy ((char *)type, (char *)SYMBOL_TYPE(sym), sizeof (struct type));
}
}
}
nbytes = FT_NUM_MEMBERS * sizeof (struct type *);
objfile -> fundamental_types = (struct type **)
obstack_alloc (&objfile -> type_obstack, nbytes);
- (void) memset (objfile -> fundamental_types, 0, nbytes);
+ (void) memset ((char *)objfile -> fundamental_types, 0, nbytes);
}
typep = objfile -> fundamental_types + typeid;
if ((type = *typep) == NULL)
#include "defs.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"
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 ();
+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;
+
+/* Prototypes for local functions */
+
+static void
+delete_display PARAMS ((int));
+
+static void
+enable_display PARAMS ((char *));
+
+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 *));
-void do_displays ();
-void print_scalar_formatted ();
+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 ((void));
+
+static void
+do_one_display PARAMS ((struct display *));
+
+static void
+undisplay_command PARAMS ((char *));
+
+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));
+
+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, 1);
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
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;
int from_tty;
{
register struct symbol *sym;
+ register struct minimal_symbol *msymbol;
register long val;
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;
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. */
/* Delete the auto-display number NUM. */
-void
+static void
delete_display (num)
int num;
{
}
}
-void
+static void
enable_display (args)
char *args;
{
}
/* ARGSUSED */
-void
+static void
disable_display_command (args, from_tty)
char *args;
int from_tty;
{
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;
static void
aixcoff_new_init PARAMS ((void));
-static void
-dump_minimal_symbols PARAMS ((struct objfile *));
-
-static void
-dump_symtab_lines PARAMS ((struct symtab *));
-
-static void
-dump_symtabs PARAMS ((struct symtab *));
-
-static void
-dump_last_symtab PARAMS ((struct symtab *));
-
-static void
-dump_blockvector PARAMS ((struct blockvector *));
-
-static void
-dump_block PARAMS ((struct block *));
-
-static char *
-dump_addrclass PARAMS ((int));
-
-static char *
-dump_namespace PARAMS ((int));
-
-static void
-dump_symbol PARAMS ((struct symbol *));
-
-static void
-dump_type PARAMS ((struct type *));
-
-static void
-dump_linetable PARAMS ((struct linetable *));
-
-static void
-dump_strtbl PARAMS ((void));
-
static int
init_lineno PARAMS ((bfd *, long, int));
make_cleanup (free, linetab); /* Be sure it gets de-allocated. */
return 0;
}
-
-
-static void
-dump_strtbl ()
-{
- int ii;
- printf ("===STRING TABLE DUMP...\n\n");
- for ( ii=0; ii < strtbl_len; ++ii )
- printf ("%c", isprint (*(strtbl+ii)) ? *(strtbl+ii) : ' ');
- printf ("\n");
-}
-
-static void
-dump_linetable (ltb)
- struct linetable *ltb;
-{
- int ii;
- for (ii=0; ii < ltb->nitems; ++ii)
- printf ("line: %d, addr: 0x%x\n", ltb->item[ii].line, ltb->item[ii].pc);
-}
-
-static void
-dump_type (typeP)
- struct type *typeP;
-{
- printf ("0x%x: name: %s\n", typeP, typeP->name ? typeP->name : "(nil)");
-}
-
-static void
-dump_symbol (pp)
- struct symbol *pp;
-{
- printf (" sym: %s\t%s,\t%s\ttype: 0x%x, val: 0x%x end: 0x%x\n",
- pp->name, dump_namespace (pp->namespace),
- dump_addrclass (pp->class), pp->type,
- SYMBOL_CLASS(pp) == LOC_BLOCK ? BLOCK_START(SYMBOL_BLOCK_VALUE(pp))
- : pp->value.value,
- SYMBOL_CLASS(pp) == LOC_BLOCK ? BLOCK_END(SYMBOL_BLOCK_VALUE(pp)) : 0);
-}
-
-static char *
-dump_namespace (ns)
-int ns;
-{
- static char *ns_name [] = {
- "UNDEF_NS", "VAR_NS", "STRUCT_NS", "LABEL_NS"};
-
- switch (ns) {
- case UNDEF_NAMESPACE:
- case VAR_NAMESPACE:
- case STRUCT_NAMESPACE:
- case LABEL_NAMESPACE:
- return ns_name[ns];
- }
-
- return "***ERROR***";
-}
-
-static char *
-dump_addrclass (ac)
-int ac; /* address class */
-{
- static char *ac_name [] = {
- "LOC_UNDEF",
- "LOC_CONST",
- "LOC_STATIC",
- "LOC_REGISTER",
- "LOC_ARG",
- "LOC_REF_ARG",
- "LOC_REGPARM",
- "LOC_LOCAL",
- "LOC_TYPEDEF",
- "LOC_LABEL",
- "LOC_BLOCK",
- "LOC_CONST_BYTES",
- "LOC_LOCAL_ARG",
- };
- switch (ac) {
- case LOC_UNDEF:
- case LOC_CONST:
- case LOC_STATIC:
- case LOC_REGISTER:
- case LOC_ARG:
- case LOC_REF_ARG:
- case LOC_REGPARM:
- case LOC_LOCAL:
- case LOC_TYPEDEF:
- case LOC_LABEL:
- case LOC_BLOCK:
- case LOC_CONST_BYTES:
- case LOC_LOCAL_ARG:
- return ac_name [ac];
- }
- return "***ERROR***";
-}
-
-static void
-dump_block (pp)
- struct block *pp;
-{
- int ii;
- printf ("BLOCK..: start: 0x%x, end: 0x%x\n", pp->startaddr, pp->endaddr);
- for (ii=0; ii < pp->nsyms; ++ii)
- dump_symbol (pp->sym[ii]);
-}
-
-static void
-dump_blockvector (pp)
- struct blockvector *pp;
-{
- int ii;
- for (ii=0; ii < pp->nblocks; ++ii)
- dump_block (pp->block [ii]);
-}
-
-static void
-dump_last_symtab (pp)
- struct symtab *pp;
-{
- for ( ; pp; pp = pp->next) {
- if ( pp->next == 0 ) {
- printf ("SYMTAB NAME: %s\n", pp->filename);
- dump_blockvector (pp->blockvector);
- }
- }
-}
-
-static void
-dump_symtabs (pp)
- struct symtab *pp;
-{
- for ( ; pp; pp = pp->next) {
- printf ("SYMTAB NAME: %s\n", pp->filename ? pp->filename : "(nil)");
-/* if (pp->linetable)
- dump_linetable (pp->linetable); */
- dump_blockvector (pp->blockvector);
- }
-}
-
-static void
-dump_symtab_lines (pp)
- struct symtab *pp;
-{
- for ( ; pp; pp = pp->next) {
- printf ("SYMTAB NAME: %s\n", pp->filename ? pp->filename : "(nil)");
- if (pp->linetable)
- dump_linetable (pp->linetable);
- /* dump_blockvector (pp->blockvector); */
- }
-}
-
-static void
-dump_minimal_symbols (objfile)
-struct objfile *objfile;
-{
- struct minimal_symbol *msymbol;
-
- for (msymbol = objfile -> msymbols; msymbol -> name != NULL; msymbol++)
- {
- printf ("name: %s, addr: 0x%x\n", msymbol -> name, msymbol -> address);
- }
-}
-
-
+\f
/* dbx allows the text of a symbol name to be continued into the
next symbol name! When such a continuation is encountered
(a \ at the end of the text of a name)