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
f29cced9
Commit
f29cced9
authored
Sep 16, 2015
by
4ast
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #221 from iovisor/bblanco_dev
Fix probe reads on char[] types
parents
2d75aa0d
9518e747
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
src/cc/frontends/clang/b_frontend_action.cc
src/cc/frontends/clang/b_frontend_action.cc
+1
-1
tests/cc/test_clang.py
tests/cc/test_clang.py
+7
-0
No files found.
src/cc/frontends/clang/b_frontend_action.cc
View file @
f29cced9
...
...
@@ -304,7 +304,7 @@ bool BTypeVisitor::VisitMemberExpr(MemberExpr *E) {
string
rhs
=
rewriter_
.
getRewrittenText
(
SourceRange
(
rhs_start
,
E
->
getLocEnd
()));
string
base_type
=
base
->
getType
()
->
getPointeeType
().
getAsString
();
string
pre
,
post
;
pre
=
"({
"
+
E
->
getType
().
getAsString
()
+
"
_val; memset(&_val, 0, sizeof(_val));"
;
pre
=
"({
typeof("
+
E
->
getType
().
getAsString
()
+
")
_val; memset(&_val, 0, sizeof(_val));"
;
pre
+=
" bpf_probe_read(&_val, sizeof(_val), (u64)"
;
post
=
" + offsetof("
+
base_type
+
", "
+
rhs
+
")"
;
post
+=
"); _val; })"
;
...
...
tests/cc/test_clang.py
View file @
f29cced9
...
...
@@ -165,5 +165,12 @@ int trace_entry(struct pt_regs *ctx, struct file *file) {
b
=
BPF
(
text
=
text
,
debug
=
0
)
fn
=
b
.
load_func
(
"trace_entry"
,
BPF
.
KPROBE
)
def
test_char_array_probe
(
self
):
BPF
(
text
=
"""#include <linux/blkdev.h>
int kprobe__blk_update_request(struct pt_regs *ctx, struct request *req) {
bpf_trace_printk("%s
\
\
n", req->rq_disk->disk_name);
return 0;
}"""
)
if
__name__
==
"__main__"
:
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