Skip to content

Commit

Permalink
perf probe: Fix line range description since a single file is allowed
Browse files Browse the repository at this point in the history
	$ perf-probe -L sched.c

is currently allowed but not documented.

Cc: Masami Hiramatsu <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Franck Bui-Huu <[email protected]>
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
  • Loading branch information
fbuihuu authored and acmel committed Dec 21, 2010
1 parent 44b81e9 commit 9d95b58
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion tools/perf/Documentation/perf-probe.txt
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ LINE SYNTAX
-----------
Line range is described by following syntax.

"FUNC[:RLN[+NUM|-RLN2]]|SRC:ALN[+NUM|-ALN2]"
"FUNC[:RLN[+NUM|-RLN2]]|SRC[:ALN[+NUM|-ALN2]]"

FUNC specifies the function name of showing lines. 'RLN' is the start line
number from function entry line, and 'RLN2' is the end line number. As same as
Expand Down
13 changes: 8 additions & 5 deletions tools/perf/util/probe-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,15 +515,18 @@ int show_available_vars(struct perf_probe_event *pevs __unused,
}
#endif

/*
* Stuff 'lr' according to the line range described by 'arg'.
* The line range syntax is described by:
*
* SRC[:SLN[+NUM|-ELN]]
* FNC[:SLN[+NUM|-ELN]]
*/
int parse_line_range_desc(const char *arg, struct line_range *lr)
{
const char *ptr;
char *tmp;
/*
* <Syntax>
* SRC:SLN[+NUM|-ELN]
* FUNC[:SLN[+NUM|-ELN]]
*/

ptr = strchr(arg, ':');
if (ptr) {
lr->start = (int)strtoul(ptr + 1, &tmp, 0);
Expand Down

0 comments on commit 9d95b58

Please sign in to comment.