diff options
author | 2025-05-15 17:52:11 +0200 | |
---|---|---|
committer | 2025-05-21 10:48:24 -0700 | |
commit | 3545414f2590177a76f86c985130dc4824d3adc9 (patch) | |
tree | dd3642ee221b1ae4771d844bd136a912ba5ba9c9 | |
parent | kernel/panic.c: format kernel-doc comments (diff) | |
download | linux-rng-3545414f2590177a76f86c985130dc4824d3adc9.tar.xz linux-rng-3545414f2590177a76f86c985130dc4824d3adc9.zip |
scripts/gdb/symbols: factor out get_vmlinux()
Patch series "scripts/gdb/symbols: determine KASLR offset on s390 during
early boot".
I noticed that debugging s390 early boot using the support I introduced in
commit 28939c3e9925 ("scripts/gdb/symbols: determine KASLR offset on
s390") does not work.
The reason is that decompressor does not provide the vmcoreinfo note, so
KASLR offset needs to be extracted in a different way, which this series
implements. Patches 1-2 are trivial refactorings, and patch 3 is the
implementation.
This patch (of 3):
Move the code that determines the current vmlinux file into a separate
function. It will be useful later in order to analyze the kernel image in
physical memory during s390 early boot.
Link: https://lkml.kernel.org/r/20250515155811.114392-1-iii@linux.ibm.com
Link: https://lkml.kernel.org/r/20250515155811.114392-2-iii@linux.ibm.com
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Kieran Bingham <kbingham@kernel.org>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
-rw-r--r-- | scripts/gdb/linux/symbols.py | 6 | ||||
-rw-r--r-- | scripts/gdb/linux/utils.py | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/scripts/gdb/linux/symbols.py b/scripts/gdb/linux/symbols.py index b255177301e9..25c4627c60e5 100644 --- a/scripts/gdb/linux/symbols.py +++ b/scripts/gdb/linux/symbols.py @@ -178,11 +178,7 @@ lx-symbols command.""" saved_states.append({'breakpoint': bp, 'enabled': bp.enabled}) # drop all current symbols and reload vmlinux - orig_vmlinux = 'vmlinux' - for obj in gdb.objfiles(): - if (obj.filename.endswith('vmlinux') or - obj.filename.endswith('vmlinux.debug')): - orig_vmlinux = obj.filename + orig_vmlinux = utils.get_vmlinux() gdb.execute("symbol-file", to_string=True) kerneloffset = get_kerneloffset() if kerneloffset is None: diff --git a/scripts/gdb/linux/utils.py b/scripts/gdb/linux/utils.py index 877404e92dbb..6e125830d3f2 100644 --- a/scripts/gdb/linux/utils.py +++ b/scripts/gdb/linux/utils.py @@ -251,3 +251,12 @@ def parse_vmcore(s): else: kerneloffset = int(match.group(1), 16) return VmCore(kerneloffset=kerneloffset) + + +def get_vmlinux(): + vmlinux = 'vmlinux' + for obj in gdb.objfiles(): + if (obj.filename.endswith('vmlinux') or + obj.filename.endswith('vmlinux.debug')): + vmlinux = obj.filename + return vmlinux |