From 7ca735573eb71cc03cc9ed4a1a18963007ad8bdd Mon Sep 17 00:00:00 2001 From: brobecke Date: Tue, 6 May 2008 21:34:59 +0000 Subject: [PATCH] * 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. --- gdb/ChangeLog | 20 ++++++++++++++++++++ gdb/Makefile.in | 8 ++++---- gdb/ada-valprint.c | 11 ++++++----- gdb/c-valprint.c | 13 ++++++++----- gdb/cp-valprint.c | 8 +++++--- gdb/f-valprint.c | 5 +++-- gdb/infcmd.c | 6 +++--- gdb/jv-valprint.c | 14 +++++++++----- gdb/m2-valprint.c | 4 ++-- gdb/mi/mi-cmd-stack.c | 7 +++++-- gdb/mi/mi-main.c | 6 ++++-- gdb/mt-tdep.c | 4 +++- gdb/p-valprint.c | 16 ++++++++++------ gdb/printcmd.c | 3 ++- gdb/scm-valprint.c | 3 ++- gdb/sh64-tdep.c | 5 +++-- gdb/stack.c | 12 +++++++++++- gdb/valprint.c | 29 +++++++++++++++++------------ gdb/value.h | 7 +++++-- gdb/varobj.c | 3 ++- 20 files changed, 124 insertions(+), 60 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 4e3cf01b06..6623d3c095 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,25 @@ 2008-05-06 Joel Brobecker + * 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 + * ia64-tdep.c (ia64_convert_from_func_ptr_addr): Treat addresses pointing inside a non-executable section as function descriptors. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 576c68ffa4..75151f6cf3 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -2555,7 +2555,7 @@ mt-tdep.o: mt-tdep.c $(defs_h) $(frame_h) $(frame_unwind_h) $(frame_base_h) \ $(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) \ @@ -2744,7 +2744,7 @@ sh64-tdep.o: sh64-tdep.c $(defs_h) $(frame_h) $(frame_base_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) \ @@ -3259,7 +3259,7 @@ mi-cmds.o: $(srcdir)/mi/mi-cmds.c $(defs_h) $(top_h) $(mi_cmds_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) @@ -3282,7 +3282,7 @@ mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(target_h) $(inferior_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 diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 648cd3605e..a94bcd17ac 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -201,7 +201,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr, 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, _(" "), i - i0); annotate_elt_rep_end (); @@ -228,7 +228,7 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr, 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 (); } } @@ -876,7 +876,7 @@ ada_val_print_1 (struct type *type, const gdb_byte *valaddr0, 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); @@ -966,7 +966,7 @@ ada_value_print (struct value *val0, struct ui_file *stream, int format, } return (val_print (type, value_contents (val), 0, address, - stream, format, 1, 0, pretty)); + stream, format, 1, 0, pretty, current_language)); } static void @@ -1096,7 +1096,8 @@ print_field_values (struct type *type, const gdb_byte *valaddr, 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 diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c index 5206569381..23f097ac0e 100644 --- a/gdb/c-valprint.c +++ b/gdb/c-valprint.c @@ -274,7 +274,8 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, } 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"); @@ -312,7 +313,7 @@ c_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, 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); @@ -618,7 +619,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format, /* 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 */ } @@ -629,7 +631,8 @@ c_value_print (struct value *val, struct ui_file *stream, int format, 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" */ } @@ -637,5 +640,5 @@ c_value_print (struct value *val, struct ui_file *stream, int format, 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); } diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index 6a297b7b02..85f673dc80 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -268,7 +268,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, (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 @@ -292,7 +293,8 @@ cp_print_value_fields (struct type *type, struct type *real_type, 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 (); @@ -486,7 +488,7 @@ cp_print_static_field (struct type *type, } 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); } diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c index 70ad59f9bf..2c482fa83a 100644 --- a/gdb/f-valprint.c +++ b/gdb/f-valprint.c @@ -308,7 +308,8 @@ f77_print_array_1 (int nss, int ndimensions, struct type *type, 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, ", "); @@ -446,7 +447,7 @@ f_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, 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); diff --git a/gdb/infcmd.c b/gdb/infcmd.c index f5d7c50bb6..16d25cc91c 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -1650,7 +1650,7 @@ default_print_registers_info (struct gdbarch *gdbarch, 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++) @@ -1668,14 +1668,14 @@ default_print_registers_info (struct gdbarch *gdbarch, { /* 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); } } diff --git a/gdb/jv-valprint.c b/gdb/jv-valprint.c index 7425dd41d5..68dbdf8074 100644 --- a/gdb/jv-valprint.c +++ b/gdb/jv-valprint.c @@ -180,7 +180,8 @@ java_value_print (struct value *val, struct ui_file *stream, int format, 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; @@ -232,7 +233,8 @@ java_value_print (struct value *val, struct ui_file *stream, int format, 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 @@ -380,7 +382,8 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr, 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 @@ -400,7 +403,7 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr, 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) @@ -410,7 +413,8 @@ java_print_value_fields (struct type *type, const gdb_byte *valaddr, 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 (); diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c index fa0bb257a0..1258d07bfa 100644 --- a/gdb/m2-valprint.c +++ b/gdb/m2-valprint.c @@ -263,7 +263,7 @@ print_variable_at_address (struct type *type, 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); @@ -423,7 +423,7 @@ m2_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, 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); diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 0a629242d2..4d38867340 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -29,6 +29,7 @@ #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); @@ -298,7 +299,8 @@ 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); @@ -306,7 +308,8 @@ list_args_or_locals (int locals, int values, struct frame_info *fi) 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; diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 9dce9b09ff..4ae509e8e7 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -44,6 +44,7 @@ #include "gdb.h" #include "frame.h" #include "mi-main.h" +#include "language.h" #include #include @@ -541,7 +542,8 @@ get_register (int regnum, int format) 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); } @@ -629,7 +631,7 @@ mi_cmd_data_evaluate_expression (char *command, char **argv, int argc) /* 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); diff --git a/gdb/mt-tdep.c b/gdb/mt-tdep.c index 57ff460172..b3049dcdda 100644 --- a/gdb/mt-tdep.c +++ b/gdb/mt-tdep.c @@ -36,6 +36,7 @@ #include "dwarf2-frame.h" #include "infcall.h" #include "gdb_assert.h" +#include "language.h" enum mt_arch_constants { @@ -691,7 +692,8 @@ mt_registers_info (struct gdbarch *gdbarch, (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) diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c index 92f820fc2c..fa0ec6c40a 100644 --- a/gdb/p-valprint.c +++ b/gdb/p-valprint.c @@ -231,7 +231,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, } 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"); @@ -270,7 +270,7 @@ pascal_val_print (struct type *type, const gdb_byte *valaddr, 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); @@ -548,7 +548,8 @@ pascal_value_print (struct value *val, struct ui_file *stream, int format, 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); } @@ -743,7 +744,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, 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 @@ -774,7 +776,8 @@ pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr, 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 (); @@ -941,7 +944,8 @@ pascal_object_print_static_field (struct value *val, 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 */ diff --git a/gdb/printcmd.c b/gdb/printcmd.c index 26a54cbb70..8a0db8dffd 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -328,7 +328,8 @@ print_scalar_formatted (const void *valaddr, struct type *type, 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; } diff --git a/gdb/scm-valprint.c b/gdb/scm-valprint.c index 7c9a58d2f4..a80a61a6d5 100644 --- a/gdb/scm-valprint.c +++ b/gdb/scm-valprint.c @@ -432,5 +432,6 @@ int 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)); } diff --git a/gdb/sh64-tdep.c b/gdb/sh64-tdep.c index 10e6099bed..6ad32f070d 100644 --- a/gdb/sh64-tdep.c +++ b/gdb/sh64-tdep.c @@ -47,6 +47,7 @@ #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 @@ -2109,10 +2110,10 @@ sh64_do_register (struct gdbarch *gdbarch, struct ui_file *file, 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"); } diff --git a/gdb/stack.c b/gdb/stack.c index d54c9e6f72..47df3967e8 100644 --- a/gdb/stack.c +++ b/gdb/stack.c @@ -365,8 +365,18 @@ print_frame_args (struct symbol *func, struct frame_info *frame, 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 diff --git a/gdb/valprint.c b/gdb/valprint.c index eb3ad35be5..3bab21edd9 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -180,9 +180,10 @@ show_addressprint (struct ui_file *file, int from_tty, } -/* 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. @@ -203,7 +204,8 @@ show_addressprint (struct ui_file *file, int from_tty, 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; @@ -228,8 +230,9 @@ val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, 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, _("")); @@ -259,8 +262,8 @@ value_check_printable (struct value *val, struct ui_file *stream) 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. @@ -275,14 +278,16 @@ value_check_printable (struct value *val, struct ui_file *stream) 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. @@ -1061,7 +1066,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, 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, " ", reps); annotate_elt_rep_end (); @@ -1072,7 +1077,7 @@ val_print_array_elements (struct type *type, const gdb_byte *valaddr, 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++; } diff --git a/gdb/value.h b/gdb/value.h index f75f7dd62e..fa42965783 100644 --- a/gdb/value.h +++ b/gdb/value.h @@ -31,6 +31,7 @@ struct regcache; 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 @@ -519,12 +520,14 @@ extern 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); + 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); diff --git a/gdb/varobj.c b/gdb/varobj.c index f3d3b5abef..317f6b47fc 100644 --- a/gdb/varobj.c +++ b/gdb/varobj.c @@ -1821,7 +1821,8 @@ value_get_print_value (struct value *value, enum varobj_display_formats format) 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); -- 2.11.0