DWARF reader: use size_t for DWARF expression length cont.

A recent change broke 32-bit builds due to an implicit assumption that
size_t == uint64_t. Note that size_t is part of the elfutils
dwarf_getlocation* functions' types.

The previous fix omitted some instances of uint64_t. This commit
updates further functions to consistently use size_t for DWARF
expression lengths and indexes.

	* src/abg-dwarf-reader.cc (eval_last_constant_dwarf_sub_expr):
	Change expr_len argument type to size_t.
	(op_pushes_constant_value): Update ops_len and index argument
	types to size_t. Update next_index argument type to size_t&.
	(op_pushes_non_constant_value): Likewise.
	(op_is_arith_logic): Update expr_len and index argument types
	to size_t. Update next_index argument type to size_t&.
	(op_is_control_flow): Likewise.

Fixes: 16207c4af7 ("Bug 28191 - Interpret DWARF 5 addrx locations")
Signed-off-by: Giuliano Procida <gprocida@google.com>
Signed-off-by: Dodji Seketeli <dodji@redhat.com>
This commit is contained in:
Mark Wielaard 2022-01-18 11:56:45 +00:00 committed by Dodji Seketeli
parent 6e0d3f7278
commit e825cef6e0

View File

@ -363,7 +363,7 @@ die_is_at_class_scope(const read_context& ctxt,
Dwarf_Die& class_scope_die); Dwarf_Die& class_scope_die);
static bool static bool
eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr, eval_last_constant_dwarf_sub_expr(Dwarf_Op* expr,
uint64_t expr_len, size_t expr_len,
int64_t& value, int64_t& value,
bool& is_tls_address); bool& is_tls_address);
@ -7732,9 +7732,9 @@ die_location_expr(const Dwarf_Die* die,
/// value onto the DEVM stack, false otherwise. /// value onto the DEVM stack, false otherwise.
static bool static bool
op_pushes_constant_value(Dwarf_Op* ops, op_pushes_constant_value(Dwarf_Op* ops,
uint64_t ops_len, size_t ops_len,
uint64_t index, size_t index,
uint64_t& next_index, size_t& next_index,
dwarf_expr_eval_context& ctxt) dwarf_expr_eval_context& ctxt)
{ {
ABG_ASSERT(index < ops_len); ABG_ASSERT(index < ops_len);
@ -7896,9 +7896,9 @@ op_pushes_constant_value(Dwarf_Op* ops,
/// non-constant value onto the DEVM stack, false otherwise. /// non-constant value onto the DEVM stack, false otherwise.
static bool static bool
op_pushes_non_constant_value(Dwarf_Op* ops, op_pushes_non_constant_value(Dwarf_Op* ops,
uint64_t ops_len, size_t ops_len,
uint64_t index, size_t index,
uint64_t& next_index, size_t& next_index,
dwarf_expr_eval_context& ctxt) dwarf_expr_eval_context& ctxt)
{ {
ABG_ASSERT(index < ops_len); ABG_ASSERT(index < ops_len);
@ -8146,9 +8146,9 @@ op_manipulates_stack(Dwarf_Op* expr,
/// arithmetic or logic operation. /// arithmetic or logic operation.
static bool static bool
op_is_arith_logic(Dwarf_Op* expr, op_is_arith_logic(Dwarf_Op* expr,
uint64_t expr_len, size_t expr_len,
uint64_t index, size_t index,
uint64_t& next_index, size_t& next_index,
dwarf_expr_eval_context& ctxt) dwarf_expr_eval_context& ctxt)
{ {
ABG_ASSERT(index < expr_len); ABG_ASSERT(index < expr_len);
@ -8279,9 +8279,9 @@ op_is_arith_logic(Dwarf_Op* expr,
/// control flow operation, false otherwise. /// control flow operation, false otherwise.
static bool static bool
op_is_control_flow(Dwarf_Op* expr, op_is_control_flow(Dwarf_Op* expr,
uint64_t expr_len, size_t expr_len,
uint64_t index, size_t index,
uint64_t& next_index, size_t& next_index,
dwarf_expr_eval_context& ctxt) dwarf_expr_eval_context& ctxt)
{ {
ABG_ASSERT(index < expr_len); ABG_ASSERT(index < expr_len);