android_kernel_google_msm/scripts
Sasha Levin 61223bca80 decode_stacktrace: make stack dump output useful again
Right now when people try to report issues in the kernel they send stack
dumps to eachother, which looks something like this:

  [    6.906437]  [<ffffffff811f0e90>] ? backtrace_test_irq_callback+0x20/0x20
  [    6.907121]  [<ffffffff84388ce8>] dump_stack+0x52/0x7f
  [    6.907640]  [<ffffffff811f0ec8>] backtrace_regression_test+0x38/0x110
  [    6.908281]  [<ffffffff813596a0>] ? proc_create_data+0xa0/0xd0
  [    6.908870]  [<ffffffff870a8040>] ? proc_modules_init+0x22/0x22
  [    6.909480]  [<ffffffff810020c2>] do_one_initcall+0xc2/0x1e0
  [...]

However, most of the text you get is pure garbage.

The only useful thing above is the function name.  Due to the amount of
different kernel code versions and various configurations being used,
the kernel address and the offset into the function are not really
helpful in determining where the problem actually occured.

Too often the result of someone looking at a stack dump is asking the
person who sent it for a translation for one or more 'addr2line'
translations.  Which slows down the entire process of debugging the
issue (and really annoying).

The decode_stacktrace script is an attempt to make the output more
useful and easy to work with by translating all kernel addresses in the
stack dump into line numbers.  Which means that the stack dump would
look like this:

  [  635.148361]  dump_stack (lib/dump_stack.c:52)
  [  635.149127]  warn_slowpath_common (kernel/panic.c:418)
  [  635.150214]  warn_slowpath_null (kernel/panic.c:453)
  [  635.151031]  _oalloc_pages_slowpath+0x6a/0x7d0
  [  635.152171]  ? zone_watermark_ok (mm/page_alloc.c:1728)
  [  635.152988]  ? get_page_from_freelist (mm/page_alloc.c:1939)
  [  635.154766]  __alloc_pages_nodemask (mm/page_alloc.c:2766)

It's pretty obvious why this is better than the previous stack dump
before.

Usage is pretty simple:

        ./decode_stacktrace.sh [vmlinux] [base path]

Where vmlinux is the vmlinux to extract line numbers from and base path
is the path that points to the root of the build tree, for example:

        ./decode_stacktrace.sh vmlinux /home/sasha/linux/ < input.log > output.log

The stack trace should be piped through it (I, for example, just pipe
the output of the serial console of my KVM test box through it).

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Change-Id: Ibd1b079d54d49b081a72f44136c3b6c478523fbb
2020-11-30 19:35:25 +03:00
..
basic
coccinelle Merge branch 'akpm' (Andrew's patch-bomb) 2012-04-05 15:30:34 -07:00
dtc scripts/dtc/libfdt: add integer overflow checks 2015-01-28 15:48:51 +00:00
genksyms scripts/genksyms: clean lex/yacc generated files 2012-01-08 14:48:15 +01:00
kconfig localmodconfig: Use Kbuild files too 2016-03-21 09:17:51 +08:00
ksymoops
mod Merge remote-tracking branch 'stable/linux-3.4.y' into lineage-15.1 2017-12-27 17:13:15 +03:00
package deb-pkg: Fix cross-building linux-headers package 2014-03-30 21:40:30 -07:00
rt-tester
selinux
tracing
.gitignore
bin2c.c
bloat-o-meter
bootgraph.pl
build-all.py Update copyright to The Linux Foundation 2013-03-15 17:07:39 -07:00
checkincludes.pl
checkkconfigsymbols.sh
checkpatch.pl checkpatch: Excuse reverts from "summary line over 75 characters" check 2013-03-07 15:20:03 -08:00
checkstack.pl
checksyscalls.sh checksyscalls: Use arch/x86/syscalls/syscall_32.tbl as source 2011-11-17 13:35:37 -08:00
checkversion.pl
cleanfile
cleanpatch
coccicheck coccicheck: change handling of C={1,2} when M= is set 2012-02-24 23:50:19 +01:00
config
conmakehash.c
decode_stacktrace.sh decode_stacktrace: make stack dump output useful again 2020-11-30 19:35:25 +03:00
decodecode
depmod.sh kbuild: do not check for ancient modutils tools 2012-01-23 15:12:19 +01:00
diffconfig
docproc.c
export_report.pl
extract-ikconfig
extract-vmlinux
gcc-goto.sh ARM: 7333/2: jump label: detect %c support for ARM 2012-03-24 09:38:56 +00:00
gcc-version.sh kbuild: Fix gcc -x syntax 2012-10-13 05:38:37 +09:00
gcc-wrapper.py Update copyright to The Linux Foundation 2013-03-15 17:07:39 -07:00
gcc-x86_32-has-stack-protector.sh kbuild: Fix gcc -x syntax 2012-10-13 05:38:37 +09:00
gcc-x86_64-has-stack-protector.sh kbuild: Fix gcc -x syntax 2012-10-13 05:38:37 +09:00
gen_initramfs_list.sh
get_maintainer.pl get_maintainer.pl: add support for moderated lists 2012-03-23 16:58:32 -07:00
gfp-translate
headerdep.pl
headers.sh kbuild, headers.sh: Don't make archheaders explicitly 2011-11-22 14:47:50 -08:00
headers_check.pl headers_check: recursively search for linux/types.h inclusion 2012-03-26 14:54:27 +02:00
headers_install.pl
kallsyms.c
Kbuild.include kbuild: Fix gcc -x syntax 2012-10-13 05:38:37 +09:00
kernel-doc kernel-doc: bugfix - multi-line macros 2013-10-01 09:10:52 -07:00
Lindent
Makefile x86, realmode: 16-bit real-mode code support for relocs tool 2012-05-18 19:49:40 -07:00
Makefile.asm-generic
Makefile.build kbuild: disable -Wmissing-field-initializers for W=1 2012-01-26 11:07:26 +01:00
Makefile.clean
Makefile.fwinst
Makefile.headersinst kbuild: Add support for installing generated asm headers 2011-11-17 13:14:36 -08:00
Makefile.help
Makefile.host
Makefile.lib Kbuild: centralize MKIMAGE and cmd_uimage definitions 2012-03-26 15:49:20 +02:00
Makefile.modbuiltin
Makefile.modinst
Makefile.modpost modpost: Make section mismatches an error 2013-02-20 02:49:31 -08:00
makelst
markup_oops.pl
mkcompile_h
mkmakefile
mksysmap
mkuboot.sh
mkversion
module-common.lds
namespace.pl
patch-kernel scripts/patch-kernel: digest kernel.org hosted .xz patches 2012-03-30 15:23:36 +02:00
pnmtologo.c
profile2linkerlist.pl
recordmcount.c ftrace/scripts: Fix incorrect use of sprintf in recordmcount 2016-10-26 23:15:42 +08:00
recordmcount.h recordmcount: Fix endianness handling bug for nop_mcount 2016-10-26 23:15:23 +08:00
recordmcount.pl scripts/recordmcount.pl: There is no -m32 gcc option on Super-H anymore 2015-04-14 17:33:54 +08:00
setlocalversion setlocalversion: Fix version when built/synced on a tag 2013-02-20 02:49:33 -08:00
show_delta
tags.sh sched: add macros to define bitops for task atomic flags 2014-12-01 18:02:38 +08:00
unifdef.c
ver_linux
xz_wrap.sh xz: Enable BCJ filters on SPARC and 32-bit x86 2012-04-18 13:13:18 -07:00