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
e5db52bf
Commit
e5db52bf
authored
Dec 12, 2017
by
4ast
Committed by
GitHub
Dec 12, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1484 from iovisor/yhs_dev
add padding to the end of structure
parents
b384b76e
b32b4a5f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
2 deletions
+10
-2
src/cc/json_map_decl_visitor.cc
src/cc/json_map_decl_visitor.cc
+7
-0
tests/python/test_clang.py
tests/python/test_clang.py
+3
-2
No files found.
src/cc/json_map_decl_visitor.cc
View file @
e5db52bf
...
...
@@ -145,6 +145,13 @@ bool BMapDeclVisitor::VisitRecordDecl(RecordDecl *D) {
Offset
=
FieldOffset
+
FieldSize
;
genJSONForField
(
F
);
}
/* Additional Padding after the last field so that the Record Size matches */
CharUnits
RecordSize
=
Layout
.
getSize
();
if
(
RecordSize
>
Offset
)
{
result_
+=
"[
\"
__pad_end
\"
,
\"
char
\"
,["
+
to_string
((
RecordSize
-
Offset
).
getQuantity
())
+
"]], "
;
}
}
if
(
!
D
->
getDefinition
()
->
field_empty
())
...
...
tests/python/test_clang.py
View file @
e5db52bf
...
...
@@ -685,6 +685,7 @@ struct key_t {
};
u8 f1_3; /* offset 48 */
unsigned __int128 f1_4; /* offset 64 */
char f1_5; /* offset 80 */
};
struct value_t {
u8 src[4] __attribute__ ((aligned (8))); /* offset 0 */
...
...
@@ -694,8 +695,8 @@ BPF_HASH(table1, struct key_t, struct value_t);
"""
b
=
BPF
(
text
=
text
)
table
=
b
[
'table1'
]
self
.
assertEqual
(
ct
.
sizeof
(
table
.
Key
),
80
)
self
.
assertEqual
(
ct
.
sizeof
(
table
.
Leaf
),
1
2
)
self
.
assertEqual
(
ct
.
sizeof
(
table
.
Key
),
96
)
self
.
assertEqual
(
ct
.
sizeof
(
table
.
Leaf
),
1
6
)
if
__name__
==
"__main__"
:
...
...
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