-
Notifications
You must be signed in to change notification settings - Fork 121
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add commands to start and use the debugger #449
Conversation
I like the idea but IMO we need to have more discussion before introducing these commands. Currently I have these questions:
Implementation-wise, I think we also need to figure how to write tests for them because the scenarios to consider will grow very fast. I also found that the
Given that we now have the Not directly related, but besides these commands a feature we can learn from
|
Same. It shouldn't be everything; you should use debug.gem directly if you want all. We need to hit a reasonable balance between convenience and maintainability. 20% of the features could cover 80% of the use cases, or something close enough to it. My ambition is always about making it a Pry alternative that is available by default. In this case it's about a pry-byebug alternative. So, looking at https://github.com/deivid-rodriguez/pry-byebug, I'd say
I personally prefer being a bit conservative about a single-char shorthand at least in the first release because As to supporting complicated features, as long as we can delegate that to debug.gem with a reasonable implementation cost, I think there's no reason to reject it. At least for the scope that could work by writing a simple
This should probably be discussed in a separate issue. Personally, the way I discover debug.gem's commands and pry-byebug's commands was to look at their README. Nothing stops us from writing a table like https://github.com/ruby/debug#debug-command-on-the-debug-console at the README on https://github.com/ruby/irb, and it seems like enough discoverability, at least for me.
Nice 👍 Agreed.
This was kind of half-intended; I didn't think I supported everything yet, but at the same time I knew this would work perfectly as soon as I write a small
So you're proposing to push it for another year (the whole point of this is to NOT write them in Gemfile; when you work on random OSS projects, you can only use what's installed by default) because we don't have isolated tests for it? If that's the only concern, I'll write a starter test code for each command. Again, with the presence of As soon as I started using |
Not just that. My concern is that with other supporting work (e.g. command documentation), issues like #445, and we're pretty short on time (1 month away from 3.2 release), I'm not sure if we can ship these commands in good shape and test them well. But I guess we can give a try because it does look like most of the problems may be on argument handling. However, I do feel strongly that we should make sure command documentation can be shipped along with this. So I just opened #450 |
Just to be clear, I'm not asking you to implement those non-
Thanks 👍 I'll give it a try, and give it up if it turns out to be too hard to write tests or fix the argument handling.
👍 |
After using the
|
^ Sorry that I probably shouldn't post issues command-by-command. It's pretty late here and I didn't think it though 😅 I'll test other commands and post what I found together. |
Thanks for your time! Have a good night.
Yes, it's the intended behavior (again, at least for Ruby 3.2. It could be changed once we have |
Let me get this straight. So far we've discussed two ways to introduce debugger commands to IRB:
And I'm proposing to implement only option 1 in Ruby 3.2, and potentially improving it to option 2 in Ruby 3.3 or later. I already spent time experimenting with option 2 and then left this comment #425 (comment). I gave up option 2 for Ruby 3.2. However, after that effort and playing with your |
e0563e4
to
ca62e66
Compare
I addressed all your concerns. This is working really well, even more than I initially expected. I don't see any reason to avoid shipping this in Ruby 3.2 at this point. Please have another look :) |
Thanks for all the updated and explanation 🙏
I think I get it now: these commands are to save typing (When I saw "Seamlessly integrate", my immediate expectation was If my current understanding is correct, I think we can also add:
|
Yeah, sorry about the confusion.
done c347b4e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the implementation looks good 👍
But I'm concerned about testing the commands with yamatanooroti
. It and its dependency vterm are both not under ruby
's control, so if they have problems going forward, we won't be able to fix them.
I think it's fine to keep and maintain the current tests but ideally we shouldn't add new tests with them, especially when these tests seem to be less-demanding on terminal setup. WDYT?
Also, can you help me setup vterm
on Mac (with libvterm
installed)? I got these errors when installing it:
current directory: /Users/hung-wulo/.gem/ruby/3.1.2/gems/vterm-0.0.5/ext/vterm
/opt/rubies/3.1.2/bin/ruby -I /opt/rubies/3.1.2/lib/ruby/3.1.0 -r ./siteconf20221120-15782-673e37.rb extconf.rb
checking for vterm.h... no
checking for vterm_new() in -lvterm... no
creating Makefile
current directory: /Users/hung-wulo/.gem/ruby/3.1.2/gems/vterm-0.0.5/ext/vterm
make DESTDIR\= clean
current directory: /Users/hung-wulo/.gem/ruby/3.1.2/gems/vterm-0.0.5/ext/vterm
make DESTDIR\=
compiling vterm.c
vterm.c:10:10: fatal error: 'vterm.h' file not found
#include "vterm.h"
^~~~~~~~~
1 error generated.
make: *** [vterm.o] Error 1
make failed, exit code 2
Thanks! Now that Koichi has merged ruby/debug@87b1fab as well, I'll merge this PR. Since this PR is already too big, I think your last point, adding a new console test framework to IRB, should be addressed in a separate PR. In fact, #456 is bigger than this 😅 Let's merge the test cases we already have, and then replace the framework.
Yup, agreed. I gave a shot at it #456. It's currently not working, but you're an expert in that framework and I think you already know the contexts to make it work. Could you have a look at it from there once you come back from a vacation? Please feel free to just abandon the PR and open another one if that's easier.
I use Mac only when I write YJIT, so I actually don't have the answer. But I can still ask: with "libvterm installed", do you mean you have a libvterm installation that has vterm headers, not just the library to be linked? You can check if vterm.h exists under the installation prefix, and try installing another package with headers if you don't find it. Also, if you haven't done that yet, you could also try doing the same thing as what CI does. It's for Ubuntu, but it's just building it from a .tar.gz file. |
(ruby/irb#449) * Seamlessly integrate a few debug commands * Improve the break command support * Utilize skip_src option if available * Add step and delete commands * Write end-to-end tests for each debugger command * Add documentation * Add backtrace, info, catch commands ruby/irb@976100c1c2
As discussed in ruby#449 (review), we should avoid adding new tests that need yamatanooroti because it's not maintained by the Ruby org. And since debug commands are now tested in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.
As discussed in ruby#449 (review), we should avoid adding new tests that need yamatanooroti because it's not maintained by the Ruby org. And since debug commands are now tested in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.
As discussed in ruby#449 (review), we should avoid adding new tests that need yamatanooroti because it's not maintained by the Ruby org. And since debug commands are now tested in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.
As discussed in ruby#449 (review), we should avoid adding new tests that need yamatanooroti because it's not maintained by the Ruby org. And since debug commands are now tested in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.
As discussed in ruby#449 (review), we should avoid adding new tests that need yamatanooroti because it's not maintained by the Ruby org. And since debug commands are now tested in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore.
* Add debug command tests that don't require yamatanooroti * Remove debug command related yamatanooroti tests As discussed in #449 (review), we should avoid adding new tests that need yamatanooroti because it's not maintained by the Ruby org. And since debug commands are now tested in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore. * Test against latest debug gem
(ruby/irb#464) * Add debug command tests that don't require yamatanooroti * Remove debug command related yamatanooroti tests As discussed in ruby/irb#449 (review), we should avoid adding new tests that need yamatanooroti because it's not maintained by the Ruby org. And since debug commands are now tested in `test/irb/test_debug_cmd.rb`, we don't need these tests anymore. * Test against latest debug gem ruby/irb@78a8aa8834
This PR adds the following IRB commands that start the debugger and seamlessly run the command at the same time:
break
delete
next
step
continue
finish
backtrace
info
catch
Given that we're trying to make debug.gem a superset of IRB functionality #446 (comment), there should be few issues in switching to debug.gem.