aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2010-03-23 12:16:56 -0400
committerSteven Rostedt <rostedt@goodmis.org>2010-03-23 12:16:56 -0400
commit0840b9aa7d991c6d0c6aa16947bedf7aa89a4e69 (patch)
tree4f920adab99fcf99c4f9bc9b1f7c531c91f72135
parent534080da20a95d4bb0d70bca42c0dac0305669da (diff)
parse-events: Handle operations within a condition
The conditon ? : does not handle other operations within it (like << which the ext4 tracepoints added). This patch makes the conditions handle operations within them. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--parse-events.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/parse-events.c b/parse-events.c
index e942916..3c2e9a0 100644
--- a/parse-events.c
+++ b/parse-events.c
@@ -1419,6 +1419,9 @@ process_arg(struct event_format *event, struct print_arg *arg, char **tok)
1419} 1419}
1420 1420
1421static enum event_type 1421static enum event_type
1422process_op(struct event_format *event, struct print_arg *arg, char **tok);
1423
1424static enum event_type
1422process_cond(struct event_format *event, struct print_arg *top, char **tok) 1425process_cond(struct event_format *event, struct print_arg *top, char **tok)
1423{ 1426{
1424 struct print_arg *arg, *left, *right; 1427 struct print_arg *arg, *left, *right;
@@ -1435,6 +1438,14 @@ process_cond(struct event_format *event, struct print_arg *top, char **tok)
1435 1438
1436 *tok = NULL; 1439 *tok = NULL;
1437 type = process_arg(event, left, &token); 1440 type = process_arg(event, left, &token);
1441
1442 again:
1443 /* Handle other operations in the arguments */
1444 if (type == EVENT_OP && strcmp(token, ":") != 0) {
1445 type = process_op(event, left, &token);
1446 goto again;
1447 }
1448
1438 if (test_type_token(type, token, EVENT_OP, ":")) 1449 if (test_type_token(type, token, EVENT_OP, ":"))
1439 goto out_free; 1450 goto out_free;
1440 1451
@@ -1670,7 +1681,7 @@ process_op(struct event_format *event, struct print_arg *arg, char **tok)
1670 goto out_free; 1681 goto out_free;
1671 } 1682 }
1672 1683
1673 if (type == EVENT_OP) { 1684 if (type == EVENT_OP && strcmp(*tok, ":") != 0) {
1674 int prio; 1685 int prio;
1675 1686
1676 /* higher prios need to be closer to the root */ 1687 /* higher prios need to be closer to the root */
@@ -2860,6 +2871,14 @@ eval_num_arg(void *data, int size, struct event_format *event, struct print_arg
2860 if (typearg) 2871 if (typearg)
2861 val = eval_type(val, typearg, 1); 2872 val = eval_type(val, typearg, 1);
2862 break; 2873 break;
2874 } else if (strcmp(arg->op.op, "?") == 0) {
2875 left = eval_num_arg(data, size, event, arg->op.left);
2876 arg = arg->op.right;
2877 if (left)
2878 val = eval_num_arg(data, size, event, arg->op.left);
2879 else
2880 val = eval_num_arg(data, size, event, arg->op.right);
2881 break;
2863 } 2882 }
2864 default_op: 2883 default_op:
2865 left = eval_num_arg(data, size, event, arg->op.left); 2884 left = eval_num_arg(data, size, event, arg->op.left);