aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2020-03-13 17:39:52 -0600
committerTom Tromey <tom@tromey.com>2020-03-13 18:03:42 -0600
commit426a9c18dddcdd5f640b702734dd8f9c108b7372 (patch)
treed9ba80f648c60ab6d3a95de00187889200459f8f /gdb
parent42331a1ea2a13ce15ec202c5f0fbef3e5171253c (diff)
downloadgdb-426a9c18dddcdd5f640b702734dd8f9c108b7372.zip
gdb-426a9c18dddcdd5f640b702734dd8f9c108b7372.tar.gz
gdb-426a9c18dddcdd5f640b702734dd8f9c108b7372.tar.bz2
Remove val_print
We can finally remove val_print and various helper functions that are no longer needed. gdb/ChangeLog 2020-03-13 Tom Tromey <tom@tromey.com> * value.h (val_print): Don't declare. * valprint.h (val_print_array_elements) (val_print_scalar_formatted, generic_val_print): Don't declare. * valprint.c (generic_val_print_array): Take a struct value. (generic_val_print_ptr, generic_val_print_memberptr) (generic_val_print_bool, generic_val_print_int) (generic_val_print_char, generic_val_print_complex) (generic_val_print): Remove. (generic_value_print): Update. (do_val_print): Remove unused parameters. Don't call la_val_print. (val_print): Remove. (common_val_print): Update. Don't call value_check_printable. (val_print_scalar_formatted, val_print_array_elements): Remove. * rust-lang.c (rust_val_print): Remove. (rust_language_defn): Update. * p-valprint.c (pascal_val_print): Remove. (pascal_value_print_inner): Update. (pascal_object_print_val_fields, pascal_object_print_val): Remove. (pascal_object_print_static_field): Update. * p-lang.h (pascal_val_print): Don't declare. * p-lang.c (pascal_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * m2-valprint.c (m2_print_unbounded_array, m2_val_print): Remove. * m2-lang.h (m2_val_print): Don't declare. * m2-lang.c (m2_language_defn): Update. * language.h (struct language_defn) <la_val_print>: Remove. * language.c (unk_lang_value_print_inner): Rename. Change argument types. (unknown_language_defn, auto_language_defn): Update. * go-valprint.c (go_val_print): Remove. * go-lang.h (go_val_print): Don't declare. * go-lang.c (go_language_defn): Update. * f-valprint.c (f_val_print): Remove. * f-lang.h (f_value_print): Don't declare. * f-lang.c (f_language_defn): Update. * d-valprint.c (d_val_print): Remove. * d-lang.h (d_value_print): Don't declare. * d-lang.c (d_language_defn): Update. * cp-valprint.c (cp_print_value_fields) (cp_print_value_fields_rtti, cp_print_value): Remove. (cp_print_static_field): Update. * c-valprint.c (c_val_print_array, c_val_print_ptr) (c_val_print_struct, c_val_print_union, c_val_print_int) (c_val_print_memberptr, c_val_print): Remove. * c-lang.h (c_val_print_array, cp_print_value_fields) (cp_print_value_fields_rtti): Don't declare. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * ada-valprint.c (ada_val_print_ptr, ada_val_print_num): Remove. (ada_val_print_enum): Take a struct value. (ada_val_print_flt, ada_val_print_array, ada_val_print_1) (ada_val_print): Remove. (ada_value_print_1): Update. (printable_val_type): Remove. * ada-lang.h (ada_val_print): Don't declare. * ada-lang.c (ada_language_defn): Update.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog62
-rw-r--r--gdb/ada-lang.c1
-rw-r--r--gdb/ada-lang.h5
-rw-r--r--gdb/ada-valprint.c309
-rw-r--r--gdb/c-lang.c4
-rw-r--r--gdb/c-lang.h20
-rw-r--r--gdb/c-valprint.c330
-rw-r--r--gdb/cp-valprint.c514
-rw-r--r--gdb/d-lang.c1
-rw-r--r--gdb/d-lang.h8
-rw-r--r--gdb/d-valprint.c24
-rw-r--r--gdb/f-lang.c1
-rw-r--r--gdb/f-lang.h5
-rw-r--r--gdb/f-valprint.c186
-rw-r--r--gdb/go-lang.c1
-rw-r--r--gdb/go-lang.h8
-rw-r--r--gdb/go-valprint.c39
-rw-r--r--gdb/language.c16
-rw-r--r--gdb/language.h24
-rw-r--r--gdb/m2-lang.c1
-rw-r--r--gdb/m2-lang.h5
-rw-r--r--gdb/m2-valprint.c223
-rw-r--r--gdb/objc-lang.c1
-rw-r--r--gdb/opencl-lang.c1
-rw-r--r--gdb/p-lang.c1
-rw-r--r--gdb/p-lang.h5
-rw-r--r--gdb/p-valprint.c705
-rw-r--r--gdb/rust-lang.c13
-rw-r--r--gdb/valprint.c566
-rw-r--r--gdb/valprint.h19
-rw-r--r--gdb/value.h7
31 files changed, 94 insertions, 3011 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index ac1a4f8..a4ed994 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,67 @@
2020-03-13 Tom Tromey <tom@tromey.com>
+ * value.h (val_print): Don't declare.
+ * valprint.h (val_print_array_elements)
+ (val_print_scalar_formatted, generic_val_print): Don't declare.
+ * valprint.c (generic_val_print_array): Take a struct value.
+ (generic_val_print_ptr, generic_val_print_memberptr)
+ (generic_val_print_bool, generic_val_print_int)
+ (generic_val_print_char, generic_val_print_complex)
+ (generic_val_print): Remove.
+ (generic_value_print): Update.
+ (do_val_print): Remove unused parameters. Don't call
+ la_val_print.
+ (val_print): Remove.
+ (common_val_print): Update. Don't call value_check_printable.
+ (val_print_scalar_formatted, val_print_array_elements): Remove.
+ * rust-lang.c (rust_val_print): Remove.
+ (rust_language_defn): Update.
+ * p-valprint.c (pascal_val_print): Remove.
+ (pascal_value_print_inner): Update.
+ (pascal_object_print_val_fields, pascal_object_print_val):
+ Remove.
+ (pascal_object_print_static_field): Update.
+ * p-lang.h (pascal_val_print): Don't declare.
+ * p-lang.c (pascal_language_defn): Update.
+ * opencl-lang.c (opencl_language_defn): Update.
+ * objc-lang.c (objc_language_defn): Update.
+ * m2-valprint.c (m2_print_unbounded_array, m2_val_print): Remove.
+ * m2-lang.h (m2_val_print): Don't declare.
+ * m2-lang.c (m2_language_defn): Update.
+ * language.h (struct language_defn) <la_val_print>: Remove.
+ * language.c (unk_lang_value_print_inner): Rename. Change
+ argument types.
+ (unknown_language_defn, auto_language_defn): Update.
+ * go-valprint.c (go_val_print): Remove.
+ * go-lang.h (go_val_print): Don't declare.
+ * go-lang.c (go_language_defn): Update.
+ * f-valprint.c (f_val_print): Remove.
+ * f-lang.h (f_value_print): Don't declare.
+ * f-lang.c (f_language_defn): Update.
+ * d-valprint.c (d_val_print): Remove.
+ * d-lang.h (d_value_print): Don't declare.
+ * d-lang.c (d_language_defn): Update.
+ * cp-valprint.c (cp_print_value_fields)
+ (cp_print_value_fields_rtti, cp_print_value): Remove.
+ (cp_print_static_field): Update.
+ * c-valprint.c (c_val_print_array, c_val_print_ptr)
+ (c_val_print_struct, c_val_print_union, c_val_print_int)
+ (c_val_print_memberptr, c_val_print): Remove.
+ * c-lang.h (c_val_print_array, cp_print_value_fields)
+ (cp_print_value_fields_rtti): Don't declare.
+ * c-lang.c (c_language_defn, cplus_language_defn)
+ (asm_language_defn, minimal_language_defn): Update.
+ * ada-valprint.c (ada_val_print_ptr, ada_val_print_num): Remove.
+ (ada_val_print_enum): Take a struct value.
+ (ada_val_print_flt, ada_val_print_array, ada_val_print_1)
+ (ada_val_print): Remove.
+ (ada_value_print_1): Update.
+ (printable_val_type): Remove.
+ * ada-lang.h (ada_val_print): Don't declare.
+ * ada-lang.c (ada_language_defn): Update.
+
+2020-03-13 Tom Tromey <tom@tromey.com>
+
* valprint.c (do_val_print): Update.
* python/python-internal.h (gdbpy_apply_val_pretty_printer): Take
a struct value.
diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 9fb59e3..2822d40 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -14109,7 +14109,6 @@ extern const struct language_defn ada_language_defn = {
emit_char, /* Function to print single char (not used) */
ada_print_type, /* Print a type using appropriate syntax */
ada_print_typedef, /* Print a typedef using appropriate syntax */
- ada_val_print, /* Print a value using appropriate syntax */
ada_value_print_inner, /* la_value_print_inner */
ada_value_print, /* Print a top-level value */
ada_read_var_value, /* la_read_var_value */
diff --git a/gdb/ada-lang.h b/gdb/ada-lang.h
index f7c0951..1f427b0 100644
--- a/gdb/ada-lang.h
+++ b/gdb/ada-lang.h
@@ -164,11 +164,6 @@ extern void ada_print_type (struct type *, const char *, struct ui_file *, int,
extern void ada_print_typedef (struct type *type, struct symbol *new_symbol,
struct ui_file *stream);
-extern void ada_val_print (struct type *, int, CORE_ADDR,
- struct ui_file *, int,
- struct value *,
- const struct value_print_options *);
-
/* Implement la_value_print_inner for Ada. */
extern void ada_value_print_inner (struct value *, struct ui_file *, int,
diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c
index 8631f7a..abf7ba4 100644
--- a/gdb/ada-valprint.c
+++ b/gdb/ada-valprint.c
@@ -274,12 +274,6 @@ val_print_packed_array_elements (struct type *type, const gdb_byte *valaddr,
value_free_to_mark (mark);
}
-static struct type *
-printable_val_type (struct type *type, const gdb_byte *valaddr)
-{
- return ada_to_fixed_type (ada_aligned_type (type), valaddr, 0, NULL, 1);
-}
-
/* Print the character C on STREAM as part of the contents of a literal
string whose delimiter is QUOTER. TYPE_LEN is the length in bytes
of the character. */
@@ -782,32 +776,6 @@ ada_val_print_gnat_array (struct value *val,
language_def (language_ada));
}
-/* Implement Ada val_print'ing for the case where TYPE is
- a TYPE_CODE_PTR. */
-
-static void
-ada_val_print_ptr (struct type *type, const gdb_byte *valaddr,
- int offset, int offset_aligned, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- val_print (type, offset, address, stream, recurse,
- original_value, options, language_def (language_c));
-
- if (ada_is_tag_type (type))
- {
- struct value *val =
- value_from_contents_and_address (type,
- valaddr + offset_aligned,
- address + offset_aligned);
- const char *name = ada_tag_name (val);
-
- if (name != NULL)
- fprintf_filtered (stream, " (%s)", name);
- }
-}
-
/* Implement Ada value_print'ing for the case where TYPE is a
TYPE_CODE_PTR. */
@@ -832,109 +800,6 @@ ada_value_print_ptr (struct value *val,
a TYPE_CODE_INT or TYPE_CODE_RANGE. */
static void
-ada_val_print_num (struct type *type, const gdb_byte *valaddr,
- int offset, int offset_aligned, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- if (ada_is_fixed_point_type (type))
- {
- struct value *scale = ada_scaling_factor (type);
- struct value *v = value_from_contents (type, valaddr + offset_aligned);
- v = value_cast (value_type (scale), v);
- v = value_binop (v, scale, BINOP_MUL);
-
- const char *fmt = TYPE_LENGTH (type) < 4 ? "%.11g" : "%.17g";
- std::string str
- = target_float_to_string (value_contents (v), value_type (v), fmt);
- fputs_filtered (str.c_str (), stream);
- return;
- }
- else if (TYPE_CODE (type) == TYPE_CODE_RANGE
- && (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_ENUM
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_BOOL
- || TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_CHAR))
- {
- /* For enum-valued ranges, we want to recurse, because we'll end
- up printing the constant's name rather than its numeric
- value. Character and fixed-point types are also printed
- differently, so recuse for those as well. */
- struct type *target_type = TYPE_TARGET_TYPE (type);
-
- if (TYPE_LENGTH (type) != TYPE_LENGTH (target_type))
- {
- /* Obscure case of range type that has different length from
- its base type. Perform a conversion, or we will get a
- nonsense value. Actually, we could use the same
- code regardless of lengths; I'm just avoiding a cast. */
- struct value *v1
- = value_from_contents_and_address (type, valaddr + offset, 0);
- struct value *v = value_cast (target_type, v1);
-
- val_print (target_type,
- value_embedded_offset (v), 0, stream,
- recurse + 1, v, options,
- language_def (language_ada));
- }
- else
- val_print (TYPE_TARGET_TYPE (type), offset,
- address, stream, recurse, original_value,
- options, language_def (language_ada));
- return;
- }
- else
- {
- int format = (options->format ? options->format
- : options->output_format);
-
- if (format)
- {
- struct value_print_options opts = *options;
-
- opts.format = format;
- val_print_scalar_formatted (type, offset_aligned,
- original_value, &opts, 0, stream);
- }
- else if (ada_is_system_address_type (type))
- {
- /* FIXME: We want to print System.Address variables using
- the same format as for any access type. But for some
- reason GNAT encodes the System.Address type as an int,
- so we have to work-around this deficiency by handling
- System.Address values as a special case. */
-
- struct gdbarch *gdbarch = get_type_arch (type);
- struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
- CORE_ADDR addr = extract_typed_address (valaddr + offset_aligned,
- ptr_type);
-
- fprintf_filtered (stream, "(");
- type_print (type, "", stream, -1);
- fprintf_filtered (stream, ") ");
- fputs_filtered (paddress (gdbarch, addr), stream);
- }
- else
- {
- val_print_scalar_formatted (type, offset_aligned,
- original_value, options, 0, stream);
- if (ada_is_character_type (type))
- {
- LONGEST c;
-
- fputs_filtered (" ", stream);
- c = unpack_long (type, valaddr + offset_aligned);
- ada_printchar (c, type, stream);
- }
- }
- return;
- }
-}
-
-/* Implement Ada val_print'ing for the case where TYPE is
- a TYPE_CODE_INT or TYPE_CODE_RANGE. */
-
-static void
ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
@@ -1017,10 +882,7 @@ ada_value_print_num (struct value *val, struct ui_file *stream, int recurse,
a TYPE_CODE_ENUM. */
static void
-ada_val_print_enum (struct type *type, const gdb_byte *valaddr,
- int offset, int offset_aligned, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
+ada_val_print_enum (struct value *value, struct ui_file *stream, int recurse,
const struct value_print_options *options)
{
int i;
@@ -1029,11 +891,14 @@ ada_val_print_enum (struct type *type, const gdb_byte *valaddr,
if (options->format)
{
- val_print_scalar_formatted (type, offset_aligned,
- original_value, options, 0, stream);
+ value_print_scalar_formatted (value, options, 0, stream);
return;
}
+ struct type *type = ada_check_typedef (value_type (value));
+ const gdb_byte *valaddr = value_contents_for_printing (value);
+ int offset_aligned = ada_aligned_value_addr (type, valaddr) - valaddr;
+
len = TYPE_NFIELDS (type);
val = unpack_long (type, valaddr + offset_aligned);
for (i = 0; i < len; i++)
@@ -1059,26 +924,6 @@ ada_val_print_enum (struct type *type, const gdb_byte *valaddr,
}
/* Implement Ada val_print'ing for the case where TYPE is
- a TYPE_CODE_FLT. */
-
-static void
-ada_val_print_flt (struct type *type, const gdb_byte *valaddr,
- int offset, int offset_aligned, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- if (options->format)
- {
- val_print (type, offset, address, stream, recurse,
- original_value, options, language_def (language_c));
- return;
- }
-
- ada_print_floating (valaddr + offset, type, stream);
-}
-
-/* Implement Ada val_print'ing for the case where TYPE is
a TYPE_CODE_STRUCT or TYPE_CODE_UNION. */
static void
@@ -1109,37 +954,6 @@ ada_val_print_struct_union
fprintf_filtered (stream, ")");
}
-/* Implement Ada val_print'ing for the case where TYPE is
- a TYPE_CODE_ARRAY. */
-
-static void
-ada_val_print_array (struct type *type, const gdb_byte *valaddr,
- int offset, int offset_aligned, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- /* For an array of characters, print with string syntax. */
- if (ada_is_string_type (type)
- && (options->format == 0 || options->format == 's'))
- {
- ada_val_print_string (type, valaddr, offset_aligned,
- stream, recurse, options);
- return;
- }
-
- fprintf_filtered (stream, "(");
- print_optional_low_bound (stream, type, options);
- if (TYPE_FIELD_BITSIZE (type, 0) > 0)
- val_print_packed_array_elements (type, valaddr, offset_aligned,
- stream, recurse, options);
- else
- val_print_array_elements (type, offset_aligned, address,
- stream, recurse, original_value,
- options, 0);
- fprintf_filtered (stream, ")");
-}
-
/* Implement Ada value_print'ing for the case where TYPE is a
TYPE_CODE_ARRAY. */
@@ -1238,113 +1052,6 @@ ada_val_print_ref (struct type *type, const gdb_byte *valaddr,
options, language_def (language_ada));
}
-/* See the comment on ada_val_print. This function differs in that it
- does not catch evaluation errors (leaving that to ada_val_print). */
-
-static void
-ada_val_print_1 (struct type *type,
- int offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- int offset_aligned;
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- type = ada_check_typedef (type);
-
- if (ada_is_array_descriptor_type (type)
- || (ada_is_constrained_packed_array_type (type)
- && TYPE_CODE (type) != TYPE_CODE_PTR))
- {
- struct value *val = value_from_contents_and_address (type,
- valaddr + offset,
- address);
- ada_val_print_gnat_array (val, stream, recurse, options);
- return;
- }
-
- offset_aligned = offset + ada_aligned_value_addr (type, valaddr) - valaddr;
- type = printable_val_type (type, valaddr + offset_aligned);
- type = resolve_dynamic_type (type, valaddr + offset_aligned,
- address + offset_aligned);
-
- switch (TYPE_CODE (type))
- {
- default:
- val_print (type, offset, address, stream, recurse,
- original_value, options, language_def (language_c));
- break;
-
- case TYPE_CODE_PTR:
- ada_val_print_ptr (type, valaddr, offset, offset_aligned,
- address, stream, recurse, original_value,
- options);
- break;
-
- case TYPE_CODE_INT:
- case TYPE_CODE_RANGE:
- ada_val_print_num (type, valaddr, offset, offset_aligned,
- address, stream, recurse, original_value,
- options);
- break;
-
- case TYPE_CODE_ENUM:
- ada_val_print_enum (type, valaddr, offset, offset_aligned,
- address, stream, recurse, original_value,
- options);
- break;
-
- case TYPE_CODE_FLT:
- ada_val_print_flt (type, valaddr, offset, offset_aligned,
- address, stream, recurse, original_value,
- options);
- break;
-
- case TYPE_CODE_UNION:
- case TYPE_CODE_STRUCT:
- ada_val_print_struct_union (type, valaddr, offset, offset_aligned,
- address, stream, recurse,
- original_value, options);
- break;
-
- case TYPE_CODE_ARRAY:
- ada_val_print_array (type, valaddr, offset, offset_aligned,
- address, stream, recurse, original_value,
- options);
- return;
-
- case TYPE_CODE_REF:
- ada_val_print_ref (type, valaddr, offset, offset_aligned,
- address, stream, recurse, original_value,
- options);
- break;
- }
-}
-
-/* See val_print for a description of the various parameters of this
- function; they are identical. */
-
-void
-ada_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options)
-{
- try
- {
- ada_val_print_1 (type, embedded_offset, address,
- stream, recurse, val, options);
- }
- catch (const gdb_exception_error &except)
- {
- fprintf_styled (stream, metadata_style.style (),
- _("<error reading variable: %s>"),
- except.what ());
- }
-}
-
/* See the comment on ada_value_print. This function differs in that
it does not catch evaluation errors (leaving that to
ada_value_print). */
@@ -1393,9 +1100,7 @@ ada_value_print_1 (struct value *val, struct ui_file *stream, int recurse,
break;
case TYPE_CODE_ENUM:
- ada_val_print_enum (type, valaddr, 0, 0,
- address, stream, recurse, val,
- options);
+ ada_val_print_enum (val, stream, recurse, options);
break;
case TYPE_CODE_FLT:
diff --git a/gdb/c-lang.c b/gdb/c-lang.c
index c919f02..c335044 100644
--- a/gdb/c-lang.c
+++ b/gdb/c-lang.c
@@ -903,7 +903,6 @@ extern const struct language_defn c_language_defn =
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
@@ -1049,7 +1048,6 @@ extern const struct language_defn cplus_language_defn =
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
@@ -1104,7 +1102,6 @@ extern const struct language_defn asm_language_defn =
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
@@ -1159,7 +1156,6 @@ extern const struct language_defn minimal_language_defn =
c_emit_char, /* Print a single char */
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/c-lang.h b/gdb/c-lang.h
index e513805..6421571 100644
--- a/gdb/c-lang.h
+++ b/gdb/c-lang.h
@@ -81,12 +81,6 @@ extern void c_print_typedef (struct type *,
struct symbol *,
struct ui_file *);
-extern void c_val_print (struct type *,
- int, CORE_ADDR,
- struct ui_file *, int,
- struct value *,
- const struct value_print_options *);
-
/* Implement la_value_print_inner for the C family of languages. */
extern void c_value_print_inner (struct value *, struct ui_file *, int,
@@ -140,20 +134,6 @@ extern void cp_print_value_fields (struct value *,
const struct value_print_options *,
struct type **, int);
-extern void cp_print_value_fields (struct type *, struct type *,
- LONGEST, CORE_ADDR,
- struct ui_file *, int,
- struct value *,
- const struct value_print_options *,
- struct type **, int);
-
-extern void cp_print_value_fields_rtti (struct type *,
- const gdb_byte *, LONGEST, CORE_ADDR,
- struct ui_file *, int,
- struct value *,
- const struct value_print_options *,
- struct type **, int);
-
/* gcc-2.6 or later (when using -fvtable-thunks)
emits a unique named type for a vtable entry.
Some gdb code depends on that specific name. */
diff --git a/gdb/c-valprint.c b/gdb/c-valprint.c
index 0f40a86..76a86fa 100644
--- a/gdb/c-valprint.c
+++ b/gdb/c-valprint.c
@@ -228,113 +228,6 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
}
}
-/* c_val_print helper for TYPE_CODE_ARRAY. */
-
-static void
-c_val_print_array (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- struct type *unresolved_elttype = TYPE_TARGET_TYPE (type);
- struct type *elttype = check_typedef (unresolved_elttype);
- struct gdbarch *arch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (arch);
-
- if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (unresolved_elttype) > 0)
- {
- LONGEST low_bound, high_bound;
- int eltlen, len;
- enum bfd_endian byte_order = type_byte_order (type);
-
- if (!get_array_bounds (type, &low_bound, &high_bound))
- error (_("Could not determine the array high bound"));
-
- eltlen = TYPE_LENGTH (elttype);
- len = high_bound - low_bound + 1;
- if (options->prettyformat_arrays)
- {
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
-
- /* Print arrays of textual chars with a string syntax, as
- long as the entire array is valid. */
- if (c_textual_element_type (unresolved_elttype,
- options->format)
- && value_bytes_available (original_value, embedded_offset,
- TYPE_LENGTH (type))
- && !value_bits_any_optimized_out (original_value,
- TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * TYPE_LENGTH (type)))
- {
- int force_ellipses = 0;
-
- /* If requested, look for the first null char and only
- print elements up to it. */
- if (options->stop_print_at_null)
- {
- unsigned int temp_len;
-
- for (temp_len = 0;
- (temp_len < len
- && temp_len < options->print_max
- && extract_unsigned_integer (valaddr
- + embedded_offset * unit_size
- + temp_len * eltlen,
- eltlen, byte_order) != 0);
- ++temp_len)
- ;
-
- /* Force LA_PRINT_STRING to print ellipses if
- we've printed the maximum characters and
- the next character is not \000. */
- if (temp_len == options->print_max && temp_len < len)
- {
- ULONGEST val
- = extract_unsigned_integer (valaddr
- + embedded_offset * unit_size
- + temp_len * eltlen,
- eltlen, byte_order);
- if (val != 0)
- force_ellipses = 1;
- }
-
- len = temp_len;
- }
-
- LA_PRINT_STRING (stream, unresolved_elttype,
- valaddr + embedded_offset * unit_size, len,
- NULL, force_ellipses, options);
- }
- else
- {
- unsigned int i = 0;
- fprintf_filtered (stream, "{");
- /* If this is a virtual function table, print the 0th
- entry specially, and the rest of the members
- normally. */
- if (cp_is_vtbl_ptr_type (elttype))
- {
- i = 1;
- fprintf_filtered (stream, _("%d vtable entries"),
- len - 1);
- }
- val_print_array_elements (type, embedded_offset,
- address, stream,
- recurse, original_value, options, i);
- fprintf_filtered (stream, "}");
- }
- }
- else
- {
- /* Array of unspecified length: treat like pointer to first elt. */
- print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr,
- embedded_offset, address + embedded_offset,
- stream, recurse, options);
- }
-}
-
/* c_value_print helper for TYPE_CODE_ARRAY. */
static void
@@ -431,46 +324,6 @@ c_value_print_array (struct value *val,
}
}
-/* c_val_print helper for TYPE_CODE_PTR. */
-
-static void
-c_val_print_ptr (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- struct gdbarch *arch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (arch);
-
- if (options->format && options->format != 's')
- {
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- }
- else if (options->vtblprint && cp_is_vtbl_ptr_type (type))
- {
- /* Print the unmangled name if desired. */
- /* Print vtable entry - we only get here if we ARE using
- -fvtable_thunks. (Otherwise, look under
- TYPE_CODE_STRUCT.) */
- CORE_ADDR addr
- = extract_typed_address (valaddr + embedded_offset, type);
- struct gdbarch *gdbarch = get_type_arch (type);
-
- print_function_pointer_address (options, gdbarch, addr, stream);
- }
- else
- {
- struct type *unresolved_elttype = TYPE_TARGET_TYPE (type);
- struct type *elttype = check_typedef (unresolved_elttype);
- CORE_ADDR addr = unpack_pointer (type,
- valaddr + embedded_offset * unit_size);
-
- print_unpacked_pointer (type, elttype, unresolved_elttype, valaddr,
- embedded_offset, addr, stream, recurse, options);
- }
-}
-
/* c_value_print_inner helper for TYPE_CODE_PTR. */
static void
@@ -508,38 +361,6 @@ c_value_print_ptr (struct value *val, struct ui_file *stream, int recurse,
}
}
-/* c_val_print helper for TYPE_CODE_STRUCT. */
-
-static void
-c_val_print_struct (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- if (options->vtblprint && cp_is_vtbl_ptr_type (type))
- {
- /* Print the unmangled name if desired. */
- /* Print vtable entry - we only get here if NOT using
- -fvtable_thunks. (Otherwise, look under
- TYPE_CODE_PTR.) */
- struct gdbarch *gdbarch = get_type_arch (type);
- int offset = (embedded_offset
- + TYPE_FIELD_BITPOS (type,
- VTBL_FNADDR_OFFSET) / 8);
- struct type *field_type = TYPE_FIELD_TYPE (type, VTBL_FNADDR_OFFSET);
- CORE_ADDR addr = extract_typed_address (valaddr + offset, field_type);
-
- print_function_pointer_address (options, gdbarch, addr, stream);
- }
- else
- cp_print_value_fields_rtti (type, valaddr,
- embedded_offset, address,
- stream, recurse,
- original_value, options,
- NULL, 0);
-}
-
/* c_value_print helper for TYPE_CODE_STRUCT and TYPE_CODE_UNION. */
static void
@@ -568,64 +389,6 @@ c_value_print_struct (struct value *val, struct ui_file *stream, int recurse,
cp_print_value_fields (val, stream, recurse, options, NULL, 0);
}
-/* c_val_print helper for TYPE_CODE_UNION. */
-
-static void
-c_val_print_union (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- if (recurse && !options->unionprint)
- {
- fprintf_filtered (stream, "{...}");
- }
- else
- {
- c_val_print_struct (type, valaddr, embedded_offset, address, stream,
- recurse, original_value, options);
- }
-}
-
-/* c_val_print helper for TYPE_CODE_INT. */
-
-static void
-c_val_print_int (struct type *type, struct type *unresolved_type,
- const gdb_byte *valaddr, int embedded_offset,
- struct ui_file *stream, struct value *original_value,
- const struct value_print_options *options)
-{
- struct gdbarch *arch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (arch);
-
- if (options->format || options->output_format)
- {
- struct value_print_options opts = *options;
-
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, embedded_offset,
- original_value, &opts, 0, stream);
- }
- else
- {
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- /* C and C++ has no single byte int type, char is used
- instead. Since we don't know whether the value is really
- intended to be used as an integer or a character, print
- the character equivalent as well. */
- if (c_textual_element_type (unresolved_type, options->format))
- {
- fputs_filtered (" ", stream);
- LA_PRINT_CHAR (unpack_long (type,
- valaddr + embedded_offset * unit_size),
- unresolved_type, stream);
- }
- }
-}
-
/* c_value_print helper for TYPE_CODE_INT. */
static void
@@ -657,26 +420,6 @@ c_value_print_int (struct value *val, struct ui_file *stream,
}
}
-/* c_val_print helper for TYPE_CODE_MEMBERPTR. */
-
-static void
-c_val_print_memberptr (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- if (!options->format)
- {
- cp_print_class_member (valaddr + embedded_offset, type, stream, "&");
- }
- else
- {
- generic_val_print (type, embedded_offset, address, stream,
- recurse, original_value, options, &c_decorations);
- }
-}
-
/* c_value_print helper for TYPE_CODE_MEMBERPTR. */
static void
@@ -694,79 +437,6 @@ c_value_print_memberptr (struct value *val, struct ui_file *stream,
generic_value_print (val, stream, recurse, options, &c_decorations);
}
-/* See val_print for a description of the various parameters of this
- function; they are identical. */
-
-void
-c_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- struct type *unresolved_type = type;
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- type = check_typedef (type);
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_ARRAY:
- c_val_print_array (type, valaddr, embedded_offset, address, stream,
- recurse, original_value, options);
- break;
-
- case TYPE_CODE_METHODPTR:
- cplus_print_method_ptr (valaddr + embedded_offset, type, stream);
- break;
-
- case TYPE_CODE_PTR:
- c_val_print_ptr (type, valaddr, embedded_offset, stream, recurse,
- original_value, options);
- break;
-
- case TYPE_CODE_UNION:
- c_val_print_union (type, valaddr, embedded_offset, address, stream,
- recurse, original_value, options);
- break;
-
- case TYPE_CODE_STRUCT:
- c_val_print_struct (type, valaddr, embedded_offset, address, stream,
- recurse, original_value, options);
- break;
-
- case TYPE_CODE_INT:
- c_val_print_int (type, unresolved_type, valaddr, embedded_offset, stream,
- original_value, options);
- break;
-
- case TYPE_CODE_MEMBERPTR:
- c_val_print_memberptr (type, valaddr, embedded_offset, address, stream,
- recurse, original_value, options);
- break;
-
- case TYPE_CODE_REF:
- case TYPE_CODE_RVALUE_REF:
- case TYPE_CODE_ENUM:
- case TYPE_CODE_FLAGS:
- case TYPE_CODE_FUNC:
- case TYPE_CODE_METHOD:
- case TYPE_CODE_BOOL:
- case TYPE_CODE_RANGE:
- case TYPE_CODE_FLT:
- case TYPE_CODE_DECFLOAT:
- case TYPE_CODE_VOID:
- case TYPE_CODE_ERROR:
- case TYPE_CODE_UNDEF:
- case TYPE_CODE_COMPLEX:
- case TYPE_CODE_CHAR:
- default:
- generic_val_print (type, embedded_offset, address,
- stream, recurse, original_value, options,
- &c_decorations);
- break;
- }
-}
-
/* See c-lang.h. */
void
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index 5e4cb3c..5625a58 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -47,13 +47,6 @@ static void cp_print_static_field (struct type *, struct value *,
struct ui_file *, int,
const struct value_print_options *);
-static void cp_print_value (struct type *, struct type *,
- LONGEST,
- CORE_ADDR, struct ui_file *,
- int, struct value *,
- const struct value_print_options *,
- struct type **);
-
static void cp_print_value (struct value *, struct ui_file *,
int, const struct value_print_options *,
struct type **);
@@ -125,287 +118,6 @@ cp_is_vtbl_member (struct type *type)
or zero if called from top level. */
void
-cp_print_value_fields (struct type *type, struct type *real_type,
- LONGEST offset,
- CORE_ADDR address, struct ui_file *stream,
- int recurse, struct value *val,
- const struct value_print_options *options,
- struct type **dont_print_vb,
- int dont_print_statmem)
-{
- int i, len, n_baseclasses;
- int fields_seen = 0;
- static int last_set_recurse = -1;
-
- type = check_typedef (type);
-
- if (recurse == 0)
- {
- /* Any object can be left on obstacks only during an unexpected
- error. */
-
- if (obstack_object_size (&dont_print_statmem_obstack) > 0)
- {
- obstack_free (&dont_print_statmem_obstack, NULL);
- obstack_begin (&dont_print_statmem_obstack,
- 32 * sizeof (CORE_ADDR));
- }
- if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
- {
- obstack_free (&dont_print_stat_array_obstack, NULL);
- obstack_begin (&dont_print_stat_array_obstack,
- 32 * sizeof (struct type *));
- }
- }
-
- fprintf_filtered (stream, "{");
- len = TYPE_NFIELDS (type);
- n_baseclasses = TYPE_N_BASECLASSES (type);
-
- /* First, print out baseclasses such that we don't print
- duplicates of virtual baseclasses. */
-
- if (n_baseclasses > 0)
- cp_print_value (type, real_type,
- offset, address, stream,
- recurse + 1, val, options,
- dont_print_vb);
-
- /* Second, print out data fields */
-
- /* If there are no data fields, skip this part */
- if (len == n_baseclasses || !len)
- fprintf_styled (stream, metadata_style.style (), "<No data fields>");
- else
- {
- size_t statmem_obstack_initial_size = 0;
- size_t stat_array_obstack_initial_size = 0;
- struct type *vptr_basetype = NULL;
- int vptr_fieldno;
-
- if (dont_print_statmem == 0)
- {
- statmem_obstack_initial_size =
- obstack_object_size (&dont_print_statmem_obstack);
-
- if (last_set_recurse != recurse)
- {
- stat_array_obstack_initial_size =
- obstack_object_size (&dont_print_stat_array_obstack);
-
- last_set_recurse = recurse;
- }
- }
-
- vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype);
- for (i = n_baseclasses; i < len; i++)
- {
- const gdb_byte *valaddr = value_contents_for_printing (val);
-
- /* If requested, skip printing of static fields. */
- if (!options->static_field_print
- && field_is_static (&TYPE_FIELD (type, i)))
- continue;
-
- if (fields_seen)
- {
- fputs_filtered (",", stream);
- if (!options->prettyformat)
- fputs_filtered (" ", stream);
- }
- else if (n_baseclasses > 0)
- {
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- fputs_filtered ("members of ", stream);
- fputs_filtered (TYPE_NAME (type), stream);
- fputs_filtered (":", stream);
- }
- }
- fields_seen = 1;
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- else
- {
- wrap_here (n_spaces (2 + 2 * recurse));
- }
-
- annotate_field_begin (TYPE_FIELD_TYPE (type, i));
-
- if (field_is_static (&TYPE_FIELD (type, i)))
- {
- fputs_filtered ("static ", stream);
- fprintf_symbol_filtered (stream,
- TYPE_FIELD_NAME (type, i),
- current_language->la_language,
- DMGL_PARAMS | DMGL_ANSI);
- }
- else
- fputs_styled (TYPE_FIELD_NAME (type, i),
- variable_name_style.style (), stream);
- annotate_field_name_end ();
-
- /* We tweak various options in a few cases below. */
- value_print_options options_copy = *options;
- value_print_options *opts = &options_copy;
-
- /* Do not print leading '=' in case of anonymous
- unions. */
- if (strcmp (TYPE_FIELD_NAME (type, i), ""))
- fputs_filtered (" = ", stream);
- else
- {
- /* If this is an anonymous field then we want to consider it
- as though it is at its parent's depth when it comes to the
- max print depth. */
- if (opts->max_depth != -1 && opts->max_depth < INT_MAX)
- ++opts->max_depth;
- }
- annotate_field_value ();
-
- if (!field_is_static (&TYPE_FIELD (type, i))
- && TYPE_FIELD_PACKED (type, i))
- {
- struct value *v;
-
- /* Bitfields require special handling, especially due to
- byte order problems. */
- if (TYPE_FIELD_IGNORE (type, i))
- {
- fputs_styled ("<optimized out or zero length>",
- metadata_style.style (), stream);
- }
- else if (value_bits_synthetic_pointer (val,
- TYPE_FIELD_BITPOS (type,
- i),
- TYPE_FIELD_BITSIZE (type,
- i)))
- {
- fputs_styled (_("<synthetic pointer>"),
- metadata_style.style (), stream);
- }
- else
- {
- opts->deref_ref = 0;
-
- v = value_field_bitfield (type, i, valaddr, offset, val);
-
- common_val_print (v, stream, recurse + 1,
- opts, current_language);
- }
- }
- else
- {
- if (TYPE_FIELD_IGNORE (type, i))
- {
- fputs_styled ("<optimized out or zero length>",
- metadata_style.style (), stream);
- }
- else if (field_is_static (&TYPE_FIELD (type, i)))
- {
- try
- {
- struct value *v = value_static_field (type, i);
-
- cp_print_static_field (TYPE_FIELD_TYPE (type, i),
- v, stream, recurse + 1,
- opts);
- }
- catch (const gdb_exception_error &ex)
- {
- fprintf_styled (stream, metadata_style.style (),
- _("<error reading variable: %s>"),
- ex.what ());
- }
- }
- else if (i == vptr_fieldno && type == vptr_basetype)
- {
- int i_offset = offset + TYPE_FIELD_BITPOS (type, i) / 8;
- struct type *i_type = TYPE_FIELD_TYPE (type, i);
-
- if (valprint_check_validity (stream, i_type, i_offset, val))
- {
- CORE_ADDR addr;
-
- i_offset += value_embedded_offset (val);
- addr = extract_typed_address (valaddr + i_offset, i_type);
- print_function_pointer_address (opts,
- get_type_arch (type),
- addr, stream);
- }
- }
- else
- {
- opts->deref_ref = 0;
- val_print (TYPE_FIELD_TYPE (type, i),
- offset + TYPE_FIELD_BITPOS (type, i) / 8,
- address,
- stream, recurse + 1, val, opts,
- current_language);
- }
- }
- annotate_field_end ();
- }
-
- if (dont_print_statmem == 0)
- {
- size_t obstack_final_size =
- obstack_object_size (&dont_print_statmem_obstack);
-
- if (obstack_final_size > statmem_obstack_initial_size)
- {
- /* In effect, a pop of the printed-statics stack. */
- size_t shrink_bytes
- = statmem_obstack_initial_size - obstack_final_size;
- obstack_blank_fast (&dont_print_statmem_obstack, shrink_bytes);
- }
-
- if (last_set_recurse != recurse)
- {
- obstack_final_size =
- obstack_object_size (&dont_print_stat_array_obstack);
-
- if (obstack_final_size > stat_array_obstack_initial_size)
- {
- void *free_to_ptr =
- (char *) obstack_next_free (&dont_print_stat_array_obstack)
- - (obstack_final_size
- - stat_array_obstack_initial_size);
-
- obstack_free (&dont_print_stat_array_obstack,
- free_to_ptr);
- }
- last_set_recurse = -1;
- }
- }
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * recurse, stream);
- }
- } /* if there are data fields */
-
- fprintf_filtered (stream, "}");
-}
-
-/* Mutually recursive subroutines of cp_print_value and c_value_print
- to print out a structure's fields: cp_print_value_fields and
- cp_print_value.
-
- VAL, ADDRESS, STREAM, RECURSE, and OPTIONS have the same meanings
- as in cp_print_value and c_value_print.
-
- DONT_PRINT is an array of baseclass types that we should not print,
- or zero if called from top level. */
-
-void
cp_print_value_fields (struct value *val, struct ui_file *stream,
int recurse, const struct value_print_options *options,
struct type **dont_print_vb,
@@ -669,222 +381,6 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
fprintf_filtered (stream, "}");
}
-/* Like cp_print_value_fields, but find the runtime type of the object
- and pass it as the `real_type' argument to cp_print_value_fields.
- This function is a hack to work around the fact that
- common_val_print passes the embedded offset to val_print, but not
- the enclosing type. */
-
-void
-cp_print_value_fields_rtti (struct type *type,
- const gdb_byte *valaddr, LONGEST offset,
- CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options,
- struct type **dont_print_vb,
- int dont_print_statmem)
-{
- struct type *real_type = NULL;
-
- /* We require all bits to be valid in order to attempt a
- conversion. */
- if (!value_bits_any_optimized_out (val,
- TARGET_CHAR_BIT * offset,
- TARGET_CHAR_BIT * TYPE_LENGTH (type)))
- {
- struct value *value;
- int full, using_enc;
- LONGEST top;
-
- /* Ugh, we have to convert back to a value here. */
- value = value_from_contents_and_address (type, valaddr + offset,
- address + offset);
- type = value_type (value);
- /* We don't actually care about most of the result here -- just
- the type. We already have the correct offset, due to how
- val_print was initially called. */
- real_type = value_rtti_type (value, &full, &top, &using_enc);
- }
-
- if (!real_type)
- real_type = type;
-
- cp_print_value_fields (type, real_type, offset,
- address, stream, recurse, val, options,
- dont_print_vb, dont_print_statmem);
-}
-
-/* Special value_print routine to avoid printing multiple copies of
- virtual baseclasses. */
-
-static void
-cp_print_value (struct type *type, struct type *real_type,
- LONGEST offset,
- CORE_ADDR address, struct ui_file *stream,
- int recurse, struct value *val,
- const struct value_print_options *options,
- struct type **dont_print_vb)
-{
- struct type **last_dont_print
- = (struct type **) obstack_next_free (&dont_print_vb_obstack);
- struct obstack tmp_obstack = dont_print_vb_obstack;
- int i, n_baseclasses = TYPE_N_BASECLASSES (type);
- LONGEST thisoffset;
- struct type *thistype;
- const gdb_byte *valaddr = value_contents_for_printing (val);
-
- if (dont_print_vb == 0)
- {
- /* If we're at top level, carve out a completely fresh chunk of
- the obstack and use that until this particular invocation
- returns. */
- /* Bump up the high-water mark. Now alpha is omega. */
- obstack_finish (&dont_print_vb_obstack);
- }
-
- for (i = 0; i < n_baseclasses; i++)
- {
- LONGEST boffset = 0;
- int skip = 0;
- struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- const char *basename = TYPE_NAME (baseclass);
- struct value *base_val = NULL;
-
- if (BASETYPE_VIA_VIRTUAL (type, i))
- {
- struct type **first_dont_print
- = (struct type **) obstack_base (&dont_print_vb_obstack);
-
- int j = (struct type **)
- obstack_next_free (&dont_print_vb_obstack) - first_dont_print;
-
- while (--j >= 0)
- if (baseclass == first_dont_print[j])
- goto flush_it;
-
- obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
- }
-
- thisoffset = offset;
- thistype = real_type;
-
- try
- {
- boffset = baseclass_offset (type, i, valaddr, offset, address, val);
- }
- catch (const gdb_exception_error &ex)
- {
- if (ex.error == NOT_AVAILABLE_ERROR)
- skip = -1;
- else
- skip = 1;
- }
-
- if (skip == 0)
- {
- if (BASETYPE_VIA_VIRTUAL (type, i))
- {
- /* The virtual base class pointer might have been
- clobbered by the user program. Make sure that it
- still points to a valid memory location. */
-
- if ((boffset + offset) < 0
- || (boffset + offset) >= TYPE_LENGTH (real_type))
- {
- gdb::byte_vector buf (TYPE_LENGTH (baseclass));
-
- if (target_read_memory (address + boffset, buf.data (),
- TYPE_LENGTH (baseclass)) != 0)
- skip = 1;
- base_val = value_from_contents_and_address (baseclass,
- buf.data (),
- address + boffset);
- baseclass = value_type (base_val);
- thisoffset = 0;
- boffset = 0;
- thistype = baseclass;
- }
- else
- {
- base_val = val;
- }
- }
- else
- {
- base_val = val;
- }
- }
-
- /* Now do the printing. */
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * recurse, stream);
- }
- fputs_filtered ("<", stream);
- /* Not sure what the best notation is in the case where there is
- no baseclass name. */
- fputs_filtered (basename ? basename : "", stream);
- fputs_filtered ("> = ", stream);
-
- if (skip < 0)
- val_print_unavailable (stream);
- else if (skip > 0)
- val_print_invalid_address (stream);
- else
- {
- int result = 0;
-
- if (options->max_depth > -1
- && recurse >= options->max_depth)
- {
- const struct language_defn *language = current_language;
- gdb_assert (language->la_struct_too_deep_ellipsis != NULL);
- fputs_filtered (language->la_struct_too_deep_ellipsis, stream);
- }
- else
- {
- /* Attempt to run an extension language pretty-printer on the
- baseclass if possible. */
- if (!options->raw)
- {
- struct value *v
- = value_from_component (base_val, baseclass,
- thisoffset + boffset);
- result
- = apply_ext_lang_val_pretty_printer (v, stream, recurse,
- options,
- current_language);
- }
-
- if (!result)
- cp_print_value_fields (baseclass, thistype,
- thisoffset + boffset,
- value_address (base_val),
- stream, recurse, base_val, options,
- ((struct type **)
- obstack_base (&dont_print_vb_obstack)),
- 0);
- }
- }
- fputs_filtered (", ", stream);
-
- flush_it:
- ;
- }
-
- if (dont_print_vb == 0)
- {
- /* Free the space used to deal with the printing
- of this type from top level. */
- obstack_free (&dont_print_vb_obstack, last_dont_print);
- /* Reset watermark so that we can continue protecting
- ourselves from whatever we were protecting ourselves. */
- dont_print_vb_obstack = tmp_obstack;
- }
-}
-
/* Special val_print routine to avoid printing multiple copies of
virtual baseclasses. */
@@ -1070,7 +566,7 @@ cp_print_static_field (struct type *type,
if (TYPE_CODE (real_type) == TYPE_CODE_STRUCT)
{
CORE_ADDR *first_dont_print;
- CORE_ADDR addr;
+ CORE_ADDR addr = value_address (val);
int i;
first_dont_print
@@ -1080,7 +576,7 @@ cp_print_static_field (struct type *type,
while (--i >= 0)
{
- if (value_address (val) == first_dont_print[i])
+ if (addr == first_dont_print[i])
{
fputs_styled (_("<same as static member of an already"
" seen type>"),
@@ -1089,13 +585,9 @@ cp_print_static_field (struct type *type,
}
}
- addr = value_address (val);
obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
sizeof (CORE_ADDR));
- cp_print_value_fields (type, value_enclosing_type (val),
- value_embedded_offset (val), addr,
- stream, recurse, val,
- options, NULL, 1);
+ cp_print_value_fields (val, stream, recurse, options, NULL, 1);
return;
}
diff --git a/gdb/d-lang.c b/gdb/d-lang.c
index 4dbcf53..f50c31a 100644
--- a/gdb/d-lang.c
+++ b/gdb/d-lang.c
@@ -224,7 +224,6 @@ extern const struct language_defn d_language_defn =
c_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
- d_val_print, /* Print a value using appropriate syntax. */
d_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/d-lang.h b/gdb/d-lang.h
index 9b4e504..a0319f1 100644
--- a/gdb/d-lang.h
+++ b/gdb/d-lang.h
@@ -76,14 +76,6 @@ extern struct block_symbol d_lookup_symbol_nonlocal (const struct language_defn
extern struct block_symbol d_lookup_nested_symbol (struct type *, const char *,
const struct block *);
-/* Defined in d-valprint.c */
-
-extern void d_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options);
-
/* Implement la_value_print_inner for D. */
extern void d_value_print_inner (struct value *val,
diff --git a/gdb/d-valprint.c b/gdb/d-valprint.c
index e26c1ea..109049c 100644
--- a/gdb/d-valprint.c
+++ b/gdb/d-valprint.c
@@ -69,30 +69,6 @@ dynamic_array_type (struct type *type,
return 1;
}
-/* Implements the la_val_print routine for language D. */
-void
-d_val_print (struct type *type, int embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options)
-{
- int ret;
-
- type = check_typedef (type);
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_STRUCT:
- ret = dynamic_array_type (type, embedded_offset, address,
- stream, recurse, val, options);
- if (ret == 0)
- break;
- /* Fall through. */
- default:
- c_val_print (type, embedded_offset, address, stream,
- recurse, val, options);
- }
-}
-
/* See d-lang.h. */
void
diff --git a/gdb/f-lang.c b/gdb/f-lang.c
index e0a2184..75a131d 100644
--- a/gdb/f-lang.c
+++ b/gdb/f-lang.c
@@ -646,7 +646,6 @@ extern const struct language_defn f_language_defn =
f_emit_char, /* Function to print a single character */
f_print_type, /* Print a type using appropriate syntax */
f_print_typedef, /* Print a typedef using appropriate syntax */
- f_val_print, /* Print a value using appropriate syntax */
f_value_print_innner, /* la_value_print_inner */
c_value_print, /* FIXME */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/f-lang.h b/gdb/f-lang.h
index 5cc59ad..84a63a8 100644
--- a/gdb/f-lang.h
+++ b/gdb/f-lang.h
@@ -36,11 +36,6 @@ extern void f_print_typedef (struct type *type, struct symbol *new_symbol,
extern void f_print_type (struct type *, const char *, struct ui_file *, int,
int, const struct type_print_options *);
-extern void f_val_print (struct type *, int, CORE_ADDR,
- struct ui_file *, int,
- struct value *,
- const struct value_print_options *);
-
/* Implement la_value_print_inner for Fortran. */
extern void f_value_print_innner (struct value *val, struct ui_file *stream,
diff --git a/gdb/f-valprint.c b/gdb/f-valprint.c
index f927214..36328c7 100644
--- a/gdb/f-valprint.c
+++ b/gdb/f-valprint.c
@@ -208,192 +208,6 @@ static const struct generic_val_print_decorations f_decorations =
"}"
};
-/* See val_print for a description of the various parameters of this
- function; they are identical. */
-
-void
-f_val_print (struct type *type, int embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- struct gdbarch *gdbarch = get_type_arch (type);
- int printed_field = 0; /* Number of fields printed. */
- struct type *elttype;
- CORE_ADDR addr;
- int index;
- const gdb_byte *valaddr =value_contents_for_printing (original_value);
-
- type = check_typedef (type);
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_STRING:
- f77_get_dynamic_length_of_aggregate (type);
- LA_PRINT_STRING (stream, builtin_type (gdbarch)->builtin_char,
- valaddr + embedded_offset,
- TYPE_LENGTH (type), NULL, 0, options);
- break;
-
- case TYPE_CODE_ARRAY:
- if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_CHAR)
- {
- fprintf_filtered (stream, "(");
- f77_print_array (type, valaddr, embedded_offset,
- address, stream, recurse, original_value, options);
- fprintf_filtered (stream, ")");
- }
- else
- {
- struct type *ch_type = TYPE_TARGET_TYPE (type);
-
- f77_get_dynamic_length_of_aggregate (type);
- LA_PRINT_STRING (stream, ch_type,
- valaddr + embedded_offset,
- TYPE_LENGTH (type) / TYPE_LENGTH (ch_type),
- NULL, 0, options);
- }
- break;
-
- case TYPE_CODE_PTR:
- if (options->format && options->format != 's')
- {
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- break;
- }
- else
- {
- int want_space = 0;
-
- addr = unpack_pointer (type, valaddr + embedded_offset);
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
-
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
- {
- /* Try to print what function it points to. */
- print_function_pointer_address (options, gdbarch, addr, stream);
- return;
- }
-
- if (options->symbol_print)
- want_space = print_address_demangle (options, gdbarch, addr,
- stream, demangle);
- else if (options->addressprint && options->format != 's')
- {
- fputs_filtered (paddress (gdbarch, addr), stream);
- want_space = 1;
- }
-
- /* For a pointer to char or unsigned char, also print the string
- pointed to, unless pointer is null. */
- if (TYPE_LENGTH (elttype) == 1
- && TYPE_CODE (elttype) == TYPE_CODE_INT
- && (options->format == 0 || options->format == 's')
- && addr != 0)
- {
- if (want_space)
- fputs_filtered (" ", stream);
- val_print_string (TYPE_TARGET_TYPE (type), NULL, addr, -1,
- stream, options);
- }
- return;
- }
- break;
-
- case TYPE_CODE_INT:
- if (options->format || options->output_format)
- {
- struct value_print_options opts = *options;
-
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, embedded_offset,
- original_value, &opts, 0, stream);
- }
- else
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- break;
-
- case TYPE_CODE_STRUCT:
- case TYPE_CODE_UNION:
- /* Starting from the Fortran 90 standard, Fortran supports derived
- types. */
- fprintf_filtered (stream, "( ");
- for (index = 0; index < TYPE_NFIELDS (type); index++)
- {
- struct value *field = value_field
- ((struct value *)original_value, index);
-
- struct type *field_type = check_typedef (TYPE_FIELD_TYPE (type, index));
-
-
- if (TYPE_CODE (field_type) != TYPE_CODE_FUNC)
- {
- const char *field_name;
-
- if (printed_field > 0)
- fputs_filtered (", ", stream);
-
- field_name = TYPE_FIELD_NAME (type, index);
- if (field_name != NULL)
- {
- fputs_styled (field_name, variable_name_style.style (),
- stream);
- fputs_filtered (" = ", stream);
- }
-
- common_val_print (field, stream, recurse + 1,
- options, current_language);
-
- ++printed_field;
- }
- }
- fprintf_filtered (stream, " )");
- break;
-
- case TYPE_CODE_BOOL:
- if (options->format || options->output_format)
- {
- struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, embedded_offset,
- original_value, &opts, 0, stream);
- }
- else
- {
- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
- LONGEST val
- = unpack_long (type, valaddr + embedded_offset * unit_size);
- /* The Fortran standard doesn't specify how logical types are
- represented. Different compilers use different non zero
- values to represent logical true. */
- if (val == 0)
- fputs_filtered (f_decorations.false_name, stream);
- else
- fputs_filtered (f_decorations.true_name, stream);
- }
- break;
-
- case TYPE_CODE_REF:
- case TYPE_CODE_FUNC:
- case TYPE_CODE_FLAGS:
- case TYPE_CODE_FLT:
- case TYPE_CODE_VOID:
- case TYPE_CODE_ERROR:
- case TYPE_CODE_RANGE:
- case TYPE_CODE_UNDEF:
- case TYPE_CODE_COMPLEX:
- case TYPE_CODE_CHAR:
- default:
- generic_val_print (type, embedded_offset, address,
- stream, recurse, original_value, options,
- &f_decorations);
- break;
- }
-}
-
/* See f-lang.h. */
void
diff --git a/gdb/go-lang.c b/gdb/go-lang.c
index 667c4ae..53e3429 100644
--- a/gdb/go-lang.c
+++ b/gdb/go-lang.c
@@ -595,7 +595,6 @@ extern const struct language_defn go_language_defn =
go_print_type, /* Print a type using appropriate syntax. */
c_print_typedef, /* Print a typedef using appropriate
syntax. */
- go_val_print, /* Print a value using appropriate syntax. */
go_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value. */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/go-lang.h b/gdb/go-lang.h
index 8647964..1f07907 100644
--- a/gdb/go-lang.h
+++ b/gdb/go-lang.h
@@ -80,14 +80,6 @@ extern void go_print_type (struct type *type, const char *varstring,
struct ui_file *stream, int show, int level,
const struct type_print_options *flags);
-/* Defined in go-valprint.c. */
-
-extern void go_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options);
-
/* Implement la_value_print_inner for Go. */
extern void go_value_print_inner (struct value *value,
diff --git a/gdb/go-valprint.c b/gdb/go-valprint.c
index 79b3ad5..fe2ee46 100644
--- a/gdb/go-valprint.c
+++ b/gdb/go-valprint.c
@@ -84,45 +84,6 @@ print_go_string (struct type *type,
val_print_string (elt_type, NULL, addr, length, stream, options);
}
-/* Implements the la_val_print routine for language Go. */
-
-void
-go_val_print (struct type *type, int embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options)
-{
- type = check_typedef (type);
-
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_STRUCT:
- {
- enum go_type go_type = go_classify_struct_type (type);
-
- switch (go_type)
- {
- case GO_TYPE_STRING:
- if (! options->raw)
- {
- print_go_string (type, embedded_offset, address,
- stream, recurse, val, options);
- return;
- }
- break;
- default:
- break;
- }
- }
- /* Fall through. */
-
- default:
- c_val_print (type, embedded_offset, address, stream,
- recurse, val, options);
- break;
- }
-}
-
/* See go-lang.h. */
void
diff --git a/gdb/language.c b/gdb/language.c
index d1dfd2d..454c6dc 100644
--- a/gdb/language.c
+++ b/gdb/language.c
@@ -792,14 +792,12 @@ unk_lang_print_type (struct type *type, const char *varstring,
}
static void
-unk_lang_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options)
+unk_lang_value_print_inner (struct value *val,
+ struct ui_file *stream, int recurse,
+ const struct value_print_options *options)
{
error (_("internal error - unimplemented "
- "function unk_lang_val_print called."));
+ "function unk_lang_value_print_inner called."));
}
static void
@@ -859,8 +857,7 @@ const struct language_defn unknown_language_defn =
unk_lang_emit_char,
unk_lang_print_type, /* Print a type using appropriate syntax */
default_print_typedef, /* Print a typedef using appropriate syntax */
- unk_lang_val_print, /* Print a value using appropriate syntax */
- nullptr, /* la_value_print_inner */
+ unk_lang_value_print_inner, /* la_value_print_inner */
unk_lang_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
unk_lang_trampoline, /* Language specific skip_trampoline */
@@ -911,8 +908,7 @@ const struct language_defn auto_language_defn =
unk_lang_emit_char,
unk_lang_print_type, /* Print a type using appropriate syntax */
default_print_typedef, /* Print a typedef using appropriate syntax */
- unk_lang_val_print, /* Print a value using appropriate syntax */
- nullptr, /* la_value_print_inner */
+ unk_lang_value_print_inner, /* la_value_print_inner */
unk_lang_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
unk_lang_trampoline, /* Language specific skip_trampoline */
diff --git a/gdb/language.h b/gdb/language.h
index c6d5496..ea8aae5 100644
--- a/gdb/language.h
+++ b/gdb/language.h
@@ -249,30 +249,6 @@ struct language_defn
struct ui_file *stream);
/* Print a value using syntax appropriate for this language.
-
- TYPE is the type of the sub-object to be printed.
-
- EMBEDDED_OFFSET is the offset into the outermost object of the
- sub-object represented by TYPE. This is the object which this
- call should print. Note that the enclosing type is not
- available.
-
- ADDRESS is the address in the inferior of the enclosing object.
-
- STREAM is the stream on which the value is to be printed.
-
- RECURSE is the recursion depth. It is zero-based.
-
- OPTIONS are the formatting options to be used when
- printing. */
-
- void (*la_val_print) (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options);
-
- /* Print a value using syntax appropriate for this language.
RECURSE is the recursion depth. It is zero-based. */
void (*la_value_print_inner) (struct value *, struct ui_file *,
diff --git a/gdb/m2-lang.c b/gdb/m2-lang.c
index c500366..af3cf3a 100644
--- a/gdb/m2-lang.c
+++ b/gdb/m2-lang.c
@@ -393,7 +393,6 @@ extern const struct language_defn m2_language_defn =
m2_emit_char, /* Function to print a single character */
m2_print_type, /* Print a type using appropriate syntax */
m2_print_typedef, /* Print a typedef using appropriate syntax */
- m2_val_print, /* Print a value using appropriate syntax */
m2_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/m2-lang.h b/gdb/m2-lang.h
index 636ba39..de477e5 100644
--- a/gdb/m2-lang.h
+++ b/gdb/m2-lang.h
@@ -35,11 +35,6 @@ extern void m2_print_typedef (struct type *, struct symbol *,
extern int m2_is_long_set (struct type *type);
extern int m2_is_unbounded_array (struct type *type);
-extern void m2_val_print (struct type *, int, CORE_ADDR,
- struct ui_file *, int,
- struct value *,
- const struct value_print_options *);
-
/* Implement la_value_print_inner for Modula-2. */
extern void m2_value_print_inner (struct value *, struct ui_file *, int,
diff --git a/gdb/m2-valprint.c b/gdb/m2-valprint.c
index facd15e..844a63f 100644
--- a/gdb/m2-valprint.c
+++ b/gdb/m2-valprint.c
@@ -181,31 +181,6 @@ m2_print_unbounded_array (struct value *value,
fprintf_filtered (stream, ", HIGH = %d}", (int) len);
}
-static void
-m2_print_unbounded_array (struct type *type, const gdb_byte *valaddr,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- const struct value_print_options *options)
-{
- CORE_ADDR addr;
- LONGEST len;
- struct value *val;
-
- type = check_typedef (type);
-
- addr = unpack_pointer (TYPE_FIELD_TYPE (type, 0),
- (TYPE_FIELD_BITPOS (type, 0) / 8) +
- valaddr + embedded_offset);
-
- val = value_at_lazy (TYPE_TARGET_TYPE (TYPE_FIELD_TYPE (type, 0)),
- addr);
- len = unpack_field_as_long (type, valaddr + embedded_offset, 1);
-
- fprintf_filtered (stream, "{");
- m2_print_array_contents (val, stream, recurse, options, len);
- fprintf_filtered (stream, ", HIGH = %d}", (int) len);
-}
-
static int
print_unpacked_pointer (struct type *type,
CORE_ADDR address, CORE_ADDR addr,
@@ -323,204 +298,6 @@ static const struct generic_val_print_decorations m2_decorations =
"}"
};
-/* See val_print for a description of the various parameters of this
- function; they are identical. */
-
-void
-m2_val_print (struct type *type, int embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- unsigned len;
- struct type *elttype;
- CORE_ADDR addr;
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- type = check_typedef (type);
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_ARRAY:
- if (TYPE_LENGTH (type) > 0 && TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0)
- {
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
- len = TYPE_LENGTH (type) / TYPE_LENGTH (elttype);
- if (options->prettyformat_arrays)
- print_spaces_filtered (2 + 2 * recurse, stream);
- /* For an array of chars, print with string syntax. */
- if (TYPE_LENGTH (elttype) == 1 &&
- ((TYPE_CODE (elttype) == TYPE_CODE_INT)
- || ((current_language->la_language == language_m2)
- && (TYPE_CODE (elttype) == TYPE_CODE_CHAR)))
- && (options->format == 0 || options->format == 's'))
- {
- /* If requested, look for the first null char and only print
- elements up to it. */
- if (options->stop_print_at_null)
- {
- unsigned int temp_len;
-
- /* Look for a NULL char. */
- for (temp_len = 0;
- (valaddr + embedded_offset)[temp_len]
- && temp_len < len && temp_len < options->print_max;
- temp_len++);
- len = temp_len;
- }
-
- LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
- valaddr + embedded_offset, len, NULL,
- 0, options);
- }
- else
- {
- fprintf_filtered (stream, "{");
- val_print_array_elements (type, embedded_offset,
- address, stream,
- recurse, original_value,
- options, 0);
- fprintf_filtered (stream, "}");
- }
- break;
- }
- /* Array of unspecified length: treat like pointer to first elt. */
- print_unpacked_pointer (type, address, address, options, stream);
- break;
-
- case TYPE_CODE_PTR:
- if (TYPE_CONST (type))
- print_variable_at_address (type, valaddr + embedded_offset,
- stream, recurse, options);
- else if (options->format && options->format != 's')
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- else
- {
- addr = unpack_pointer (type, valaddr + embedded_offset);
- print_unpacked_pointer (type, addr, address, options, stream);
- }
- break;
-
- case TYPE_CODE_UNION:
- if (recurse && !options->unionprint)
- {
- fprintf_filtered (stream, "{...}");
- break;
- }
- /* Fall through. */
- case TYPE_CODE_STRUCT:
- if (m2_is_long_set (type))
- m2_print_long_set (type, valaddr, embedded_offset, address,
- stream);
- else if (m2_is_unbounded_array (type))
- m2_print_unbounded_array (type, valaddr, embedded_offset,
- address, stream, recurse, options);
- else
- cp_print_value_fields (type, type, embedded_offset,
- address, stream, recurse, original_value,
- options, NULL, 0);
- break;
-
- case TYPE_CODE_SET:
- elttype = TYPE_INDEX_TYPE (type);
- elttype = check_typedef (elttype);
- if (TYPE_STUB (elttype))
- {
- fprintf_styled (stream, metadata_style.style (),
- _("<incomplete type>"));
- break;
- }
- else
- {
- struct type *range = elttype;
- LONGEST low_bound, high_bound;
- int i;
- int need_comma = 0;
-
- fputs_filtered ("{", stream);
-
- i = get_discrete_bounds (range, &low_bound, &high_bound);
- maybe_bad_bstring:
- if (i < 0)
- {
- fputs_styled (_("<error value>"), metadata_style.style (),
- stream);
- goto done;
- }
-
- for (i = low_bound; i <= high_bound; i++)
- {
- int element = value_bit_index (type, valaddr + embedded_offset,
- i);
-
- if (element < 0)
- {
- i = element;
- goto maybe_bad_bstring;
- }
- if (element)
- {
- if (need_comma)
- fputs_filtered (", ", stream);
- print_type_scalar (range, i, stream);
- need_comma = 1;
-
- if (i + 1 <= high_bound
- && value_bit_index (type, valaddr + embedded_offset,
- ++i))
- {
- int j = i;
-
- fputs_filtered ("..", stream);
- while (i + 1 <= high_bound
- && value_bit_index (type,
- valaddr + embedded_offset,
- ++i))
- j = i;
- print_type_scalar (range, j, stream);
- }
- }
- }
- done:
- fputs_filtered ("}", stream);
- }
- break;
-
- case TYPE_CODE_RANGE:
- if (TYPE_LENGTH (type) == TYPE_LENGTH (TYPE_TARGET_TYPE (type)))
- {
- m2_val_print (TYPE_TARGET_TYPE (type), embedded_offset,
- address, stream, recurse, original_value, options);
- break;
- }
- /* FIXME: create_static_range_type does not set the unsigned bit in a
- range type (I think it probably should copy it from the target
- type), so we won't print values which are too large to
- fit in a signed integer correctly. */
- /* FIXME: Doesn't handle ranges of enums correctly. (Can't just
- print with the target type, though, because the size of our type
- and the target type might differ). */
- /* FALLTHROUGH */
-
- case TYPE_CODE_REF:
- case TYPE_CODE_ENUM:
- case TYPE_CODE_FUNC:
- case TYPE_CODE_INT:
- case TYPE_CODE_FLT:
- case TYPE_CODE_METHOD:
- case TYPE_CODE_VOID:
- case TYPE_CODE_ERROR:
- case TYPE_CODE_UNDEF:
- case TYPE_CODE_BOOL:
- case TYPE_CODE_CHAR:
- default:
- generic_val_print (type, embedded_offset, address,
- stream, recurse, original_value, options,
- &m2_decorations);
- break;
- }
-}
-
/* See m2-lang.h. */
void
diff --git a/gdb/objc-lang.c b/gdb/objc-lang.c
index 5126e9f..1c7ec56 100644
--- a/gdb/objc-lang.c
+++ b/gdb/objc-lang.c
@@ -381,7 +381,6 @@ extern const struct language_defn objc_language_defn = {
c_emit_char,
c_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index a480798..a4fdc5a 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -1060,7 +1060,6 @@ extern const struct language_defn opencl_language_defn =
c_emit_char, /* Print a single char */
opencl_print_type, /* Print a type using appropriate syntax */
c_print_typedef, /* Print a typedef using appropriate syntax */
- c_val_print, /* Print a value using appropriate syntax */
c_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/p-lang.c b/gdb/p-lang.c
index 87ddf34..944a077 100644
--- a/gdb/p-lang.c
+++ b/gdb/p-lang.c
@@ -447,7 +447,6 @@ extern const struct language_defn pascal_language_defn =
pascal_emit_char, /* Print a single char */
pascal_print_type, /* Print a type using appropriate syntax */
pascal_print_typedef, /* Print a typedef using appropriate syntax */
- pascal_val_print, /* Print a value using appropriate syntax */
pascal_value_print_inner, /* la_value_print_inner */
pascal_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/p-lang.h b/gdb/p-lang.h
index ae0b2aa..9ce6131 100644
--- a/gdb/p-lang.h
+++ b/gdb/p-lang.h
@@ -37,11 +37,6 @@ extern void pascal_print_type (struct type *, const char *, struct ui_file *,
extern void pascal_print_typedef (struct type *, struct symbol *,
struct ui_file *);
-extern void pascal_val_print (struct type *, int,
- CORE_ADDR, struct ui_file *, int,
- struct value *,
- const struct value_print_options *);
-
/* Implement la_value_print_inner for Pascal. */
extern void pascal_value_print_inner (struct value *, struct ui_file *, int,
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index d53cfd5..35a4e59 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -42,14 +42,6 @@
#include "cli/cli-style.h"
-static void pascal_object_print_value_fields (struct type *, const gdb_byte *,
- LONGEST,
- CORE_ADDR, struct ui_file *,
- int,
- struct value *,
- const struct value_print_options *,
- struct type **, int);
-
static void pascal_object_print_value_fields (struct value *, struct ui_file *,
int,
const struct value_print_options *,
@@ -69,368 +61,6 @@ static const struct generic_val_print_decorations p_decorations =
"}"
};
-/* See val_print for a description of the various parameters of this
- function; they are identical. */
-
-void
-pascal_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options)
-{
- struct gdbarch *gdbarch = get_type_arch (type);
- enum bfd_endian byte_order = type_byte_order (type);
- unsigned int i = 0; /* Number of characters printed */
- unsigned len;
- struct type *elttype;
- unsigned eltlen;
- int length_pos, length_size, string_pos;
- struct type *char_type;
- CORE_ADDR addr;
- int want_space = 0;
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- type = check_typedef (type);
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_ARRAY:
- {
- LONGEST low_bound, high_bound;
-
- if (get_array_bounds (type, &low_bound, &high_bound))
- {
- len = high_bound - low_bound + 1;
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
- eltlen = TYPE_LENGTH (elttype);
- if (options->prettyformat_arrays)
- {
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- /* If 's' format is used, try to print out as string.
- If no format is given, print as string if element type
- is of TYPE_CODE_CHAR and element size is 1,2 or 4. */
- if (options->format == 's'
- || ((eltlen == 1 || eltlen == 2 || eltlen == 4)
- && TYPE_CODE (elttype) == TYPE_CODE_CHAR
- && options->format == 0))
- {
- /* If requested, look for the first null char and only print
- elements up to it. */
- if (options->stop_print_at_null)
- {
- unsigned int temp_len;
-
- /* Look for a NULL char. */
- for (temp_len = 0;
- extract_unsigned_integer (valaddr + embedded_offset +
- temp_len * eltlen, eltlen,
- byte_order)
- && temp_len < len && temp_len < options->print_max;
- temp_len++);
- len = temp_len;
- }
-
- LA_PRINT_STRING (stream, TYPE_TARGET_TYPE (type),
- valaddr + embedded_offset, len, NULL, 0,
- options);
- i = len;
- }
- else
- {
- fprintf_filtered (stream, "{");
- /* If this is a virtual function table, print the 0th
- entry specially, and the rest of the members normally. */
- if (pascal_object_is_vtbl_ptr_type (elttype))
- {
- i = 1;
- fprintf_filtered (stream, "%d vtable entries", len - 1);
- }
- else
- {
- i = 0;
- }
- val_print_array_elements (type, embedded_offset,
- address, stream, recurse,
- original_value, options, i);
- fprintf_filtered (stream, "}");
- }
- break;
- }
- /* Array of unspecified length: treat like pointer to first elt. */
- addr = address + embedded_offset;
- }
- goto print_unpacked_pointer;
-
- case TYPE_CODE_PTR:
- if (options->format && options->format != 's')
- {
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- break;
- }
- if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
- {
- /* Print the unmangled name if desired. */
- /* Print vtable entry - we only get here if we ARE using
- -fvtable_thunks. (Otherwise, look under TYPE_CODE_STRUCT.) */
- /* Extract the address, assume that it is unsigned. */
- addr = extract_unsigned_integer (valaddr + embedded_offset,
- TYPE_LENGTH (type), byte_order);
- print_address_demangle (options, gdbarch, addr, stream, demangle);
- break;
- }
- check_typedef (TYPE_TARGET_TYPE (type));
-
- addr = unpack_pointer (type, valaddr + embedded_offset);
- print_unpacked_pointer:
- elttype = check_typedef (TYPE_TARGET_TYPE (type));
-
- if (TYPE_CODE (elttype) == TYPE_CODE_FUNC)
- {
- /* Try to print what function it points to. */
- print_address_demangle (options, gdbarch, addr, stream, demangle);
- return;
- }
-
- if (options->addressprint && options->format != 's')
- {
- fputs_filtered (paddress (gdbarch, addr), stream);
- want_space = 1;
- }
-
- /* For a pointer to char or unsigned char, also print the string
- pointed to, unless pointer is null. */
- if (((TYPE_LENGTH (elttype) == 1
- && (TYPE_CODE (elttype) == TYPE_CODE_INT
- || TYPE_CODE (elttype) == TYPE_CODE_CHAR))
- || ((TYPE_LENGTH (elttype) == 2 || TYPE_LENGTH (elttype) == 4)
- && TYPE_CODE (elttype) == TYPE_CODE_CHAR))
- && (options->format == 0 || options->format == 's')
- && addr != 0)
- {
- if (want_space)
- fputs_filtered (" ", stream);
- /* No wide string yet. */
- i = val_print_string (elttype, NULL, addr, -1, stream, options);
- }
- /* Also for pointers to pascal strings. */
- /* Note: this is Free Pascal specific:
- as GDB does not recognize stabs pascal strings
- Pascal strings are mapped to records
- with lowercase names PM. */
- if (is_pascal_string_type (elttype, &length_pos, &length_size,
- &string_pos, &char_type, NULL)
- && addr != 0)
- {
- ULONGEST string_length;
- gdb_byte *buffer;
-
- if (want_space)
- fputs_filtered (" ", stream);
- buffer = (gdb_byte *) xmalloc (length_size);
- read_memory (addr + length_pos, buffer, length_size);
- string_length = extract_unsigned_integer (buffer, length_size,
- byte_order);
- xfree (buffer);
- i = val_print_string (char_type, NULL,
- addr + string_pos, string_length,
- stream, options);
- }
- else if (pascal_object_is_vtbl_member (type))
- {
- /* Print vtbl's nicely. */
- CORE_ADDR vt_address = unpack_pointer (type,
- valaddr + embedded_offset);
- struct bound_minimal_symbol msymbol =
- lookup_minimal_symbol_by_pc (vt_address);
-
- /* If 'symbol_print' is set, we did the work above. */
- if (!options->symbol_print
- && (msymbol.minsym != NULL)
- && (vt_address == BMSYMBOL_VALUE_ADDRESS (msymbol)))
- {
- if (want_space)
- fputs_filtered (" ", stream);
- fputs_filtered ("<", stream);
- fputs_filtered (msymbol.minsym->print_name (), stream);
- fputs_filtered (">", stream);
- want_space = 1;
- }
- if (vt_address && options->vtblprint)
- {
- struct value *vt_val;
- struct symbol *wsym = NULL;
- struct type *wtype;
-
- if (want_space)
- fputs_filtered (" ", stream);
-
- if (msymbol.minsym != NULL)
- {
- const char *search_name = msymbol.minsym->search_name ();
- wsym = lookup_symbol_search_name (search_name, NULL,
- VAR_DOMAIN).symbol;
- }
-
- if (wsym)
- {
- wtype = SYMBOL_TYPE (wsym);
- }
- else
- {
- wtype = TYPE_TARGET_TYPE (type);
- }
- vt_val = value_at (wtype, vt_address);
- common_val_print (vt_val, stream, recurse + 1, options,
- current_language);
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- }
- }
-
- return;
-
- case TYPE_CODE_REF:
- case TYPE_CODE_ENUM:
- case TYPE_CODE_FLAGS:
- case TYPE_CODE_FUNC:
- case TYPE_CODE_RANGE:
- case TYPE_CODE_INT:
- case TYPE_CODE_FLT:
- case TYPE_CODE_VOID:
- case TYPE_CODE_ERROR:
- case TYPE_CODE_UNDEF:
- case TYPE_CODE_BOOL:
- case TYPE_CODE_CHAR:
- generic_val_print (type, embedded_offset, address,
- stream, recurse, original_value, options,
- &p_decorations);
- break;
-
- case TYPE_CODE_UNION:
- if (recurse && !options->unionprint)
- {
- fprintf_filtered (stream, "{...}");
- break;
- }
- /* Fall through. */
- case TYPE_CODE_STRUCT:
- if (options->vtblprint && pascal_object_is_vtbl_ptr_type (type))
- {
- /* Print the unmangled name if desired. */
- /* Print vtable entry - we only get here if NOT using
- -fvtable_thunks. (Otherwise, look under TYPE_CODE_PTR.) */
- /* Extract the address, assume that it is unsigned. */
- print_address_demangle
- (options, gdbarch,
- extract_unsigned_integer (valaddr + embedded_offset
- + TYPE_FIELD_BITPOS (type,
- VTBL_FNADDR_OFFSET) / 8,
- TYPE_LENGTH (TYPE_FIELD_TYPE (type,
- VTBL_FNADDR_OFFSET)),
- byte_order),
- stream, demangle);
- }
- else
- {
- if (is_pascal_string_type (type, &length_pos, &length_size,
- &string_pos, &char_type, NULL))
- {
- len = extract_unsigned_integer (valaddr + embedded_offset
- + length_pos, length_size,
- byte_order);
- LA_PRINT_STRING (stream, char_type,
- valaddr + embedded_offset + string_pos,
- len, NULL, 0, options);
- }
- else
- pascal_object_print_value_fields (type, valaddr, embedded_offset,
- address, stream, recurse,
- original_value, options,
- NULL, 0);
- }
- break;
-
- case TYPE_CODE_SET:
- elttype = TYPE_INDEX_TYPE (type);
- elttype = check_typedef (elttype);
- if (TYPE_STUB (elttype))
- {
- fprintf_styled (stream, metadata_style.style (), "<incomplete type>");
- break;
- }
- else
- {
- struct type *range = elttype;
- LONGEST low_bound, high_bound;
- int need_comma = 0;
-
- fputs_filtered ("[", stream);
-
- int bound_info = get_discrete_bounds (range, &low_bound, &high_bound);
- if (low_bound == 0 && high_bound == -1 && TYPE_LENGTH (type) > 0)
- {
- /* If we know the size of the set type, we can figure out the
- maximum value. */
- bound_info = 0;
- high_bound = TYPE_LENGTH (type) * TARGET_CHAR_BIT - 1;
- TYPE_HIGH_BOUND (range) = high_bound;
- }
- maybe_bad_bstring:
- if (bound_info < 0)
- {
- fputs_styled ("<error value>", metadata_style.style (), stream);
- goto done;
- }
-
- for (i = low_bound; i <= high_bound; i++)
- {
- int element = value_bit_index (type,
- valaddr + embedded_offset, i);
-
- if (element < 0)
- {
- i = element;
- goto maybe_bad_bstring;
- }
- if (element)
- {
- if (need_comma)
- fputs_filtered (", ", stream);
- print_type_scalar (range, i, stream);
- need_comma = 1;
-
- if (i + 1 <= high_bound
- && value_bit_index (type,
- valaddr + embedded_offset, ++i))
- {
- int j = i;
-
- fputs_filtered ("..", stream);
- while (i + 1 <= high_bound
- && value_bit_index (type,
- valaddr + embedded_offset,
- ++i))
- j = i;
- print_type_scalar (range, j, stream);
- }
- }
- }
- done:
- fputs_filtered ("]", stream);
- }
- break;
-
- default:
- error (_("Invalid pascal type code %d in symbol table."),
- TYPE_CODE (type));
- }
-}
-
/* See p-lang.h. */
void
@@ -698,10 +328,8 @@ pascal_value_print_inner (struct value *val, struct ui_file *stream,
len, NULL, 0, options);
}
else
- pascal_object_print_value_fields (type, valaddr, 0,
- value_address (val), stream,
- recurse, val, options,
- NULL, 0);
+ pascal_object_print_value_fields (val, stream, recurse,
+ options, NULL, 0);
}
break;
@@ -831,13 +459,6 @@ static void pascal_object_print_static_field (struct value *,
struct ui_file *, int,
const struct value_print_options *);
-static void pascal_object_print_value (struct type *, const gdb_byte *,
- LONGEST,
- CORE_ADDR, struct ui_file *, int,
- struct value *,
- const struct value_print_options *,
- struct type **);
-
static void pascal_object_print_value (struct value *, struct ui_file *, int,
const struct value_print_options *,
struct type **);
@@ -884,194 +505,6 @@ pascal_object_is_vtbl_member (struct type *type)
}
/* Mutually recursive subroutines of pascal_object_print_value and
- c_val_print to print out a structure's fields:
- pascal_object_print_value_fields and pascal_object_print_value.
-
- TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the
- same meanings as in pascal_object_print_value and c_val_print.
-
- DONT_PRINT is an array of baseclass types that we
- should not print, or zero if called from top level. */
-
-static void
-pascal_object_print_value_fields (struct type *type, const gdb_byte *valaddr,
- LONGEST offset,
- CORE_ADDR address, struct ui_file *stream,
- int recurse,
- struct value *val,
- const struct value_print_options *options,
- struct type **dont_print_vb,
- int dont_print_statmem)
-{
- int i, len, n_baseclasses;
- char *last_dont_print
- = (char *) obstack_next_free (&dont_print_statmem_obstack);
-
- type = check_typedef (type);
-
- fprintf_filtered (stream, "{");
- len = TYPE_NFIELDS (type);
- n_baseclasses = TYPE_N_BASECLASSES (type);
-
- /* Print out baseclasses such that we don't print
- duplicates of virtual baseclasses. */
- if (n_baseclasses > 0)
- pascal_object_print_value (type, valaddr, offset, address,
- stream, recurse + 1, val,
- options, dont_print_vb);
-
- if (!len && n_baseclasses == 1)
- fprintf_styled (stream, metadata_style.style (), "<No data fields>");
- else
- {
- struct obstack tmp_obstack = dont_print_statmem_obstack;
- int fields_seen = 0;
-
- if (dont_print_statmem == 0)
- {
- /* If we're at top level, carve out a completely fresh
- chunk of the obstack and use that until this particular
- invocation returns. */
- obstack_finish (&dont_print_statmem_obstack);
- }
-
- for (i = n_baseclasses; i < len; i++)
- {
- /* If requested, skip printing of static fields. */
- if (!options->pascal_static_field_print
- && field_is_static (&TYPE_FIELD (type, i)))
- continue;
- if (fields_seen)
- fprintf_filtered (stream, ", ");
- else if (n_baseclasses > 0)
- {
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- fputs_filtered ("members of ", stream);
- fputs_filtered (TYPE_NAME (type), stream);
- fputs_filtered (": ", stream);
- }
- }
- fields_seen = 1;
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- else
- {
- wrap_here (n_spaces (2 + 2 * recurse));
- }
-
- annotate_field_begin (TYPE_FIELD_TYPE (type, i));
-
- if (field_is_static (&TYPE_FIELD (type, i)))
- {
- fputs_filtered ("static ", stream);
- fprintf_symbol_filtered (stream,
- TYPE_FIELD_NAME (type, i),
- current_language->la_language,
- DMGL_PARAMS | DMGL_ANSI);
- }
- else
- fputs_styled (TYPE_FIELD_NAME (type, i),
- variable_name_style.style (), stream);
- annotate_field_name_end ();
- fputs_filtered (" = ", stream);
- annotate_field_value ();
-
- if (!field_is_static (&TYPE_FIELD (type, i))
- && TYPE_FIELD_PACKED (type, i))
- {
- struct value *v;
-
- /* Bitfields require special handling, especially due to byte
- order problems. */
- if (TYPE_FIELD_IGNORE (type, i))
- {
- fputs_styled ("<optimized out or zero length>",
- metadata_style.style (), stream);
- }
- else if (value_bits_synthetic_pointer (val,
- TYPE_FIELD_BITPOS (type,
- i),
- TYPE_FIELD_BITSIZE (type,
- i)))
- {
- fputs_styled (_("<synthetic pointer>"),
- metadata_style.style (), stream);
- }
- else
- {
- struct value_print_options opts = *options;
-
- v = value_field_bitfield (type, i, valaddr, offset, val);
-
- opts.deref_ref = 0;
- common_val_print (v, stream, recurse + 1, &opts,
- current_language);
- }
- }
- else
- {
- if (TYPE_FIELD_IGNORE (type, i))
- {
- fputs_styled ("<optimized out or zero length>",
- metadata_style.style (), stream);
- }
- else if (field_is_static (&TYPE_FIELD (type, i)))
- {
- /* struct value *v = value_static_field (type, i);
- v4.17 specific. */
- struct value *v;
-
- v = value_field_bitfield (type, i, valaddr, offset, val);
-
- if (v == NULL)
- val_print_optimized_out (NULL, stream);
- else
- pascal_object_print_static_field (v, stream, recurse + 1,
- options);
- }
- else
- {
- struct value_print_options opts = *options;
-
- opts.deref_ref = 0;
- /* val_print (TYPE_FIELD_TYPE (type, i),
- valaddr + TYPE_FIELD_BITPOS (type, i) / 8,
- address + TYPE_FIELD_BITPOS (type, i) / 8, 0,
- stream, format, 0, recurse + 1, pretty); */
- val_print (TYPE_FIELD_TYPE (type, i),
- offset + TYPE_FIELD_BITPOS (type, i) / 8,
- address, stream, recurse + 1, val, &opts,
- current_language);
- }
- }
- annotate_field_end ();
- }
-
- if (dont_print_statmem == 0)
- {
- /* Free the space used to deal with the printing
- of the members from top level. */
- obstack_free (&dont_print_statmem_obstack, last_dont_print);
- dont_print_statmem_obstack = tmp_obstack;
- }
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * recurse, stream);
- }
- }
- fprintf_filtered (stream, "}");
-}
-
-/* Mutually recursive subroutines of pascal_object_print_value and
pascal_value_print to print out a structure's fields:
pascal_object_print_value_fields and pascal_object_print_value.
@@ -1257,132 +690,6 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
baseclasses. */
static void
-pascal_object_print_value (struct type *type, const gdb_byte *valaddr,
- LONGEST offset,
- CORE_ADDR address, struct ui_file *stream,
- int recurse,
- struct value *val,
- const struct value_print_options *options,
- struct type **dont_print_vb)
-{
- struct type **last_dont_print
- = (struct type **) obstack_next_free (&dont_print_vb_obstack);
- struct obstack tmp_obstack = dont_print_vb_obstack;
- int i, n_baseclasses = TYPE_N_BASECLASSES (type);
-
- if (dont_print_vb == 0)
- {
- /* If we're at top level, carve out a completely fresh
- chunk of the obstack and use that until this particular
- invocation returns. */
- /* Bump up the high-water mark. Now alpha is omega. */
- obstack_finish (&dont_print_vb_obstack);
- }
-
- for (i = 0; i < n_baseclasses; i++)
- {
- LONGEST boffset = 0;
- struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
- const char *basename = TYPE_NAME (baseclass);
- const gdb_byte *base_valaddr = NULL;
- LONGEST thisoffset;
- int skip = 0;
- gdb::byte_vector buf;
-
- if (BASETYPE_VIA_VIRTUAL (type, i))
- {
- struct type **first_dont_print
- = (struct type **) obstack_base (&dont_print_vb_obstack);
-
- int j = (struct type **) obstack_next_free (&dont_print_vb_obstack)
- - first_dont_print;
-
- while (--j >= 0)
- if (baseclass == first_dont_print[j])
- goto flush_it;
-
- obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
- }
-
- thisoffset = offset;
-
- try
- {
- boffset = baseclass_offset (type, i, valaddr, offset, address, val);
- }
- catch (const gdb_exception_error &ex)
- {
- if (ex.error == NOT_AVAILABLE_ERROR)
- skip = -1;
- else
- skip = 1;
- }
-
- if (skip == 0)
- {
- /* The virtual base class pointer might have been clobbered by the
- user program. Make sure that it still points to a valid memory
- location. */
-
- if (boffset < 0 || boffset >= TYPE_LENGTH (type))
- {
- buf.resize (TYPE_LENGTH (baseclass));
-
- base_valaddr = buf.data ();
- if (target_read_memory (address + boffset, buf.data (),
- TYPE_LENGTH (baseclass)) != 0)
- skip = 1;
- address = address + boffset;
- thisoffset = 0;
- boffset = 0;
- }
- else
- base_valaddr = valaddr;
- }
-
- if (options->prettyformat)
- {
- fprintf_filtered (stream, "\n");
- print_spaces_filtered (2 * recurse, stream);
- }
- fputs_filtered ("<", stream);
- /* Not sure what the best notation is in the case where there is no
- baseclass name. */
-
- fputs_filtered (basename ? basename : "", stream);
- fputs_filtered ("> = ", stream);
-
- if (skip < 0)
- val_print_unavailable (stream);
- else if (skip > 0)
- val_print_invalid_address (stream);
- else
- pascal_object_print_value_fields (baseclass, base_valaddr,
- thisoffset + boffset, address,
- stream, recurse, val, options,
- (struct type **) obstack_base (&dont_print_vb_obstack),
- 0);
- fputs_filtered (", ", stream);
-
- flush_it:
- ;
- }
-
- if (dont_print_vb == 0)
- {
- /* Free the space used to deal with the printing
- of this type from top level. */
- obstack_free (&dont_print_vb_obstack, last_dont_print);
- /* Reset watermark so that we can continue protecting
- ourselves from whatever we were protecting ourselves. */
- dont_print_vb_obstack = tmp_obstack;
- }
-}
-
-/* Special val_print routine to avoid printing multiple copies of virtual
- baseclasses. */
-
-static void
pascal_object_print_value (struct value *val, struct ui_file *stream,
int recurse,
const struct value_print_options *options,
@@ -1548,12 +855,8 @@ pascal_object_print_static_field (struct value *val,
sizeof (CORE_ADDR));
type = check_typedef (type);
- pascal_object_print_value_fields (type,
- value_contents_for_printing (val),
- value_embedded_offset (val),
- addr,
- stream, recurse,
- val, options, NULL, 1);
+ pascal_object_print_value_fields (val, stream, recurse,
+ options, NULL, 1);
return;
}
diff --git a/gdb/rust-lang.c b/gdb/rust-lang.c
index 2afdeb3..139e4c2 100644
--- a/gdb/rust-lang.c
+++ b/gdb/rust-lang.c
@@ -545,18 +545,6 @@ static const struct generic_val_print_decorations rust_decorations =
"]"
};
-/* la_val_print implementation for Rust. */
-
-static void
-rust_val_print (struct type *type, int embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options)
-{
- generic_val_print (type, embedded_offset, address, stream,
- recurse, val, options, &rust_decorations);
-}
-
/* la_value_print_inner implementation for Rust. */
static void
rust_value_print_inner (struct value *val, struct ui_file *stream,
@@ -2157,7 +2145,6 @@ extern const struct language_defn rust_language_defn =
rust_emitchar, /* Print a single char */
rust_print_type, /* Print a type using appropriate syntax */
rust_print_typedef, /* Print a typedef using appropriate syntax */
- rust_val_print, /* Print a value using appropriate syntax */
rust_value_print_inner, /* la_value_print_inner */
c_value_print, /* Print a top-level value */
default_read_var_value, /* la_read_var_value */
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 07f5c57..108a21b 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -424,14 +424,13 @@ print_unpacked_pointer (struct type *type, struct type *elttype,
/* generic_val_print helper for TYPE_CODE_ARRAY. */
static void
-generic_val_print_array (struct type *type,
- int embedded_offset, CORE_ADDR address,
+generic_val_print_array (struct value *val,
struct ui_file *stream, int recurse,
- struct value *original_value,
const struct value_print_options *options,
const struct
generic_val_print_decorations *decorations)
{
+ struct type *type = check_typedef (value_type (val));
struct type *unresolved_elttype = TYPE_TARGET_TYPE (type);
struct type *elttype = check_typedef (unresolved_elttype);
@@ -448,48 +447,18 @@ generic_val_print_array (struct type *type,
}
fputs_filtered (decorations->array_start, stream);
- val_print_array_elements (type, embedded_offset,
- address, stream,
- recurse, original_value, options, 0);
+ value_print_array_elements (val, stream, recurse, options, 0);
fputs_filtered (decorations->array_end, stream);
}
else
{
/* Array of unspecified length: treat like pointer to first elt. */
- print_unpacked_pointer (type, elttype, address + embedded_offset, stream,
- options);
+ print_unpacked_pointer (type, elttype, value_address (val),
+ stream, options);
}
}
-/* generic_val_print helper for TYPE_CODE_PTR. */
-
-static void
-generic_val_print_ptr (struct type *type,
- int embedded_offset, struct ui_file *stream,
- struct value *original_value,
- const struct value_print_options *options)
-{
- struct gdbarch *gdbarch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
-
- if (options->format && options->format != 's')
- {
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- }
- else
- {
- struct type *unresolved_elttype = TYPE_TARGET_TYPE(type);
- struct type *elttype = check_typedef (unresolved_elttype);
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
- CORE_ADDR addr = unpack_pointer (type,
- valaddr + embedded_offset * unit_size);
-
- print_unpacked_pointer (type, elttype, addr, stream, options);
- }
-}
-
/* generic_value_print helper for TYPE_CODE_PTR. */
static void
@@ -511,18 +480,6 @@ generic_value_print_ptr (struct value *val, struct ui_file *stream,
}
-/* generic_val_print helper for TYPE_CODE_MEMBERPTR. */
-
-static void
-generic_val_print_memberptr (struct type *type,
- int embedded_offset, struct ui_file *stream,
- struct value *original_value,
- const struct value_print_options *options)
-{
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
-}
-
/* Print '@' followed by the address contained in ADDRESS_BUFFER. */
static void
@@ -754,41 +711,6 @@ generic_val_print_func (struct type *type,
print_address_demangle (options, gdbarch, address, stream, demangle);
}
-/* generic_val_print helper for TYPE_CODE_BOOL. */
-
-static void
-generic_val_print_bool (struct type *type,
- int embedded_offset, struct ui_file *stream,
- struct value *original_value,
- const struct value_print_options *options,
- const struct generic_val_print_decorations *decorations)
-{
- LONGEST val;
- struct gdbarch *gdbarch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
-
- if (options->format || options->output_format)
- {
- struct value_print_options opts = *options;
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, embedded_offset,
- original_value, &opts, 0, stream);
- }
- else
- {
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- val = unpack_long (type, valaddr + embedded_offset * unit_size);
- if (val == 0)
- fputs_filtered (decorations->false_name, stream);
- else if (val == 1)
- fputs_filtered (decorations->true_name, stream);
- else
- print_longest (stream, 'd', 0, val);
- }
-}
-
/* generic_value_print helper for TYPE_CODE_BOOL. */
static void
@@ -818,22 +740,6 @@ generic_value_print_bool
}
}
-/* generic_val_print helper for TYPE_CODE_INT. */
-
-static void
-generic_val_print_int (struct type *type,
- int embedded_offset, struct ui_file *stream,
- struct value *original_value,
- const struct value_print_options *options)
-{
- struct value_print_options opts = *options;
-
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, embedded_offset,
- original_value, &opts, 0, stream);
-}
-
/* generic_value_print helper for TYPE_CODE_INT. */
static void
@@ -847,42 +753,6 @@ generic_value_print_int (struct value *val, struct ui_file *stream,
value_print_scalar_formatted (val, &opts, 0, stream);
}
-/* generic_val_print helper for TYPE_CODE_CHAR. */
-
-static void
-generic_val_print_char (struct type *type, struct type *unresolved_type,
- int embedded_offset,
- struct ui_file *stream,
- struct value *original_value,
- const struct value_print_options *options)
-{
- LONGEST val;
- struct gdbarch *gdbarch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
-
- if (options->format || options->output_format)
- {
- struct value_print_options opts = *options;
-
- opts.format = (options->format ? options->format
- : options->output_format);
- val_print_scalar_formatted (type, embedded_offset,
- original_value, &opts, 0, stream);
- }
- else
- {
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- val = unpack_long (type, valaddr + embedded_offset * unit_size);
- if (TYPE_UNSIGNED (type))
- fprintf_filtered (stream, "%u", (unsigned int) val);
- else
- fprintf_filtered (stream, "%d", (int) val);
- fputs_filtered (" ", stream);
- LA_PRINT_CHAR (val, unresolved_type, stream);
- }
-}
-
/* generic_value_print helper for TYPE_CODE_CHAR. */
static void
@@ -931,41 +801,6 @@ generic_val_print_float (struct type *type,
print_floating (valaddr + embedded_offset * unit_size, type, stream);
}
-/* generic_val_print helper for TYPE_CODE_COMPLEX. */
-
-static void
-generic_val_print_complex (struct type *type,
- int embedded_offset, struct ui_file *stream,
- struct value *original_value,
- const struct value_print_options *options,
- const struct generic_val_print_decorations
- *decorations)
-{
- struct gdbarch *gdbarch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (gdbarch);
- const gdb_byte *valaddr = value_contents_for_printing (original_value);
-
- fprintf_filtered (stream, "%s", decorations->complex_prefix);
- if (options->format)
- val_print_scalar_formatted (TYPE_TARGET_TYPE (type),
- embedded_offset, original_value, options, 0,
- stream);
- else
- print_floating (valaddr + embedded_offset * unit_size,
- TYPE_TARGET_TYPE (type), stream);
- fprintf_filtered (stream, "%s", decorations->complex_infix);
- if (options->format)
- val_print_scalar_formatted (TYPE_TARGET_TYPE (type),
- embedded_offset
- + type_length_units (TYPE_TARGET_TYPE (type)),
- original_value, options, 0, stream);
- else
- print_floating (valaddr + embedded_offset * unit_size
- + TYPE_LENGTH (TYPE_TARGET_TYPE (type)),
- TYPE_TARGET_TYPE (type), stream);
- fprintf_filtered (stream, "%s", decorations->complex_suffix);
-}
-
/* generic_value_print helper for TYPE_CODE_COMPLEX. */
static void
@@ -990,144 +825,6 @@ generic_value_print_complex (struct value *val, struct ui_file *stream,
fprintf_filtered (stream, "%s", decorations->complex_suffix);
}
-/* A generic val_print that is suitable for use by language
- implementations of the la_val_print method. This function can
- handle most type codes, though not all, notably exception
- TYPE_CODE_UNION and TYPE_CODE_STRUCT, which must be implemented by
- the caller.
-
- Most arguments are as to val_print.
-
- The additional DECORATIONS argument can be used to customize the
- output in some small, language-specific ways. */
-
-void
-generic_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options,
- const struct generic_val_print_decorations *decorations)
-{
- struct type *unresolved_type = type;
-
- type = check_typedef (type);
- switch (TYPE_CODE (type))
- {
- case TYPE_CODE_ARRAY:
- generic_val_print_array (type, embedded_offset, address, stream,
- recurse, original_value, options, decorations);
- break;
-
- case TYPE_CODE_MEMBERPTR:
- generic_val_print_memberptr (type, embedded_offset, stream,
- original_value, options);
- break;
-
- case TYPE_CODE_PTR:
- generic_val_print_ptr (type, embedded_offset, stream,
- original_value, options);
- break;
-
- case TYPE_CODE_REF:
- case TYPE_CODE_RVALUE_REF:
- generic_val_print_ref (type, embedded_offset, stream, recurse,
- original_value, options);
- break;
-
- case TYPE_CODE_ENUM:
- if (options->format)
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- else
- generic_val_print_enum (type, embedded_offset, stream,
- original_value, options);
- break;
-
- case TYPE_CODE_FLAGS:
- if (options->format)
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- else
- val_print_type_code_flags (type, original_value, embedded_offset,
- stream);
- break;
-
- case TYPE_CODE_FUNC:
- case TYPE_CODE_METHOD:
- if (options->format)
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- else
- generic_val_print_func (type, embedded_offset, address, stream,
- original_value, options);
- break;
-
- case TYPE_CODE_BOOL:
- generic_val_print_bool (type, embedded_offset, stream,
- original_value, options, decorations);
- break;
-
- case TYPE_CODE_RANGE:
- /* FIXME: create_static_range_type does not set the unsigned bit in a
- range type (I think it probably should copy it from the
- target type), so we won't print values which are too large to
- fit in a signed integer correctly. */
- /* FIXME: Doesn't handle ranges of enums correctly. (Can't just
- print with the target type, though, because the size of our
- type and the target type might differ). */
-
- /* FALLTHROUGH */
-
- case TYPE_CODE_INT:
- generic_val_print_int (type, embedded_offset, stream,
- original_value, options);
- break;
-
- case TYPE_CODE_CHAR:
- generic_val_print_char (type, unresolved_type, embedded_offset,
- stream, original_value, options);
- break;
-
- case TYPE_CODE_FLT:
- case TYPE_CODE_DECFLOAT:
- if (options->format)
- val_print_scalar_formatted (type, embedded_offset,
- original_value, options, 0, stream);
- else
- generic_val_print_float (type, embedded_offset, stream,
- original_value, options);
- break;
-
- case TYPE_CODE_VOID:
- fputs_filtered (decorations->void_name, stream);
- break;
-
- case TYPE_CODE_ERROR:
- fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
- break;
-
- case TYPE_CODE_UNDEF:
- /* This happens (without TYPE_STUB set) on systems which don't use
- dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar"
- and no complete type for struct foo in that file. */
- fprintf_styled (stream, metadata_style.style (), _("<incomplete type>"));
- break;
-
- case TYPE_CODE_COMPLEX:
- generic_val_print_complex (type, embedded_offset, stream,
- original_value, options, decorations);
- break;
-
- case TYPE_CODE_UNION:
- case TYPE_CODE_STRUCT:
- case TYPE_CODE_METHODPTR:
- default:
- error (_("Unhandled type code %d in symbol table."),
- TYPE_CODE (type));
- }
-}
-
/* See valprint.h. */
void
@@ -1141,8 +838,7 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
switch (TYPE_CODE (type))
{
case TYPE_CODE_ARRAY:
- generic_val_print_array (type, 0, value_address (val), stream,
- recurse, val, options, decorations);
+ generic_val_print_array (val, stream, recurse, options, decorations);
break;
case TYPE_CODE_MEMBERPTR:
@@ -1247,15 +943,13 @@ generic_value_print (struct value *val, struct ui_file *stream, int recurse,
the value to be printed. */
static void
-do_val_print (struct value *full_value,
- struct type *type, LONGEST embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *val,
+do_val_print (struct value *value, struct ui_file *stream, int recurse,
const struct value_print_options *options,
const struct language_defn *language)
{
int ret = 0;
struct value_print_options local_opts = *options;
+ struct type *type = value_type (value);
struct type *real_type = check_typedef (type);
if (local_opts.prettyformat == Val_prettyformat_default)
@@ -1274,17 +968,12 @@ do_val_print (struct value *full_value,
return;
}
- if (!valprint_check_validity (stream, real_type, embedded_offset, val))
+ if (!valprint_check_validity (stream, real_type, 0, value))
return;
if (!options->raw)
{
- struct value *v = full_value;
-
- if (v == nullptr)
- v = value_from_component (val, type, embedded_offset);
-
- ret = apply_ext_lang_val_pretty_printer (v, stream, recurse, options,
+ ret = apply_ext_lang_val_pretty_printer (value, stream, recurse, options,
language);
if (ret)
return;
@@ -1305,13 +994,7 @@ do_val_print (struct value *full_value,
try
{
- if (full_value != nullptr && language->la_value_print_inner != nullptr)
- language->la_value_print_inner (full_value, stream, recurse,
- &local_opts);
- else
- language->la_val_print (type, embedded_offset, address,
- stream, recurse, val,
- &local_opts);
+ language->la_value_print_inner (value, stream, recurse, &local_opts);
}
catch (const gdb_exception_error &except)
{
@@ -1320,36 +1003,6 @@ do_val_print (struct value *full_value,
}
}
-/* Print using the given LANGUAGE the data of type TYPE located at
- VAL's contents buffer + EMBEDDED_OFFSET (within GDB), which came
- from the inferior at address ADDRESS + EMBEDDED_OFFSET, onto
- stdio stream STREAM according to OPTIONS. VAL is the whole object
- that came from ADDRESS.
-
- The language printers will pass down an adjusted EMBEDDED_OFFSET to
- further helper subroutines as subfields of TYPE are printed. In
- such cases, VAL is passed down unadjusted, so
- that VAL can be queried for metadata about the contents data being
- printed, using EMBEDDED_OFFSET as an offset into VAL's contents
- buffer. For example: "has this field been optimized out", or "I'm
- printing an object while inspecting a traceframe; has this
- particular piece of data been collected?".
-
- RECURSE indicates the amount of indentation to supply before
- continuation lines; this amount is roughly twice the value of
- RECURSE. */
-
-void
-val_print (struct type *type, LONGEST embedded_offset,
- CORE_ADDR address, struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options,
- const struct language_defn *language)
-{
- do_val_print (nullptr, type, embedded_offset, address, stream,
- recurse, val, options, language);
-}
-
/* See valprint.h. */
bool
@@ -1434,9 +1087,6 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse,
const struct value_print_options *options,
const struct language_defn *language)
{
- if (!value_check_printable (val, stream, options))
- return;
-
if (language->la_language == language_ada)
/* The value might have a dynamic type, which would cause trouble
below when trying to extract the value contents (since the value
@@ -1447,10 +1097,7 @@ common_val_print (struct value *val, struct ui_file *stream, int recurse,
if (value_lazy (val))
value_fetch_lazy (val);
- do_val_print (val, value_type (val),
- value_embedded_offset (val), value_address (val),
- stream, recurse,
- val, options, language);
+ do_val_print (val, stream, recurse, options, language);
}
/* See valprint.h. */
@@ -1543,57 +1190,6 @@ val_print_type_code_flags (struct type *type, struct value *original_value,
fputs_filtered (" ]", stream);
}
-/* Print a scalar of data of type TYPE, pointed to in GDB by VALADDR,
- according to OPTIONS and SIZE on STREAM. Format i is not supported
- at this level.
-
- This is how the elements of an array or structure are printed
- with a format. */
-
-void
-val_print_scalar_formatted (struct type *type,
- LONGEST embedded_offset,
- struct value *val,
- const struct value_print_options *options,
- int size,
- struct ui_file *stream)
-{
- struct gdbarch *arch = get_type_arch (type);
- int unit_size = gdbarch_addressable_memory_unit_size (arch);
-
- gdb_assert (val != NULL);
-
- /* If we get here with a string format, try again without it. Go
- all the way back to the language printers, which may call us
- again. */
- if (options->format == 's')
- {
- struct value_print_options opts = *options;
- opts.format = 0;
- opts.deref_ref = 0;
- val_print (type, embedded_offset, 0, stream, 0, val, &opts,
- current_language);
- return;
- }
-
- /* value_contents_for_printing fetches all VAL's contents. They are
- needed to check whether VAL is optimized-out or unavailable
- below. */
- const gdb_byte *valaddr = value_contents_for_printing (val);
-
- /* A scalar object that does not have all bits available can't be
- printed, because all bits contribute to its representation. */
- if (value_bits_any_optimized_out (val,
- TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * TYPE_LENGTH (type)))
- val_print_optimized_out (val, stream);
- else if (!value_bytes_available (val, embedded_offset, TYPE_LENGTH (type)))
- val_print_unavailable (stream);
- else
- print_scalar_formatted (valaddr + embedded_offset * unit_size, type,
- options, size, stream);
-}
-
/* See valprint.h. */
void
@@ -2275,144 +1871,6 @@ maybe_print_array_index (struct type *index_type, LONGEST index,
LA_PRINT_ARRAY_INDEX (index_value, stream, options);
}
-/* Called by various <lang>_val_print routines to print elements of an
- array in the form "<elem1>, <elem2>, <elem3>, ...".
-
- (FIXME?) Assumes array element separator is a comma, which is correct
- for all languages currently handled.
- (FIXME?) Some languages have a notation for repeated array elements,
- perhaps we should try to use that notation when appropriate. */
-
-void
-val_print_array_elements (struct type *type,
- LONGEST embedded_offset,
- CORE_ADDR address, struct ui_file *stream,
- int recurse,
- struct value *val,
- const struct value_print_options *options,
- unsigned int i)
-{
- unsigned int things_printed = 0;
- unsigned len;
- struct type *elttype, *index_type, *base_index_type;
- unsigned eltlen;
- /* Position of the array element we are examining to see
- whether it is repeated. */
- unsigned int rep1;
- /* Number of repetitions we have detected so far. */
- unsigned int reps;
- LONGEST low_bound, high_bound;
- LONGEST low_pos, high_pos;
-
- elttype = TYPE_TARGET_TYPE (type);
- eltlen = type_length_units (check_typedef (elttype));
- index_type = TYPE_INDEX_TYPE (type);
-
- if (get_array_bounds (type, &low_bound, &high_bound))
- {
- if (TYPE_CODE (index_type) == TYPE_CODE_RANGE)
- base_index_type = TYPE_TARGET_TYPE (index_type);
- else
- base_index_type = index_type;
-
- /* Non-contiguous enumerations types can by used as index types
- in some languages (e.g. Ada). In this case, the array length
- shall be computed from the positions of the first and last
- literal in the enumeration type, and not from the values
- of these literals. */
- if (!discrete_position (base_index_type, low_bound, &low_pos)
- || !discrete_position (base_index_type, high_bound, &high_pos))
- {
- warning (_("unable to get positions in array, use bounds instead"));
- low_pos = low_bound;
- high_pos = high_bound;
- }
-
- /* The array length should normally be HIGH_POS - LOW_POS + 1.
- But we have to be a little extra careful, because some languages
- such as Ada allow LOW_POS to be greater than HIGH_POS for
- empty arrays. In that situation, the array length is just zero,
- not negative! */
- if (low_pos > high_pos)
- len = 0;
- else
- len = high_pos - low_pos + 1;
- }
- else
- {
- warning (_("unable to get bounds of array, assuming null array"));
- low_bound = 0;
- len = 0;
- }
-
- annotate_array_section_begin (i, elttype);
-
- for (; i < len && things_printed < options->print_max; i++)
- {
- if (i != 0)
- {
- if (options->prettyformat_arrays)
- {
- fprintf_filtered (stream, ",\n");
- print_spaces_filtered (2 + 2 * recurse, stream);
- }
- else
- {
- fprintf_filtered (stream, ", ");
- }
- }
- wrap_here (n_spaces (2 + 2 * recurse));
- maybe_print_array_index (index_type, i + low_bound,
- stream, options);
-
- rep1 = i + 1;
- reps = 1;
- /* Only check for reps if repeat_count_threshold is not set to
- UINT_MAX (unlimited). */
- if (options->repeat_count_threshold < UINT_MAX)
- {
- while (rep1 < len
- && value_contents_eq (val,
- embedded_offset + i * eltlen,
- val,
- (embedded_offset
- + rep1 * eltlen),
- eltlen))
- {
- ++reps;
- ++rep1;
- }
- }
-
- if (reps > options->repeat_count_threshold)
- {
- val_print (elttype, embedded_offset + i * eltlen,
- address, stream, recurse + 1, val, options,
- current_language);
- annotate_elt_rep (reps);
- fprintf_filtered (stream, " %p[<repeats %u times>%p]",
- metadata_style.style ().ptr (), reps, nullptr);
- annotate_elt_rep_end ();
-
- i = rep1 - 1;
- things_printed += options->repeat_count_threshold;
- }
- else
- {
- val_print (elttype, embedded_offset + i * eltlen,
- address,
- stream, recurse + 1, val, options, current_language);
- annotate_elt ();
- things_printed++;
- }
- }
- annotate_array_section_end ();
- if (i < len)
- {
- fprintf_filtered (stream, "...");
- }
-}
-
/* See valprint.h. */
void
diff --git a/gdb/valprint.h b/gdb/valprint.h
index 20a4231..57bc033 100644
--- a/gdb/valprint.h
+++ b/gdb/valprint.h
@@ -128,11 +128,6 @@ extern void maybe_print_array_index (struct type *index_type, LONGEST index,
struct ui_file *stream,
const struct value_print_options *);
-extern void val_print_array_elements (struct type *, LONGEST,
- CORE_ADDR, struct ui_file *, int,
- struct value *,
- const struct value_print_options *,
- unsigned int);
/* Print elements of an array. */
@@ -140,13 +135,6 @@ extern void value_print_array_elements (struct value *, struct ui_file *, int,
const struct value_print_options *,
unsigned int);
-extern void val_print_scalar_formatted (struct type *,
- LONGEST,
- struct value *,
- const struct value_print_options *,
- int,
- struct ui_file *);
-
/* Print a scalar according to OPTIONS and SIZE on STREAM. Format 'i'
is not supported at this level.
@@ -220,13 +208,6 @@ struct generic_val_print_decorations
};
-extern void generic_val_print (struct type *type,
- int embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *original_value,
- const struct value_print_options *options,
- const struct generic_val_print_decorations *);
-
/* Print a value in a generic way. VAL is the value, STREAM is where
to print it, RECURSE is the recursion depth, OPTIONS describe how
the printing should be done, and D is the language-specific
diff --git a/gdb/value.h b/gdb/value.h
index df6d80c..e4fd258 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -1097,13 +1097,6 @@ extern void value_print_array_elements (struct value *val,
extern std::vector<value_ref_ptr> value_release_to_mark
(const struct value *mark);
-extern void val_print (struct type *type,
- LONGEST embedded_offset, CORE_ADDR address,
- struct ui_file *stream, int recurse,
- struct value *val,
- const struct value_print_options *options,
- const struct language_defn *language);
-
extern void common_val_print (struct value *val,
struct ui_file *stream, int recurse,
const struct value_print_options *options,