diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2011-02-10 04:08:10 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-02-16 14:03:23 -0500 |
commit | e116dfa1c357da49f55e1555767ec991225a8321 (patch) | |
tree | 58399140eb095b3550b5593c4e6348983208604c /tools/perf/util/probe-event.c | |
parent | 4187e262bc90369ba581ee28ec74ed416618889e (diff) |
perf probe: Support function@filename syntax for --line
Since "perf probe --add" supports function@filename syntax, --line
option should also support it.
Cc: 2nddept-manager@sdl.hitachi.co.jp
Cc: Franck Bui-Huu <fbuihuu@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: linux-kernel@vger.kernel.org
LKML-Reference: <20110210090810.1809.26913.stgit@ltc236.sdl.hitachi.co.jp>
Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/probe-event.c')
-rw-r--r-- | tools/perf/util/probe-event.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 9d237e3cff5d..cbd76507a56f 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -595,11 +595,11 @@ static int parse_line_num(char **ptr, int *val, const char *what) | |||
595 | * The line range syntax is described by: | 595 | * The line range syntax is described by: |
596 | * | 596 | * |
597 | * SRC[:SLN[+NUM|-ELN]] | 597 | * SRC[:SLN[+NUM|-ELN]] |
598 | * FNC[:SLN[+NUM|-ELN]] | 598 | * FNC[@SRC][:SLN[+NUM|-ELN]] |
599 | */ | 599 | */ |
600 | int parse_line_range_desc(const char *arg, struct line_range *lr) | 600 | int parse_line_range_desc(const char *arg, struct line_range *lr) |
601 | { | 601 | { |
602 | char *range, *name = strdup(arg); | 602 | char *range, *file, *name = strdup(arg); |
603 | int err; | 603 | int err; |
604 | 604 | ||
605 | if (!name) | 605 | if (!name) |
@@ -649,7 +649,16 @@ int parse_line_range_desc(const char *arg, struct line_range *lr) | |||
649 | } | 649 | } |
650 | } | 650 | } |
651 | 651 | ||
652 | if (strchr(name, '.')) | 652 | file = strchr(name, '@'); |
653 | if (file) { | ||
654 | *file = '\0'; | ||
655 | lr->file = strdup(++file); | ||
656 | if (lr->file == NULL) { | ||
657 | err = -ENOMEM; | ||
658 | goto err; | ||
659 | } | ||
660 | lr->function = name; | ||
661 | } else if (strchr(name, '.')) | ||
653 | lr->file = name; | 662 | lr->file = name; |
654 | else | 663 | else |
655 | lr->function = name; | 664 | lr->function = name; |