From 416595d6409b1bd2e2f9862c133ca764688da77f Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Fri, 13 Mar 2020 17:39:52 -0600 Subject: [PATCH] Introduce ada_value_print_ptr This adds ada_value_print_ptr, a value-based analogue of ada_val_print_ptr. gdb/ChangeLog 2020-03-13 Tom Tromey * ada-valprint.c (ada_value_print_ptr): New function. (ada_value_print_1): Use it. --- gdb/ChangeLog | 5 +++++ gdb/ada-valprint.c | 24 +++++++++++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 74146ef03b0..c5c060f3613 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2020-03-13 Tom Tromey + + * ada-valprint.c (ada_value_print_ptr): New function. + (ada_value_print_1): Use it. + 2020-03-13 Tom Tromey * ada-valprint.c (ada_val_print_gnat_array): Take a struct value; diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 3c389d63536..2cb7334b4ec 100644 --- a/gdb/ada-valprint.c +++ b/gdb/ada-valprint.c @@ -814,6 +814,26 @@ ada_val_print_ptr (struct type *type, const gdb_byte *valaddr, } } +/* Implement Ada value_print'ing for the case where TYPE is a + TYPE_CODE_PTR. */ + +static void +ada_value_print_ptr (struct value *val, + struct ui_file *stream, int recurse, + const struct value_print_options *options) +{ + common_val_print (val, stream, recurse, options, language_def (language_c)); + + struct type *type = ada_check_typedef (value_type (val)); + if (ada_is_tag_type (type)) + { + const char *name = ada_tag_name (val); + + if (name != NULL) + fprintf_filtered (stream, " (%s)", name); + } +} + /* Implement Ada val_print'ing for the case where TYPE is a TYPE_CODE_INT or TYPE_CODE_RANGE. */ @@ -1257,9 +1277,7 @@ ada_value_print_1 (struct value *val, struct ui_file *stream, int recurse, break; case TYPE_CODE_PTR: - ada_val_print_ptr (type, valaddr, 0, 0, - address, stream, recurse, val, - options); + ada_value_print_ptr (val, stream, recurse, options); break; case TYPE_CODE_INT: -- 2.39.2