aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2008-05-06 21:35:01 +0000
committerJoel Brobecker <brobecker@gnat.com>2008-05-06 21:35:01 +0000
commitd8ca156b0e90ca9549bde4a88c2c2f27127f71a7 (patch)
tree6e3dcc04ed2388f8fab12af288022cd1045e91f6 /gdb/valprint.c
parent2b706932eef86b25a7a833b0e3136d3a0429bfab (diff)
downloadgdb-d8ca156b0e90ca9549bde4a88c2c2f27127f71a7.zip
gdb-d8ca156b0e90ca9549bde4a88c2c2f27127f71a7.tar.gz
gdb-d8ca156b0e90ca9549bde4a88c2c2f27127f71a7.tar.bz2
* 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.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c29
1 files changed, 17 insertions, 12 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index eb3ad35..3bab21e 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, _("<error reading variable>"));
@@ -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, " <repeats %u times>", 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++;
}