aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-01-31 14:17:50 -0700
committerTom Tromey <tom@tromey.com>2023-02-13 15:22:16 -0700
commite989e63761c66d632e1e3b9b40feb12e76cc5dd3 (patch)
tree9eadbd3a0540dc8f0032f4f4e2c8f045eaa6fea2 /gdb
parent02744ba9a2cfb7d1d2b8ebb6e80178a68bf56e06 (diff)
downloadgdb-e989e63761c66d632e1e3b9b40feb12e76cc5dd3.zip
gdb-e989e63761c66d632e1e3b9b40feb12e76cc5dd3.tar.gz
gdb-e989e63761c66d632e1e3b9b40feb12e76cc5dd3.tar.bz2
Turn value_bits_synthetic_pointer into a method
This changes value_bits_synthetic_pointer to be a method of value. Approved-By: Simon Marchi <simon.marchi@efficios.com>
Diffstat (limited to 'gdb')
-rw-r--r--gdb/cp-valprint.c6
-rw-r--r--gdb/dwarf2/expr.c4
-rw-r--r--gdb/opencl-lang.c5
-rw-r--r--gdb/p-valprint.c6
-rw-r--r--gdb/valops.c4
-rw-r--r--gdb/valprint.c9
-rw-r--r--gdb/value.c12
-rw-r--r--gdb/value.h11
8 files changed, 26 insertions, 31 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c
index dd39682..5f18d37 100644
--- a/gdb/cp-valprint.c
+++ b/gdb/cp-valprint.c
@@ -270,9 +270,9 @@ cp_print_value_fields (struct value *val, struct ui_file *stream,
fputs_styled ("<optimized out or zero length>",
metadata_style.style (), stream);
}
- else if (value_bits_synthetic_pointer
- (val, type->field (i).loc_bitpos (),
- TYPE_FIELD_BITSIZE (type, i)))
+ else if (val->bits_synthetic_pointer
+ (type->field (i).loc_bitpos (),
+ TYPE_FIELD_BITSIZE (type, i)))
{
fputs_styled (_("<synthetic pointer>"),
metadata_style.style (), stream);
diff --git a/gdb/dwarf2/expr.c b/gdb/dwarf2/expr.c
index e08dca0..ef93b89 100644
--- a/gdb/dwarf2/expr.c
+++ b/gdb/dwarf2/expr.c
@@ -576,8 +576,8 @@ coerce_pieced_ref (const value *value)
{
struct type *type = check_typedef (value->type ());
- if (value_bits_synthetic_pointer (value, value->embedded_offset (),
- TARGET_CHAR_BIT * type->length ()))
+ if (value->bits_synthetic_pointer (value->embedded_offset (),
+ TARGET_CHAR_BIT * type->length ()))
{
const piece_closure *closure
= (piece_closure *) value->computed_closure ();
diff --git a/gdb/opencl-lang.c b/gdb/opencl-lang.c
index 8bc727c..e4a88a2 100644
--- a/gdb/opencl-lang.c
+++ b/gdb/opencl-lang.c
@@ -215,9 +215,8 @@ lval_func_check_synthetic_pointer (const struct value *v,
int comp_offset = (i == start) ? startrest : 0;
int comp_length = (i == end) ? endrest : elsize;
- if (!value_bits_synthetic_pointer (c->val,
- c->indices[i] * elsize + comp_offset,
- comp_length))
+ if (!c->val->bits_synthetic_pointer (c->indices[i] * elsize + comp_offset,
+ comp_length))
return 0;
}
diff --git a/gdb/p-valprint.c b/gdb/p-valprint.c
index c6b9b55..4b84ec1 100644
--- a/gdb/p-valprint.c
+++ b/gdb/p-valprint.c
@@ -609,9 +609,9 @@ pascal_object_print_value_fields (struct value *val, struct ui_file *stream,
fputs_styled ("<optimized out or zero length>",
metadata_style.style (), stream);
}
- else if (value_bits_synthetic_pointer
- (val, type->field (i).loc_bitpos (),
- TYPE_FIELD_BITSIZE (type, i)))
+ else if (val->bits_synthetic_pointer
+ (type->field (i).loc_bitpos (),
+ TYPE_FIELD_BITSIZE (type, i)))
{
fputs_styled (_("<synthetic pointer>"),
metadata_style.style (), stream);
diff --git a/gdb/valops.c b/gdb/valops.c
index 6896478..fc9c6dc 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1556,8 +1556,8 @@ value_addr (struct value *arg1)
if (TYPE_IS_REFERENCE (type))
{
- if (value_bits_synthetic_pointer (arg1, arg1->embedded_offset (),
- TARGET_CHAR_BIT * type->length ()))
+ if (arg1->bits_synthetic_pointer (arg1->embedded_offset (),
+ TARGET_CHAR_BIT * type->length ()))
arg1 = coerce_ref (arg1);
else
{
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 2fa18b8..08e8826 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -381,8 +381,8 @@ valprint_check_validity (struct ui_file *stream,
return 0;
}
- if (value_bits_synthetic_pointer (val, TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * type->length ()))
+ if (val->bits_synthetic_pointer (TARGET_CHAR_BIT * embedded_offset,
+ TARGET_CHAR_BIT * type->length ()))
{
const int is_ref = type->code () == TYPE_CODE_REF;
int ref_is_addressable = 0;
@@ -568,9 +568,8 @@ generic_val_print_ref (struct type *type,
struct type *elttype = check_typedef (type->target_type ());
struct value *deref_val = NULL;
const int value_is_synthetic
- = value_bits_synthetic_pointer (original_value,
- TARGET_CHAR_BIT * embedded_offset,
- TARGET_CHAR_BIT * type->length ());
+ = original_value->bits_synthetic_pointer (TARGET_CHAR_BIT * embedded_offset,
+ TARGET_CHAR_BIT * type->length ());
const int must_coerce_ref = ((options->addressprint && value_is_synthetic)
|| options->deref_ref);
const int type_is_defined = elttype->code () != TYPE_CODE_UNDEF;
diff --git a/gdb/value.c b/gdb/value.c
index 6198fb8..75f8dc4 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1365,15 +1365,13 @@ mark_value_bits_optimized_out (struct value *value,
}
int
-value_bits_synthetic_pointer (const struct value *value,
- LONGEST offset, LONGEST length)
+value::bits_synthetic_pointer (LONGEST offset, LONGEST length) const
{
- if (value->m_lval != lval_computed
- || !value->m_location.computed.funcs->check_synthetic_pointer)
+ if (m_lval != lval_computed
+ || !m_location.computed.funcs->check_synthetic_pointer)
return 0;
- return value->m_location.computed.funcs->check_synthetic_pointer (value,
- offset,
- length);
+ return m_location.computed.funcs->check_synthetic_pointer (this, offset,
+ length);
}
const struct lval_funcs *
diff --git a/gdb/value.h b/gdb/value.h
index b025d67..5738584 100644
--- a/gdb/value.h
+++ b/gdb/value.h
@@ -455,6 +455,11 @@ public:
values. */
bool contents_eq (const struct value *val2) const;
+ /* Given a value, determine whether the bits starting at OFFSET and
+ extending for LENGTH bits are a synthetic pointer. */
+
+ int bits_synthetic_pointer (LONGEST offset, LONGEST length) const;
+
/* Type of value; either not an lval, or one of the various
different possible kinds of lval. */
@@ -862,12 +867,6 @@ extern struct value *coerce_ref (struct value *value);
extern struct value *coerce_array (struct value *value);
-/* Given a value, determine whether the bits starting at OFFSET and
- extending for LENGTH bits are a synthetic pointer. */
-
-extern int value_bits_synthetic_pointer (const struct value *value,
- LONGEST offset, LONGEST length);
-
/* Given a value, determine whether the contents bytes starting at
OFFSET and extending for LENGTH bytes are available. This returns
nonzero if all bytes in the given range are available, zero if any