diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2010-04-14 18:39:50 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-04-14 16:41:30 -0400 |
commit | dda4ab34fe1905d3d590572b776dd92aa0866558 (patch) | |
tree | 8b35deec810f2a16c86833b2020584831383b71c /tools/perf/util/probe-event.c | |
parent | d3b63d7ae04879a817bac5c0bf09749f73629d32 (diff) |
perf probe: Fix line range to show end line
Line range should reject the range if the number of lines is 0
(e.g. "sched.c:1024+0"), and it should show the lines include
the end of line number (e.g. "sched.c:1024-2048" should show
2048th line).
LKML-Reference: <20100414223950.14630.42263.stgit@localhost6.localdomain6>
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>
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 | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/tools/perf/util/probe-event.c b/tools/perf/util/probe-event.c index 954ca210e4b7..5bf8ab034466 100644 --- a/tools/perf/util/probe-event.c +++ b/tools/perf/util/probe-event.c | |||
@@ -290,7 +290,7 @@ int show_line_range(struct line_range *lr) | |||
290 | 290 | ||
291 | if (lr->end == INT_MAX) | 291 | if (lr->end == INT_MAX) |
292 | lr->end = l + NR_ADDITIONAL_LINES; | 292 | lr->end = l + NR_ADDITIONAL_LINES; |
293 | while (l < lr->end && !feof(fp) && ret >= 0) | 293 | while (l <= lr->end && !feof(fp) && ret >= 0) |
294 | ret = show_one_line(fp, (l++) - lr->offset, false, false); | 294 | ret = show_one_line(fp, (l++) - lr->offset, false, false); |
295 | end: | 295 | end: |
296 | fclose(fp); | 296 | fclose(fp); |
@@ -341,9 +341,15 @@ int parse_line_range_desc(const char *arg, struct line_range *lr) | |||
341 | ptr = strchr(arg, ':'); | 341 | ptr = strchr(arg, ':'); |
342 | if (ptr) { | 342 | if (ptr) { |
343 | lr->start = (int)strtoul(ptr + 1, &tmp, 0); | 343 | lr->start = (int)strtoul(ptr + 1, &tmp, 0); |
344 | if (*tmp == '+') | 344 | if (*tmp == '+') { |
345 | lr->end = lr->start + (int)strtoul(tmp + 1, &tmp, 0); | 345 | lr->end = lr->start + (int)strtoul(tmp + 1, &tmp, 0); |
346 | else if (*tmp == '-') | 346 | lr->end--; /* |
347 | * Adjust the number of lines here. | ||
348 | * If the number of lines == 1, the | ||
349 | * the end of line should be equal to | ||
350 | * the start of line. | ||
351 | */ | ||
352 | } else if (*tmp == '-') | ||
347 | lr->end = (int)strtoul(tmp + 1, &tmp, 0); | 353 | lr->end = (int)strtoul(tmp + 1, &tmp, 0); |
348 | else | 354 | else |
349 | lr->end = INT_MAX; | 355 | lr->end = INT_MAX; |