+2008-05-06 Joel Brobecker <brobecker@adacore.com>
+
+ * valprint.c (val_print): Add new language parameter and use it
+ instead of using the current_language. Update calls to val_print
+ throughout.
+ (common_val_print): Add new langauge parameter and pass it to
+ val_print.
+ * value.h (struct language_defn): Add opaque declaration.
+ (val_print, common_val_print): Update declarations.
+ * stack.c (print_frame_args): Update call to common_val_print
+ using the appropriate language.
+ * mi/mi-cmd-stack.c (list_args_or_locals): Likewise.
+ * c-valprint, f-valprint.c, m2-valprint.c, mt-tdep.c, infcmd.c,
+ mi/mi-main.c, jv-valprint.c, ada-valprint.c, varobj.c, p-valprint.c,
+ scm-valprint.c, cp-valprint.c, sh64-tdep.c, printcmd.c:
+ #include "language.h" if necessary.
+ Update calls to val_print and common_val_print.
+ * Makefile.in (mt-tdep.o, sh64-tdep.o, mi-cmds.o, mi-main.o):
+ Update dependencies.
+
2008-05-06 Joel Brobecker <brobecker@adacore.com>
* ia64-tdep.c (ia64_convert_from_func_ptr_addr): Treat addresses
$(symtab_h) $(dis_asm_h) $(arch_utils_h) $(gdbtypes_h) \
$(gdb_string_h) $(regcache_h) $(reggroups_h) $(gdbcore_h) \
$(trad_frame_h) $(inferior_h) $(dwarf2_frame_h) $(infcall_h) \
- $(gdb_assert_h)
+ $(gdb_assert_h) $(language_h)
nbsd-nat.o: nbsd-nat.c $(defs_h) $(nbsd_nat_h)
nbsd-tdep.o: nbsd-tdep.c $(defs_h) $(gdb_string_h) $(solib_svr4_h)
nto-procfs.o: nto-procfs.c $(defs_h) $(gdb_dirent_h) $(exceptions_h) \
$(frame_unwind_h) $(dwarf2_frame_h) $(symtab_h) $(gdbtypes_h) \
$(gdbcmd_h) $(gdbcore_h) $(value_h) $(dis_asm_h) $(inferior_h) \
$(gdb_string_h) $(gdb_assert_h) $(arch_utils_h) $(regcache_h) \
- $(osabi_h) $(elf_bfd_h) $(elf_sh_h) $(gdb_sim_sh_h)
+ $(osabi_h) $(elf_bfd_h) $(elf_sh_h) $(gdb_sim_sh_h) $(language_h)
shnbsd-nat.o: shnbsd-nat.c $(defs_h) $(inferior_h) $(sh_tdep_h) \
$(shnbsd_tdep_h) $(inf_ptrace_h) $(regcache_h)
shnbsd-tdep.o: shnbsd-tdep.c $(defs_h) $(gdbcore_h) $(regcache_h) $(regset_h) \
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmds.c
mi-cmd-stack.o: $(srcdir)/mi/mi-cmd-stack.c $(defs_h) $(target_h) $(frame_h) \
$(value_h) $(mi_cmds_h) $(ui_out_h) $(symtab_h) $(block_h) \
- $(stack_h) $(dictionary_h) $(gdb_string_h)
+ $(stack_h) $(dictionary_h) $(gdb_string_h) $(language_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-cmd-stack.c
mi-cmd-target.o: $(srcdir)/mi/mi-cmd-target.c $(defs_h) $(mi_cmds_h) \
$(mi_getopt_h) $(remote_h)
$(gdb_string_h) $(exceptions_h) $(top_h) $(gdbthread_h) $(mi_cmds_h) \
$(mi_parse_h) $(mi_getopt_h) $(mi_console_h) $(ui_out_h) $(mi_out_h) \
$(interps_h) $(event_loop_h) $(event_top_h) $(gdbcore_h) $(value_h) \
- $(regcache_h) $(gdb_h) $(frame_h) $(mi_main_h)
+ $(regcache_h) $(gdb_h) $(frame_h) $(mi_main_h) $(language_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-main.c
mi-out.o: $(srcdir)/mi/mi-out.c $(defs_h) $(ui_out_h) $(mi_out_h)
$(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-out.c
if (i - i0 > repeat_count_threshold)
{
val_print (elttype, value_contents (v0), 0, 0, stream, format,
- 0, recurse + 1, pretty);
+ 0, recurse + 1, pretty, current_language);
annotate_elt_rep (i - i0);
fprintf_filtered (stream, _(" <repeats %u times>"), i - i0);
annotate_elt_rep_end ();
stream, format, pretty);
}
val_print (elttype, value_contents (v0), 0, 0, stream, format,
- 0, recurse + 1, pretty);
+ 0, recurse + 1, pretty, current_language);
annotate_elt ();
}
}
val_print (value_type (deref_val),
value_contents (deref_val), 0,
VALUE_ADDRESS (deref_val), stream, format,
- deref_ref, recurse + 1, pretty);
+ deref_ref, recurse + 1, pretty, current_language);
}
else
fputs_filtered ("(null)", stream);
}
return (val_print (type, value_contents (val), 0, address,
- stream, format, 1, 0, pretty));
+ stream, format, 1, 0, pretty, current_language));
}
static void
bit_size,
TYPE_FIELD_TYPE (type, i));
val_print (TYPE_FIELD_TYPE (type, i), value_contents (v), 0, 0,
- stream, format, 0, recurse + 1, pretty);
+ stream, format, 0, recurse + 1, pretty,
+ current_language);
}
}
else
}
vt_val = value_at (wtype, vt_address);
common_val_print (vt_val, stream, format,
- deref_ref, recurse + 1, pretty);
+ deref_ref, recurse + 1, pretty,
+ current_language);
if (pretty)
{
fprintf_filtered (stream, "\n");
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset));
common_val_print (deref_val, stream, format, deref_ref,
- recurse, pretty);
+ recurse, pretty, current_language);
}
else
fputs_filtered ("???", stream);
/* Print out object: enclosing type is same as real_type if full */
return val_print (value_enclosing_type (val),
value_contents_all (val), 0,
- VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
+ VALUE_ADDRESS (val), stream, format, 1, 0,
+ pretty, current_language);
/* Note: When we look up RTTI entries, we don't get any information on
const or volatile attributes */
}
TYPE_NAME (value_enclosing_type (val)));
return val_print (value_enclosing_type (val),
value_contents_all (val), 0,
- VALUE_ADDRESS (val), stream, format, 1, 0, pretty);
+ VALUE_ADDRESS (val), stream, format, 1, 0,
+ pretty, current_language);
}
/* Otherwise, we end up at the return outside this "if" */
}
return val_print (type, value_contents_all (val),
value_embedded_offset (val),
VALUE_ADDRESS (val) + value_offset (val),
- stream, format, 1, 0, pretty);
+ stream, format, 1, 0, pretty, current_language);
}
(TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr + offset, i));
- common_val_print (v, stream, format, 0, recurse + 1, pretty);
+ common_val_print (v, stream, format, 0, recurse + 1, pretty,
+ current_language);
}
}
else
val_print (TYPE_FIELD_TYPE (type, i),
valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
address + TYPE_FIELD_BITPOS (type, i) / 8,
- stream, format, 0, recurse + 1, pretty);
+ stream, format, 0, recurse + 1, pretty,
+ current_language);
}
}
annotate_field_end ();
}
val_print (type, value_contents_all (val),
value_embedded_offset (val), VALUE_ADDRESS (val),
- stream, format, 0, recurse, pretty);
+ stream, format, 0, recurse, pretty, current_language);
}
valaddr + i * F77_DIM_OFFSET (ndimensions),
0,
address + i * F77_DIM_OFFSET (ndimensions),
- stream, format, deref_ref, recurse, pretty);
+ stream, format, deref_ref, recurse, pretty,
+ current_language);
if (i != (F77_DIM_SIZE (nss) - 1))
fprintf_filtered (stream, ", ");
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset));
common_val_print (deref_val, stream, format, deref_ref, recurse,
- pretty);
+ pretty, current_language);
}
else
fputs_filtered ("???", stream);
int j;
val_print (register_type (gdbarch, i), buffer, 0, 0,
- file, 0, 1, 0, Val_pretty_default);
+ file, 0, 1, 0, Val_pretty_default, current_language);
fprintf_filtered (file, "\t(raw 0x");
for (j = 0; j < register_size (gdbarch, i); j++)
{
/* Print the register in hex. */
val_print (register_type (gdbarch, i), buffer, 0, 0,
- file, 'x', 1, 0, Val_pretty_default);
+ file, 'x', 1, 0, Val_pretty_default, current_language);
/* If not a vector register, print it also according to its
natural format. */
if (TYPE_VECTOR (register_type (gdbarch, i)) == 0)
{
fprintf_filtered (file, "\t");
val_print (register_type (gdbarch, i), buffer, 0, 0,
- file, 0, 1, 0, Val_pretty_default);
+ file, 0, 1, 0, Val_pretty_default, current_language);
}
}
else
fprintf_filtered (stream, "%d..%d: ", i, i + reps - 1);
- common_val_print (v, stream, format, 2, 1, pretty);
+ common_val_print (v, stream, format, 2, 1, pretty,
+ current_language);
things_printed++;
i += reps;
return 0;
}
- return common_val_print (val, stream, format, 1, 0, pretty);
+ return common_val_print (val, stream, format, 1, 0, pretty,
+ current_language);
}
/* TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and PRETTY have the
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i));
- common_val_print (v, stream, format, 0, recurse + 1, pretty);
+ common_val_print (v, stream, format, 0, recurse + 1,
+ pretty, current_language);
}
}
else
if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
v = value_addr (v);
common_val_print (v, stream, format, 0, recurse + 1,
- pretty);
+ pretty, current_language);
}
}
else if (TYPE_FIELD_TYPE (type, i) == NULL)
val_print (TYPE_FIELD_TYPE (type, i),
valaddr + TYPE_FIELD_BITPOS (type, i) / 8, 0,
address + TYPE_FIELD_BITPOS (type, i) / 8,
- stream, format, 0, recurse + 1, pretty);
+ stream, format, 0, recurse + 1, pretty,
+ current_language);
}
}
annotate_field_end ();
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr));
common_val_print (deref_val, stream, format, deref_ref,
- recurse, pretty);
+ recurse, pretty, current_language);
}
else
fputs_filtered ("???", stream);
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset));
common_val_print (deref_val, stream, format, deref_ref,
- recurse, pretty);
+ recurse, pretty, current_language);
}
else
fputs_filtered ("???", stream);
#include "stack.h"
#include "dictionary.h"
#include "gdb_string.h"
+#include "language.h"
static void list_args_or_locals (int locals, int values, struct frame_info *fi);
{
val = read_var_value (sym2, fi);
common_val_print
- (val, stb->stream, 0, 1, 0, Val_no_prettyprint);
+ (val, stb->stream, 0, 1, 0, Val_no_prettyprint,
+ language_def (SYMBOL_LANGUAGE (sym2)));
ui_out_field_stream (uiout, "value", stb);
}
do_cleanups (cleanup_tuple);
case PRINT_ALL_VALUES:
val = read_var_value (sym2, fi);
common_val_print
- (val, stb->stream, 0, 1, 0, Val_no_prettyprint);
+ (val, stb->stream, 0, 1, 0, Val_no_prettyprint,
+ language_def (SYMBOL_LANGUAGE (sym2)));
ui_out_field_stream (uiout, "value", stb);
do_cleanups (cleanup_tuple);
break;
#include "gdb.h"
#include "frame.h"
#include "mi-main.h"
+#include "language.h"
#include <ctype.h>
#include <sys/time.h>
else
{
val_print (register_type (current_gdbarch, regnum), buffer, 0, 0,
- stb->stream, format, 1, 0, Val_pretty_default);
+ stb->stream, format, 1, 0, Val_pretty_default,
+ current_language);
ui_out_field_stream (uiout, "value", stb);
ui_out_stream_delete (stb);
}
/* Print the result of the expression evaluation. */
val_print (value_type (val), value_contents (val),
value_embedded_offset (val), VALUE_ADDRESS (val),
- stb->stream, 0, 0, 0, 0);
+ stb->stream, 0, 0, 0, 0, current_language);
ui_out_field_stream (uiout, "value", stb);
ui_out_stream_delete (stb);
#include "dwarf2-frame.h"
#include "infcall.h"
#include "gdb_assert.h"
+#include "language.h"
enum mt_arch_constants
{
(gdbarch, regnum)),
file);
val_print (register_type (gdbarch, regnum), buf,
- 0, 0, file, 0, 1, 0, Val_no_prettyprint);
+ 0, 0, file, 0, 1, 0, Val_no_prettyprint,
+ current_language);
fputs_filtered ("\n", file);
}
else if (regnum == MT_MAC_REGNUM || regnum == MT_MAC_PSEUDOREG_REGNUM)
}
vt_val = value_at (wtype, vt_address);
common_val_print (vt_val, stream, format, deref_ref,
- recurse + 1, pretty);
+ recurse + 1, pretty, current_language);
if (pretty)
{
fprintf_filtered (stream, "\n");
unpack_pointer (lookup_pointer_type (builtin_type_void),
valaddr + embedded_offset));
common_val_print (deref_val, stream, format, deref_ref,
- recurse + 1, pretty);
+ recurse + 1, pretty, current_language);
}
else
fputs_filtered ("???", stream);
fprintf_filtered (stream, ") ");
}
}
- return common_val_print (val, stream, format, 1, 0, pretty);
+ return common_val_print (val, stream, format, 1, 0, pretty,
+ current_language);
}
v = value_from_longest (TYPE_FIELD_TYPE (type, i),
unpack_field_as_long (type, valaddr, i));
- common_val_print (v, stream, format, 0, recurse + 1, pretty);
+ common_val_print (v, stream, format, 0, recurse + 1,
+ pretty, current_language);
}
}
else
val_print (TYPE_FIELD_TYPE (type, i),
valaddr, TYPE_FIELD_BITPOS (type, i) / 8,
address + TYPE_FIELD_BITPOS (type, i) / 8,
- stream, format, 0, recurse + 1, pretty);
+ stream, format, 0, recurse + 1, pretty,
+ current_language);
}
}
annotate_field_end ();
stream, format, recurse, pretty, NULL, 1);
return;
}
- common_val_print (val, stream, format, 0, recurse, pretty);
+ common_val_print (val, stream, format, 0, recurse, pretty,
+ current_language);
}
extern initialize_file_ftype _initialize_pascal_valprint; /* -Wmissing-prototypes */
again. */
if (format == 's')
{
- val_print (type, valaddr, 0, 0, stream, 0, 0, 0, Val_pretty_default);
+ val_print (type, valaddr, 0, 0, stream, 0, 0, 0, Val_pretty_default,
+ current_language);
return;
}
scm_value_print (struct value *val, struct ui_file *stream, int format,
enum val_prettyprint pretty)
{
- return (common_val_print (val, stream, format, 1, 0, pretty));
+ return (common_val_print (val, stream, format, 1, 0, pretty,
+ current_language));
}
#include "elf/sh.h"
/* registers numbers shared with the simulator */
#include "gdb/sim-sh.h"
+#include "language.h"
/* Information that is dependent on the processor variant. */
enum sh_abi
fprintf_filtered (file, "*value not available*\n");
val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
- file, 'x', 1, 0, Val_pretty_default);
+ file, 'x', 1, 0, Val_pretty_default, current_language);
fprintf_filtered (file, "\t");
val_print (register_type (gdbarch, regnum), raw_buffer, 0, 0,
- file, 0, 1, 0, Val_pretty_default);
+ file, 0, 1, 0, Val_pretty_default, current_language);
fprintf_filtered (file, "\n");
}
if (val)
{
+ const struct language_defn *language;
+
+ /* Use the appropriate language to display our symbol,
+ unless the user forced the language to a specific
+ language. */
+ if (language_mode == language_mode_auto)
+ language = language_def (SYMBOL_LANGUAGE (sym));
+ else
+ language = current_language;
+
common_val_print (val, stb->stream, 0, 0, 2,
- Val_no_prettyprint);
+ Val_no_prettyprint, language);
ui_out_field_stream (uiout, "value", stb);
}
else
}
\f
-/* Print data of type TYPE located at VALADDR (within GDB), which came from
- the inferior at address ADDRESS, onto stdio stream STREAM according to
- FORMAT (a letter, or 0 for natural format using TYPE).
+/* Print using the given LANGUAGE the data of type TYPE located at VALADDR
+ (within GDB), which came from the inferior at address ADDRESS, onto
+ stdio stream STREAM according to FORMAT (a letter, or 0 for natural
+ format using TYPE).
If DEREF_REF is nonzero, then dereference references, otherwise just print
them like pointers.
int
val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset,
CORE_ADDR address, struct ui_file *stream, int format,
- int deref_ref, int recurse, enum val_prettyprint pretty)
+ int deref_ref, int recurse, enum val_prettyprint pretty,
+ const struct language_defn *language)
{
volatile struct gdb_exception except;
volatile enum val_prettyprint real_pretty = pretty;
TRY_CATCH (except, RETURN_MASK_ERROR)
{
- ret = LA_VAL_PRINT (type, valaddr, embedded_offset, address,
- stream, format, deref_ref, recurse, real_pretty);
+ ret = language->la_val_print (type, valaddr, embedded_offset, address,
+ stream, format, deref_ref, recurse,
+ real_pretty);
}
if (except.reason < 0)
fprintf_filtered (stream, _("<error reading variable>"));
return 1;
}
-/* Print the value VAL onto stream STREAM according to FORMAT (a
- letter, or 0 for natural format using TYPE).
+/* Print using the given LANGUAGE the value VAL onto stream STREAM according
+ to FORMAT (a letter, or 0 for natural format using TYPE).
If DEREF_REF is nonzero, then dereference references, otherwise just print
them like pointers.
int
common_val_print (struct value *val, struct ui_file *stream, int format,
- int deref_ref, int recurse, enum val_prettyprint pretty)
+ int deref_ref, int recurse, enum val_prettyprint pretty,
+ const struct language_defn *language)
{
if (!value_check_printable (val, stream))
return 0;
return val_print (value_type (val), value_contents_all (val),
value_embedded_offset (val), VALUE_ADDRESS (val),
- stream, format, deref_ref, recurse, pretty);
+ stream, format, deref_ref, recurse, pretty,
+ language);
}
/* Print the value VAL in C-ish syntax on stream STREAM.
if (reps > repeat_count_threshold)
{
val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
- deref_ref, recurse + 1, pretty);
+ deref_ref, recurse + 1, pretty, current_language);
annotate_elt_rep (reps);
fprintf_filtered (stream, " <repeats %u times>", reps);
annotate_elt_rep_end ();
else
{
val_print (elttype, valaddr + i * eltlen, 0, 0, stream, format,
- deref_ref, recurse + 1, pretty);
+ deref_ref, recurse + 1, pretty, current_language);
annotate_elt ();
things_printed++;
}
struct symbol;
struct type;
struct ui_file;
+struct language_defn;
/* The structure which defines the type of a value. It should never
be possible for a program lval value to survive over a call to the
int embedded_offset, CORE_ADDR address,
struct ui_file *stream, int format,
int deref_ref, int recurse,
- enum val_prettyprint pretty);
+ enum val_prettyprint pretty,
+ const struct language_defn *language);
extern int common_val_print (struct value *val,
struct ui_file *stream, int format,
int deref_ref, int recurse,
- enum val_prettyprint pretty);
+ enum val_prettyprint pretty,
+ const struct language_defn *language);
extern int val_print_string (CORE_ADDR addr, int len, int width,
struct ui_file *stream);
stb = mem_fileopen ();
old_chain = make_cleanup_ui_file_delete (stb);
- common_val_print (value, stb, format_code[(int) format], 1, 0, 0);
+ common_val_print (value, stb, format_code[(int) format], 1, 0, 0,
+ current_language);
thevalue = ui_file_xstrdup (stb, &dummy);
do_cleanups (old_chain);