Skip to content

Commit

Permalink
scripts/gdb: disable pagination while printing from breakpoint handler
Browse files Browse the repository at this point in the history
While reporting the (refreshed) list of modules on automatic updates we
may hit the page boundary of the output console and cause a stop if
pagination is enabled.  However, gdb does not accept user input while
running over the breakpoint handler.  So we get stuck, and the user is
forced to interrupt gdb.

Resolve this by disabling pagination during automatic symbol updates.  We
restore the user's configuration once done.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Jason Wessel <jason.wessel@windriver.com>
Cc: Andi Kleen <andi@firstfloor.org>
Cc: Ben Widawsky <ben@bwidawsk.net>
Cc: Borislav Petkov <bp@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jan Kiszka authored and Linus Torvalds committed Feb 17, 2015
1 parent 158daf1 commit a9c5bcf
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions scripts/gdb/linux/symbols.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,23 @@ def stop(self):
# enforce update if object file is not found
cmd.module_files_updated = False

# Disable pagination while reporting symbol (re-)loading.
# The console input is blocked in this context so that we would
# get stuck waiting for the user to acknowledge paged output.
show_pagination = gdb.execute("show pagination", to_string=True)
pagination = show_pagination.endswith("on.\n")
gdb.execute("set pagination off")

if module_name in cmd.loaded_modules:
gdb.write("refreshing all symbols to reload module "
"'{0}'\n".format(module_name))
cmd.load_all_symbols()
else:
cmd.load_module_symbols(module)

# restore pagination state
gdb.execute("set pagination %s" % ("on" if pagination else "off"))

return False


Expand Down

0 comments on commit a9c5bcf

Please sign in to comment.