Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 257135
b: refs/heads/master
c: bcfc082
h: refs/heads/master
i:
  257133: a992bdb
  257131: f98750a
  257127: a6b9357
  257119: adf5456
v: v3
  • Loading branch information
Masami Hiramatsu authored and Steven Rostedt committed Jul 15, 2011
1 parent 47de5d5 commit 623e744
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 38 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: bad03ae476214d9d66bb96be02b630385936f788
refs/heads/master: bcfc082150c6b1e9443c1277bca8be80094150b5
50 changes: 13 additions & 37 deletions trunk/tools/perf/util/probe-finder.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,36 +361,6 @@ static bool die_is_signed_type(Dwarf_Die *tp_die)
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)
{
Expand Down Expand Up @@ -882,6 +852,7 @@ static int convert_variable_type(Dwarf_Die *vr_die,
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 */
Expand All @@ -891,11 +862,15 @@ static int convert_variable_type(Dwarf_Die *vr_die,
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;
}

Expand Down Expand Up @@ -943,10 +918,11 @@ static int convert_variable_type(Dwarf_Die *vr_die,
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) {
Expand Down Expand Up @@ -1010,7 +986,7 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname,
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));
Expand Down

0 comments on commit 623e744

Please sign in to comment.