File tree Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Expand file tree Collapse file tree 2 files changed +18
-13
lines changed Original file line number Diff line number Diff line change @@ -38,19 +38,13 @@ def stop(self):
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
Original file line number Diff line number Diff line change @@ -260,3 +260,14 @@ def get_vmlinux():
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" ))
You can’t perform that action at this time.
0 commit comments