Giter VIP home page Giter VIP logo

readapt's People

Contributors

antronin avatar bobbymcwho avatar castwide avatar gobijan avatar pyvesb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

readapt's Issues

Repl error for Ruby

I try to use this gem with Neovim 5.0 in Windows 10 and dap-neovim, but when i try to use the repl o receive the following issues

Debug adapter definition and debug configuration

:gem install readapt

local dap = require('dap')

dap.adapters.ruby = {
  type = 'executable';
  command = 'ruby.exe';
  args = {"C:\\Ruby3\\bin\\readapt", 'stdio'};
}

dap.configurations.ruby = {
  {
    type = 'ruby',
    request = 'launch',
    name = 'File',
    cwd = vim.fn.getcwd(),
    program = '${workspaceFolder}/main.rb',
  },
}

Debug adapter version

readapt 1.4.1

Steps to Reproduce

Set breakpoint
Start Debugger
Try print variable in repl

Expected Result

print variable in repl console

Actual Result

Oox7pRBXxk.mp4
dap>
dap> p ciao
"ciao"
"ciao"
#<Thread:0x0000000008b4e800 C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:104 run> terminated with exception (report_on_exception is true):
C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/message/variables.rb:7:in `ru
n': no implicit conversion of String into Integer (TypeError)
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/message.rb:38:in `process'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/adapter.rb:68:in `process'
	from C
:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/adapter.rb:39:in `block in opening'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/data_reader.rb:51:in `parse_message_from_buffer'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/reada
pt-1.4.1/lib/readapt/data_reader.rb:29:in `block in receive'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/data_reader.rb:24:in `each_char'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/data_reader.rb:24:in `receive
'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/readapt-1.4.1/lib/readapt/adapter.rb:48:in `receiving'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:66:in `tick'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport
/server/stdio.rb:23:in `update'
	from C:/Ruby3/lib/ruby/3.0.0/observer.rb:222:in `block in notify_observers'
	from C:/Ruby3/lib/ruby/3.0.0/observer.rb:221:in `each'
	from C:/Ruby3/lib/ruby/3.0.0/observer.rb:221:in `notify_observers'
	from C:/Ruby3/lib/rub
y/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:124:in `read_input'
	from C:/Ruby3/lib/ruby/gems/3.0.0/gems/backport-1.2.0/lib/backport/client.rb:105:in `block in run_input_thread'
dap> 

Support for eval in eclipse

ruby 3.0.0p0 (2020-12-25 revision 95aff21468) [x86_64-linux]
eclipse: Version: 2020-09 (4.17.0)
Entering a valid ruby expression in the eclipse console during debugging gives the following error in the eclipse console:
[NoMethodError] private method `eval' called for nil:NilClass
Where is this error coming from ?

Exception NoMethodError' at /.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/readapt-1.2.0/lib/readapt/frame.rb:13 - private method eval' called for nil:NilClass

Trouble installing on MacOS 13.1 + Ruby 3.2.0 (via rbenv)

Hi, happy new year and thanks for making this gem :)

I was trying to install it on MacOS 13.1 (22C65) with installed and agreed xcode commandline tools and rbenv ruby 3.2.0 (2022-12-25 revision a528908271) [arm64-darwin22]

Unfortunately I can't get it to install with Ruby 3.2.0. However I can install using Ruby 3.1.2.
Any clue how to fix this?

Here is the output:

โฏ gem install readapt                                                                                                   
Building native extensions. This could take a while...
ERROR:  Error installing readapt:
	ERROR: Failed to build gem native extension.

    current directory: /Users/bijan/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/readapt-1.4.4/ext/readapt
/Users/bijan/.rbenv/versions/3.2.0/bin/ruby -I /Users/bijan/.rbenv/versions/3.2.0/lib/ruby/site_ruby/3.2.0 extconf.rb
creating Makefile

current directory: /Users/bijan/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/readapt-1.4.4/ext/readapt
make DESTDIR\= sitearchdir\=./.gem.20230104-50495-5f0q9k sitelibdir\=./.gem.20230104-50495-5f0q9k clean

current directory: /Users/bijan/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/readapt-1.4.4/ext/readapt
make DESTDIR\= sitearchdir\=./.gem.20230104-50495-5f0q9k sitelibdir\=./.gem.20230104-50495-5f0q9k
compiling breakpoints.c
compiling frame.c
frame.c:131:57: error: use of undeclared identifier 'rb_cData'
    c_Frame = rb_define_class_under(m_Readapt, "Frame", rb_cData);
                                                        ^
1 error generated.
make: *** [frame.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/bijan/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/gems/readapt-1.4.4 for inspection.
Results logged to /Users/bijan/.rbenv/versions/3.2.0/lib/ruby/gems/3.2.0/extensions/arm64-darwin-22/3.2.0/readapt-1.4.4/gem_make.out

Not able to install if ruby engine is jruby

I am using jruby, tried to install readapt using gem install readapt but its failing.

Logs

Building native extensions.  This could take a while...
ERROR:  Error installing readapt:
        ERROR: Failed to build gem native extension.

    current directory: /Users/ankso/.rvm/gems/jruby-9.1.17.0/gems/readapt-1.0.0/ext/readapt
/Users/ankso/.rvm/rubies/jruby-9.1.17.0/bin/jruby -r ./siteconf20200429-58412-1qk4ftf.rb extconf.rb
creating Makefile

current directory: /Users/ankso/.rvm/gems/jruby-9.1.17.0/gems/readapt-1.0.0/ext/readapt
make "DESTDIR=" clean

current directory: /Users/ankso/.rvm/gems/jruby-9.1.17.0/gems/readapt-1.0.0/ext/readapt
make "DESTDIR="
make: *** No rule to make target `/Users/ankso/.rvm/rubies/jruby-9.1.17.0/lib/ruby/include/ruby/ruby.h', needed by `monitor.o'.  Stop.

make failed, exit code 2

Gem files will remain installed in /Users/ankso/.rvm/gems/jruby-9.1.17.0/gems/readapt-1.0.0 for inspection.
Results logged to /Users/ankso/.rvm/gems/jruby-9.1.17.0/extensions/universal-java-13/2.3.0/readapt-1.0.0/gem_make.out

Install on OSX Catalina.

macOS Catalina 10.15.1
$>ruby --version
ruby 2.5.3p105

$>gem install readapt
`
Fetching: backport-1.1.2.gem (100%)
Successfully installed backport-1.1.2
Fetching: thor-0.20.3.gem (100%)
Successfully installed thor-0.20.3
Fetching: readapt-0.8.0.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing readapt:
ERROR: Failed to build gem native extension.

current directory: /Users/vicben01/.rvm/gems/ruby-2.5.3/gems/readapt-0.8.0/ext/readapt

/Users/vicben01/.rvm/rubies/ruby-2.5.3/bin/ruby -r ./siteconf20191114-59641-1nn7hhg.rb extconf.rb
creating Makefile

current directory: /Users/vicben01/.rvm/gems/ruby-2.5.3/gems/readapt-0.8.0/ext/readapt
make "DESTDIR=" clean

current directory: /Users/vicben01/.rvm/gems/ruby-2.5.3/gems/readapt-0.8.0/ext/readapt
make "DESTDIR="
compiling breakpoints.c
compiling frame.c
compiling hash_table.c
compiling inspector.c
In file included from inspector.c:4:
In file included from ./threads.h:6:
./stack.h:12:3: error: typedef redefinition with different types ('struct stack_struct' vs 'struct __darwin_sigaltstack')
} stack_t;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/sys/_types/_sigaltstack.h:48:33: note: previous definition is here
typedef _STRUCT_SIGALTSTACK stack_t; /* [???] signal stack */
^
1 error generated.
make: *** [inspector.o] Error 1

make failed, exit code 2
`

"\\xE2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

I just started using readapt (1.1.0) in combination with the ruby-debug extension (0.3.5) in visual studio code. When running rails, I get a crash in readapt:

/home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/readapt-1.1.0/lib/readapt/output.rb:20:in to_json': "\\xE2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)

Does this ring a bell?

Full trace:

=> Booting Puma
=> Rails 6.0.3.4 application starting in development 
=> Run `rails server --help` for more startup options
W, [2020-11-20T10:05:43.105518 #291342]  WARN -- Skylight: [SKYLIGHT] [4.3.1] Running Skylight in development mode. No data will be reported until you deploy your app.
(To disable this message for all local apps, run `skylight disable_dev_warning`.)
Warning: method `snooze` already defined in Winkel::StoreOrderLinesController
Puma starting in single mode...
* Version 5.0.4 (ruby 2.7.0-p0), codename: Spoony Bard
* Min threads: 1, max threads: 1
* Environment: development
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop
Started GET "/admin/articles" for 127.0.0.1 at 2020-11-20 10:06:02 +0100
Processing by Admin::ArticlesController#index as HTML
#<Thread:0x000055c029d54a00 /home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:101 run> terminated with exception (report_on_exception is true):
/home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/readapt-1.1.0/lib/readapt/output.rb:20:in `to_json': "\\xE2" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/readapt-1.1.0/lib/readapt/output.rb:20:in `send_event'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/readapt-1.1.0/lib/readapt/output.rb:8:in `receiving'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:63:in `tick'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/server/stdio.rb:18:in `update'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/2.7.0/observer.rb:197:in `block in notify_observers'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/2.7.0/observer.rb:196:in `each'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/2.7.0/observer.rb:196:in `notify_observers'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:121:in `read_input'
	from /home/danny/.rbenv/versions/2.7.0/lib/ruby/gems/2.7.0/gems/backport-1.1.2/lib/backport/client.rb:102:in `block in run_input_thread'

Support for stdin/stdout communication

Hello @castwide!

Thanks for starting this project. I've had a quick play around with the debugger and it seems to work great. ๐Ÿ‘

If I'm not mistaken, Readapt currently only supports communication over a network socket. Are you planning on adding support for stdin and stdout, similarly to the solargraph stdio and solargraph socket variants? That would be very handy!

Thanks!

Pyves

Debugger doesn't seem to work any more with Ruby 3.3

Solargraph struggles to access a readapt which even runs, and when that is resolved, the solution doesn't actually work.

There are two issues in this report. Am uncertain which if either should be filed against readapt rather than solargraph. I filed PyvesB/eclipse-solargraph#31 and they seem to think the first issue is because a fix hasn't been published, and think the second issue is with the Readapt code.

First issue: The latest Solargraph seems to pull down a readapt version which is missing the rb_cData with rb_cObject fix:
7b209fe

This means the native extension does not compile.

c:\Ruby33-x64\lib\ruby\gems>gem install readapt
Fetching readapt-1.4.4.gem
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
ERROR: Error installing readapt:
ERROR: Failed to build gem native extension.
current directory: C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/readapt-1.4.4/ext/readapt
C:/Ruby33-x64/bin/ruby.exe extconf.rb
creating Makefile

current directory: C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/readapt-1.4.4/ext/readapt
make DESTDIR= sitearchdir=./.gem.20240310-22128-j61oje sitelibdir=./.gem.20240310-22128-j61oje clean

current directory: C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/readapt-1.4.4/ext/readapt
make DESTDIR= sitearchdir=./.gem.20240310-22128-j61oje sitelibdir=./.gem.20240310-22128-j61oje
generating readapt-x64-mingw-ucrt.def
compiling breakpoints.c
compiling frame.c
frame.c: In function 'initialize_frame':
frame.c:131:57: error: 'rb_cData' undeclared (first use in this function)
131 | c_Frame = rb_define_class_under(m_Readapt, "Frame", rb_cData);
| ^~~~~~~~
frame.c:131:57: note: each undeclared identifier is reported only once for each function it appears in
make: *** [Makefile:248: frame.o] Error 1

make failed, exit code 2

Gem files will remain installed in C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/readapt-1.4.4 for inspection.
Results logged to C:/Ruby33-x64/lib/ruby/gems/3.3.0/extensions/x64-mingw-ucrt/3.3.0/readapt-1.4.4/gem_make.out

I was able to get round this with help from https://stackoverflow.com/questions/16310793/how-to-avoid-the-source-being-overwritten-when-compiling-a-gem:

  1. doing a git clone from https://github.com/castwide/readapt (the head source does have the repair)
  2. gem build readapt.gemspec
  3. gem install readapt-1.4.4.gem

But then hit second issue.

Second issue: trying to start the debugger triggers these errors.

[TypeError] no implicit conversion of nil into String
internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb:127:in require' <internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in require'

I happen to be debugging a selenium test, which runs fine in Ruby directly (the thing I am troubleshooting connects to a DOM change in what I'm running against), but triggers this error when I try to run through Eclipse/SolarGraph/Readapt, meaning I don't get any interactive debugging.

The fault reproduces with this trivial rb file. Runs cleanly with 100% passed when run directly, but produces the error when run through solargraph/readapt

require "test/unit"

class Noop < Test::Unit::TestCase
def setup
end

def teardown
end

def test_main
end
end

It is not helped by the fact one of the messages gets truncated. There seems to be some kind of 355 character limit in the "output" lines. Eventually I found the Solargraph "Troubleshoot Readapt debugger by enabling adapter logs" checkbox. Hard to work out where this was going to put log messages, but eventually found the debug adapter logs had turned into JSON rather than raw text. But there's no real extra content:

Content-Length: 344

{"type":"response","request_seq":1,"success":true,"command":"initialize","body":{"supportsConfigurationDoneRequest":true,"exceptionBreakpointFilters":[{"filter":"raise","label":"Break on raised exceptions","description":"The debugger will break when an exception is raised, regardless of whether it is subsequently rescued.","default":false}]}}Content-Length: 38

{"type":"event","event":"initialized"}Content-Length: 79

{"type":"response","request_seq":2,"success":true,"command":"launch","body":{}}Content-Length: 90

{"type":"response","request_seq":3,"success":true,"command":"configurationDone","body":{}}Content-Length: 108

{"type":"event","event":"process","body":{"name":"<the full path to my rb file>"}}Content-Length: 74

{"type":"event","event":"thread","body":{"reason":"started","threadId":1}}Content-Length: 74

{"type":"event","event":"thread","body":{"reason":"started","threadId":1}}Content-Length: 129

{"type":"event","event":"output","body":{"output":"[TypeError] no implicit conversion of nil into String\n","category":"stderr"}}Content-Length: 331

{"type":"event","event":"output","body":{"output":"<internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:127:in require'\n\<internal:C:/Ruby33-x64/lib/ruby/3.3.0/rubygems/core_ext/kernel_require.rb\>:127:in require'\n<full path to one of my rb files>:2:in `<top (require","category":"stderr"}}Content-Length: 333

I've been using these extensions without too much trouble for years (9?!?), and have very much appreciated them, so am sad they have now broken, and am hopeful repair isn't too difficult?

Thank you!

Hi there! ๐Ÿ‘‹

This debugger has dramatically increased my productivity while working on a large codebase. I tried different projects and none worked as well as readapt + VSCode. I just wanted to thank you for all the great work! I also use solargraph and that's a fantastic project too, so thank you again :)

Thread id: 64 vs 32 bits?

Hi @castwide!

When responding to a Threads request, Readapt returns an id that may not fit within a 32-bit representation. On my macOS machine, I've for example seen a value of 70268739693720.

The Debug Adapter Specification states that this value should be of type number. However, this is incorrect, the actual specification source indicates integer. This discrepancy between the website and the source is tracked by this issue.

Unfortunately, the specification does not unambiguously state what an integer is in the context of the protocol, but many people seem to be leaning towards 32-bit values (see microsoft/debug-adapter-protocol#63 and microsoft/debug-adapter-protocol#90 as examples).

As far as implementations of the specification are concerned:

  • VS Code only supports 32-bit values. JavaScript can not handle numbers which do not fit within 52 bits, I believe values will overflow otherwise. This caused some subtle issues in the Python debug integration.
  • LSP4J, which is used in Eclipse, Netbeans and some IntelliJ plugins only supports 32-bit values and will fail to parse responses with larger numbers.

I found that the Threads response was built here:

Should the value be scaled down to a 32-bit value at this point? What are your thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.