Commit 59dd974b authored by Rasmus Villemoes's avatar Rasmus Villemoes Committed by Steven Rostedt (VMware)

tracing: Merge seq_print_sym_short() and seq_print_sym_offset()

These two functions are nearly identical, so we can avoid some code
duplication by moving the conditional into a common implementation.

Link: http://lkml.kernel.org/r/20181029223542.26175-2-linux@rasmusvillemoes.dkSigned-off-by: default avatarRasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 05ddb25c
...@@ -339,34 +339,17 @@ static inline const char *kretprobed(const char *name) ...@@ -339,34 +339,17 @@ static inline const char *kretprobed(const char *name)
#endif /* CONFIG_KRETPROBES */ #endif /* CONFIG_KRETPROBES */
static void static void
seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address) seq_print_sym(struct trace_seq *s, const char *fmt, unsigned long address,
{ bool offset)
char str[KSYM_SYMBOL_LEN];
#ifdef CONFIG_KALLSYMS
const char *name;
kallsyms_lookup(address, NULL, NULL, NULL, str);
name = kretprobed(str);
if (name && strlen(name)) {
trace_seq_printf(s, fmt, name);
return;
}
#endif
snprintf(str, KSYM_SYMBOL_LEN, "0x%08lx", address);
trace_seq_printf(s, fmt, str);
}
static void
seq_print_sym_offset(struct trace_seq *s, const char *fmt,
unsigned long address)
{ {
char str[KSYM_SYMBOL_LEN]; char str[KSYM_SYMBOL_LEN];
#ifdef CONFIG_KALLSYMS #ifdef CONFIG_KALLSYMS
const char *name; const char *name;
if (offset)
sprint_symbol(str, address); sprint_symbol(str, address);
else
kallsyms_lookup(address, NULL, NULL, NULL, str);
name = kretprobed(str); name = kretprobed(str);
if (name && strlen(name)) { if (name && strlen(name)) {
...@@ -424,10 +407,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags) ...@@ -424,10 +407,7 @@ seq_print_ip_sym(struct trace_seq *s, unsigned long ip, unsigned long sym_flags)
goto out; goto out;
} }
if (sym_flags & TRACE_ITER_SYM_OFFSET) seq_print_sym(s, "%s", ip, sym_flags & TRACE_ITER_SYM_OFFSET);
seq_print_sym_offset(s, "%s", ip);
else
seq_print_sym_short(s, "%s", ip);
if (sym_flags & TRACE_ITER_SYM_ADDR) if (sym_flags & TRACE_ITER_SYM_ADDR)
trace_seq_printf(s, " <" IP_FMT ">", ip); trace_seq_printf(s, " <" IP_FMT ">", ip);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment