public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "blarsen at redhat dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug cli/30497] New: Bad User Experience with multiple list commands reaching end of file
Date: Tue, 30 May 2023 11:04:26 +0000	[thread overview]
Message-ID: <bug-30497-4717@http.sourceware.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-05-30 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-30 11:04 blarsen at redhat dot com [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-30497-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).