Skip to content

Commit

Permalink
Merge pull request iovisor#1929 from iovisor/yhs_dev
Browse files Browse the repository at this point in the history
fix a rewriter bug for array subscript
  • Loading branch information
palmtenor authored Aug 15, 2018
2 parents 0284325 + eb7b586 commit ecfbc74
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/cc/frontends/clang/b_frontend_action.cc
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ bool ProbeVisitor::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
SourceLocation lbracket_start, lbracket_end;
SourceRange lbracket_range;
pre = "({ typeof(" + E->getType().getAsString() + ") _val; __builtin_memset(&_val, 0, sizeof(_val));";
pre += " bpf_probe_read(&_val, sizeof(_val), (u64)(";
pre += " bpf_probe_read(&_val, sizeof(_val), (u64)((";
if (isMemberDereference(base)) {
pre += "&";
// If the base of the array subscript is a member dereference, we'll rewrite
Expand All @@ -530,7 +530,7 @@ bool ProbeVisitor::VisitArraySubscriptExpr(ArraySubscriptExpr *E) {
lbracket_range = expansionRange(SourceRange(lbracket_start, lbracket_end));
rewriter_.ReplaceText(lbracket_range, lbracket);

rbracket = ")); _val; })";
rbracket = "))); _val; })";
rewriter_.ReplaceText(expansionLoc(E->getRBracketLoc()), 1, rbracket);

return true;
Expand Down

0 comments on commit ecfbc74

Please sign in to comment.