Commit 0e02fec8 authored by Yonghong Song's avatar Yonghong Song

correct certain tracepoint types in tp frontend action

Fix issue #2010.

Alastair reported some missing cases in tp frontend action
where certain types are not adjusted.
For example, for tracepoint syscalls:sys_enter_kill,
the kernel format:
        ...
        field:int __syscall_nr; offset:8;       size:4; signed:1;
        field:pid_t pid;        offset:16;      size:8; signed:0;
        field:int sig;  offset:24;      size:8; signed:0;

The size for "pid_t pid" is 8 bytes, but the kernel pid_t
is "int", so it is needed to change its type to "s64"
to be consistent to its size.

This patch also added conversion for gid_t and uid_t as Alastair
discovered that they are also used in some tracepoints with size 8.
For type gid_t and uid_t, the corresponding kernel type is "unsigned int",
so it should be converted to "u64".
Signed-off-by: default avatarYonghong Song <yhs@fb.com>
parent f3fc87aa
......@@ -121,11 +121,13 @@ static inline field_kind_t _get_field_kind(string const& line,
} else if (size == 8) {
if (field_type == "char" || field_type == "short" || field_type == "int" ||
field_type == "int8_t" || field_type == "int16_t" ||
field_type == "int32_t")
field_type == "int32_t" || field_type == "pid_t")
field_type = "s64";
if (field_type == "unsigned char" || field_type == "unsigned short" ||
field_type == "unsigned int" || field_type == "uint8_t" ||
field_type == "uint16_t" || field_type == "uint32_t")
field_type == "uint16_t" || field_type == "uint32_t" ||
field_type == "unsigned" || field_type == "u32" ||
field_type == "uid_t" || field_type == "gid_t")
field_type = "u64";
}
......
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