Commit c2e2a26b authored by yonghong-song's avatar yonghong-song Committed by GitHub

fix a bug in tracepoint struct rewriter (#1856)

Fix issue #1853.

Commit 7c489469 ("adjust tracepoint field type
based on size") tried to fix the tracepoint format
descrepancy between declared type and actual size is 8.
The type has to be promoted to match the size.

The commit introduced a bug if the field is an array.
For exmaple, block:block_rq_complete tracepoint has
field rwbs:
  field:char rwbs[8];	offset:32;	size:8;	signed:1;

The current implementation will incorrectly translate it
into
  s64 rwbs[8];
since it considers the type is "char".

This patch fixed this issue by checking the field name
and if it is an array, rewriting will be skipped.
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
parent eba1483f
......@@ -98,6 +98,9 @@ static inline field_kind_t _get_field_kind(string const& line,
return field_kind_t::data_loc;
if (field_name.find("common_") == 0)
return field_kind_t::common;
// do not change type definition for array
if (field_name.find("[") != string::npos)
return field_kind_t::regular;
// adjust the field_type based on the size of field
// otherwise, incorrect value may be retrieved for big endian
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment