vscode-rdbg icon indicating copy to clipboard operation
vscode-rdbg copied to clipboard

Support to attach multiple sockets

Open ikhsan opened this issue 1 year ago • 3 comments

For https://github.com/ruby/vscode-rdbg/issues/372

  • Introduce a new adapter MultiSessionDebugAdapter where it emits events with all socket paths
  • Add a listener that subscribes to custom events that MultiSessionDebugAdapter emits, which attach it as a child process
  • This is enabled via supportAttachMultiSockets config

Screenshot

When running a rails server with 4 processes

Before After
Screenshot 2024-02-03 at 22 29 51 Screenshot 2024-02-03 at 22 31 41
when set tofalse, it defaults to the picker selector when set to true, it attaches all as child processes

ikhsan avatar Feb 03 '24 22:02 ikhsan

@ikhsan

Thank you for your work! Sorry, I'm not familiar with multiple process debugging. Can you please give me the sample project to experiment the behavior?

ono-max avatar Feb 24 '24 08:02 ono-max

@ono-max sure thing. I've created the demo app here: https://github.com/ikhsan/attach-multi-socket

Sorry, I'm not familiar with multiple process debugging.

The setup for multi process is here: https://github.com/ikhsan/attach-multi-socket/commit/7e65b1d57e27fa37d2c389a213886cb5824844a4. This is copied from our original app.

Steps

  • Copy and run the demo app, $ bundle install then $ bin/rails s
  • Run the extension with this branch, open the demo app
  • Without multi attach
    • Attach the app by clicking "Attach with rdbg"
      • The picker is shown (e.g. we need to pick one by one, bad dev experience) Screenshot 2024-02-25 at 02 32 46
  • With turning multi-attach
    • Enable the flag https://github.com/ikhsan/attach-multi-socket/blob/7e65b1d57e27fa37d2c389a213886cb5824844a4/.vscode/launch.json#L12-L13
    • Attach the app again by re-clicking "Attach with rdbg"
      • All process are automatically attached Screenshot 2024-02-25 at 02 33 11
    • Turn the breakpoint on the endpoint https://github.com/ikhsan/attach-multi-socket/blob/7e65b1d57e27fa37d2c389a213886cb5824844a4/app/controllers/debug_controller.rb#L3
    • Visit http://localhost:3000/debug/
      • Stopped at the breakpoint as normal Screenshot 2024-02-25 at 02 33 59

Let me know if the demo does or doesn't work 🙏

ikhsan avatar Feb 25 '24 02:02 ikhsan

Thank you for your work! Sorry, I'm not familiar with multiple process debugging. Can you please give me the sample project to experiment the behavior?

Hey @ono-max 👋 just want to touch point with you on this. Did you have the chance to try debugging with the demo app?

ikhsan avatar Apr 18 '24 10:04 ikhsan