diff options
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 99274cec0adb..8b2ec882e6e0 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -38,6 +38,7 @@ static char *dso_list_str, *comm_list_str, *sym_list_str, | |||
38 | static struct strlist *dso_list, *comm_list, *sym_list; | 38 | static struct strlist *dso_list, *comm_list, *sym_list; |
39 | static char *field_sep; | 39 | static char *field_sep; |
40 | 40 | ||
41 | static int force; | ||
41 | static int input; | 42 | static int input; |
42 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 43 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
43 | 44 | ||
@@ -1526,11 +1527,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1526 | more_data += sizeof(u64); | 1527 | more_data += sizeof(u64); |
1527 | } | 1528 | } |
1528 | 1529 | ||
1529 | dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d: %p period: %Ld\n", | 1530 | dprintf("%p [%p]: PERF_EVENT_SAMPLE (IP, %d): %d/%d: %p period: %Ld\n", |
1530 | (void *)(offset + head), | 1531 | (void *)(offset + head), |
1531 | (void *)(long)(event->header.size), | 1532 | (void *)(long)(event->header.size), |
1532 | event->header.misc, | 1533 | event->header.misc, |
1533 | event->ip.pid, | 1534 | event->ip.pid, event->ip.tid, |
1534 | (void *)(long)ip, | 1535 | (void *)(long)ip, |
1535 | (long long)period); | 1536 | (long long)period); |
1536 | 1537 | ||
@@ -1590,10 +1591,11 @@ process_sample_event(event_t *event, unsigned long offset, unsigned long head) | |||
1590 | if (show & show_mask) { | 1591 | if (show & show_mask) { |
1591 | struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip); | 1592 | struct symbol *sym = resolve_symbol(thread, &map, &dso, &ip); |
1592 | 1593 | ||
1593 | if (dso_list && dso && dso->name && !strlist__has_entry(dso_list, dso->name)) | 1594 | if (dso_list && (!dso || !dso->name || |
1595 | !strlist__has_entry(dso_list, dso->name))) | ||
1594 | return 0; | 1596 | return 0; |
1595 | 1597 | ||
1596 | if (sym_list && sym && !strlist__has_entry(sym_list, sym->name)) | 1598 | if (sym_list && (!sym || !strlist__has_entry(sym_list, sym->name))) |
1597 | return 0; | 1599 | return 0; |
1598 | 1600 | ||
1599 | if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) { | 1601 | if (hist_entry__add(thread, map, dso, sym, ip, chain, level, period)) { |
@@ -1612,10 +1614,11 @@ process_mmap_event(event_t *event, unsigned long offset, unsigned long head) | |||
1612 | struct thread *thread = threads__findnew(event->mmap.pid); | 1614 | struct thread *thread = threads__findnew(event->mmap.pid); |
1613 | struct map *map = map__new(&event->mmap); | 1615 | struct map *map = map__new(&event->mmap); |
1614 | 1616 | ||
1615 | dprintf("%p [%p]: PERF_EVENT_MMAP %d: [%p(%p) @ %p]: %s\n", | 1617 | dprintf("%p [%p]: PERF_EVENT_MMAP %d/%d: [%p(%p) @ %p]: %s\n", |
1616 | (void *)(offset + head), | 1618 | (void *)(offset + head), |
1617 | (void *)(long)(event->header.size), | 1619 | (void *)(long)(event->header.size), |
1618 | event->mmap.pid, | 1620 | event->mmap.pid, |
1621 | event->mmap.tid, | ||
1619 | (void *)(long)event->mmap.start, | 1622 | (void *)(long)event->mmap.start, |
1620 | (void *)(long)event->mmap.len, | 1623 | (void *)(long)event->mmap.len, |
1621 | (void *)(long)event->mmap.pgoff, | 1624 | (void *)(long)event->mmap.pgoff, |
@@ -1854,6 +1857,11 @@ static int __cmd_report(void) | |||
1854 | exit(-1); | 1857 | exit(-1); |
1855 | } | 1858 | } |
1856 | 1859 | ||
1860 | if (!force && (stat.st_uid != geteuid())) { | ||
1861 | fprintf(stderr, "file: %s not owned by current user\n", input_name); | ||
1862 | exit(-1); | ||
1863 | } | ||
1864 | |||
1857 | if (!stat.st_size) { | 1865 | if (!stat.st_size) { |
1858 | fprintf(stderr, "zero-sized file, nothing to do!\n"); | 1866 | fprintf(stderr, "zero-sized file, nothing to do!\n"); |
1859 | exit(0); | 1867 | exit(0); |
@@ -2062,6 +2070,7 @@ static const struct option options[] = { | |||
2062 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, | 2070 | OPT_BOOLEAN('D', "dump-raw-trace", &dump_trace, |
2063 | "dump raw trace in ASCII"), | 2071 | "dump raw trace in ASCII"), |
2064 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), | 2072 | OPT_STRING('k', "vmlinux", &vmlinux, "file", "vmlinux pathname"), |
2073 | OPT_BOOLEAN('f', "force", &force, "don't complain, do it"), | ||
2065 | OPT_BOOLEAN('m', "modules", &modules, | 2074 | OPT_BOOLEAN('m', "modules", &modules, |
2066 | "load module symbols - WARNING: use only with -k and LIVE kernel"), | 2075 | "load module symbols - WARNING: use only with -k and LIVE kernel"), |
2067 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, | 2076 | OPT_BOOLEAN('n', "show-nr-samples", &show_nr_samples, |