未验证 提交 c2e2a26b 编辑于 作者: yonghong-song's avatar yonghong-song 提交者: 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>
显示 3 个添加0 个删除
+3 -0
......@@ -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
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册