kernel: split patches folder up into backport, pending and hack folders
[openwrt/openwrt.git] / target / linux / generic / pending-4.9 / 205-backtrace_module_info.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Subject: kernel: when KALLSYMS is disabled, print module address + size for matching backtrace entries
3
4 [john@phrozen.org: felix will add this to his upstream queue]
5
6 lede-commit 53827cdc824556cda910b23ce5030c363b8f1461
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9 lib/vsprintf.c | 15 +++++++++++----
10 1 file changed, 11 insertions(+), 4 deletions(-)
11
12 diff --git a/lib/vsprintf.c b/lib/vsprintf.c
13 index 0967771d8f7f..5d27eae49198 100644
14 --- a/lib/vsprintf.c
15 +++ b/lib/vsprintf.c
16 @@ -669,8 +669,10 @@ char *symbol_string(char *buf, char *end, void *ptr,
17 struct printf_spec spec, const char *fmt)
18 {
19 unsigned long value;
20 -#ifdef CONFIG_KALLSYMS
21 char sym[KSYM_SYMBOL_LEN];
22 +#ifndef CONFIG_KALLSYMS
23 + struct module *mod;
24 + int len;
25 #endif
26
27 if (fmt[1] == 'R')
28 @@ -684,11 +686,16 @@ char *symbol_string(char *buf, char *end, void *ptr,
29 sprint_symbol(sym, value);
30 else
31 sprint_symbol_no_offset(sym, value);
32 -
33 - return string(buf, end, sym, spec);
34 #else
35 - return special_hex_number(buf, end, value, sizeof(void *));
36 + len = snprintf(sym, sizeof(sym), "0x%lx", value);
37 +
38 + mod = __module_address(value);
39 + if (mod)
40 + snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]",
41 + mod->name, mod->core_layout.base,
42 + mod->core_layout.size);
43 #endif
44 + return string(buf, end, sym, spec);
45 }
46
47 static noinline_for_stack
48 --
49 2.11.0
50