debug icon indicating copy to clipboard operation
debug copied to clipboard

`rdbg` without no arguments

Open ko1 opened this issue 1 year ago • 3 comments

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 avatar Dec 05 '23 19:12 ko1

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 avatar Dec 05 '23 19:12 ko1

I agree that showing help is better 👍

st0012 avatar Dec 06 '23 10:12 st0012

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)
...

dentarg avatar Jun 18 '24 13:06 dentarg