diff options
author | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-06-22 23:04:55 +0200 |
---|---|---|
committer | Steven Rostedt (VMware) <rostedt@goodmis.org> | 2017-06-22 23:10:06 +0200 |
commit | feaf1283d11794b9d518fcfd54b6bf8bee1f0b4b (patch) | |
tree | 31122c0a329faf629559f7f250b605eeb988e8a0 /kernel/trace/trace_output.c | |
parent | ftrace: Add missing comment for FTRACE_OPS_FL_RCU (diff) | |
download | linux-feaf1283d11794b9d518fcfd54b6bf8bee1f0b4b.tar.xz linux-feaf1283d11794b9d518fcfd54b6bf8bee1f0b4b.zip |
tracing: Show address when function names are not found
Currently, when a function is not found in kallsyms, instead of simply
showing the function address, it shows nothing at all:
# echo ':mod:kvm_intel' > /sys/kernel/tracing/set_ftrace_filter
# echo function > /sys/kernel/tracing/set_ftrace_filter
# qemu -enable-kvm /home/my-qemu-image
<Ctrl-C>
# rmmod kvm_intel
# cat /sys/kernel/tracing/trace
qemu-system-x86-2408 [001] d..2 135.013238: <-kvm_arch_hardware_enable
qemu-system-x86-2408 [001] .... 135.014574: <-kvm_arch_vm_ioctl
qemu-system-x86-2408 [001] .... 135.015420: <-kvm_vm_ioctl_check_extension
qemu-system-x86-2408 [001] .... 135.045411: <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045412: <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045412: <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045412: <-__do_cpuid_ent
qemu-system-x86-2408 [001] ...1 135.045413: <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045413: <-__do_cpuid_ent
When it should show:
qemu-system-x86-2408 [001] d..2 135.013238: 0xffffffffa02a39f0 <-kvm_arch_hardware_enable
qemu-system-x86-2408 [001] .... 135.014574: 0xffffffffa02a2ba0 <-kvm_arch_vm_ioctl
qemu-system-x86-2408 [001] .... 135.015420: 0xffffffffa029e4e0 <-kvm_vm_ioctl_check_extension
qemu-system-x86-2408 [001] .... 135.045411: 0xffffffffa02a1380 <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045412: 0xffffffffa029e160 <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045412: 0xffffffffa029e180 <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045412: 0xffffffffa029e520 <-__do_cpuid_ent
qemu-system-x86-2408 [001] ...1 135.045413: 0xffffffffa02a13b0 <-__do_cpuid_ent
qemu-system-x86-2408 [001] .... 135.045413: 0xffffffffa02a1380 <-__do_cpuid_ent
instead.
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
Diffstat (limited to 'kernel/trace/trace_output.c')
-rw-r--r-- | kernel/trace/trace_output.c | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 08f9bab8089e..01ff99969ca7 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -340,31 +340,41 @@ static inline const char *kretprobed(const char *name) static void seq_print_sym_short(struct trace_seq *s, const char *fmt, unsigned long address) { -#ifdef CONFIG_KALLSYMS char str[KSYM_SYMBOL_LEN]; +#ifdef CONFIG_KALLSYMS const char *name; kallsyms_lookup(address, NULL, NULL, NULL, str); name = kretprobed(str); - trace_seq_printf(s, fmt, name); + 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) { -#ifdef CONFIG_KALLSYMS char str[KSYM_SYMBOL_LEN]; +#ifdef CONFIG_KALLSYMS const char *name; sprint_symbol(str, address); name = kretprobed(str); - trace_seq_printf(s, fmt, name); + 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); } #ifndef CONFIG_64BIT |