diff options
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; |