Skip to content

Commit

Permalink
ARM: reduce the information printed in call traces
Browse files Browse the repository at this point in the history
A while back, Linus complained about the numeric values printed by the
ARM backtracing code. Printing these values does not make sense if one
does not have access to the kernel ELF image (as is normally the case
when helping a third party on a mailing list), but if one does, they
can be very useful to find the code, rather than searching for the
function name, and then doing hex math to work out where the backtrace
entry is referring to.

Provide an option to control whether this information is included,
which will only be visible if EXPERT is enabled.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
  • Loading branch information
Russell King committed Dec 17, 2021
1 parent 3d14751 commit b0343ab
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
11 changes: 11 additions & 0 deletions arch/arm/Kconfig.debug
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ endchoice
config ARM_UNWIND
bool

config BACKTRACE_VERBOSE
bool "Verbose backtrace"
depends on EXPERT
help
When the kernel produces a warning or oops, the kernel prints a
trace of the call chain. This option controls whether we include
the numeric addresses or only include the symbolic information.

In most cases, say N here, unless you are intending to debug the
kernel and have access to the kernel binary image.

config FRAME_POINTER
bool

Expand Down
8 changes: 5 additions & 3 deletions arch/arm/kernel/traps.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,14 @@ void dump_backtrace_entry(unsigned long where, unsigned long from,
{
unsigned long end = frame + 4 + sizeof(struct pt_regs);

#ifdef CONFIG_KALLSYMS
#ifndef CONFIG_KALLSYMS
printk("%sFunction entered at [<%08lx>] from [<%08lx>]\n",
loglvl, where, from);
#elif defined CONFIG_BACKTRACE_VERBOSE
printk("%s[<%08lx>] (%ps) from [<%08lx>] (%pS)\n",
loglvl, where, (void *)where, from, (void *)from);
#else
printk("%sFunction entered at [<%08lx>] from [<%08lx>]\n",
loglvl, where, from);
printk("%s %ps from %pS\n", loglvl, (void *)where, (void *)from);
#endif

if (in_entry_text(from) && end <= ALIGN(frame, THREAD_SIZE))
Expand Down

0 comments on commit b0343ab

Please sign in to comment.