Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/20250515155811.114392-3-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>

authored by

Ilya Leoshkevich and committed by
Andrew Morton
e97c4a27 3545414f

+18 -13
+7 -13
scripts/gdb/linux/symbols.py
··· 38 38 # Disable pagination while reporting symbol (re-)loading. 39 39 # The console input is blocked in this context so that we would 40 40 # 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) 54 48 55 49 return False 56 50
+11
scripts/gdb/linux/utils.py
··· 260 260 obj.filename.endswith('vmlinux.debug')): 261 261 vmlinux = obj.filename 262 262 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"))