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.
This commit is contained in:
Tom Tromey 2020-03-13 17:39:52 -06:00
parent 5b5e15ecdd
commit 416595d640
2 changed files with 26 additions and 3 deletions

View File

@ -1,3 +1,8 @@
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;

View File

@ -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: