diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2011-06-27 03:27:21 -0400 |
---|---|---|
committer | Steven Rostedt <rostedt@goodmis.org> | 2011-07-15 16:04:47 -0400 |
commit | bcfc082150c6b1e9443c1277bca8be80094150b5 (patch) | |
tree | fcb522f8c9bd2ab926065cfb9799defbddb4353b /tools | |
parent | bad03ae476214d9d66bb96be02b630385936f788 (diff) |
perf probe: Remove redundant dwarf functions
Since there are dwarf_bitsize, dwarf_bitoffset and dwarf_bytesize
defined in libdw, we don't need die_get_bit_size, die_get_bit_offset
and die_get_byte_size anymore.
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Arnaldo Carvalho de Melo <acme@ghostprotocols.net>
Link: http://lkml.kernel.org/r/20110627072721.6528.2747.stgit@fedora15
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/probe-finder.c | 50 |
1 files changed, 13 insertions, 37 deletions
diff --git a/tools/perf/util/probe-finder.c b/tools/perf/util/probe-finder.c index 459ebe8b04f3..d443b643957f 100644 --- a/tools/perf/util/probe-finder.c +++ b/tools/perf/util/probe-finder.c | |||
@@ -361,36 +361,6 @@ static bool die_is_signed_type(Dwarf_Die *tp_die) | |||
361 | ret == DW_ATE_signed_fixed); | 361 | ret == DW_ATE_signed_fixed); |
362 | } | 362 | } |
363 | 363 | ||
364 | static int die_get_byte_size(Dwarf_Die *tp_die) | ||
365 | { | ||
366 | Dwarf_Word ret; | ||
367 | |||
368 | if (die_get_attr_udata(tp_die, DW_AT_byte_size, &ret)) | ||
369 | return 0; | ||
370 | |||
371 | return (int)ret; | ||
372 | } | ||
373 | |||
374 | static int die_get_bit_size(Dwarf_Die *tp_die) | ||
375 | { | ||
376 | Dwarf_Word ret; | ||
377 | |||
378 | if (die_get_attr_udata(tp_die, DW_AT_bit_size, &ret)) | ||
379 | return 0; | ||
380 | |||
381 | return (int)ret; | ||
382 | } | ||
383 | |||
384 | static int die_get_bit_offset(Dwarf_Die *tp_die) | ||
385 | { | ||
386 | Dwarf_Word ret; | ||
387 | |||
388 | if (die_get_attr_udata(tp_die, DW_AT_bit_offset, &ret)) | ||
389 | return 0; | ||
390 | |||
391 | return (int)ret; | ||
392 | } | ||
393 | |||
394 | /* Get data_member_location offset */ | 364 | /* Get data_member_location offset */ |
395 | static int die_get_data_member_location(Dwarf_Die *mb_die, Dwarf_Word *offs) | 365 | static int die_get_data_member_location(Dwarf_Die *mb_die, Dwarf_Word *offs) |
396 | { | 366 | { |
@@ -882,6 +852,7 @@ static int convert_variable_type(Dwarf_Die *vr_die, | |||
882 | struct probe_trace_arg_ref **ref_ptr = &tvar->ref; | 852 | struct probe_trace_arg_ref **ref_ptr = &tvar->ref; |
883 | Dwarf_Die type; | 853 | Dwarf_Die type; |
884 | char buf[16]; | 854 | char buf[16]; |
855 | int bsize, boffs, total; | ||
885 | int ret; | 856 | int ret; |
886 | 857 | ||
887 | /* TODO: check all types */ | 858 | /* TODO: check all types */ |
@@ -891,11 +862,15 @@ static int convert_variable_type(Dwarf_Die *vr_die, | |||
891 | return (tvar->type == NULL) ? -ENOMEM : 0; | 862 | return (tvar->type == NULL) ? -ENOMEM : 0; |
892 | } | 863 | } |
893 | 864 | ||
894 | if (die_get_bit_size(vr_die) != 0) { | 865 | bsize = dwarf_bitsize(vr_die); |
866 | if (bsize > 0) { | ||
895 | /* This is a bitfield */ | 867 | /* This is a bitfield */ |
896 | ret = snprintf(buf, 16, "b%d@%d/%zd", die_get_bit_size(vr_die), | 868 | boffs = dwarf_bitoffset(vr_die); |
897 | die_get_bit_offset(vr_die), | 869 | total = dwarf_bytesize(vr_die); |
898 | BYTES_TO_BITS(die_get_byte_size(vr_die))); | 870 | if (boffs < 0 || total < 0) |
871 | return -ENOENT; | ||
872 | ret = snprintf(buf, 16, "b%d@%d/%zd", bsize, boffs, | ||
873 | BYTES_TO_BITS(total)); | ||
899 | goto formatted; | 874 | goto formatted; |
900 | } | 875 | } |
901 | 876 | ||
@@ -943,10 +918,11 @@ static int convert_variable_type(Dwarf_Die *vr_die, | |||
943 | return (tvar->type == NULL) ? -ENOMEM : 0; | 918 | return (tvar->type == NULL) ? -ENOMEM : 0; |
944 | } | 919 | } |
945 | 920 | ||
946 | ret = BYTES_TO_BITS(die_get_byte_size(&type)); | 921 | ret = dwarf_bytesize(&type); |
947 | if (!ret) | 922 | if (ret <= 0) |
948 | /* No size ... try to use default type */ | 923 | /* No size ... try to use default type */ |
949 | return 0; | 924 | return 0; |
925 | ret = BYTES_TO_BITS(ret); | ||
950 | 926 | ||
951 | /* Check the bitwidth */ | 927 | /* Check the bitwidth */ |
952 | if (ret > MAX_BASIC_TYPE_BITS) { | 928 | if (ret > MAX_BASIC_TYPE_BITS) { |
@@ -1010,7 +986,7 @@ static int convert_variable_fields(Dwarf_Die *vr_die, const char *varname, | |||
1010 | else | 986 | else |
1011 | *ref_ptr = ref; | 987 | *ref_ptr = ref; |
1012 | } | 988 | } |
1013 | ref->offset += die_get_byte_size(&type) * field->index; | 989 | ref->offset += dwarf_bytesize(&type) * field->index; |
1014 | if (!field->next) | 990 | if (!field->next) |
1015 | /* Save vr_die for converting types */ | 991 | /* Save vr_die for converting types */ |
1016 | memcpy(die_mem, vr_die, sizeof(*die_mem)); | 992 | memcpy(die_mem, vr_die, sizeof(*die_mem)); |