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
byebug improvements #263
Comments
* all fail stepping into/next/continue-to-brk-pt in Shoes.app
After looking at the byebug 8.2.2 code - things are broken for # some tests of debugging
# next over:
one = 1
two = "two"
Shoes.app do
stack do
para one
para two
flow do
button "rdb" do
require 'byebug'
byebug
para "rdb: #{one} #{two}"
end
end
end
end using -d and terminal launch of shoes/cshoes you can step through ruby upto the Shoes.app. # next over:
require 'byebug'
byebug
one = 1 and terminal launch w/o -d then byebug can step into shoes.app , set break points and |
Set priority to low. Nobody is using it or they would have complained, |
I didnt know Shoes had debuger. I think it will be very nice to use ! |
@dredknight , the debugger can be confusing and illuminating in Shoes because of those blocks and how Shoes execute things. If it's mostly just Ruby, it works pretty well. There is a lot of power in byebug but it takes some learning and thinking which I'm just starting to acquire. |
Updated the wiki a bit, as I really learn what works. |
* -d is going away since it's trivial for the user to enable their script for debugging with their own command line parsing. see
* eliminate -d as command line arg. * see https://github.com/Shoes3/shoes3/wiki/Debugging-with-Byebug
Something I've wished for since I first started working on Shoes. Debugging Shoes internals in Ruby: Currently on branch 'sdb'. OSX might be a problem but this is pretty secret voodoo that only insiders care about.
You can set breakpoints on files not currently loaded (if you supply the right path) so --sdb it can be used for debugging user scripts too. |
* of course --sdb does what -d was intended to do. DUH! delete --sdb and use -d
* Duh! Can't require byebug until after shoes has run cache.rb Unless it's loose shoes and you have byebug installed - head fake.
@ccoupe for President ! |
One problem. irb tries to alias exit and Shoes is not co-operating. Perhaps quit too. Not sure how to fix that but until I do the only way to get out of byebug->irb is |
That one problem is a big problem involving deep deep do-do about exit and quit. Been in there. don't want to be there. irb and pry commands should be disabled from byebug if in Shoes. Even when Shoes exit and quit are modified for irb, it does the wrong thing (for a Shoes scripter). Not worth fixing and I'm not sure it can be fixed. |
Branch 'sdb': When starting up normally -- SHOES_DEBUG == false, then exit and quit point to the Shoes redefined method - shoes_app_quit. When SHOES_DEBUG == true ( from command line -d ) then exit and quit do not point to Shoes. They point to base Ruby (or byebug invoked irb) definitions of quit and exit. This affects Shoes scripts being debugged if they call quit or exit -- they'll log an error to the Shoes console (aka log.rb). Use the window close widget. This is not optimal. But, you can invoke irb from byebug if Shoes was started -d. I strongly suggest you do not use irb but you can get Shoes.APPS and probably get Still on branch Please discuss - @backorder, @passenger94 ? My thoughts: Aside from the byebug/irb mess Shoes should not redefine Ruby exit and quit. It was a clever hack back in the old times. But it is a hack and not every hack can be carried into the future. It's not like Ruby is standing still. |
* backwards compatible. * prepare for new API #263
Branch master: Through the magic of Shoes, inheritance and duck typing we always could have called Shoes.quit and Shoes.exit. Who knew? This make the proposed API transition not so terrible. |
This means, no breakage ? |
No, there is still breakage. Byebug and irb really doesn't like how Shoes has defined exit and quit in Ruby kernel. It's easy enough to not create them when running -d. Not so easy (impossible?) if running remote byebug. If shoes doesn't override exit and quit when running -d then the only way to exit is the window close button or by calling Shoes.exit or Shoes.quit - which just happens to work already in Shoes 3.3.1 whether the sdb branch is merged to master or not. In short, I'm proposing moving Shoes quit/exit from Ruby kernel space to Shoes.space. That breaks the API. Shoes.space has all kinds of oddities like fullscreen and terminal ... exit and quit fit there reasonably well. While it is clever to redefine Kernel and Object methods, it is a hack just waiting for a Ruby API change to break things - and they do change things down in the kernel. IMO, I think it is worth the user pain to fix any Shoes scripts that explicitly call exit or quit. It's not a lot of pain and users can start now. FWIW, the quit method is not documented in the manual and the description of exit is worth reading. Now that I've some more time to ponder, I think I think irb is pretty useless in Shoes because it is confusing down there inside Shoes, but that's just me and I suspect some .irbrc settings /macros/new shoes apis might make it easier. I don't see pry being useful in a Shoes context but I could be wrong and I don't want to close the door on either of them if someone wants them enough to do that work. |
One side benefit to getting -d working: There is no good reason (IMO) to have remote debug which was damn clunky at it's best. There are still some puzzles with exit, should it be called from Shoes (branch sdb). Must think more. |
* but they may not work if the debugger is active
I think I've got a new position: exit and quit will work as always (backwards compatible) until you use byebug either from -d or invoking it in a script. Then quit and exit may not close the windows and exit the app. Use the window decorator. If you get stuck in irb without a working quit and exit, ^D will get you back to byebug. If your code needs the debugger and therefore the command line, you can handle some inconsistency in quit/exit behavior. You can and should use Shoes.quit because it works in all those situations. FYI, in ruby.c where we do |
* completly out out my depth. How to draw wedges? Anybody want to take that on. I don't * So many chart things could be done but (and known bugs do exist) we have to think about "does anyone care?" And diminishing returns.
Closed in Shoes 3.3.2 |
Now that osx, linux and windows have working launch scripts and we can depend on the underlying native console, we should try again to get `-d script.rb' working. Note that would only work for console launch. This issue has nothing to do with Shoes.terminal (because that's never going to be a readline compatible thing.
cshoes -d [script.rb]
and or./dist/shoes
or other command line invocations like cshoes.exe should work. First is to get the command line parsed. Then get byebug to white-list the GUI threads from being suspended. While remote debugger mostly works, it could be easier . Lastly 'debugging' from the splash screen doesn't actually work. Yet.That thread white-list is dependent on byebug - it's a fairly active project with responsive maintainers so I'm sure we can get this figured out.
The text was updated successfully, but these errors were encountered: