#include "breakpoint.h"
#include "demangle.h"
#include "valprint.h"
+#include "annotate.h"
extern int asm_demangle; /* Whether to demangle syms in asm printouts */
extern int addressprint; /* Whether to print hex addresses in HLL " */
int inspect_it = 0;
-void
-print_value_flags (t)
- struct type *t;
-{
- /* FIXME: Should we be printing * for references as well as pointers? */
- if (t != NULL
- && TYPE_CODE (t) == TYPE_CODE_PTR
- && TYPE_CODE (TYPE_TARGET_TYPE (t)) != TYPE_CODE_VOID)
- printf_filtered ("*");
- else
- printf_filtered ("-");
-}
-
struct display
{
/* Chain link to next auto-display item. */
struct symbol *symbol;
struct symtab *symtab = 0;
CORE_ADDR name_location = 0;
- char *name;
+ char *name = "";
/* First try to find the address in the symbol table, then
in the minsyms. Take the closest one. */
fputs_filtered (">", stream);
}
-/* Print address ADDR on STREAM. */
+/* Print address ADDR on STREAM. USE_LOCAL means the same thing as for
+ print_longest. */
void
-print_address_numeric (addr, stream)
+print_address_numeric (addr, use_local, stream)
CORE_ADDR addr;
+ int use_local;
GDB_FILE *stream;
{
/* This assumes a CORE_ADDR can fit in a LONGEST. Probably a safe
CORE_ADDR addr;
GDB_FILE *stream;
{
- print_address_numeric (addr, stream);
+ print_address_numeric (addr, 1, stream);
print_address_symbolic (addr, stream, asm_demangle, " ");
}
}
else if (addressprint)
{
- print_address_numeric (addr, stream);
+ print_address_numeric (addr, 1, stream);
print_address_symbolic (addr, stream, do_demangle, " ");
}
else
{
int histindex = record_latest_value (val);
- if (annotation_level > 1)
- {
- if (histindex >= 0)
- printf_filtered ("\n\032\032value-history-begin %d ", histindex);
- else
- printf_filtered ("\n\032\032value-begin ");
- print_value_flags (VALUE_TYPE (val));
- printf_filtered ("\n");
- }
+ if (histindex >= 0)
+ annotate_value_history_begin (histindex, VALUE_TYPE (val));
+ else
+ annotate_value_begin (VALUE_TYPE (val));
if (inspect)
printf_unfiltered ("\031(gdb-makebuffer \"%s\" %d '(\"", exp, histindex);
else
if (histindex >= 0) printf_filtered ("$%d = ", histindex);
- if (annotation_level > 1 && histindex >= 0)
- printf_filtered ("\n\032\032value-history-value\n");
+ if (histindex >= 0)
+ annotate_value_history_value ();
print_formatted (val, format, fmt.size);
printf_filtered ("\n");
- if (annotation_level > 1)
- {
- if (histindex >= 0)
- printf_filtered ("\n\032\032value-history-end\n");
- else
- printf_filtered ("\n\032\032value-end\n");
- }
+ if (histindex >= 0)
+ annotate_value_history_end ();
+ else
+ annotate_value_end ();
if (inspect)
printf_unfiltered("\") )\030");
val = evaluate_expression (expr);
- if (annotation_level > 1)
- {
- printf_filtered ("\n\032\032value-begin ");
- print_value_flags (VALUE_TYPE (val));
- printf_filtered ("\n");
- }
+ annotate_value_begin (VALUE_TYPE (val));
print_formatted (val, format, fmt.size);
- if (annotation_level > 1)
- printf_filtered ("\n\032\032value-end\n");
+ annotate_value_end ();
do_cleanups (old_chain);
}
fprintf_symbol_filtered (gdb_stdout, exp,
current_language->la_language, DMGL_ANSI);
printf_filtered ("\" is at ");
- print_address_numeric (SYMBOL_VALUE_ADDRESS (msymbol), gdb_stdout);
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (msymbol), 1,
+ gdb_stdout);
printf_filtered (" in a file compiled without debugging.\n");
}
else
case LOC_LABEL:
printf_filtered ("a label at address ");
- print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), gdb_stdout);
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), 1, gdb_stdout);
break;
case LOC_REGISTER:
case LOC_STATIC:
printf_filtered ("static storage at address ");
- print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), gdb_stdout);
+ print_address_numeric (SYMBOL_VALUE_ADDRESS (sym), 1, gdb_stdout);
break;
case LOC_REGPARM:
case LOC_BLOCK:
printf_filtered ("a function at address ");
- print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)),
+ print_address_numeric (BLOCK_START (SYMBOL_BLOCK_VALUE (sym)), 1,
gdb_stdout);
break;
current_display_number = d->number;
- printf_filtered ("%d: ", d->number);
+ annotate_display_begin ();
+ printf_filtered ("%d", d->number);
+ annotate_display_number_end ();
+ printf_filtered (": ");
if (d->format.size)
{
CORE_ADDR addr;
-
+
+ annotate_display_format ();
+
printf_filtered ("x/");
if (d->format.count != 1)
printf_filtered ("%d", d->format.count);
if (d->format.format != 'i' && d->format.format != 's')
printf_filtered ("%c", d->format.size);
printf_filtered (" ");
+
+ annotate_display_expression ();
+
print_expression (d->exp, gdb_stdout);
+ annotate_display_expression_end ();
+
if (d->format.count != 1)
printf_filtered ("\n");
else
addr = value_as_pointer (evaluate_expression (d->exp));
if (d->format.format == 'i')
addr = ADDR_BITS_REMOVE (addr);
-
+
+ annotate_display_value ();
+
do_examine (d->format, addr);
}
else
{
+ annotate_display_format ();
+
if (d->format.format)
printf_filtered ("/%c ", d->format.format);
+
+ annotate_display_expression ();
+
print_expression (d->exp, gdb_stdout);
+ annotate_display_expression_end ();
+
printf_filtered (" = ");
+
+ annotate_display_expression ();
+
print_formatted (evaluate_expression (d->exp),
d->format.format, d->format.size);
printf_filtered ("\n");
}
+ annotate_display_end ();
+
gdb_flush (gdb_stdout);
current_display_number = -1;
}
Additional note: It might be nice if "info args" displayed
both values.
- One more note: There is a case with sparc sturcture passing
+ One more note: There is a case with sparc structure passing
where we need to use the LOC_REGISTER, but this is dealt with
by creating a single LOC_REGPARM in symbol reading. */
fprintf_filtered (stream, ", ");
wrap_here (" ");
- if (annotation_level > 1)
- printf_filtered ("\n\032\032arg-name-begin\n");
+ annotate_arg_begin ();
+
fprintf_symbol_filtered (stream, SYMBOL_SOURCE_NAME (sym),
SYMBOL_LANGUAGE (sym), DMGL_PARAMS | DMGL_ANSI);
- if (annotation_level > 1)
- printf_filtered ("\n\032\032arg-name-end\n");
+ annotate_arg_name_end ();
fputs_filtered ("=", stream);
/* Avoid value_print because it will deref ref parameters. We just
2 for each recurse. */
val = read_var_value (sym, FRAME_INFO_ID (fi));
- if (annotation_level > 1)
- {
- printf_filtered ("\n\032\032arg-begin ");
- print_value_flags (val == NULL ? NULL : VALUE_TYPE (val));
- printf_filtered ("\n");
- }
+ annotate_arg_value (val == NULL ? NULL : VALUE_TYPE (val));
if (val)
val_print (VALUE_TYPE (val), VALUE_CONTENTS (val), VALUE_ADDRESS (val),
else
fputs_filtered ("???", stream);
- if (annotation_level > 1)
- printf_filtered ("\n\032\032arg-end\n");
+ annotate_arg_end ();
first = 0;
}
{
/* Now scan the string for %-specs and see what kinds of args they want.
- argclass[I] classifies the %-specs so we can give vprintf_unfiltered something
- of the right size. */
+ argclass[I] classifies the %-specs so we can give printf_filtered
+ something of the right size. */
enum argclass {no_arg, int_arg, string_arg, double_arg, long_long_arg};
enum argclass *argclass;
if (nargs != nargs_wanted)
error ("Wrong number of arguments for specified format-string");
- /* FIXME: We should be using vprintf_filtered, but as long as it
- has an arbitrary limit that is unacceptable. Correct fix is
- for vprintf_filtered to scan down the format string so it knows
- how big a buffer it needs (perhaps by putting a vasprintf (see
- GNU C library) in libiberty).
-
- But for now, just force out any pending output, so at least the output
- appears in the correct order. */
- wrap_here ((char *)NULL);
-
/* Now actually print them. */
current_substring = substrings;
for (i = 0; i < nargs; i++)
read_memory (tem, str, j);
str[j] = 0;
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, str);
+ printf_filtered (current_substring, str);
}
break;
case double_arg:
{
double val = value_as_double (val_args[i]);
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, val);
+ printf_filtered (current_substring, val);
break;
}
case long_long_arg:
#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
{
long long val = value_as_long (val_args[i]);
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, val);
+ printf_filtered (current_substring, val);
break;
}
#else
{
/* FIXME: there should be separate int_arg and long_arg. */
long val = value_as_long (val_args[i]);
- /* Don't use printf_filtered because of arbitrary limit. */
- printf_unfiltered (current_substring, val);
+ printf_filtered (current_substring, val);
break;
}
default:
current_substring += strlen (current_substring) + 1;
}
/* Print the portion of the format string after the last argument. */
- /* It would be OK to use printf_filtered here. */
- printf (last_arg);
+ printf_filtered (last_arg);
}
do_cleanups (old_cleanups);
}
else
{
printf_filtered ("from ");
- print_address_numeric (low, gdb_stdout);
+ print_address_numeric (low, 1, gdb_stdout);
printf_filtered (" to ");
- print_address_numeric (high, gdb_stdout);
+ print_address_numeric (high, 1, gdb_stdout);
printf_filtered (":\n");
}