diff options
author | Tom Tromey <tom@tromey.com> | 2020-03-13 17:39:52 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-03-13 18:03:41 -0600 |
commit | 416595d6409b1bd2e2f9862c133ca764688da77f (patch) | |
tree | 0e6098bca479afea0b96870263ede579690de2d2 | |
parent | 5b5e15ecddafc43de2da632aa68f935a879d9a91 (diff) | |
download | gdb-416595d6409b1bd2e2f9862c133ca764688da77f.zip gdb-416595d6409b1bd2e2f9862c133ca764688da77f.tar.gz gdb-416595d6409b1bd2e2f9862c133ca764688da77f.tar.bz2 |
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 <tom@tromey.com>
* ada-valprint.c (ada_value_print_ptr): New function.
(ada_value_print_1): Use it.
-rw-r--r-- | gdb/ChangeLog | 5 | ||||
-rw-r--r-- | gdb/ada-valprint.c | 24 |
2 files changed, 26 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 74146ef..c5c060f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,10 @@ 2020-03-13 Tom Tromey <tom@tromey.com> + * ada-valprint.c (ada_value_print_ptr): New function. + (ada_value_print_1): Use it. + +2020-03-13 Tom Tromey <tom@tromey.com> + * ada-valprint.c (ada_val_print_gnat_array): Take a struct value; call common_val_print. (ada_val_print_1): Update. diff --git a/gdb/ada-valprint.c b/gdb/ada-valprint.c index 3c389d6..2cb7334 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: |