ret == DW_ATE_signed_fixed);
}
-static int die_get_byte_size(Dwarf_Die *tp_die)
-{
- Dwarf_Word ret;
-
- if (die_get_attr_udata(tp_die, DW_AT_byte_size, &ret))
- return 0;
-
- return (int)ret;
-}
-
-static int die_get_bit_size(Dwarf_Die *tp_die)
-{
- Dwarf_Word ret;
-
- if (die_get_attr_udata(tp_die, DW_AT_bit_size, &ret))
- return 0;
-
- return (int)ret;
-}
-
-static int die_get_bit_offset(Dwarf_Die *tp_die)
-{
- Dwarf_Word ret;
-
- if (die_get_attr_udata(tp_die, DW_AT_bit_offset, &ret))
- return 0;
-
- return (int)ret;
-}
-
/* Get data_member_location offset */
static int die_get_data_member_location(Dwarf_Die *mb_die, Dwarf_Word *offs)
{
struct probe_trace_arg_ref **ref_ptr = &tvar->ref;
Dwarf_Die type;
char buf[16];
+ int bsize, boffs, total;
int ret;
/* TODO: check all types */
return (tvar->type == NULL) ? -ENOMEM : 0;
}
- if (die_get_bit_size(vr_die) != 0) {
+ bsize = dwarf_bitsize(vr_die);
+ if (bsize > 0) {
/* This is a bitfield */
- ret = snprintf(buf, 16, "b%d@%d/%zd", die_get_bit_size(vr_die),
- die_get_bit_offset(vr_die),
- BYTES_TO_BITS(die_get_byte_size(vr_die)));
+ boffs = dwarf_bitoffset(vr_die);
+ total = dwarf_bytesize(vr_die);
+ if (boffs < 0 || total < 0)
+ return -ENOENT;
+ ret = snprintf(buf, 16, "b%d@%d/%zd", bsize, boffs,
+ BYTES_TO_BITS(total));
goto formatted;
}
return (tvar->type == NULL) ? -ENOMEM : 0;
}
- ret = BYTES_TO_BITS(die_get_byte_size(&type));
- if (!ret)
+ ret = dwarf_bytesize(&type);
+ if (ret <= 0)
/* No size ... try to use default type */
return 0;
+ ret = BYTES_TO_BITS(ret);
/* Check the bitwidth */
if (ret > MAX_BASIC_TYPE_BITS) {
else
*ref_ptr = ref;
}
- ref->offset += die_get_byte_size(&type) * field->index;
+ ref->offset += dwarf_bytesize(&type) * field->index;
if (!field->next)
/* Save vr_die for converting types */
memcpy(die_mem, vr_die, sizeof(*die_mem));