OpenWrt – Blame information for rev 1
?pathlinks?
Rev | Author | Line No. | Line |
---|---|---|---|
1 | office | 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 | --- a/lib/vsprintf.c |
||
13 | +++ b/lib/vsprintf.c |
||
14 | @@ -670,8 +670,10 @@ char *symbol_string(char *buf, char *end |
||
15 | struct printf_spec spec, const char *fmt) |
||
16 | { |
||
17 | unsigned long value; |
||
18 | -#ifdef CONFIG_KALLSYMS |
||
19 | char sym[KSYM_SYMBOL_LEN]; |
||
20 | +#ifndef CONFIG_KALLSYMS |
||
21 | + struct module *mod; |
||
22 | + int len; |
||
23 | #endif |
||
24 | |||
25 | if (fmt[1] == 'R') |
||
26 | @@ -685,11 +687,16 @@ char *symbol_string(char *buf, char *end |
||
27 | sprint_symbol(sym, value); |
||
28 | else |
||
29 | sprint_symbol_no_offset(sym, value); |
||
30 | - |
||
31 | - return string(buf, end, sym, spec); |
||
32 | #else |
||
33 | - return special_hex_number(buf, end, value, sizeof(void *)); |
||
34 | + len = snprintf(sym, sizeof(sym), "0x%lx", value); |
||
35 | + |
||
36 | + mod = __module_address(value); |
||
37 | + if (mod) |
||
38 | + snprintf(sym + len, sizeof(sym) - len, " [%s@%p+0x%x]", |
||
39 | + mod->name, mod->core_layout.base, |
||
40 | + mod->core_layout.size); |
||
41 | #endif |
||
42 | + return string(buf, end, sym, spec); |
||
43 | } |
||
44 | |||
45 | static noinline_for_stack |