aboutsummaryrefslogtreecommitdiff
path: root/gdb/ax-gdb.c
diff options
context:
space:
mode:
authorSimon Marchi <simon.marchi@polymtl.ca>2022-09-21 11:05:21 -0400
committerSimon Marchi <simon.marchi@polymtl.ca>2022-09-21 11:05:21 -0400
commitdf86565b31bf12aab6fdceade49169bc6f378b13 (patch)
tree76d5944661919552ce4ea01ac49188e151d72fa7 /gdb/ax-gdb.c
parentb6cdbc9a8173b9e6cc8cfc284caa0efa8129ca02 (diff)
downloadgdb-df86565b31bf12aab6fdceade49169bc6f378b13.zip
gdb-df86565b31bf12aab6fdceade49169bc6f378b13.tar.gz
gdb-df86565b31bf12aab6fdceade49169bc6f378b13.tar.bz2
gdb: remove TYPE_LENGTH
Remove the macro, replace all uses with calls to type::length. Change-Id: Ib9bdc954576860b21190886534c99103d6a47afb
Diffstat (limited to 'gdb/ax-gdb.c')
-rw-r--r--gdb/ax-gdb.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 44a2f96..a52a5bf 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -221,7 +221,7 @@ gen_trace_static_fields (struct agent_expr *ax,
{
/* Initialize the TYPE_LENGTH if it is a typedef. */
check_typedef (value.type);
- ax_const_l (ax, TYPE_LENGTH (value.type));
+ ax_const_l (ax, value.type->length ());
ax_simple (ax, aop_trace);
}
break;
@@ -292,7 +292,7 @@ gen_traced_pop (struct agent_expr *ax, struct axs_value *value)
"const8 SIZE trace" is also three bytes, does the same
thing, and the simplest code which generates that will also
work correctly for objects with large sizes. */
- ax_const_l (ax, TYPE_LENGTH (value->type));
+ ax_const_l (ax, value->type->length ());
ax_simple (ax, aop_trace);
}
}
@@ -337,7 +337,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type)
{
/* Do we need to sign-extend this? */
if (!type->is_unsigned ())
- ax_ext (ax, TYPE_LENGTH (type) * TARGET_CHAR_BIT);
+ ax_ext (ax, type->length () * TARGET_CHAR_BIT);
}
@@ -347,7 +347,7 @@ gen_sign_extend (struct agent_expr *ax, struct type *type)
static void
gen_extend (struct agent_expr *ax, struct type *type)
{
- int bits = TYPE_LENGTH (type) * TARGET_CHAR_BIT;
+ int bits = type->length () * TARGET_CHAR_BIT;
/* I just had to. */
((type->is_unsigned () ? ax_zero_ext : ax_ext) (ax, bits));
@@ -363,7 +363,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
if (ax->tracing)
{
/* Record the area of memory we're about to fetch. */
- ax_trace_quick (ax, TYPE_LENGTH (type));
+ ax_trace_quick (ax, type->length ());
}
if (type->code () == TYPE_CODE_RANGE)
@@ -380,7 +380,7 @@ gen_fetch (struct agent_expr *ax, struct type *type)
case TYPE_CODE_BOOL:
/* It's a scalar value, so we know how to dereference it. How
many bytes long is it? */
- switch (TYPE_LENGTH (type))
+ switch (type->length ())
{
case 8 / TARGET_CHAR_BIT:
ax_simple (ax, aop_ref8);
@@ -761,8 +761,8 @@ gen_usual_unary (struct agent_expr *ax, struct axs_value *value)
static int
type_wider_than (struct type *type1, struct type *type2)
{
- return (TYPE_LENGTH (type1) > TYPE_LENGTH (type2)
- || (TYPE_LENGTH (type1) == TYPE_LENGTH (type2)
+ return (type1->length () > type2->length ()
+ || (type1->length () == type2->length ()
&& type1->is_unsigned ()
&& !type2->is_unsigned ()));
}
@@ -784,12 +784,12 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
/* If we're converting to a narrower type, then we need to clear out
the upper bits. */
- if (TYPE_LENGTH (to) < TYPE_LENGTH (from))
+ if (to->length () < from->length ())
gen_extend (ax, to);
/* If the two values have equal width, but different signednesses,
then we need to extend. */
- else if (TYPE_LENGTH (to) == TYPE_LENGTH (from))
+ else if (to->length () == from->length ())
{
if (from->is_unsigned () != to->is_unsigned ())
gen_extend (ax, to);
@@ -797,7 +797,7 @@ gen_conversion (struct agent_expr *ax, struct type *from, struct type *to)
/* If we're converting to a wider type, and becoming unsigned, then
we need to zero out any possible sign bits. */
- else if (TYPE_LENGTH (to) > TYPE_LENGTH (from))
+ else if (to->length () > from->length ())
{
if (to->is_unsigned ())
gen_extend (ax, to);
@@ -948,9 +948,9 @@ gen_scale (struct agent_expr *ax, enum agent_op op, struct type *type)
{
struct type *element = type->target_type ();
- if (TYPE_LENGTH (element) != 1)
+ if (element->length () != 1)
{
- ax_const_l (ax, TYPE_LENGTH (element));
+ ax_const_l (ax, element->length ());
ax_simple (ax, op);
}
}
@@ -997,8 +997,8 @@ gen_ptrdiff (struct agent_expr *ax, struct axs_value *value,
gdb_assert (value1->type->is_pointer_or_reference ());
gdb_assert (value2->type->is_pointer_or_reference ());
- if (TYPE_LENGTH (value1->type->target_type ())
- != TYPE_LENGTH (value2->type->target_type ()))
+ if (value1->type->target_type ()->length ()
+ != value2->type->target_type ()->length ())
error (_("\
First argument of `-' is a pointer, but second argument is neither\n\
an integer nor a pointer of the same type."));
@@ -1810,7 +1810,7 @@ unop_sizeof_operation::do_generate_ax (struct expression *exp,
/* Throw away the code we just generated. */
ax->len = start;
- ax_const_l (ax, TYPE_LENGTH (value->type));
+ ax_const_l (ax, value->type->length ());
value->kind = axs_rvalue;
value->type = builtin_type (ax->gdbarch)->builtin_int;
}