Skip to content

Commit e97c4a2

Browse files
iii-iakpm00
authored andcommitted
scripts/gdb/symbols: factor out pagination_off()
Move the code that turns off pagination into a separate function. It will be useful later in order to prevent hangs when loading symbols for kernel image in physical memory during s390 early boot. 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 3545414 commit e97c4a2

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

scripts/gdb/linux/symbols.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,13 @@ def stop(self):
3838
# Disable pagination while reporting symbol (re-)loading.
3939
# The console input is blocked in this context so that we would
4040
# get stuck waiting for the user to acknowledge paged output.
41-
show_pagination = gdb.execute("show pagination", to_string=True)
42-
pagination = show_pagination.endswith("on.\n")
43-
gdb.execute("set pagination off")
44-
45-
if module_name in cmd.loaded_modules:
46-
gdb.write("refreshing all symbols to reload module "
47-
"'{0}'\n".format(module_name))
48-
cmd.load_all_symbols()
49-
else:
50-
cmd.load_module_symbols(module)
51-
52-
# restore pagination state
53-
gdb.execute("set pagination %s" % ("on" if pagination else "off"))
41+
with utils.pagination_off():
42+
if module_name in cmd.loaded_modules:
43+
gdb.write("refreshing all symbols to reload module "
44+
"'{0}'\n".format(module_name))
45+
cmd.load_all_symbols()
46+
else:
47+
cmd.load_module_symbols(module)
5448

5549
return False
5650

scripts/gdb/linux/utils.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,3 +260,14 @@ def get_vmlinux():
260260
obj.filename.endswith('vmlinux.debug')):
261261
vmlinux = obj.filename
262262
return vmlinux
263+
264+
265+
@contextlib.contextmanager
266+
def pagination_off():
267+
show_pagination = gdb.execute("show pagination", to_string=True)
268+
pagination = show_pagination.endswith("on.\n")
269+
gdb.execute("set pagination off")
270+
try:
271+
yield
272+
finally:
273+
gdb.execute("set pagination %s" % ("on" if pagination else "off"))

0 commit comments

Comments
 (0)