Skip to content

Commit a18d8bb

Browse files
amscannejordalgo
authored andcommitted
Support fn keyword for external names
Fixes bpftrace#3177 This change adds `fn` to the list of external names that may be used to index structures, etc. I had originally considered allowing `fn` (and `config`) arbitrarily as an identifier within the body of a probe (esentially extending `ident` to include CONFIG and SUBPROG within the parser, and limiting `attach_point_def` accordingly), but since there is already a strong split between internal and external identifiers, I went with the simpler proposed solution.
1 parent df2445d commit a18d8bb

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/parser.yy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -650,6 +650,7 @@ keyword:
650650
| SIZEOF { $$ = $1; }
651651
| UNROLL { $$ = $1; }
652652
| WHILE { $$ = $1; }
653+
| SUBPROG { $$ = $1; }
653654
;
654655

655656
ident:

tests/semantic_analyser.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3104,6 +3104,8 @@ TEST(semantic_analyser, struct_member_keywords)
31043104
"raw",
31053105
"uprobe",
31063106
"kprobe",
3107+
"config",
3108+
"fn",
31073109
};
31083110
for (auto kw : keywords) {
31093111
test("struct S{ int " + kw + ";}; k:f { ((struct S*)arg0)->" + kw + "}");

0 commit comments

Comments
 (0)