Skip to content

Commit 3545414

Browse files
iii-iakpm00
authored andcommitted
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 28939c3 ("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/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ilya Leoshkevich <[email protected]> Cc: Alexander Gordeev <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Jan Kiszka <[email protected]> Cc: Kieran Bingham <[email protected]> Cc: Vasily Gorbik <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 85915c6 commit 3545414

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

scripts/gdb/linux/symbols.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -178,11 +178,7 @@ def load_all_symbols(self):
178178
saved_states.append({'breakpoint': bp, 'enabled': bp.enabled})
179179

180180
# drop all current symbols and reload vmlinux
181-
orig_vmlinux = 'vmlinux'
182-
for obj in gdb.objfiles():
183-
if (obj.filename.endswith('vmlinux') or
184-
obj.filename.endswith('vmlinux.debug')):
185-
orig_vmlinux = obj.filename
181+
orig_vmlinux = utils.get_vmlinux()
186182
gdb.execute("symbol-file", to_string=True)
187183
kerneloffset = get_kerneloffset()
188184
if kerneloffset is None:

scripts/gdb/linux/utils.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,3 +251,12 @@ def parse_vmcore(s):
251251
else:
252252
kerneloffset = int(match.group(1), 16)
253253
return VmCore(kerneloffset=kerneloffset)
254+
255+
256+
def get_vmlinux():
257+
vmlinux = 'vmlinux'
258+
for obj in gdb.objfiles():
259+
if (obj.filename.endswith('vmlinux') or
260+
obj.filename.endswith('vmlinux.debug')):
261+
vmlinux = obj.filename
262+
return vmlinux

0 commit comments

Comments
 (0)