Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
f29e1de
crash.types.task: improve task flag handling
jeffmahoney Apr 29, 2019
86422cb
crash.commands.ps: add support for TASK_IDLE
jeffmahoney Apr 29, 2019
68f6630
crash.commands.help: sort commands in help output
jeffmahoney Sep 19, 2018
4fb4c3a
crash.util: add struct_has_member
jeffmahoney Apr 29, 2019
7fe8aa7
crash.types.task: handle anonymous sub-structure in mm_struct
jeffmahoney Apr 29, 2019
b8de0ab
crash.util: add uuid decoding
jeffmahoney May 1, 2019
e75bc23
crash.util: add decode_flags helper
jeffmahoney Apr 26, 2019
81cb971
crash.types.{,k}list: use the type from the symbol when available
jeffmahoney Sep 19, 2018
736fdf7
crash.types.list: add list_empty
jeffmahoney Apr 26, 2019
df92870
crash.types.list: fix cycle tests
jeffmahoney Apr 22, 2019
87aec81
tests: clear file during test teardown
jeffmahoney Apr 22, 2019
ff7ef81
crash.kernel: convert setup to use DelayedSymvals
jeffmahoney Apr 22, 2019
a132e76
crash.arch: add baseline ppc64 support
jeffmahoney Apr 22, 2019
bbe3d6f
crash.types.bitmap: add find first/last/next helpers
jeffmahoney Apr 22, 2019
527e044
crash: use new gdb.Target to create standalone target
jeffmahoney Apr 22, 2019
afdd5b2
crash.types.module: create module for modules
jeffmahoney May 7, 2019
96be843
kdump.target: don't specify offset for .data..percpu
jeffmahoney May 1, 2019
fa71477
crash.types.percpu: handle missing pcpu_nr_slots
jeffmahoney May 6, 2019
c6ec4bc
crash.types.percpu: get_percpu_var, raise exception with passed val
jeffmahoney May 1, 2019
7502b34
crash.types.cpu: fix online cpu mask and add possible cpu mask
jeffmahoney May 7, 2019
36a58b8
crash.types.percpu: better percpu handling
jeffmahoney Apr 22, 2019
118bbfe
crash.types.percpu: separate the all-cpus and single-cpu cases
jeffmahoney May 21, 2019
7b38ed4
crash.types.percpu: add percpu_counter_sum
jeffmahoney Apr 30, 2019
a515eef
crash: auto-select crashing task and print backtrace on startup
jeffmahoney Apr 22, 2019
f6feb54
crash.sh: use $TMPDIR for gdbinit in --gdb mode
jeffmahoney May 1, 2019
fe1c40e
crash.kernel: use new KernelError exception to report errors during s…
jeffmahoney May 1, 2019
18707a4
crash.kernel: add debug option to load_modules
jeffmahoney May 1, 2019
823e505
crash.kernel: use objfile.has_symbols() to detect debuginfo
jeffmahoney May 1, 2019
58b7c35
crash.util: promote to be its own sub-package
jeffmahoney May 3, 2019
4175429
crash: add static percpu regions for modules
jeffmahoney May 1, 2019
40352e2
crash.kernel: handle failure to add module symbols
jeffmahoney May 1, 2019
9a86bc6
crash.kernel: improve and document debuginfo and module loading
jeffmahoney May 1, 2019
95b3d0d
crash.kernel: check module version on load
jeffmahoney Apr 26, 2019
917c3a9
crash.commands.task: allow 'task' command with no argument to show cu…
jeffmahoney May 2, 2019
a18e2b7
crash.infra.callbacks: explicitly connect to callbacks
jeffmahoney May 17, 2019
e0fa23e
crash.infra.lookup: move type name resolution into TypeCallback
jeffmahoney May 3, 2019
5dee123
crash.util.symbols: introduce simplified delayed lookups
jeffmahoney May 3, 2019
cc56e25
crash.subsystem.filesystem: add super_flags
jeffmahoney Apr 26, 2019
5f69e54
crash.subsystem.filesystem: add for_each_super_block, get_super_block
jeffmahoney Sep 18, 2018
7d72016
crash.subsystem.filesystem.mount: use type from symbol when available
jeffmahoney Sep 19, 2018
b4facc0
crash.subsystem.filesystem.mount: use crash.util.decode_flags
jeffmahoney May 4, 2019
b2817c9
crash.subsystem.filesystem: include sector number when describing dio…
jeffmahoney May 1, 2019
b7085be
crash.subsystem.{filesystem,storage}: refactor bio decoders
jeffmahoney May 3, 2019
c27620b
crash.types.vmstat: remove dead code
jeffmahoney May 6, 2019
fcb22c4
crash: remove CrashBaseClass
jeffmahoney May 3, 2019
30dd42b
crash.util: add more documentation
jeffmahoney May 20, 2019
65a7e06
crash: factor out task iteration
jeffmahoney May 7, 2019
abfd2dc
crash.commands: handle DelayedAttributeError gracefully
jeffmahoney May 8, 2019
62bb502
crash.commands.dmesg: handling dictionary string encoding better
jeffmahoney May 8, 2019
e7ff8dd
crash.types.slab: improve address printing
jeffmahoney May 9, 2019
6da88b1
crash.commands.kmem: use exceptions to exit command with error
jeffmahoney May 9, 2019
29ea504
crash.commands.kmem: fix argument parsing
jeffmahoney May 9, 2019
f2142e5
crash.commands.kmem: clean up some trivial things
jeffmahoney May 9, 2019
08749dd
crash.commands.ps: uncomment -G mode
jeffmahoney May 10, 2019
004ad94
crash: add kernel testing against vmcores
jeffmahoney May 7, 2019
cfac8fb
crash.types.classdev: update classdev iteration to use device_private
jeffmahoney May 7, 2019
39131e1
crash.subsystem.filesystems: add is_fstype_super and is_fstype_inode
jeffmahoney May 9, 2019
bfd2628
crash.subsystem.filesystem: document gdb.NotAvailableError
jeffmahoney May 15, 2019
c5691bf
crash.subsytem.filesystem.mount: add API documentation
jeffmahoney May 9, 2019
4e60c1c
crash.subsystem.filesystem.btrfs: add helpers for super, inode, and u…
jeffmahoney Apr 29, 2019
7e077de
crash.commands.btrfs: add basic btrfs command
jeffmahoney Sep 18, 2018
575d1ef
crash.subsystem.filesystem.xfs: Add basic XFS infra
jeffmahoney Sep 18, 2018
1522012
crash.commands.xfs: add basic xfs command
jeffmahoney Sep 18, 2018
5483d9f
crash.subsystem.storage.blocksq: add per-queue requests_in_flight call
jeffmahoney Apr 22, 2019
538acd1
crash.commands.lsmod: add basic lsmod command
jeffmahoney May 1, 2019
e7789d4
crash.types.task: get_stack_pointer should take thread_struct
jeffmahoney May 15, 2019
1d22d73
crash.types.task: add accessor-helpers
jeffmahoney May 15, 2019
af12734
crash.commands.ps: factor out formatting
jeffmahoney May 15, 2019
550c337
crash.cache.syscache: update config parsing
jeffmahoney May 9, 2019
d04844b
tests: silence as much noise as possible
jeffmahoney May 17, 2019
cb870bb
crash.util: fix get_typed_pointer semantics
jeffmahoney May 20, 2019
0f70ab1
crash.types.task: add documentation and static typing hints
jeffmahoney May 20, 2019
d6bc98b
crash: more documentation and typing
jeffmahoney May 21, 2019
2834470
WIP: Add initial support for "live" debugging
May 9, 2019
14529d1
WIP: Add new "kcore" target using "drgn" backend
sdimitro May 20, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
crash.kernel: improve and document debuginfo and module loading
In an ideal world, debuginfo packages would be installed under /usr/lib/debug
and gdb would locate debuginfo automatically.

Practically, this isn't the case.  Recent SUSE kernel debuginfo packages
don't create the symlinks for modules for automatic loading.  Even if they
did, the more common use case is to maintain a cache of debuginfo files
outside of /usr/lib/debug.  This commit improves the handling of the loading
of modules and debuginfo.  We have some sane defaults, documented in
crash.kernel and add some command line options to override those.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
  • Loading branch information
jeffmahoney committed May 21, 2019
commit 9a86bc6c55accb9babc39b105556cb27fe0fab0b
134 changes: 112 additions & 22 deletions crash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,98 @@

usage() {
cat <<END >&2
usage: $(basename $0) [-d|--search-dir <debuginfo/module dir>] <vmlinux> <vmcore>
usage: $(basename $0) [options] <vmlinux> <vmcore>

Debugging options:
--gdb Run the embedded gdb underneath a separate gdb instance.
This is useful for debugging issues in gdb that are seen
while running crash-python.
--valgrind Run the embedded gdb underneath valgrind.
This is useful for debugging memory leaks in gdb patches.
--nofiles Start up without loading any object files.
This is useful for testing delayed lookup error handling.
Options:
-r <dir> | --root <dir>
Use the specified directory as the root for all file searches. When
using properly configured .build-id symbolic links, this is the
best method to use as the debuginfo will be loaded automatically via
gdb without searching for filenames.

-m <dir> | --modules <dir>
Use the specified directory to search for modules

-d <dir> | --modules-debuginfo <dir>
Use the specified directory to search for module debuginfo

-D <dir> | --vmlinux-debuginfo <dir>
Use the specified directory to search for vmlinux debuginfo

-b <dir> | --build-dir <dir>
Use the specified directory as the root for all file searches. This
directory should be the root of a built kernel source tree. This is
shorthand for "-r <dir> -m . -d . -D ." and will override preceding
options.

Debugging options:
--debug
Enable noisy output for debugging the debugger
-v | --verbose
Enable verbose output for debugging the debugger
--gdb
Run the embedded gdb underneath a separate gdb instance. This is useful
for debugging issues in gdb that are seen while running crash-python.
--valgrind
Run the embedded gdb underneath valgrind. This is useful
for debugging memory leaks in gdb patches.
END
exit 1
}

TEMP=$(getopt -o 'd:h' --long 'search-dir:,gdb,valgrind,nofiles,help' -n "$(basename $0)" -- "$@")
TEMP=$(getopt -o 'vr:d:m:D:b:h' --long 'verbose,root:,modules-debuginfo:,modules:,vmlinux-debuginfo:,build-dir:,debug,gdb,valgrind,help' -n "$(basename $0)" -- "$@")

if [ $? -ne 0 ]; then
echo "Terminating." >&2
exit 1
usage
fi

eval set -- "$TEMP"
unset TEMP

VERBOSE=False
DEBUG=False

while true; do
case "$1" in
'-d'|'--search-dir')
SEARCHDIRS="$SEARCHDIRS $2"
'-r'|'--root')
SEARCH_DIRS="$SEARCH_DIRS $2"
shift 2
continue
;;
'-m'|'--modules')
MODULES="$MODULES $2"
shift 2
continue
;;
'-d'|'--modules-debuginfo')
MODULES_DEBUGINFO="$MODULES_DEBUGINFO $2"
shift 2
continue
;;
'-D'|'--vmlinux-debuginfo')
VMLINUX_DEBUGINFO="$VMLINUX_DEBUGINFO $2"
shift 2
continue
;;
'-b'|'--build-dir')
SEARCH_DIRS="$2"
VMLINUX_DEBUGINFO="."
MODULES="."
MODULES_DEBUGINFO="."
shift 2
continue
;;
'-v'|'--verbose')
VERBOSE="True"
shift
continue
;;
'--debug')
DEBUG="True"
shift
continue
;;

'--gdb')
DEBUGMODE=gdb
shift
Expand All @@ -45,11 +105,6 @@ while true; do
shift
continue
;;
'--nofiles')
NOFILES=yes
shift
continue
;;
'-h'|'--help')
usage ;;
'--')
Expand All @@ -63,7 +118,7 @@ while true; do
esac
done

if [ "$#" -ne 2 -a -z "$NOFILES" ]; then
if [ "$#" -ne 2 ]; then
usage
fi

Expand Down Expand Up @@ -111,7 +166,15 @@ else
fi

VMCORE=$2
for path in $SEARCH_DIRS; do
if test -n "$DFD"; then
DFD="$DFD:$path"
else
DFD="$path"
fi
done
cat << EOF >> $GDBINIT
set debug-file-directory $DFD:/usr/lib/debug
set build-id-verbose 0
set python print-stack full
set prompt py-crash>
Expand All @@ -132,13 +195,40 @@ import sys
import traceback
try:
import crash.session
from crash.kernel import CrashKernel
except RuntimeError as e:
print("crash-python: {}, exiting".format(str(e)), file=sys.stderr)
traceback.print_exc()
sys.exit(1)
path = "$SEARCHDIRS".split(' ')

roots = None
module_path = None
module_debuginfo_path = None
vmlinux_debuginfo = None
verbose=$VERBOSE
debug=$DEBUG

s = "$SEARCH_DIRS"
if len(s) > 0:
roots = s.split(" ")

s = "$VMLINUX_DEBUGINFO"
if len(s) > 0:
vmlinux_debuginfo = s.split(" ")

s = "$MODULES"
if len(s) > 0:
module_path = s.split(" ")

s = "$MODULES_DEBUGINFO"
if len(s) > 0:
module_debuginfo_path = s.split(" ")

try:
x = crash.session.Session(path)
kernel = CrashKernel(roots, vmlinux_debuginfo, module_path,
module_debuginfo_path, verbose, debug)

x = crash.session.Session(kernel, verbose=verbose, debug=debug)
print("The 'pyhelp' command will list the command extensions.")
except gdb.error as e:
print("crash-python: {}, exiting".format(str(e)), file=sys.stderr)
Expand Down
Loading