67338973e881bde5609ccaaf9222e34a38b5f39e
[openwrt/staging/yousong.git] / target / linux / generic / patches-4.9 / 205-backtrace_module_info.patch
1 --- a/lib/vsprintf.c
2 +++ b/lib/vsprintf.c
3 @@ -669,8 +669,10 @@ char *symbol_string(char *buf, char *end
4 struct printf_spec spec, const char *fmt)
5 {
6 unsigned long value;
7 -#ifdef CONFIG_KALLSYMS
8 char sym[KSYM_SYMBOL_LEN];
9 +#ifndef CONFIG_KALLSYMS
10 + struct module *mod;
11 + int len;
12 #endif
13
14 if (fmt[1] == 'R')
15 @@ -684,11 +686,15 @@ char *symbol_string(char *buf, char *end
16 sprint_symbol(sym, value);
17 else
18 sprint_symbol_no_offset(sym, value);
19 -
20 - return string(buf, end, sym, spec);
21 #else
22 - return special_hex_number(buf, end, value, sizeof(void *));
23 + len = snprintf(sym, sizeof(sym), "0x%lx", value);
24 +
25 + mod = __module_address(value);
26 + if (mod)
27 + snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]",
28 + mod->name, mod->module_core, mod->core_size);
29 #endif
30 + return string(buf, end, sym, spec);
31 }
32
33 static noinline_for_stack