You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+89-25Lines changed: 89 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -91,49 +91,113 @@ You can modify this configuration, and also you can add your favorite configurat
91
91
92
92
You can use the following "launch" configurations.
93
93
94
-
*`script`: Script file name (default: active ruby file on VSCode)
95
-
*`command`: Executable command (default: `ruby`)
96
-
*`cwd`: Directory to execute the program in (default: `${workspaceFolder}`)
97
-
*`args`: Command line arguments passed to the program (default: `[]`)
98
-
*`env`: Additional environment variables to pass to the debugging (and debugged) process.
99
-
*`useBundler`: Execute Ruby programs with `bundle exec` if `command` configuration is not given and `Gemfile` is available in the workspace.
100
-
*`askParameters`: Ask "Debug command line" before debugging (default: `true`)
101
-
*`rdbgPath`: Location of the rdbg executable (default: `rdbg`).
102
-
*`debugPort`: On default (without `debugPort` configulation), open a UNIX Domain Socket with default name to communicate with debuggee. If you want to use another debug port, set this configuration.
103
-
*`12345`: open a TCP/IP debug port with port `12345`
104
-
*`hostname:12345`: open a TCP/IP port `12345` and hostname `hostname`
105
-
* Otherwize, open a UNIX Domain socket with given filename.
106
-
* Note that you can specify `0` TCP/IP port (choose usable port) with debug.gem v1.5.0 or later.
107
-
*`waitLaunchTime`: If you want to open TCP/IP debug port, you may need to wait for opening debug port. On default, it waits 1000 milli seconds (1 sec) but if it is not enough, please specify more wait time (default: `1000` in milli seconds). With debug.gem 1.5.0 and later you may not need this configulation.
108
-
*`localfs`: On TCP/IP, if target host is local machine, set `true` and you can open the file directly (default: `false`).
109
-
*`useTerminal`: Create a new terminal and then execute the debug command line there (default: `false`).
94
+
* Debuggee settings
95
+
*`script`
96
+
* A target script file name.
97
+
* default: an active ruby file on VSCode
98
+
*`command`
99
+
* Executable Ruby command. You can specify `bundle exec ruby` for example.
100
+
* default: `ruby`
101
+
*`cwd`
102
+
* Directory to execute the program in.
103
+
* default: `${workspaceFolder}`
104
+
*`args`
105
+
* Command line arguments passed to the program.
106
+
* default: `[]`
107
+
*`env`
108
+
* Additional environment variables to pass to the debugging (and debugged) process.
109
+
* default: N/A
110
+
*`useBundler`:
111
+
* Execute Ruby programs with `bundle exec` if `command` configuration is not given. and `Gemfile` is available in the workspace.
112
+
* Note that you can specify this `useBundler` by the extension configuration (default: true).
113
+
* default: undefined (and the extention configuration default value is `true`)
114
+
* Behavir settings
115
+
*`askParameters`
116
+
* Ask "Debug command line" before debugging. If the MAIN program is always same, set it false.
117
+
* Note that the last invoked command is rememberred.
118
+
* default: true
119
+
*`rdbgPath`
120
+
* Location of the rdbg executable.
121
+
* Note that you can specify this `rdbgPath` by the extension configuration (default: `rdbg`).
122
+
* default: `rdbg`
123
+
*`debugPort`
124
+
* On default (without `debugPort` configulation), open a UNIX Domain Socket with default name to communicate with debuggee. If you want to use another debug port, set this configuration.
125
+
*`12345`: open a TCP/IP debug port with port `12345`
126
+
*`hostname:12345`: open a TCP/IP port `12345` and hostname `hostname`
127
+
* Otherwize, open a UNIX Domain socket with given configuration.
128
+
* Note that you can specify `0` TCP/IP port (choose usable port) with debug.gem v1.5.0 or later.
129
+
*`waitLaunchTime`
130
+
* If you want to open TCP/IP debug port, you may need to wait for opening debug port. On default, it waits 1000 milli seconds (1 sec) but if it is not enough, please specify more wait time (default: `1000` in milli seconds).
131
+
* With debug.gem 1.5.0 and later you may not need this configulation.
132
+
*`localfs`
133
+
* On TCP/IP, if target host is local machine, set `true` and you can open the file directly
134
+
* default: false
135
+
*`useTerminal`
136
+
* If the configuration is true, create a new terminal and then execute the debug command line there. It is a bit slower.
137
+
* Otherwise, all outputs to the STDIN/OUT are shown in the DEBUG CONSOLE.
138
+
* If you need to use STDIN, please set this option.
139
+
* default: false
140
+
*`showProtocolLog`
141
+
* Prints all DAP communication log in "rdbg" output. This is for development of this extension.
142
+
* default: false
110
143
111
144
Note that if you have a trouble by launching `rdbg`, please try to specify `rdbgPath`. Without this configuration, this extension simply calls `rdbg` in PATH.
112
145
113
146
### Attach to the running Ruby process
114
147
115
148
You can attach to a Ruby process which run with an opening debugger port.
116
149
117
-
The following command starts the `foo.rb` with opening debug port. There are more methods to open the port. See more for [ruby/debug: Debugging functionality for Ruby](https://github.com/ruby/debug).
150
+
The following commands starts the `foo.rb` with opening debug port. There are more methods to open the port. See more for [ruby/debug: Debugging functionality for Ruby](https://github.com/ruby/debug).
118
151
119
152
```shell
120
-
$ rdbg --open foo.rb
153
+
# With rdbg command
154
+
$ rdbg --open foo.rb # open debug port. -O is short for --open
155
+
$ rdbg -n -O foo.rb # do not stop at the beggining of application
156
+
$ rdbg -O -c -- bundle exec rspec # run rspec with remote
157
+
158
+
# With debug/open lib
159
+
$ ruby -r debug/open foo.rb
160
+
$ ruby -r debug/open_nonstop foo.rb # do not stop at the beggining of application
161
+
162
+
# If your application requires debug/open (or debug/open_nonstop) explictly, of course -r is not needed.
163
+
$ ruby foo.rb
164
+
165
+
# With debug lib with RUBY_DEBUG_OPEN
166
+
$ RUBY_DEBUG_OPEN=true ruby -r debug foo.rb
167
+
168
+
# If your application requires debug explictly, of course -r is not needed.
169
+
$ RUBY_DEBUG_OPEN=true ruby foo.rb
170
+
171
+
# If your Gemfile has a line `gem 'debug'` with Rails, you only need to launch it with the `RUBY_DEBUG_OPEN` envval.
172
+
$ RUBY_DEBUG_OPEN=true raise server
121
173
```
122
174
123
175
After that, you can connect to the debug port. This extension searches opening debugger port and attach to that port by running `Attach with rdbg` (select it on the top of "RUN AND DEBUG" pane and push the green "Start Debugging" button).
124
176
125
177
You can specify the following "attach" configurations.
126
178
127
-
*`rdbgPath`: Same as `launch` request.
128
-
*`debugPort`: Same as `launch` request.
129
-
*`localfs`: Same as `launch` request.
130
-
*`localfsMap`: Specify pairs of remote root path and local root path like `/remote_dir:/local_dir`. You can specify multiple pairs like `/rem1:/loc1,/rem2:/loc2` by concatenating with `,`.
179
+
*`rdbgPath`
180
+
* Same as `launch` request.
181
+
*`debugPort`
182
+
* Same as `launch` request.
183
+
*`localfs`
184
+
* Same as `launch` request.
185
+
*`localfsMap`
186
+
* Specify pairs of remote root path and local root path like `/remote_dir:/local_dir` if sharing the same source reposiroty with local and remote computers.
187
+
* You can specify multiple pairs like `/rem1:/loc1,/rem2:/loc2` by concatenating with `,`.
188
+
* default: undefined
189
+
190
+
Without `debugPort` configuration, the
131
191
132
192
With `debugPort`, you can attach to TCP/IP debug port.
133
193
134
-
* Start with a TCP/IP debug port with `rdbg --open --port 12345 foo.rb`
135
-
* Add `debugPort: '12345'` attach configration.
136
-
* Choose `Attach with rdbg` and start attach debugging
194
+
* Start your debuggee command with a TCP/IP debug port with debug.gem configurations.
195
+
* Using `rdbg` command like: `rdbg --open --port 12345 foo.rb`
196
+
* Using `debug/open` lib: `RUBY_DEBUG_PORT=12345 ruby -r debug/open foo.rb`
197
+
* Using `debug` lib with `RUBY_DEBUG_OPEN` envval: `RUBY_DEBUG_OPEN=true RUBY_DEBUG_PORT=12345 ruby -r debug foo.rb`
198
+
* On VSCode (debugger-side):
199
+
* Add `debugPort: '12345'` attach configration.
200
+
* Choose `Attach with rdbg` and start attach debugging
137
201
138
202
`localfsMap` is helpful if you run the debuggee and share the same file system with another name in debuggee.
0 commit comments