gdb: introduce field::bitsize / field::set_bitsize

Add these two methods, rename the field to m_bitsize to make it pseudo
private.

Change-Id: Ief95e5cf106e72f2c22ae47b033d0fa47202b413
Approved-By: Tom Tromey <tom@tromey.com>
This commit is contained in:
Simon Marchi
2023-08-31 11:46:25 -04:00
committed by Simon Marchi
parent 454977cdc4
commit 886176b865
11 changed files with 60 additions and 51 deletions

View File

@@ -574,6 +574,16 @@ struct field
m_artificial = is_artificial;
}
unsigned int bitsize () const
{
return m_bitsize;
}
void set_bitsize (unsigned int bitsize)
{
m_bitsize = bitsize;
}
/* Return true if this field is static; false if not. */
bool is_static () const
{
@@ -672,7 +682,7 @@ struct field
For an unpacked field, the field's type's length
says how many bytes the field occupies. */
unsigned int bitsize : 28;
unsigned int m_bitsize : 28;
/* * In a struct or union type, type of this field.
- In a function or member type, type of this argument.
@@ -1070,8 +1080,8 @@ struct type
ULONGEST bit_stride () const
{
if (this->code () == TYPE_CODE_ARRAY && this->field (0).bitsize != 0)
return this->field (0).bitsize;
if (this->code () == TYPE_CODE_ARRAY && this->field (0).bitsize () != 0)
return this->field (0).bitsize ();
return this->bounds ()->bit_stride ();
}
@@ -1923,7 +1933,7 @@ extern void set_type_vptr_basetype (struct type *, struct type *);
(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits == NULL ? 0 \
: B_TST(TYPE_CPLUS_SPECIFIC(thistype)->virtual_field_bits, (index)))
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize)
#define FIELD_BITSIZE(thisfld) ((thisfld).bitsize ())
#define TYPE_FIELD_BITSIZE(thistype, n) FIELD_BITSIZE((thistype)->field (n))
#define TYPE_FIELD_PACKED(thistype, n) (FIELD_BITSIZE((thistype)->field (n))!=0)