X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fprintcmd.c;h=66dc512df67c2762f9cde41e7a092d644ce101cc;hb=ad53e288d3fccbd419d5ba1979f2e5075f414462;hp=9fac1f39b4b9b44d30804341cdcda8e54df73f0e;hpb=d9fcf2fb1c12d48f657c974dc5b6898022bf9ccf;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 9fac1f39b4..66dc512df6 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -1,5 +1,7 @@ /* Print values for GNU debugger GDB. - Copyright 1986-1991, 1993-1995, 1998, 2000 Free Software Foundation, Inc. + + Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, + 1996, 1997, 1998, 1999, 2000, 2001 Free Software Foundation, Inc. This file is part of GDB. @@ -35,6 +37,9 @@ #include "annotate.h" #include "symfile.h" /* for overlay functions */ #include "objfiles.h" /* ditto */ +#ifdef UI_OUT +#include "ui-out.h" +#endif extern int asm_demangle; /* Whether to demangle syms in asm printouts */ extern int addressprint; /* Whether to print hex addresses in HLL " */ @@ -118,60 +123,61 @@ static int display_number; /* Prototypes for exported functions. */ -void output_command PARAMS ((char *, int)); +void output_command (char *, int); -void _initialize_printcmd PARAMS ((void)); +void _initialize_printcmd (void); /* Prototypes for local functions. */ -static void delete_display PARAMS ((int)); +static void delete_display (int); -static void enable_display PARAMS ((char *, int)); +static void enable_display (char *, int); -static void disable_display_command PARAMS ((char *, int)); +static void disable_display_command (char *, int); -static void disassemble_command PARAMS ((char *, int)); +static void disassemble_command (char *, int); -static void printf_command PARAMS ((char *, int)); +static void printf_command (char *, int); static void print_frame_nameless_args (struct frame_info *, long, int, int, struct ui_file *); -static void display_info PARAMS ((char *, int)); +static void display_info (char *, int); -static void do_one_display PARAMS ((struct display *)); +static void do_one_display (struct display *); -static void undisplay_command PARAMS ((char *, int)); +static void undisplay_command (char *, int); -static void free_display PARAMS ((struct display *)); +static void free_display (struct display *); -static void display_command PARAMS ((char *, int)); +static void display_command (char *, int); -void x_command PARAMS ((char *, int)); +void x_command (char *, int); -static void address_info PARAMS ((char *, int)); +static void address_info (char *, int); -static void set_command PARAMS ((char *, int)); +static void set_command (char *, int); -static void call_command PARAMS ((char *, int)); +static void call_command (char *, int); -static void inspect_command PARAMS ((char *, int)); +static void inspect_command (char *, int); -static void print_command PARAMS ((char *, int)); +static void print_command (char *, int); -static void print_command_1 PARAMS ((char *, int, int)); +static void print_command_1 (char *, int, int); -static void validate_format PARAMS ((struct format_data, char *)); +static void validate_format (struct format_data, char *); -static void do_examine PARAMS ((struct format_data, CORE_ADDR addr, asection * section)); +static void do_examine (struct format_data, CORE_ADDR addr, + asection * section); static void print_formatted (value_ptr, int, int, struct ui_file *); -static struct format_data decode_format PARAMS ((char **, int, int)); +static struct format_data decode_format (char **, int, int); static int print_insn (CORE_ADDR, struct ui_file *); -static void sym_info PARAMS ((char *, int)); +static void sym_info (char *, int); /* Decode a format specification. *STRING_PTR should point to it. @@ -185,10 +191,7 @@ static void sym_info PARAMS ((char *, int)); past the specification and past all whitespace following it. */ static struct format_data -decode_format (string_ptr, oformat, osize) - char **string_ptr; - int oformat; - int osize; +decode_format (char **string_ptr, int oformat, int osize) { struct format_data val; register char *p = *string_ptr; @@ -246,7 +249,7 @@ decode_format (string_ptr, oformat, osize) val.size = osize ? 'h' : osize; else /* Bad value for TARGET_PTR_BIT */ - abort (); + internal_error (__FILE__, __LINE__, "failed internal consistency check"); break; case 'f': /* Floating point has to be word or giantword. */ @@ -276,11 +279,8 @@ decode_format (string_ptr, oformat, osize) This is used to pad hex numbers so they line up. */ static void -print_formatted (val, format, size, stream) - register value_ptr val; - register int format; - int size; - struct ui_file *stream; +print_formatted (register value_ptr val, register int format, int size, + struct ui_file *stream) { struct type *type = check_typedef (VALUE_TYPE (val)); int len = TYPE_LENGTH (type); @@ -343,12 +343,8 @@ print_formatted (val, format, size, stream) with a format. */ void -print_scalar_formatted (valaddr, type, format, size, stream) - char *valaddr; - struct type *type; - int format; - int size; - struct ui_file *stream; +print_scalar_formatted (char *valaddr, struct type *type, int format, int size, + struct ui_file *stream) { LONGEST val_long; unsigned int len = TYPE_LENGTH (type); @@ -440,7 +436,10 @@ print_scalar_formatted (valaddr, type, format, size, stream) break; case 'a': - print_address (unpack_pointer (type, valaddr), stream); + { + CORE_ADDR addr = unpack_pointer (type, valaddr); + print_address (addr, stream); + } break; case 'c': @@ -457,7 +456,7 @@ print_scalar_formatted (valaddr, type, format, size, stream) break; case 0: - abort (); + internal_error (__FILE__, __LINE__, "failed internal consistency check"); case 't': /* Binary; 't' stands for "two". */ @@ -517,15 +516,14 @@ print_scalar_formatted (valaddr, type, format, size, stream) `info lines' uses this. */ void -set_next_address (addr) - CORE_ADDR addr; +set_next_address (CORE_ADDR addr) { next_address = addr; /* Make address available to the user as $_. */ set_internalvar (lookup_internalvar ("_"), - value_from_longest (lookup_pointer_type (builtin_type_void), - (LONGEST) addr)); + value_from_pointer (lookup_pointer_type (builtin_type_void), + addr)); } /* Optionally print address ADDR symbolically as on STREAM, @@ -537,27 +535,84 @@ set_next_address (addr) settings of the demangle and asm_demangle variables. */ void -print_address_symbolic (addr, stream, do_demangle, leadin) - CORE_ADDR addr; - struct ui_file *stream; - int do_demangle; - char *leadin; +print_address_symbolic (CORE_ADDR addr, struct ui_file *stream, int do_demangle, + char *leadin) +{ + char *name = NULL; + char *filename = NULL; + int unmapped = 0; + int offset = 0; + int line = 0; + + /* throw away both name and filename */ + struct cleanup *cleanup_chain = make_cleanup (free_current_contents, &name); + make_cleanup (free_current_contents, &filename); + + if (build_address_symbolic (addr, do_demangle, &name, &offset, &filename, &line, &unmapped)) + { + do_cleanups (cleanup_chain); + return; + } + + fputs_filtered (leadin, stream); + if (unmapped) + fputs_filtered ("<*", stream); + else + fputs_filtered ("<", stream); + fputs_filtered (name, stream); + if (offset != 0) + fprintf_filtered (stream, "+%u", (unsigned int) offset); + + /* Append source filename and line number if desired. Give specific + line # of this addr, if we have it; else line # of the nearest symbol. */ + if (print_symbol_filename && filename != NULL) + { + if (line != -1) + fprintf_filtered (stream, " at %s:%d", filename, line); + else + fprintf_filtered (stream, " in %s", filename); + } + if (unmapped) + fputs_filtered ("*>", stream); + else + fputs_filtered (">", stream); + + do_cleanups (cleanup_chain); +} + +/* Given an address ADDR return all the elements needed to print the + address in a symbolic form. NAME can be mangled or not depending + on DO_DEMANGLE (and also on the asm_demangle global variable, + manipulated via ''set print asm-demangle''). Return 0 in case of + success, when all the info in the OUT paramters is valid. Return 1 + otherwise. */ +int +build_address_symbolic (CORE_ADDR addr, /* IN */ + int do_demangle, /* IN */ + char **name, /* OUT */ + int *offset, /* OUT */ + char **filename, /* OUT */ + int *line, /* OUT */ + int *unmapped) /* OUT */ { struct minimal_symbol *msymbol; struct symbol *symbol; struct symtab *symtab = 0; CORE_ADDR name_location = 0; - char *name = ""; asection *section = 0; - int unmapped = 0; + char *name_temp = ""; + + /* Let's say it is unmapped. */ + *unmapped = 0; - /* Determine if the address is in an overlay, and whether it is mapped. */ + /* Determine if the address is in an overlay, and whether it is + mapped. */ if (overlay_debugging) { section = find_pc_overlay (addr); if (pc_in_unmapped_range (addr, section)) { - unmapped = 1; + *unmapped = 1; addr = overlay_mapped_address (addr, section); } } @@ -587,9 +642,9 @@ print_address_symbolic (addr, stream, do_demangle, leadin) { name_location = BLOCK_START (SYMBOL_BLOCK_VALUE (symbol)); if (do_demangle) - name = SYMBOL_SOURCE_NAME (symbol); + name_temp = SYMBOL_SOURCE_NAME (symbol); else - name = SYMBOL_LINKAGE_NAME (symbol); + name_temp = SYMBOL_LINKAGE_NAME (symbol); } if (msymbol != NULL) @@ -602,13 +657,13 @@ print_address_symbolic (addr, stream, do_demangle, leadin) symtab = 0; name_location = SYMBOL_VALUE_ADDRESS (msymbol); if (do_demangle) - name = SYMBOL_SOURCE_NAME (msymbol); + name_temp = SYMBOL_SOURCE_NAME (msymbol); else - name = SYMBOL_LINKAGE_NAME (msymbol); + name_temp = SYMBOL_LINKAGE_NAME (msymbol); } } if (symbol == NULL && msymbol == NULL) - return; + return 1; /* On some targets, mask out extra "flag" bits from PC for handsome disassembly. */ @@ -627,19 +682,12 @@ print_address_symbolic (addr, stream, do_demangle, leadin) of the address space back to the beginning, giving bogus comparison. */ if (addr > name_location + max_symbolic_offset && name_location + max_symbolic_offset > name_location) - return; + return 1; - fputs_filtered (leadin, stream); - if (unmapped) - fputs_filtered ("<*", stream); - else - fputs_filtered ("<", stream); - fputs_filtered (name, stream); - if (addr != name_location) - fprintf_filtered (stream, "+%u", (unsigned int) (addr - name_location)); + *offset = addr - name_location; + + *name = xstrdup (name_temp); - /* Append source filename and line number if desired. Give specific - line # of this addr, if we have it; else line # of the nearest symbol. */ if (print_symbol_filename) { struct symtab_and_line sal; @@ -647,29 +695,42 @@ print_address_symbolic (addr, stream, do_demangle, leadin) sal = find_pc_sect_line (addr, section, 0); if (sal.symtab) - fprintf_filtered (stream, " at %s:%d", sal.symtab->filename, sal.line); + { + *filename = xstrdup (sal.symtab->filename); + *line = sal.line; + } else if (symtab && symbol && symbol->line) - fprintf_filtered (stream, " at %s:%d", symtab->filename, symbol->line); + { + *filename = xstrdup (symtab->filename); + *line = symbol->line; + } else if (symtab) - fprintf_filtered (stream, " in %s", symtab->filename); + { + *filename = xstrdup (symtab->filename); + *line = -1; + } } - if (unmapped) - fputs_filtered ("*>", stream); - else - fputs_filtered (">", stream); + return 0; } - /* Print address ADDR on STREAM. USE_LOCAL means the same thing as for print_longest. */ void -print_address_numeric (addr, use_local, stream) - CORE_ADDR addr; - int use_local; - struct ui_file *stream; +print_address_numeric (CORE_ADDR addr, int use_local, struct ui_file *stream) { - /* This assumes a CORE_ADDR can fit in a LONGEST. Probably a safe - assumption. */ + /* Truncate address to the size of a target address, avoiding shifts + larger or equal than the width of a CORE_ADDR. The local + variable ADDR_BIT stops the compiler reporting a shift overflow + when it won't occur. */ + /* NOTE: This assumes that the significant address information is + kept in the least significant bits of ADDR - the upper bits were + either zero or sign extended. Should ADDRESS_TO_POINTER() or + some ADDRESS_TO_PRINTABLE() be used to do the conversion? */ + + int addr_bit = TARGET_ADDR_BIT; + + if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT)) + addr &= ((CORE_ADDR) 1 << addr_bit) - 1; print_longest (stream, 'x', use_local, (ULONGEST) addr); } @@ -678,9 +739,7 @@ print_address_numeric (addr, use_local, stream) after the number. */ void -print_address (addr, stream) - CORE_ADDR addr; - struct ui_file *stream; +print_address (CORE_ADDR addr, struct ui_file *stream) { print_address_numeric (addr, 1, stream); print_address_symbolic (addr, stream, asm_demangle, " "); @@ -692,10 +751,7 @@ print_address (addr, stream) or not. */ void -print_address_demangle (addr, stream, do_demangle) - CORE_ADDR addr; - struct ui_file *stream; - int do_demangle; +print_address_demangle (CORE_ADDR addr, struct ui_file *stream, int do_demangle) { if (addr == 0) { @@ -727,10 +783,7 @@ static struct type *examine_g_type; Fetch it from memory and print on gdb_stdout. */ static void -do_examine (fmt, addr, sect) - struct format_data fmt; - CORE_ADDR addr; - asection *sect; +do_examine (struct format_data fmt, CORE_ADDR addr, asection *sect) { register char format = 0; register char size; @@ -811,9 +864,7 @@ do_examine (fmt, addr, sect) } static void -validate_format (fmt, cmdname) - struct format_data fmt; - char *cmdname; +validate_format (struct format_data fmt, char *cmdname) { if (fmt.size != 0) error ("Size letters are meaningless in \"%s\" command.", cmdname); @@ -831,10 +882,7 @@ validate_format (fmt, cmdname) */ static void -print_command_1 (exp, inspect, voidprint) - char *exp; - int inspect; - int voidprint; +print_command_1 (char *exp, int inspect, int voidprint) { struct expression *expr; register struct cleanup *old_chain = 0; @@ -864,8 +912,7 @@ print_command_1 (exp, inspect, voidprint) { struct type *type; expr = parse_expression (exp); - old_chain = make_cleanup ((make_cleanup_func) free_current_contents, - &expr); + old_chain = make_cleanup (free_current_contents, &expr); cleanup = 1; val = evaluate_expression (expr); @@ -928,9 +975,7 @@ print_command_1 (exp, inspect, voidprint) /* ARGSUSED */ static void -print_command (exp, from_tty) - char *exp; - int from_tty; +print_command (char *exp, int from_tty) { print_command_1 (exp, 0, 1); } @@ -938,9 +983,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; - int from_tty; +inspect_command (char *exp, int from_tty) { extern int epoch_interface; @@ -950,18 +993,14 @@ 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; - int from_tty; +call_command (char *exp, int from_tty) { print_command_1 (exp, 0, 0); } /* ARGSUSED */ void -output_command (exp, from_tty) - char *exp; - int from_tty; +output_command (char *exp, int from_tty) { struct expression *expr; register struct cleanup *old_chain; @@ -978,7 +1017,7 @@ output_command (exp, from_tty) } expr = parse_expression (exp); - old_chain = make_cleanup ((make_cleanup_func) free_current_contents, &expr); + old_chain = make_cleanup (free_current_contents, &expr); val = evaluate_expression (expr); @@ -996,22 +1035,18 @@ output_command (exp, from_tty) /* ARGSUSED */ static void -set_command (exp, from_tty) - char *exp; - int from_tty; +set_command (char *exp, int from_tty) { struct expression *expr = parse_expression (exp); - register struct cleanup *old_chain - = make_cleanup ((make_cleanup_func) free_current_contents, &expr); + register struct cleanup *old_chain = + make_cleanup (free_current_contents, &expr); evaluate_expression (expr); do_cleanups (old_chain); } /* ARGSUSED */ static void -sym_info (arg, from_tty) - char *arg; - int from_tty; +sym_info (char *arg, int from_tty) { struct minimal_symbol *msymbol; struct objfile *objfile; @@ -1056,9 +1091,7 @@ sym_info (arg, from_tty) /* ARGSUSED */ static void -address_info (exp, from_tty) - char *exp; - int from_tty; +address_info (char *exp, int from_tty) { register struct symbol *sym; register struct minimal_symbol *msymbol; @@ -1270,9 +1303,7 @@ address_info (exp, from_tty) } void -x_command (exp, from_tty) - char *exp; - int from_tty; +x_command (char *exp, int from_tty) { struct expression *expr; struct format_data fmt; @@ -1299,15 +1330,14 @@ x_command (exp, from_tty) But don't clobber a user-defined command's definition. */ if (from_tty) *exp = 0; - old_chain = make_cleanup ((make_cleanup_func) free_current_contents, - &expr); + old_chain = make_cleanup (free_current_contents, &expr); val = evaluate_expression (expr); if (TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_REF) val = value_ind (val); /* In rvalue contexts, such as this, functions are coerced into pointers to functions. This makes "x/i main" work. */ - if ( /* last_format == 'i' - && */ TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC + if (/* last_format == 'i' && */ + TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_FUNC && VALUE_LVAL (val) == lval_memory) next_address = VALUE_ADDRESS (val); else @@ -1328,10 +1358,11 @@ x_command (exp, from_tty) { /* Make last address examined available to the user as $_. Use the correct pointer type. */ + struct type *pointer_type + = lookup_pointer_type (VALUE_TYPE (last_examine_value)); set_internalvar (lookup_internalvar ("_"), - value_from_longest ( - lookup_pointer_type (VALUE_TYPE (last_examine_value)), - (LONGEST) last_examine_address)); + value_from_pointer (pointer_type, + last_examine_address)); /* Make contents of last address examined available to the user as $__. */ /* If the last value has not been fetched from memory then don't @@ -1349,9 +1380,7 @@ x_command (exp, from_tty) Specify the expression. */ static void -display_command (exp, from_tty) - char *exp; - int from_tty; +display_command (char *exp, int from_tty) { struct format_data fmt; register struct expression *expr; @@ -1409,11 +1438,10 @@ display_command (exp, from_tty) } static void -free_display (d) - struct display *d; +free_display (struct display *d) { - free ((PTR) d->exp); - free ((PTR) d); + xfree (d->exp); + xfree (d); } /* Clear out the display_chain. @@ -1421,23 +1449,22 @@ free_display (d) the types stored in many expressions. */ void -clear_displays () +clear_displays (void) { register struct display *d; while ((d = display_chain) != NULL) { - free ((PTR) d->exp); + xfree (d->exp); display_chain = d->next; - free ((PTR) d); + xfree (d); } } /* Delete the auto-display number NUM. */ static void -delete_display (num) - int num; +delete_display (int num) { register struct display *d1, *d; @@ -1469,9 +1496,7 @@ delete_display (num) Specify the element numbers. */ static void -undisplay_command (args, from_tty) - char *args; - int from_tty; +undisplay_command (char *args, int from_tty) { register char *p = args; register char *p1; @@ -1509,8 +1534,7 @@ undisplay_command (args, from_tty) or if the display is disabled. */ static void -do_one_display (d) - struct display *d; +do_one_display (struct display *d) { int within_current_scope; @@ -1595,7 +1619,7 @@ do_one_display (d) evaluated in the current scope. */ void -do_displays () +do_displays (void) { register struct display *d; @@ -1607,8 +1631,7 @@ do_displays () This is done when there is an error or a signal. */ void -disable_display (num) - int num; +disable_display (int num) { register struct display *d; @@ -1622,7 +1645,7 @@ disable_display (num) } void -disable_current_display () +disable_current_display (void) { if (current_display_number >= 0) { @@ -1634,9 +1657,7 @@ disable_current_display () } static void -display_info (ignore, from_tty) - char *ignore; - int from_tty; +display_info (char *ignore, int from_tty) { register struct display *d; @@ -1663,9 +1684,7 @@ Num Enb Expression\n"); } static void -enable_display (args, from_tty) - char *args; - int from_tty; +enable_display (char *args, int from_tty) { register char *p = args; register char *p1; @@ -1704,9 +1723,7 @@ enable_display (args, from_tty) /* ARGSUSED */ static void -disable_display_command (args, from_tty) - char *args; - int from_tty; +disable_display_command (char *args, int from_tty) { register char *p = args; register char *p1; @@ -1739,10 +1756,8 @@ disable_display_command (args, from_tty) specified by a struct symbol. */ void -print_variable_value (var, frame, stream) - struct symbol *var; - struct frame_info *frame; - struct ui_file *stream; +print_variable_value (struct symbol *var, struct frame_info *frame, + struct ui_file *stream) { value_ptr val = read_var_value (var, frame); @@ -1758,11 +1773,8 @@ print_variable_value (var, frame, stream) according to the stack frame". At least for VAX, i386, isi. */ void -print_frame_args (func, fi, num, stream) - struct symbol *func; - struct frame_info *fi; - int num; - struct ui_file *stream; +print_frame_args (struct symbol *func, struct frame_info *fi, int num, + struct ui_file *stream) { struct block *b = NULL; int nsyms = 0; @@ -1777,6 +1789,13 @@ print_frame_args (func, fi, num, stream) int arg_size; /* Number of ints of arguments that we have printed so far. */ int args_printed = 0; +#ifdef UI_OUT + struct cleanup *old_chain, *list_chain; + struct ui_stream *stb; + + stb = ui_out_stream_new (uiout); + old_chain = make_cleanup_ui_out_stream_delete (stb); +#endif /* UI_OUT */ if (func) { @@ -1802,8 +1821,8 @@ print_frame_args (func, fi, num, stream) /* Compute address of next argument by adding the size of this argument and rounding to an int boundary. */ - current_offset - = ((current_offset + arg_size + sizeof (int) - 1) + current_offset = + ((current_offset + arg_size + sizeof (int) - 1) & ~(sizeof (int) - 1)); /* If this is the highest offset seen yet, set highest_offset. */ @@ -1881,6 +1900,21 @@ print_frame_args (func, fi, num, stream) sym = nsym; } +#ifdef UI_OUT + /* Print the current arg. */ + if (!first) + ui_out_text (uiout, ", "); + ui_out_wrap_hint (uiout, " "); + + annotate_arg_begin (); + + list_chain = make_cleanup_ui_out_tuple_begin_end (uiout, NULL); + fprintf_symbol_filtered (stb->stream, SYMBOL_SOURCE_NAME (sym), + SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI); + ui_out_field_stream (uiout, "name", stb); + annotate_arg_name_end (); + ui_out_text (uiout, "="); +#else /* Print the current arg. */ if (!first) fprintf_filtered (stream, ", "); @@ -1892,6 +1926,7 @@ print_frame_args (func, fi, num, stream) SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI); annotate_arg_name_end (); fputs_filtered ("=", stream); +#endif /* Avoid value_print because it will deref ref parameters. We just want to print their addresses. Print ??? for args whose address @@ -1907,12 +1942,25 @@ print_frame_args (func, fi, num, stream) if (GDB_TARGET_IS_D10V && SYMBOL_CLASS (sym) == LOC_REGPARM && TYPE_CODE (VALUE_TYPE (val)) == TYPE_CODE_PTR) TYPE_LENGTH (VALUE_TYPE (val)) = 2; +#ifdef UI_OUT + val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, + VALUE_ADDRESS (val), + stb->stream, 0, 0, 2, Val_no_prettyprint); + ui_out_field_stream (uiout, "value", stb); + } + else + ui_out_text (uiout, "???"); + + /* Invoke ui_out_tuple_end. */ + do_cleanups (list_chain); +#else val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), 0, VALUE_ADDRESS (val), stream, 0, 0, 2, Val_no_prettyprint); } else fputs_filtered ("???", stream); +#endif annotate_arg_end (); @@ -1933,6 +1981,9 @@ print_frame_args (func, fi, num, stream) print_frame_nameless_args (fi, start, num - args_printed, first, stream); } +#ifdef UI_OUT + do_cleanups (old_chain); +#endif /* no UI_OUT */ } /* Print nameless args on STREAM. @@ -1942,12 +1993,8 @@ print_frame_args (func, fi, num, stream) the first nameless arg). */ static void -print_frame_nameless_args (fi, start, num, first, stream) - struct frame_info *fi; - long start; - int num; - int first; - struct ui_file *stream; +print_frame_nameless_args (struct frame_info *fi, long start, int num, + int first, struct ui_file *stream) { int i; CORE_ADDR argsaddr; @@ -1985,9 +2032,7 @@ print_frame_nameless_args (fi, start, num, first, stream) /* ARGSUSED */ static void -printf_command (arg, from_tty) - char *arg; - int from_tty; +printf_command (char *arg, int from_tty) { register char *f = NULL; register char *s = arg; @@ -2000,8 +2045,7 @@ printf_command (arg, from_tty) struct cleanup *old_cleanups; val_args = (value_ptr *) xmalloc (allocated_args * sizeof (value_ptr)); - old_cleanups = make_cleanup ((make_cleanup_func) free_current_contents, - &val_args); + old_cleanups = make_cleanup (free_current_contents, &val_args); if (s == 0) error_no_arg ("format-control string and values to print"); @@ -2034,11 +2078,7 @@ printf_command (arg, from_tty) *f++ = '\\'; break; case 'a': -#ifdef __STDC__ *f++ = '\a'; -#else - *f++ = '\007'; /* Bell */ -#endif break; case 'b': *f++ = '\b'; @@ -2212,15 +2252,15 @@ printf_command (arg, from_tty) { char c; QUIT; - read_memory_section (tem + j, &c, 1, - VALUE_BFD_SECTION (val_args[i])); + read_memory (tem + j, &c, 1); if (c == 0) break; } /* Copy the string contents into a string inside GDB. */ str = (char *) alloca (j + 1); - read_memory_section (tem, str, j, VALUE_BFD_SECTION (val_args[i])); + if (j != 0) + read_memory (tem, str, j); str[j] = 0; printf_filtered (current_substring, str); @@ -2270,9 +2310,7 @@ printf_command (arg, from_tty) /* ARGSUSED */ static void -disassemble_command (arg, from_tty) - char *arg; - int from_tty; +disassemble_command (char *arg, int from_tty) { CORE_ADDR low, high; char *name; @@ -2395,9 +2433,7 @@ disassemble_command (arg, from_tty) on STREAM. Returns length of the instruction, in bytes. */ static int -print_insn (memaddr, stream) - CORE_ADDR memaddr; - struct ui_file *stream; +print_insn (CORE_ADDR memaddr, struct ui_file *stream) { if (TARGET_BYTE_ORDER == BIG_ENDIAN) TARGET_PRINT_INSN_INFO->endian = BFD_ENDIAN_BIG; @@ -2413,7 +2449,7 @@ print_insn (memaddr, stream) void -_initialize_printcmd () +_initialize_printcmd (void) { current_display_number = -1;