Commit f0617f52 authored by Adrian Hunter's avatar Adrian Hunter Committed by Arnaldo Carvalho de Melo

perf parse: Allow config terms with breakpoints

Add config terms to the parsing of breakpoint events. Extend "Test event
parsing" to also cover using a confg term.

This makes breakpoint events consistent with other events which already
support config terms.

Example:

  $ cat dr_test.c
  #include <unistd.h>
  #include <stdio.h>

  void func0(void)
  {
  }

  int main()
  {
          printf("func0 %p\n", &func0);
          while (1) {
                  func0();
                  usleep(100000);
          }
          return 0;
  }
  $ gcc -g -O0 -o dr_test dr_test.c
  $ ./dr_test &
  [2] 19646
  func0 0x55feb98dd169
  $ perf record -e mem:0x55feb98dd169:x/name=breakpoint/ -p 19646 -- sleep 0.5
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.017 MB perf.data (5 samples) ]
  $ perf script
      dr_test 19646  5632.956628:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
      dr_test 19646  5633.056866:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
      dr_test 19646  5633.157084:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
      dr_test 19646  5633.257309:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
      dr_test 19646  5633.357532:          1 breakpoint:      55feb98dd169 func0+0x0 (/home/ahunter/git/work/dr_test)
  $ sudo perf test "Test event parsing"
    6: Parse event definition strings                                  :
    6.1: Test event parsing                                            : Ok
  $ sudo perf test -v "Test event parsing" |& grep mem
  running test 8 'mem:0'
  running test 9 'mem:0:x'
  running test 10 'mem:0:r'
  running test 11 'mem:0:w'
  running test 19 'mem:0:u'
  running test 20 'mem:0:x:k'
  running test 21 'mem:0:r:hp'
  running test 22 'mem:0:w:up'
  running test 26 'mem:0:rw'
  running test 27 'mem:0:rw:kp'
  running test 42 'mem:0/1'
  running test 43 'mem:0/2:w'
  running test 44 'mem:0/4:rw:u'
  running test 58 'mem:0/name=breakpoint/'
  running test 59 'mem:0:x/name=breakpoint/'
  running test 60 'mem:0:r/name=breakpoint/'
  running test 61 'mem:0:w/name=breakpoint/'
  running test 62 'mem:0/name=breakpoint/u'
  running test 63 'mem:0:x/name=breakpoint/k'
  running test 64 'mem:0:r/name=breakpoint/hp'
  running test 65 'mem:0:w/name=breakpoint/up'
  running test 66 'mem:0:rw/name=breakpoint/'
  running test 67 'mem:0:rw/name=breakpoint/kp'
  running test 68 'mem:0/1/name=breakpoint/'
  running test 69 'mem:0/2:w/name=breakpoint/'
  running test 70 'mem:0/4:rw/name=breakpoint/u'
  running test 71 'mem:0/1/name=breakpoint1/,mem:0/4:rw/name=breakpoint2/'

Committer notes:

Folded follow up patch (see 2nd link below) to address warnings about
unused tokens:

perf tools: Suppress bison unused value warnings

Patch "perf tools: Allow config terms with breakpoints" introduced parse
tokens for colons and slashes within breakpoint parsing to prevent mix
up with colons and slashes related to config terms.

The token values are not needed but introduce bison "unused value"
warnings.

Suppress those warnings.

Committer testing:

  # cat ~acme/c/mem_breakpoint.c
  #include <stdio.h>
  #include <unistd.h>

  void func1(void) { }
  void func2(void) { }
  void func3(void) { }
  void func4(void) { }
  void func5(void) { }

  int main()
  {
  	printf("func1 %p\n", &func1);
  	printf("func2 %p\n", &func2);
  	printf("func3 %p\n", &func3);
  	printf("func4 %p\n", &func4);
  	printf("func5 %p\n", &func5);
  	while (1) {
  		func1(); func2(); func3(); func4(); func5();
  		usleep(100000);
  	}
  	return 0;
  }

  # ~acme/c/mem_breakpoint &
  [1] 3186153
  func1 0x401136
  func2 0x40113d
  func3 0x401144
  func4 0x40114b
  func5 0x401152
  #

Trying to watch the first 4 functions for eXecutable access:

  # perf record -e mem:0x401136:x/name=breakpoint1/,mem:0x40113d:x/name=breakpoint2/,mem:0x401144:x/name=breakpoint3/,mem:0x40114b:x/name=breakpoint4/  -p 3186153 -- sleep 0.5
  [ perf record: Woken up 1 times to write data ]
  [ perf record: Captured and wrote 0.026 MB perf.data (20 samples) ]
  [root@five ~]# perf script
    mem_breakpoint 3186153 131612.864793:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131612.864795:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131612.864796:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131612.864797:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131612.964868:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131612.964870:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131612.964871:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131612.964872:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.064945:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.064948:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.064948:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.064949:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.165024:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.165026:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.165027:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.165028:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.265103:  1 breakpoint1:  401136 func1+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.265105:  1 breakpoint2:  40113d func2+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.265106:  1 breakpoint3:  401144 func3+0x0 (/var/home/acme/c/mem_breakpoint)
    mem_breakpoint 3186153 131613.265107:  1 breakpoint4:  40114b func4+0x0 (/var/home/acme/c/mem_breakpoint)
  #

Then all the 5 functions:

  # perf record -e mem:0x401136:x/name=breakpoint1/,mem:0x40113d:x/name=breakpoint2/,mem:0x401144:x/name=breakpoint3/,mem:0x40114b:x/name=breakpoint4/,mem:0x401152:x/name=breakpoint5/ -p 3186153 -- sleep 0.5
  Error:
  The sys_perf_event_open() syscall returned with 28 (No space left on device) for event (breakpoint5).
  /bin/dmesg | grep -i perf may provide additional information.

  # grep -m1 'model name' /proc/cpuinfo
  model name	: AMD Ryzen 9 5950X 16-Core Processor
  #
Reviewed-by: default avatarIan Rogers <irogers@google.com>
Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20230525082902.25332-2-adrian.hunter@intel.com
Link: https://lore.kernel.org/r/f7228dc9-fe18-a8e3-7d3f-52922e0e1113@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 36d3e413
...@@ -486,6 +486,93 @@ static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist) ...@@ -486,6 +486,93 @@ static int test__checkevent_breakpoint_rw_modifier(struct evlist *evlist)
return test__checkevent_breakpoint_rw(evlist); return test__checkevent_breakpoint_rw(evlist);
} }
static int test__checkevent_breakpoint_modifier_name(struct evlist *evlist)
{
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
TEST_ASSERT_VAL("wrong name",
!strcmp(evsel__name(evsel), "breakpoint"));
return test__checkevent_breakpoint(evlist);
}
static int test__checkevent_breakpoint_x_modifier_name(struct evlist *evlist)
{
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", !evsel->core.attr.precise_ip);
TEST_ASSERT_VAL("wrong name",
!strcmp(evsel__name(evsel), "breakpoint"));
return test__checkevent_breakpoint_x(evlist);
}
static int test__checkevent_breakpoint_r_modifier_name(struct evlist *evlist)
{
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", !evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
TEST_ASSERT_VAL("wrong name",
!strcmp(evsel__name(evsel), "breakpoint"));
return test__checkevent_breakpoint_r(evlist);
}
static int test__checkevent_breakpoint_w_modifier_name(struct evlist *evlist)
{
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong exclude_user", !evsel->core.attr.exclude_user);
TEST_ASSERT_VAL("wrong exclude_kernel", evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
TEST_ASSERT_VAL("wrong name",
!strcmp(evsel__name(evsel), "breakpoint"));
return test__checkevent_breakpoint_w(evlist);
}
static int test__checkevent_breakpoint_rw_modifier_name(struct evlist *evlist)
{
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong exclude_user", evsel->core.attr.exclude_user);
TEST_ASSERT_VAL("wrong exclude_kernel", !evsel->core.attr.exclude_kernel);
TEST_ASSERT_VAL("wrong exclude_hv", evsel->core.attr.exclude_hv);
TEST_ASSERT_VAL("wrong precise_ip", evsel->core.attr.precise_ip);
TEST_ASSERT_VAL("wrong name",
!strcmp(evsel__name(evsel), "breakpoint"));
return test__checkevent_breakpoint_rw(evlist);
}
static int test__checkevent_breakpoint_2_events(struct evlist *evlist)
{
struct evsel *evsel = evlist__first(evlist);
TEST_ASSERT_VAL("wrong number of entries", 2 == evlist->core.nr_entries);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "breakpoint1"));
evsel = evsel__next(evsel);
TEST_ASSERT_VAL("wrong type", PERF_TYPE_BREAKPOINT == evsel->core.attr.type);
TEST_ASSERT_VAL("wrong name", !strcmp(evsel__name(evsel), "breakpoint2"));
return TEST_OK;
}
static int test__checkevent_pmu(struct evlist *evlist) static int test__checkevent_pmu(struct evlist *evlist)
{ {
...@@ -1973,6 +2060,76 @@ static const struct evlist_test test__events[] = { ...@@ -1973,6 +2060,76 @@ static const struct evlist_test test__events[] = {
.check = test__term_equal_legacy, .check = test__term_equal_legacy,
/* 9 */ /* 9 */
}, },
{
.name = "mem:0/name=breakpoint/",
.check = test__checkevent_breakpoint,
/* 0 */
},
{
.name = "mem:0:x/name=breakpoint/",
.check = test__checkevent_breakpoint_x,
/* 1 */
},
{
.name = "mem:0:r/name=breakpoint/",
.check = test__checkevent_breakpoint_r,
/* 2 */
},
{
.name = "mem:0:w/name=breakpoint/",
.check = test__checkevent_breakpoint_w,
/* 3 */
},
{
.name = "mem:0/name=breakpoint/u",
.check = test__checkevent_breakpoint_modifier_name,
/* 4 */
},
{
.name = "mem:0:x/name=breakpoint/k",
.check = test__checkevent_breakpoint_x_modifier_name,
/* 5 */
},
{
.name = "mem:0:r/name=breakpoint/hp",
.check = test__checkevent_breakpoint_r_modifier_name,
/* 6 */
},
{
.name = "mem:0:w/name=breakpoint/up",
.check = test__checkevent_breakpoint_w_modifier_name,
/* 7 */
},
{
.name = "mem:0:rw/name=breakpoint/",
.check = test__checkevent_breakpoint_rw,
/* 8 */
},
{
.name = "mem:0:rw/name=breakpoint/kp",
.check = test__checkevent_breakpoint_rw_modifier_name,
/* 9 */
},
{
.name = "mem:0/1/name=breakpoint/",
.check = test__checkevent_breakpoint_len,
/* 0 */
},
{
.name = "mem:0/2:w/name=breakpoint/",
.check = test__checkevent_breakpoint_len_w,
/* 1 */
},
{
.name = "mem:0/4:rw/name=breakpoint/u",
.check = test__checkevent_breakpoint_len_rw_modifier,
/* 2 */
},
{
.name = "mem:0/1/name=breakpoint1/,mem:0/4:rw/name=breakpoint2/",
.check = test__checkevent_breakpoint_2_events,
/* 3 */
},
}; };
static const struct evlist_test test__events_pmu[] = { static const struct evlist_test test__events_pmu[] = {
......
...@@ -946,10 +946,14 @@ do { \ ...@@ -946,10 +946,14 @@ do { \
return 0; return 0;
} }
int parse_events_add_breakpoint(struct list_head *list, int *idx, int parse_events_add_breakpoint(struct parse_events_state *parse_state,
u64 addr, char *type, u64 len) struct list_head *list,
u64 addr, char *type, u64 len,
struct list_head *head_config __maybe_unused)
{ {
struct perf_event_attr attr; struct perf_event_attr attr;
LIST_HEAD(config_terms);
const char *name;
memset(&attr, 0, sizeof(attr)); memset(&attr, 0, sizeof(attr));
attr.bp_addr = addr; attr.bp_addr = addr;
...@@ -970,8 +974,19 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx, ...@@ -970,8 +974,19 @@ int parse_events_add_breakpoint(struct list_head *list, int *idx,
attr.type = PERF_TYPE_BREAKPOINT; attr.type = PERF_TYPE_BREAKPOINT;
attr.sample_period = 1; attr.sample_period = 1;
return add_event(list, idx, &attr, /*name=*/NULL, /*mertic_id=*/NULL, if (head_config) {
/*config_terms=*/NULL); if (config_attr(&attr, head_config, parse_state->error,
config_term_common))
return -EINVAL;
if (get_config_terms(head_config, &config_terms))
return -ENOMEM;
}
name = get_config_name(head_config);
return add_event(list, &parse_state->idx, &attr, name, /*mertic_id=*/NULL,
&config_terms);
} }
static int check_type_val(struct parse_events_term *term, static int check_type_val(struct parse_events_term *term,
......
...@@ -185,8 +185,10 @@ int parse_events_add_cache(struct list_head *list, int *idx, const char *name, ...@@ -185,8 +185,10 @@ int parse_events_add_cache(struct list_head *list, int *idx, const char *name,
struct parse_events_state *parse_state, struct parse_events_state *parse_state,
struct list_head *head_config); struct list_head *head_config);
int parse_events__decode_legacy_cache(const char *name, int pmu_type, __u64 *config); int parse_events__decode_legacy_cache(const char *name, int pmu_type, __u64 *config);
int parse_events_add_breakpoint(struct list_head *list, int *idx, int parse_events_add_breakpoint(struct parse_events_state *parse_state,
u64 addr, char *type, u64 len); struct list_head *list,
u64 addr, char *type, u64 len,
struct list_head *head_config);
int parse_events_add_pmu(struct parse_events_state *parse_state, int parse_events_add_pmu(struct parse_events_state *parse_state,
struct list_head *list, char *name, struct list_head *list, char *name,
struct list_head *head_config, struct list_head *head_config,
...@@ -226,6 +228,10 @@ void parse_events_error__handle(struct parse_events_error *err, int idx, ...@@ -226,6 +228,10 @@ void parse_events_error__handle(struct parse_events_error *err, int idx,
void parse_events_error__print(struct parse_events_error *err, void parse_events_error__print(struct parse_events_error *err,
const char *event); const char *event);
static inline void parse_events_unused_value(const void *x __maybe_unused)
{
}
#ifdef HAVE_LIBELF_SUPPORT #ifdef HAVE_LIBELF_SUPPORT
/* /*
* If the probe point starts with '%', * If the probe point starts with '%',
......
...@@ -190,11 +190,16 @@ name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]!\-]* ...@@ -190,11 +190,16 @@ name [a-zA-Z_*?\[\]][a-zA-Z0-9_*?.\[\]!\-]*
name_tag [\'][a-zA-Z_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\'] name_tag [\'][a-zA-Z_*?\[\]][a-zA-Z0-9_*?\-,\.\[\]:=]*[\']
name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]* name_minus [a-zA-Z_*?][a-zA-Z0-9\-_*?.:]*
drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)? drv_cfg_term [a-zA-Z0-9_\.]+(=[a-zA-Z0-9_*?\.:]+)?
/* If you add a modifier you need to update check_modifier() */ /*
* If you add a modifier you need to update check_modifier().
* Also, the letters in modifier_event must not be in modifier_bp.
*/
modifier_event [ukhpPGHSDIWeb]+ modifier_event [ukhpPGHSDIWeb]+
modifier_bp [rwx]{1,3} modifier_bp [rwx]{1,3}
lc_type (L1-dcache|l1-d|l1d|L1-data|L1-icache|l1-i|l1i|L1-instruction|LLC|L2|dTLB|d-tlb|Data-TLB|iTLB|i-tlb|Instruction-TLB|branch|branches|bpu|btb|bpc|node) lc_type (L1-dcache|l1-d|l1d|L1-data|L1-icache|l1-i|l1i|L1-instruction|LLC|L2|dTLB|d-tlb|Data-TLB|iTLB|i-tlb|Instruction-TLB|branch|branches|bpu|btb|bpc|node)
lc_op_result (load|loads|read|store|stores|write|prefetch|prefetches|speculative-read|speculative-load|refs|Reference|ops|access|misses|miss) lc_op_result (load|loads|read|store|stores|write|prefetch|prefetches|speculative-read|speculative-load|refs|Reference|ops|access|misses|miss)
digit [0-9]
non_digit [^0-9]
%% %%
...@@ -304,8 +309,20 @@ r0x{num_raw_hex} { return str(yyscanner, PE_RAW); } ...@@ -304,8 +309,20 @@ r0x{num_raw_hex} { return str(yyscanner, PE_RAW); }
<mem>{ <mem>{
{modifier_bp} { return str(yyscanner, PE_MODIFIER_BP); } {modifier_bp} { return str(yyscanner, PE_MODIFIER_BP); }
: { return ':'; } /*
"/" { return '/'; } * The colon before memory access modifiers can get mixed up with the
* colon before event modifiers. Fortunately none of the option letters
* are the same, so trailing context can be used disambiguate the two
* cases.
*/
":"/{modifier_bp} { return str(yyscanner, PE_BP_COLON); }
/*
* The slash before memory length can get mixed up with the slash before
* config terms. Fortunately config terms do not start with a numeric
* digit, so trailing context can be used disambiguate the two cases.
*/
"/"/{digit} { return str(yyscanner, PE_BP_SLASH); }
"/"/{non_digit} { BEGIN(config); return '/'; }
{num_dec} { return value(yyscanner, 10); } {num_dec} { return value(yyscanner, 10); }
{num_hex} { return value(yyscanner, 16); } {num_hex} { return value(yyscanner, 16); }
/* /*
......
...@@ -59,7 +59,7 @@ static void free_list_evsel(struct list_head* list_evsel) ...@@ -59,7 +59,7 @@ static void free_list_evsel(struct list_head* list_evsel)
%token PE_EVENT_NAME %token PE_EVENT_NAME
%token PE_RAW PE_NAME %token PE_RAW PE_NAME
%token PE_BPF_OBJECT PE_BPF_SOURCE %token PE_BPF_OBJECT PE_BPF_SOURCE
%token PE_MODIFIER_EVENT PE_MODIFIER_BP %token PE_MODIFIER_EVENT PE_MODIFIER_BP PE_BP_COLON PE_BP_SLASH
%token PE_LEGACY_CACHE %token PE_LEGACY_CACHE
%token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP %token PE_PREFIX_MEM PE_PREFIX_RAW PE_PREFIX_GROUP
%token PE_ERROR %token PE_ERROR
...@@ -80,6 +80,8 @@ static void free_list_evsel(struct list_head* list_evsel) ...@@ -80,6 +80,8 @@ static void free_list_evsel(struct list_head* list_evsel)
%type <str> PE_LEGACY_CACHE %type <str> PE_LEGACY_CACHE
%type <str> PE_MODIFIER_EVENT %type <str> PE_MODIFIER_EVENT
%type <str> PE_MODIFIER_BP %type <str> PE_MODIFIER_BP
%type <str> PE_BP_COLON
%type <str> PE_BP_SLASH
%type <str> PE_EVENT_NAME %type <str> PE_EVENT_NAME
%type <str> PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE %type <str> PE_KERNEL_PMU_EVENT PE_PMU_EVENT_FAKE
%type <str> PE_DRV_CFG_TERM %type <str> PE_DRV_CFG_TERM
...@@ -275,7 +277,7 @@ event_def ...@@ -275,7 +277,7 @@ event_def
event_def: event_pmu | event_def: event_pmu |
event_legacy_symbol | event_legacy_symbol |
event_legacy_cache sep_dc | event_legacy_cache sep_dc |
event_legacy_mem | event_legacy_mem sep_dc |
event_legacy_tracepoint sep_dc | event_legacy_tracepoint sep_dc |
event_legacy_numeric sep_dc | event_legacy_numeric sep_dc |
event_legacy_raw sep_dc | event_legacy_raw sep_dc |
...@@ -503,16 +505,19 @@ PE_LEGACY_CACHE opt_event_config ...@@ -503,16 +505,19 @@ PE_LEGACY_CACHE opt_event_config
} }
event_legacy_mem: event_legacy_mem:
PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config
{ {
struct parse_events_state *parse_state = _parse_state;
struct list_head *list; struct list_head *list;
int err; int err;
parse_events_unused_value(&$3);
parse_events_unused_value(&$5);
list = alloc_list(); list = alloc_list();
ABORT_ON(!list); ABORT_ON(!list);
err = parse_events_add_breakpoint(list, &parse_state->idx, err = parse_events_add_breakpoint(_parse_state, list,
$2, $6, $4); $2, $6, $4, $7);
parse_events_terms__delete($7);
free($6); free($6);
if (err) { if (err) {
free(list); free(list);
...@@ -521,31 +526,37 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc ...@@ -521,31 +526,37 @@ PE_PREFIX_MEM PE_VALUE '/' PE_VALUE ':' PE_MODIFIER_BP sep_dc
$$ = list; $$ = list;
} }
| |
PE_PREFIX_MEM PE_VALUE '/' PE_VALUE sep_dc PE_PREFIX_MEM PE_VALUE PE_BP_SLASH PE_VALUE opt_event_config
{ {
struct parse_events_state *parse_state = _parse_state;
struct list_head *list; struct list_head *list;
int err;
parse_events_unused_value(&$3);
list = alloc_list(); list = alloc_list();
ABORT_ON(!list); ABORT_ON(!list);
if (parse_events_add_breakpoint(list, &parse_state->idx, err = parse_events_add_breakpoint(_parse_state, list,
$2, NULL, $4)) { $2, NULL, $4, $5);
parse_events_terms__delete($5);
if (err) {
free(list); free(list);
YYABORT; YYABORT;
} }
$$ = list; $$ = list;
} }
| |
PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc PE_PREFIX_MEM PE_VALUE PE_BP_COLON PE_MODIFIER_BP opt_event_config
{ {
struct parse_events_state *parse_state = _parse_state;
struct list_head *list; struct list_head *list;
int err; int err;
parse_events_unused_value(&$3);
list = alloc_list(); list = alloc_list();
ABORT_ON(!list); ABORT_ON(!list);
err = parse_events_add_breakpoint(list, &parse_state->idx, err = parse_events_add_breakpoint(_parse_state, list,
$2, $4, 0); $2, $4, 0, $5);
parse_events_terms__delete($5);
free($4); free($4);
if (err) { if (err) {
free(list); free(list);
...@@ -554,15 +565,17 @@ PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc ...@@ -554,15 +565,17 @@ PE_PREFIX_MEM PE_VALUE ':' PE_MODIFIER_BP sep_dc
$$ = list; $$ = list;
} }
| |
PE_PREFIX_MEM PE_VALUE sep_dc PE_PREFIX_MEM PE_VALUE opt_event_config
{ {
struct parse_events_state *parse_state = _parse_state;
struct list_head *list; struct list_head *list;
int err;
list = alloc_list(); list = alloc_list();
ABORT_ON(!list); ABORT_ON(!list);
if (parse_events_add_breakpoint(list, &parse_state->idx, err = parse_events_add_breakpoint(_parse_state, list,
$2, NULL, 0)) { $2, NULL, 0, $3);
parse_events_terms__delete($3);
if (err) {
free(list); free(list);
YYABORT; YYABORT;
} }
......
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