ftrace/x86: Show trampoline call function in enabled_functions
The file /sys/kernel/debug/tracing/eneabled_functions is used to debug ftrace function hooks. Add to the output what function is being called by the trampoline if the arch supports it. Add support for this feature in x86_64. Cc: H. Peter Anvin <hpa@linux.intel.com> Tested-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Tested-by: Jiri Kosina <jkosina@suse.cz> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
This commit is contained in:
parent
f3bea49115
commit
15d5b02cc5
2 changed files with 106 additions and 14 deletions
|
|
@ -2952,6 +2952,22 @@ static void t_stop(struct seq_file *m, void *p)
|
|||
mutex_unlock(&ftrace_lock);
|
||||
}
|
||||
|
||||
void * __weak
|
||||
arch_ftrace_trampoline_func(struct ftrace_ops *ops, struct dyn_ftrace *rec)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void add_trampoline_func(struct seq_file *m, struct ftrace_ops *ops,
|
||||
struct dyn_ftrace *rec)
|
||||
{
|
||||
void *ptr;
|
||||
|
||||
ptr = arch_ftrace_trampoline_func(ops, rec);
|
||||
if (ptr)
|
||||
seq_printf(m, " ->%pS", ptr);
|
||||
}
|
||||
|
||||
static int t_show(struct seq_file *m, void *v)
|
||||
{
|
||||
struct ftrace_iterator *iter = m->private;
|
||||
|
|
@ -2975,19 +2991,21 @@ static int t_show(struct seq_file *m, void *v)
|
|||
|
||||
seq_printf(m, "%ps", (void *)rec->ip);
|
||||
if (iter->flags & FTRACE_ITER_ENABLED) {
|
||||
struct ftrace_ops *ops = NULL;
|
||||
|
||||
seq_printf(m, " (%ld)%s",
|
||||
ftrace_rec_count(rec),
|
||||
rec->flags & FTRACE_FL_REGS ? " R" : " ");
|
||||
if (rec->flags & FTRACE_FL_TRAMP_EN) {
|
||||
struct ftrace_ops *ops;
|
||||
|
||||
ops = ftrace_find_tramp_ops_any(rec);
|
||||
if (ops)
|
||||
seq_printf(m, "\ttramp: %pS",
|
||||
(void *)ops->trampoline);
|
||||
else
|
||||
seq_printf(m, "\ttramp: ERROR!");
|
||||
|
||||
}
|
||||
add_trampoline_func(m, ops, rec);
|
||||
}
|
||||
|
||||
seq_printf(m, "\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue