perf script: Show text poke address symbol
It is generally more useful to show the symbol with an address. In this case, the print function requires the 'machine' which means changing callers to provide it as a parameter. It is optional because most events do not need it and the callers that matter can provide it. Committer notes: Made 'union perf_event' continue to be the first parameter to the perf_event__fprintf() and perf_event__fprintf_text_poke() events. Signed-off-by: Adrian Hunter <adrian.hunter@intel.com> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Borislav Petkov <bp@alien8.de> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Masami Hiramatsu <mhiramat@kernel.org> Cc: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Steven Rostedt (VMware) <rostedt@goodmis.org> Cc: x86@kernel.org Link: http://lore.kernel.org/lkml/20200512121922.8997-16-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
92ecf3a64f
commit
7eeb9855c1
|
@ -2178,7 +2178,7 @@ static int print_event_with_time(struct perf_tool *tool,
|
|||
event->header.type, stdout);
|
||||
}
|
||||
|
||||
perf_event__fprintf(event, stdout);
|
||||
perf_event__fprintf(event, machine, stdout);
|
||||
|
||||
thread__put(thread);
|
||||
|
||||
|
@ -2313,7 +2313,7 @@ process_finished_round_event(struct perf_tool *tool __maybe_unused,
|
|||
struct ordered_events *oe __maybe_unused)
|
||||
|
||||
{
|
||||
perf_event__fprintf(event, stdout);
|
||||
perf_event__fprintf(event, NULL, stdout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -185,14 +185,14 @@ int test__PERF_RECORD(struct test *test __maybe_unused, int subtest __maybe_unus
|
|||
err = perf_evlist__parse_sample(evlist, event, &sample);
|
||||
if (err < 0) {
|
||||
if (verbose > 0)
|
||||
perf_event__fprintf(event, stderr);
|
||||
perf_event__fprintf(event, NULL, stderr);
|
||||
pr_debug("Couldn't parse sample\n");
|
||||
goto out_delete_evlist;
|
||||
}
|
||||
|
||||
if (verbose > 0) {
|
||||
pr_info("%" PRIu64" %d ", sample.time, sample.cpu);
|
||||
perf_event__fprintf(event, stderr);
|
||||
perf_event__fprintf(event, NULL, stderr);
|
||||
}
|
||||
|
||||
if (prev_time > sample.time) {
|
||||
|
|
|
@ -440,14 +440,25 @@ static int text_poke_printer(enum binary_printer_ops op, unsigned int val,
|
|||
}
|
||||
}
|
||||
|
||||
size_t perf_event__fprintf_text_poke(union perf_event *event, FILE *fp)
|
||||
size_t perf_event__fprintf_text_poke(union perf_event *event, struct machine *machine, FILE *fp)
|
||||
{
|
||||
struct perf_record_text_poke_event *tp = &event->text_poke;
|
||||
size_t ret;
|
||||
bool old;
|
||||
|
||||
ret = fprintf(fp, " %" PRI_lx64 " old len %u new len %u\n",
|
||||
tp->addr, tp->old_len, tp->new_len);
|
||||
ret = fprintf(fp, " %" PRI_lx64 " ", tp->addr);
|
||||
if (machine) {
|
||||
struct addr_location al;
|
||||
|
||||
al.map = maps__find(&machine->kmaps, tp->addr);
|
||||
if (al.map && map__load(al.map) >= 0) {
|
||||
al.addr = al.map->map_ip(al.map, tp->addr);
|
||||
al.sym = map__find_symbol(al.map, al.addr);
|
||||
if (al.sym)
|
||||
ret += symbol__fprintf_symname_offs(al.sym, &al, fp);
|
||||
}
|
||||
}
|
||||
ret += fprintf(fp, " old len %u new len %u\n", tp->old_len, tp->new_len);
|
||||
old = true;
|
||||
ret += binary__fprintf(tp->bytes, tp->old_len, 16, text_poke_printer,
|
||||
&old, fp);
|
||||
|
@ -457,7 +468,7 @@ size_t perf_event__fprintf_text_poke(union perf_event *event, FILE *fp)
|
|||
return ret;
|
||||
}
|
||||
|
||||
size_t perf_event__fprintf(union perf_event *event, FILE *fp)
|
||||
size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FILE *fp)
|
||||
{
|
||||
size_t ret = fprintf(fp, "PERF_RECORD_%s",
|
||||
perf_event__name(event->header.type));
|
||||
|
@ -502,7 +513,7 @@ size_t perf_event__fprintf(union perf_event *event, FILE *fp)
|
|||
ret += perf_event__fprintf_bpf(event, fp);
|
||||
break;
|
||||
case PERF_RECORD_TEXT_POKE:
|
||||
ret += perf_event__fprintf_text_poke(event, fp);
|
||||
ret += perf_event__fprintf_text_poke(event, machine, fp);
|
||||
break;
|
||||
default:
|
||||
ret += fprintf(fp, "\n");
|
||||
|
|
|
@ -389,8 +389,8 @@ size_t perf_event__fprintf_namespaces(union perf_event *event, FILE *fp);
|
|||
size_t perf_event__fprintf_cgroup(union perf_event *event, FILE *fp);
|
||||
size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp);
|
||||
size_t perf_event__fprintf_bpf(union perf_event *event, FILE *fp);
|
||||
size_t perf_event__fprintf_text_poke(union perf_event *event, FILE *fp);
|
||||
size_t perf_event__fprintf(union perf_event *event, FILE *fp);
|
||||
size_t perf_event__fprintf_text_poke(union perf_event *event, struct machine *machine,FILE *fp);
|
||||
size_t perf_event__fprintf(union perf_event *event, struct machine *machine, FILE *fp);
|
||||
|
||||
int kallsyms__get_function_start(const char *kallsyms_filename,
|
||||
const char *symbol_name, u64 *addr);
|
||||
|
|
|
@ -236,7 +236,7 @@ static void intel_pt_log_event(union perf_event *event)
|
|||
if (!intel_pt_enable_logging || !f)
|
||||
return;
|
||||
|
||||
perf_event__fprintf(event, f);
|
||||
perf_event__fprintf(event, NULL, f);
|
||||
}
|
||||
|
||||
static void intel_pt_dump_sample(struct perf_session *session,
|
||||
|
|
|
@ -821,7 +821,7 @@ int machine__process_text_poke(struct machine *machine, union perf_event *event,
|
|||
u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
|
||||
|
||||
if (dump_trace)
|
||||
perf_event__fprintf_text_poke(event, stdout);
|
||||
perf_event__fprintf_text_poke(event, machine, stdout);
|
||||
|
||||
if (!event->text_poke.new_len)
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue