On 8/5/21 10:42 AM, Jakob Cornell wrote:
Hi Alan, thanks for the input.
The gdb behavior is context dependent and not clear to me that it's
worth trying to add it to jdb.
Could you provide some more detail about the context upon which GDB's
behavior depends? And are you saying that my proposed changes aren't
worth adding, or that it's not worth replicating the exact behavior of
GDB? In my opinion a straightforward approximation of GDB's behavior
will be more convenient for users than the current behavior.
I believe only "list" and "x" have content dependent behavior. I'm not
sure of the list of commands that are purposefully not repeated, such as
"run".
If it is added then I think Chris is right that is might have to be
disabled by default as it could otherwise break existing
scripts/tests with empty lines. One place for configuration ~/.jdbrc
and it might be that it can only be enabled for interactive sessions.
Okay, so it sounds like rather than using a command line option you're
suggesting we create new JDB commands (e.g. `repeat' and `norepeat')
to enable/disable the feature, plus a check (`System.console() !=
null' perhaps?) that honors `repeat' only in an interactive session.
This sounds fine to me, although I suspect it becomes a lot more
difficult to test this feature when it doesn't work in non-interactive
sessions.
If usability is an issue then maybe it would be better to look at
jshell (the REPL that has been included since JDK 9). It makes us of
jline so you get better input navigation, history navigation, and tab
completion. I suspect there is an interesting project there.
Thanks for this tip; line editing is also on my wishlist for JDB, so I
would be interested in a jline integration. However, based on the JBS
discussion Chris seems to have sort of the opposite view; that a jline
integration likely isn't worth the effort whereas command repetition
may be. I would be interested in both, since I think automatic
repetition provides utility beyond line editing, and I would be
willing to work on both, but I want to make sure I end up with a
change that someone is willing to sponsor and review.
Yes, your last comment is part of what I was getting at when I said this
is probably not worth the effort. It will take a fair amount of review
effort, and as I pointed out in my previous email, in general jdb is not
high priority and we shouldn't be directing much of our time to it.
thanks,
Chris
Jakob