aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-31 16:13:08 -0700
committerTom Tromey <tom@tromey.com>2023-02-13 15:22:17 -0700
commitd00664dbba2802bacfed2335b6f249fc418182a0 (patch)
treed926f7656d767617427844def6d80e8e72817207 /gdb/valprint.c
parentcda0334434412d888443e9a98386255f2e0c2eab (diff)
downloadgdb-d00664dbba2802bacfed2335b6f249fc418182a0.zip
gdb-d00664dbba2802bacfed2335b6f249fc418182a0.tar.gz
gdb-d00664dbba2802bacfed2335b6f249fc418182a0.tar.bz2
Turn many optimized-out value functions into methods
This turns many functions that are related to optimized-out or availability-checking to be methods of value. The static function value_entirely_covered_by_range_vector is also converted to be a private method. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index ba62d3a..46d0aee 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -373,9 +373,8 @@ valprint_check_validity (struct ui_file *stream,
&& type->code () != TYPE_CODE_STRUCT
&& type->code () != TYPE_CODE_ARRAY)
{
- if (value_bits_any_optimized_out (val,
- TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * type->length ()))
+ if (val->bits_any_optimized_out (TARGET_CHAR_BIT * embedded_offset,
+ TARGET_CHAR_BIT * type->length ()))
{
val_print_optimized_out (val, stream);
return 0;
@@ -403,7 +402,7 @@ valprint_check_validity (struct ui_file *stream,
return is_ref;
}
- if (!value_bytes_available (val, embedded_offset, type->length ()))
+ if (!val->bytes_available (embedded_offset, type->length ()))
{
val_print_unavailable (stream);
return 0;
@@ -1131,7 +1130,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
return 0;
}
- if (value_entirely_optimized_out (val))
+ if (val->entirely_optimized_out ())
{
if (options->summary && !val_print_scalar_type_p (val->type ()))
gdb_printf (stream, "...");
@@ -1140,7 +1139,7 @@ value_check_printable (struct value *val, struct ui_file *stream,
return 0;
}
- if (value_entirely_unavailable (val))
+ if (val->entirely_unavailable ())
{
if (options->summary && !val_print_scalar_type_p (val->type ()))
gdb_printf (stream, "...");
@@ -1304,10 +1303,10 @@ value_print_scalar_formatted (struct value *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, 0,
- TARGET_CHAR_BIT * type->length ()))
+ if (val->bits_any_optimized_out (0,
+ TARGET_CHAR_BIT * type->length ()))
val_print_optimized_out (val, stream);
- else if (!value_bytes_available (val, 0, type->length ()))
+ else if (!val->bytes_available (0, type->length ()))
val_print_unavailable (stream);
else
print_scalar_formatted (valaddr, type, options, size, stream);
@@ -2017,8 +2016,8 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
UINT_MAX (unlimited). */
if (options->repeat_count_threshold < UINT_MAX)
{
- bool unavailable = value_entirely_unavailable (element);
- bool available = value_entirely_available (element);
+ bool unavailable = element->entirely_unavailable ();
+ bool available = element->entirely_available ();
while (rep1 < len)
{
@@ -2027,10 +2026,10 @@ value_print_array_elements (struct value *val, struct ui_file *stream,
rep1 * bit_stride,
bit_stride);
bool repeated = ((available
- && value_entirely_available (rep_elt)
+ && rep_elt->entirely_available ()
&& element->contents_eq (rep_elt))
|| (unavailable
- && value_entirely_unavailable (rep_elt)));
+ && rep_elt->entirely_unavailable ()));
if (!repeated)
break;
++reps;