Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
bcc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
bcc
Commits
d727b409
Commit
d727b409
authored
Jun 11, 2018
by
4ast
Committed by
GitHub
Jun 11, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1808 from iovisor/yhs_dev2
adjust tracepoint field type based on size
parents
eaf4f07d
7c489469
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
44 additions
and
2 deletions
+44
-2
src/cc/frontends/clang/tp_frontend_action.cc
src/cc/frontends/clang/tp_frontend_action.cc
+44
-2
No files found.
src/cc/frontends/clang/tp_frontend_action.cc
View file @
d727b409
...
...
@@ -62,7 +62,15 @@ static inline field_kind_t _get_field_kind(string const& line,
if
(
field_pos
==
string
::
npos
)
return
field_kind_t
::
invalid
;
auto
semi_pos
=
line
.
find
(
';'
,
field_pos
);
auto
field_semi_pos
=
line
.
find
(
';'
,
field_pos
);
if
(
field_semi_pos
==
string
::
npos
)
return
field_kind_t
::
invalid
;
auto
offset_pos
=
line
.
find
(
"offset:"
,
field_semi_pos
);
if
(
offset_pos
==
string
::
npos
)
return
field_kind_t
::
invalid
;
auto
semi_pos
=
line
.
find
(
';'
,
offset_pos
);
if
(
semi_pos
==
string
::
npos
)
return
field_kind_t
::
invalid
;
...
...
@@ -70,8 +78,16 @@ static inline field_kind_t _get_field_kind(string const& line,
if
(
size_pos
==
string
::
npos
)
return
field_kind_t
::
invalid
;
semi_pos
=
line
.
find
(
';'
,
size_pos
);
if
(
semi_pos
==
string
::
npos
)
return
field_kind_t
::
invalid
;
auto
size_str
=
line
.
substr
(
size_pos
+
5
,
semi_pos
-
size_pos
-
5
);
int
size
=
std
::
stoi
(
size_str
,
nullptr
);
auto
field
=
line
.
substr
(
field_pos
+
6
/*"field:"*/
,
semi_pos
-
field_pos
-
6
);
field_
semi_pos
-
field_pos
-
6
);
auto
pos
=
field
.
find_last_of
(
"
\t
"
);
if
(
pos
==
string
::
npos
)
return
field_kind_t
::
invalid
;
...
...
@@ -83,6 +99,32 @@ static inline field_kind_t _get_field_kind(string const& line,
if
(
field_name
.
find
(
"common_"
)
==
0
)
return
field_kind_t
::
common
;
// adjust the field_type based on the size of field
// otherwise, incorrect value may be retrieved for big endian
// and the field may have incorrect structure offset.
if
(
size
==
2
)
{
if
(
field_type
==
"char"
||
field_type
==
"int8_t"
)
field_type
=
"s16"
;
if
(
field_type
==
"unsigned char"
||
field_type
==
"uint8_t"
)
field_type
=
"u16"
;
}
else
if
(
size
==
4
)
{
if
(
field_type
==
"char"
||
field_type
==
"short"
||
field_type
==
"int8_t"
||
field_type
==
"int16_t"
)
field_type
=
"s32"
;
if
(
field_type
==
"unsigned char"
||
field_type
==
"unsiggned short"
||
field_type
==
"uint8_t"
||
field_type
==
"uint16_t"
)
field_type
=
"u32"
;
}
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
=
"s64"
;
if
(
field_type
==
"unsigned char"
||
field_type
==
"unsiggned short"
||
field_type
==
"unsigned int"
||
field_type
==
"uint8_t"
||
field_type
==
"uint16_t"
||
field_type
==
"uint32_t"
)
field_type
=
"u64"
;
}
return
field_kind_t
::
regular
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment