Skip to content
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

rdbg without no arguments #1042

Open
ko1 opened this issue Dec 5, 2023 · 3 comments
Open

rdbg without no arguments #1042

ko1 opened this issue Dec 5, 2023 · 3 comments
Labels
enhancement New feature or request

Comments

@ko1
Copy link
Collaborator

ko1 commented Dec 5, 2023

Now rdbg without script waits script from STDIN:

[master]$ exe/rdbg
p 1 # Ctrl-D here to terminate input
# No sourcefile available for -
=>#0    <main> at -:1
(rdbg) n    # next command
1

But I think nobody use this feature so showing help (rdbg -h) seems better.

@ko1
Copy link
Collaborator Author

ko1 commented Dec 5, 2023

STDIN from pipe will not work because Reline needs input.

$ echo p 1 | exe/rdbg
# No sourcefile available for -
=>#0    <main> at -:1
#<Thread:0x00007f42ded32368@DEBUGGER__::SESSION@server /home/ko1/ruby/debug/lib/debug/session.rb:179 run> terminated with exception (report_on_exception is true):
/home/ko1/ruby/install/trunk/lib/ruby/3.3.0+0/reline/ansi.rb:152:in `raw': Inappropriate ioctl for device (Errno::ENOTTY)

BTW remote debugging works fine.

[master]$ echo p 1 | exe/rdbg -O
DEBUGGER: Debugger can attach via UNIX domain socket (/run/user/1000/rdbg-3543)
DEBUGGER: wait for debugger connection...
DEBUGGER: Connected.
1
DEBUGGER: Disconnected.

hmm. can be used by pipe command line tool?

@ko1 ko1 added the enhancement New feature or request label Dec 5, 2023
@st0012
Copy link
Member

st0012 commented Dec 6, 2023

I agree that showing help is better 👍

@dentarg
Copy link

dentarg commented Jun 18, 2024

But I think nobody use this feature

I would use it if it worked, to debug Rack/Puma on the fly:

$ echo 'app { |env| require "debug";debugger;[200, {}, ["OK"]] }' | puma --config /dev/stdin --port 0
Puma starting in single mode...
* Puma version: 6.4.2 (ruby 3.2.4-p170) ("The Eagle of Durango")
*  Min threads: 0
*  Max threads: 5
*  Environment: development
*          PID: 60630
* Listening on http://0.0.0.0:51168/
Use Ctrl-C to stop
# No sourcefile available for /dev/stdin
=>#0	block {|env={"rack.version"=>[1, 6], "rack.errors"=>...|} in _load_from at /dev/stdin:1
  #1	Puma::Configuration::ConfigMiddleware#call(env={"rack.version"=>[1, 6], "rack.errors"=>...) at ~/.arm64_rubies/3.2.4/lib/ruby/gems/3.2.0/gems/puma-6.4.2/lib/puma/configuration.rb:272
  # and 6 frames (use `bt' command for all frames)
▽#<Thread:0x0000000104ce37b8@DEBUGGER__::SESSION@server /Users/dentarg/.arm64_rubies/3.2.4/lib/ruby/gems/3.2.0/gems/debug-1.9.2/lib/debug/session.rb:179 run> terminated with exception (report_on_exception is true):
/Users/dentarg/.arm64_rubies/3.2.4/lib/ruby/gems/3.2.0/gems/reline-0.5.3/lib/reline/ansi.rb:284:in `pread': not opened for reading (IOError)
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

3 participants