nvim-dap-ruby icon indicating copy to clipboard operation
nvim-dap-ruby copied to clipboard

[Question] Session active, but not stopped at breakpoint

Open weizheheng opened this issue 3 years ago • 9 comments

Sorry for this question, I am pretty new to debugging ruby code in nvim with nvim-dap.

I have followed the setup instruction but nothing happens after I set a breakpoint and run :lua require'dap'.continue()

I am seeing Session active, but not stopped at breakpoint. Any idea why this is happening?

image

Debugging in a terminal with the debug gem seems fine, but would be awesome if I can get that experience in Neovim itself.

Thanks for the plugin!

weizheheng avatar Apr 15 '22 15:04 weizheheng

I'm having the same problem. I've installed this plugin and can set a breakpoint for dap, and I get the prompt to debug the current file, but when I do that nothing happens. Looking at nvim-dap debug logs, I confirm that the breakpoint is set, and that rspec is started. I get the same "Session active" as in the above screenshot when I try to continue again, and when I try a ".c" in the REPL. I don't know how to further interpret the dap debug logs, but everything seems to show success and nothing jumps out at me.

I've also tried adding a binding.b in my code, and that doesn't help. I can run rdbg from the command line and it stops with both binding.b and a manually set breakpoint with b file:line.

I've tried running a normal ruby file and running a spec, both using the appropriate option provided by this plugin; neither work.

Any further debugging tips would be appreciated!

bmulholland avatar Apr 25 '22 11:04 bmulholland

I found nvim-dap-ruby works fine with nvim-dap older version (Feb 4, 2022).

But I don't know what is the breaking change now. I'll investigate more.

suketa avatar Apr 30 '22 00:04 suketa

I found nvim-dap-ruby works fine with nvim-dap with commit https://github.com/mfussenegger/nvim-dap/commit/1de5f63228488fef93af22448ba2febad71a3a4f

but nvim-dap-ruby does not work well after commit https://github.com/mfussenegger/nvim-dap/commit/4446d77b75b41bae89a7d6d845f72333dcaba86a

I'll investigate more.

suketa avatar Apr 30 '22 00:04 suketa

Thanks for looking into that, I wouldn't have thought that nvim-dap could have broken this plugin. FYI: With https://github.com/mfussenegger/nvim-dap/commit/1de5f63228488fef93af22448ba2febad71a3a4f, I at least get a break at the beginning of file execution, though I do not get a break at a binding.b or a DAP breakpoint.

bmulholland avatar May 02 '22 12:05 bmulholland

I think it is expected behavior.

Could you try the following after break at the beginning of file execution?

  1. :lua require'dap'.repl.open()
  2. move cursor into opened buffer
  3. type i (move input mode and show dap> console)
  4. type .c

suketa avatar May 13 '22 10:05 suketa

Oh yeah, that does work. Interesting. lua require('dap').continue() does work sometimes too, but it seems to crash about half the time. Unfortunately I haven't managed to reproduce it with the repl open, so I can't diagnose. Gets me unblocked though: I can just open the repl and continue after I've done that. Thanks!

bmulholland avatar May 13 '22 11:05 bmulholland

I think https://github.com/mfussenegger/nvim-dap/pull/553 will fix this issue.

And https://github.com/suketa/nvim-dap-ruby/pull/12 will stop at breaking point at first.

Could you try ~~https://github.com/mfussenegger/nvim-dap/pull/553~~ latest nvim-dap, nvim-dap-ruby ?

suketa avatar May 14 '22 19:05 suketa

With the latest, weird things happen.

Setting a breakpoint on a spec and then running continue and selecting rspec (2) will run the spec (as verified by output in the repl) but not stop on a breakpoint I set (binding.b or a DAP breakpoint).

It does, however, occasionally open a file in rubocop (so far, twice it was lib/rubocop.rb and once lib/rubocop/ast/node_pattern/lexer.rb) and show as if the breakpoint is paused there... but then it continues running without pausing, finishes execution, and leaves vim with that random rubocop file open.

dap.log output:

[ WARN ] 2022-05-16T14:54:47Z+0200 ] ...nvim/site/pack/packer/start/nvim-dap/lua/dap/session.lua:598 ]	"No callback for "	{
  body = {
    allThreadsContinued = true
  },
  command = "continue",
  message = "Success",
  request_seq = 9,
  seq = 14,
  success = true,
  type = "response"
}

bmulholland avatar May 16 '22 12:05 bmulholland

I can't reproduce the behavior you said. Could you show me the simple spec file to reproduce it?

suketa avatar May 17 '22 11:05 suketa