public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug cli/30497] New: Bad User Experience with multiple list commands reaching end of file
@ 2023-05-30 11:04 blarsen at redhat dot com
  2023-07-14  9:03 ` [Bug cli/30497] " cvs-commit at gcc dot gnu.org
  2023-07-14  9:06 ` blarsen at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: blarsen at redhat dot com @ 2023-05-30 11:04 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30497

            Bug ID: 30497
           Summary: Bad User Experience with multiple list commands
                    reaching end of file
           Product: gdb
           Version: HEAD
            Status: NEW
          Severity: normal
          Priority: P2
         Component: cli
          Assignee: unassigned at sourceware dot org
          Reporter: blarsen at redhat dot com
  Target Milestone: ---

A question was raised today on the Libera IRC instance where a user couldn't
understand the error raised by the list command. While the original user never
replied, it was mentioned that a possibly confusing UX would happen in the
following situation:

While debugging a file close to its end, for instance the following:
int main () {
  return 0;
}

starting the inferior, then trying the command list twice we get the following
session:
(gdb) list
1       int main(){
2           return 0;
3       }
(gdb) 
Line number 4 out of range; t.cc has 3 lines.

With this session, the error is pretty easy to understand, but if a user is in
a more complex session, having used "list" then run multiple other commands, to
a point where the user would like to see the current source location again,
they would get the error.

In my opinion, the ideal solution is that GDB should not continue listing the
program if the previous command was not "list", but reprint the current context
instead. If that isn't possible, adding a message like "end of file was
reached. Printing current context again" if there was no argument given to the
command "list" sounds like a decent work-around.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug cli/30497] Bad User Experience with multiple list commands reaching end of file
  2023-05-30 11:04 [Bug cli/30497] New: Bad User Experience with multiple list commands reaching end of file blarsen at redhat dot com
@ 2023-07-14  9:03 ` cvs-commit at gcc dot gnu.org
  2023-07-14  9:06 ` blarsen at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2023-07-14  9:03 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30497

--- Comment #1 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Bruno Larsen <blarsen@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=f52625f1f29a87e94aa9d40e1b76be2d0ecedc10

commit f52625f1f29a87e94aa9d40e1b76be2d0ecedc10
Author: Bruno Larsen <blarsen@redhat.com>
Date:   Thu Jun 15 11:17:07 2023 +0200

    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 <eliz@gnu.org>
    Approved-By: Tom Tromey <tom@tromey.com>

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug cli/30497] Bad User Experience with multiple list commands reaching end of file
  2023-05-30 11:04 [Bug cli/30497] New: Bad User Experience with multiple list commands reaching end of file blarsen at redhat dot com
  2023-07-14  9:03 ` [Bug cli/30497] " cvs-commit at gcc dot gnu.org
@ 2023-07-14  9:06 ` blarsen at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: blarsen at redhat dot com @ 2023-07-14  9:06 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=30497

B. Larsen <blarsen at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|NEW                         |RESOLVED

--- Comment #2 from B. Larsen <blarsen at redhat dot com> ---
That commit fixes it

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-07-14  9:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-30 11:04 [Bug cli/30497] New: Bad User Experience with multiple list commands reaching end of file blarsen at redhat dot com
2023-07-14  9:03 ` [Bug cli/30497] " cvs-commit at gcc dot gnu.org
2023-07-14  9:06 ` blarsen at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).