Commit 0ac26e8b authored by Brenden Blanco's avatar Brenden Blanco

Fix breakage in bpf_probe_read from #196

Argument needs to be cast to u64, otherwise it is adding a whole pointer
stride.
Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent 78823a8e
......@@ -277,7 +277,7 @@ bool BTypeVisitor::VisitMemberExpr(MemberExpr *E) {
string base_type = Ref->getType()->getPointeeType().getAsString();
string pre, post;
pre = "({ " + E->getType().getAsString() + " _val; memset(&_val, 0, sizeof(_val));";
pre += " bpf_probe_read(&_val, sizeof(_val), ";
pre += " bpf_probe_read(&_val, sizeof(_val), (u64)";
post = " + offsetof(" + base_type + ", " + F->getName().str() + ")";
post += "); _val; })";
rewriter_.InsertText(E->getLocStart(), pre);
......
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