From f52625f1f29a87e94aa9d40e1b76be2d0ecedc10 Mon Sep 17 00:00:00 2001 From: Bruno Larsen Date: Thu, 15 Jun 2023 11:17:07 +0200 Subject: gdb/cli: Improve UX when using list with no args When using "list" with no arguments, GDB will first print the lines around where the inferior is stopped, then print the next N lines until reaching the end of file, at which point it warns the user "Line X out of range, file Y only has X-1 lines.". This is usually desirable, but if the user can no longer see the original line, they may have forgotten the current line or that a list command was used at all, making GDB's error message look cryptic. It was reported in bugzilla as PR cli/30497. This commit improves the user experience by changing the behavior of "list" slightly when a user passes no arguments. It now prints that the end of the file has been reached and recommends that the user use the command "list ." instead. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30497 Reviewed-By: Eli Zaretskii Approved-By: Tom Tromey --- gdb/doc/gdb.texinfo | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'gdb/doc') diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index 7619efe..20c9b24 100644 --- a/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo @@ -9144,7 +9144,9 @@ Print more lines. If the last lines printed were printed with a @code{list} command, this prints lines following the last lines printed; however, if the last line printed was a solitary line printed as part of displaying a stack frame (@pxref{Stack, ,Examining the -Stack}), this prints lines centered around that line. +Stack}), this prints lines centered around that line. If no +@code{list} command has been used and no solitary line was printed, +it prints the lines around the function @code{main}. @item list - Print lines just before the lines last printed. -- cgit v1.1