diff mbox series

[2/2] kallsyms: expand symbol name into comment for debugging

Message ID 20230306101451.375844-2-arnd@kernel.org (mailing list archive)
State New, archived
Headers show
Series [1/2] kallsyms: add kallsyms_seqs_of_names to list of special symbols | expand

Commit Message

Arnd Bergmann March 6, 2023, 10:14 a.m. UTC
From: Arnd Bergmann <arnd@arndb.de>

The assembler output of kallsyms.c is not meant for people to understand,
and is generally not helpful when debugging "Inconsistent kallsyms data"
warnings. I have previously struggled with these, but found it helpful
to list which symbols changed between the first and second pass in the
.tmp_vmlinux.kallsyms*.S files.

As this file is preprocessed, it's possible to add a C-style multiline
comment with the full type/name tuple.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
No idea if there is already a better way to debug this kind of problem,
or if this causes a notable slowdown.
---
 scripts/kallsyms.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Masahiro Yamada March 7, 2023, 1:57 a.m. UTC | #1
On Mon, Mar 6, 2023 at 7:15 PM Arnd Bergmann <arnd@kernel.org> wrote:
>
> From: Arnd Bergmann <arnd@arndb.de>
>
> The assembler output of kallsyms.c is not meant for people to understand,
> and is generally not helpful when debugging "Inconsistent kallsyms data"
> warnings. I have previously struggled with these, but found it helpful
> to list which symbols changed between the first and second pass in the
> .tmp_vmlinux.kallsyms*.S files.
>
> As this file is preprocessed, it's possible to add a C-style multiline
> comment with the full type/name tuple.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> No idea if there is already a better way to debug this kind of problem,
> or if this causes a notable slowdown.
> ---
>  scripts/kallsyms.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
> index a239a87e7bec..ea1e3d3aaa6b 100644
> --- a/scripts/kallsyms.c
> +++ b/scripts/kallsyms.c
> @@ -525,7 +525,8 @@ static void write_src(void)
>                                         table[i]->addr);
>                                 exit(EXIT_FAILURE);
>                         }
> -                       printf("\t.long\t%#x\n", (int)offset);
> +                       expand_symbol(table[i]->sym, table[i]->len, buf);
> +                       printf("\t.long\t%#x    /* %s */\n", (int)offset, buf);




This is printed only for base_relative,
but ia64 will go away sooner or later,
so this seems good to me.

Applied to linux-kbuild. Thanks.











>                 } else if (!symbol_absolute(table[i])) {
>                         output_address(table[i]->addr);
>                 } else {
> --
> 2.39.2
>
diff mbox series

Patch

diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c
index a239a87e7bec..ea1e3d3aaa6b 100644
--- a/scripts/kallsyms.c
+++ b/scripts/kallsyms.c
@@ -525,7 +525,8 @@  static void write_src(void)
 					table[i]->addr);
 				exit(EXIT_FAILURE);
 			}
-			printf("\t.long\t%#x\n", (int)offset);
+			expand_symbol(table[i]->sym, table[i]->len, buf);
+			printf("\t.long\t%#x	/* %s */\n", (int)offset, buf);
 		} else if (!symbol_absolute(table[i])) {
 			output_address(table[i]->addr);
 		} else {