aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/trace-event-parse.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/trace-event-parse.c')
-rw-r--r--tools/perf/util/trace-event-parse.c31
1 files changed, 27 insertions, 4 deletions
diff --git a/tools/perf/util/trace-event-parse.c b/tools/perf/util/trace-event-parse.c
index ead6a9ad3599..b53b27f34e4e 100644
--- a/tools/perf/util/trace-event-parse.c
+++ b/tools/perf/util/trace-event-parse.c
@@ -1462,6 +1462,7 @@ process_paren(struct event *event, struct print_arg *arg, char **tok)
1462{ 1462{
1463 struct print_arg *item_arg; 1463 struct print_arg *item_arg;
1464 enum event_type type; 1464 enum event_type type;
1465 int ptr_cast = 0;
1465 char *token; 1466 char *token;
1466 1467
1467 type = process_arg(event, arg, &token); 1468 type = process_arg(event, arg, &token);
@@ -1469,11 +1470,26 @@ process_paren(struct event *event, struct print_arg *arg, char **tok)
1469 if (type == EVENT_ERROR) 1470 if (type == EVENT_ERROR)
1470 return EVENT_ERROR; 1471 return EVENT_ERROR;
1471 1472
1472 if (type == EVENT_OP) 1473 if (type == EVENT_OP) {
1473 type = process_op(event, arg, &token); 1474 /* handle the ptr casts */
1475 if (!strcmp(token, "*")) {
1476 /*
1477 * FIXME: should we zapp whitespaces before ')' ?
1478 * (may require a peek_token_item())
1479 */
1480 if (__peek_char() == ')') {
1481 ptr_cast = 1;
1482 free_token(token);
1483 type = read_token_item(&token);
1484 }
1485 }
1486 if (!ptr_cast) {
1487 type = process_op(event, arg, &token);
1474 1488
1475 if (type == EVENT_ERROR) 1489 if (type == EVENT_ERROR)
1476 return EVENT_ERROR; 1490 return EVENT_ERROR;
1491 }
1492 }
1477 1493
1478 if (test_type_token(type, token, EVENT_DELIM, (char *)")")) { 1494 if (test_type_token(type, token, EVENT_DELIM, (char *)")")) {
1479 free_token(token); 1495 free_token(token);
@@ -1499,6 +1515,13 @@ process_paren(struct event *event, struct print_arg *arg, char **tok)
1499 item_arg = malloc_or_die(sizeof(*item_arg)); 1515 item_arg = malloc_or_die(sizeof(*item_arg));
1500 1516
1501 arg->type = PRINT_TYPE; 1517 arg->type = PRINT_TYPE;
1518 if (ptr_cast) {
1519 char *old = arg->atom.atom;
1520
1521 arg->atom.atom = malloc_or_die(strlen(old + 3));
1522 sprintf(arg->atom.atom, "%s *", old);
1523 free(old);
1524 }
1502 arg->typecast.type = arg->atom.atom; 1525 arg->typecast.type = arg->atom.atom;
1503 arg->typecast.item = item_arg; 1526 arg->typecast.item = item_arg;
1504 type = process_arg_token(event, item_arg, &token, type); 1527 type = process_arg_token(event, item_arg, &token, type);