This repo reproduces an issue of the debug
gem as described below.
Breakpoints added via VS Code seems to be lost after Rails' code reload.
-
Clone this repo.
-
Run
$ bundle install
. -
Run
$ bundle exec bin/rails db:migrate RAILS_ENV=development
. -
Run
$ bundle exec rdbg -O -n -c -- bundle exec bin/rails s
to run the server with debugger in server mode. -
Press
F5
to attach VS Code to the debugger. -
Go to
app/controllers/posts_controller.rb
and place an VS Code breakpoint at line6
.def index @posts = Post.all # set the breakpoint at this line end
-
Verify the breakpoint can be hit:
- In browser, visit http://localhost:3000.
- See the breakpoint being hit.
- Press
F5
again to continue the program.
-
Add
puts "foo"
atapp/controllers/posts_controller.rb:6
def index puts "foo" @posts = Post.all end
-
Refresh the page in browser.
The breakpoint should still be hit.
The breakpoint would be ignored.
From DAP server logs, it looks like the debugger does receive updated setBreakpoints
request:
#25986:[>] {"command":"setBreakpoints","arguments":{"source":{"path":"/Users/hung-wulo/src/github.com/st0012/debug-issue/app/controllers/posts_controller.rb","name":"posts_controller.rb","sourceReference":0},"lines":[6],"breakpoints":[{"line":6}],"sourceModified":true},"type":"request","seq":13}
#25986:[<] {"type":"response","command":"setBreakpoints","request_seq":13,"success":true,"message":"Success","body":{"breakpoints":[{"verified":true}]},"seq":977}
But the breakpoint wasn't actually added.