Add crash utility extension

Change-Id: Ia3dadecdd4605c3ee74d1b5242f67486c675faa7
This commit is contained in:
Dominique Martinet
2018-10-31 16:11:58 +09:00
committed by Dominique Martinet
parent 04c11f35e9
commit db4d19e419
3 changed files with 1480 additions and 0 deletions

35
tools/crash/README Normal file
View File

@@ -0,0 +1,35 @@
crash extension for mckernel
== BUILD ==
You can build it by installing the crash-devel package, or putting
the files here in the extensions directory of the crash sources, and
running `make -f mckernel.mk`
== USAGE ==
Either run 'extend path/to/mckernel.so' from within crash or run crash
with `CRASH_EXTENSIONS=path/to/dir crash -x`
You then need to tell crash about mckernel symbol with the `mcsymbols`
command:
crash> mcsymbols path/to/mckernel.img
Loading symbols from path/to/mckernel.img... OK.
If your mckernel.img is always at the same place, you can put the command
in a crashrc file and load everything automatically with -i, such as:
CRASH_EXTENSIONS=.../crash/extensions crash -x -i .../crashrc
At this point, you can use the various mckernel commands, as well as
regular linux crash commands:
crash> help | xargs -n 1 | grep -E '^mc'
mcmem
mcps
mcsymbols
mcvtop
mckmsg
Refer to the inline help of each command for their usage and examples.

1395
tools/crash/mckernel.c Normal file

File diff suppressed because it is too large Load Diff

50
tools/crash/mckernel.mk Normal file
View File

@@ -0,0 +1,50 @@
#
# Copyright (C) 2009, 2011, 2013 David Anderson
# Copyright (C) 2009, 2011, 2013 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
ifeq ($(shell arch), i686)
TARGET=X86
TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64
endif
ifeq ($(shell arch), ppc64)
TARGET=PPC64
TARGET_CFLAGS=-m64
endif
ifeq ($(shell arch), ppc64le)
TARGET=PPC64
TARGET_CFLAGS=-m64
endif
ifeq ($(shell arch), ia64)
TARGET=IA64
TARGET_CFLAGS=
endif
ifeq ($(shell arch), x86_64)
TARGET=X86_64
TARGET_CFLAGS=
endif
ifeq ($(shell /bin/ls ../defs.h 2> /dev/null), ../defs.h)
INCDIR=..
endif
ifeq ($(shell /bin/ls ./defs.h 2> /dev/null), ./defs.h)
INCDIR=.
endif
ifeq ($(shell /bin/ls /usr/include/crash/defs.h 2>/dev/null), /usr/include/crash/defs.h)
INCDIR=/usr/include/crash
endif
all: mckernel.so
mckernel.so: $(INCDIR)/defs.h mckernel.c
gcc -Wall -g -I$(INCDIR) -shared -rdynamic -o mckernel.so mckernel.c -fPIC -D$(TARGET) $(TARGET_CFLAGS) $(GDB_FLAGS)