Skip to content

Proposal: Report relative paths to VS Code to support remote debugging #463

Closed

Description

@jvilk-stripe

Your proposal

rdbg reports absolute file paths to files on disk to VS Code. If rdbg had an option to report file paths relative to a specific root directory, then it could support remote debugging in VS Code across multiple machines.

Additional context

In our remote debugging setup, VS Code runs on one machine, but the process being debugged is on a second machine. Both computers have the same source tree, but at different absolute file paths.

Activity

  1. ko1 commented on Dec 27, 2021

    @ko1
    Collaborator

    Sorry I couldn't understand your proposal.

    Understood:

    • You have two machines, which have same src tree but different absolute path.
    • For VSCode integration (DAP support) we use absolute path.

    Couldn't understand:

    • VSCode support remote login and it mounts remote directory. How to use the absolute path from rdbg on other (host?) machine?
  2. jvilk-stripe commented on Dec 27, 2021

    @jvilk-stripe
    Author

    You have two machines, which have same src tree but different absolute path.

    Correct!

    VSCode support remote login and it mounts remote directory. How to use the absolute path from rdbg on other (host?) machine?

    We are not using VS Code's remote login support. We need rdbg to report relative paths so that they resolve on the machine running VS Code.

    I hope that makes things clearer!

  3. jvilk-stripe commented on Dec 27, 2021

    @jvilk-stripe
    Author

    I might be able to contribute this feature if you feel OK with it.

  4. ko1 commented on Dec 28, 2021

    @ko1
    Collaborator

    Sorry I couldn't understand yet.

    Assume
    (1) machine M1 has src tree.
    (2) machine M2 also has src tree.

    Q1. Where do you want to run the VSCode and rdbg?
    Q2. Now VSCode integration using UNIX Domain socket and it can not connect to the different macine (ex: M1 -> M2). How to connect it?

  5. jez commented on Mar 1, 2022

    @jez

    👋 I work with jvilk at Stripe, so I can help answer some of these question for him:

    Q1. Where do you want to run the VSCode and rdbg?

    VS Code is open on a laptop, editing local files on the laptop (in our case, running macOS). VS Code is not using built-in remote development support. The files being edited have paths like /Users/jez/stripe/pay-server/...

    When edits happen to files open in VS Code, they get saved to the local (laptop) file system. A custom script running watchman and rsync will notice file changes and send the new files to a remote development machine (in our case, running Ubuntu). It will sync the files to a folder like /pay/src/pay-server/...

    Meanwhile, rdbg will be running the code on the remote development machine. The file contents will be the same as those on the laptop, but the files will have different absolute paths.

    Q2. Now VSCode integration using UNIX Domain socket and it can not connect to the different macine (ex: M1 -> M2). How to connect it?

    The plan is to use TCP/IP to connect to it. The rdbg process will bind to a port on the remote linux machine, and we will connect to it like jez-dev-machine.<stripe-intranet-domain>:$RUBY_DEBUG_PORT. It's secure because the <stripe-intranet-domain> is not available to the public internet—we have a custom proxy server that will allow connecting directly to the TCP port on the remote linux machine from the macOS laptop over TCP.

    Basically, to rdbg's eyes, it looks the same as if it were bound to localhost on the linux remote development machine. The only problem is that it has to work with relative paths like lib/foo.rb when setting breakpoints, instead of absolute paths.

    Please let me know if that helps clear things up, or if it makes it more confusing.

  6. ko1 commented on Mar 20, 2022

    @ko1
    Collaborator

    Ok, I understand the situation.

    There are several points the full-path is shown.

      1. DAP event
      1. backtrace of caused exception in Ruby
    • (and maybe another points)

    Do you want to solve case 1?

  7. jez commented on Mar 21, 2022

    @jez

    Yes I believe that the DAP event case is what we care about.

  8. ko1 commented on Mar 21, 2022

    @ko1
    Collaborator

    All right. It's clear. We can support by debug.gem or vscode-rdbg (maybe), let me take a time to consider about it.

  9. jez commented on Mar 21, 2022

    @jez

    Thanks! If there’s anything I can ever help answer, or you’d like us to test something out, please don’t hesitate to @mention me.

  10. added this to the v1.6.0 milestone on Mar 25, 2022
  11. firien commented on Apr 21, 2022

    @firien

    All right. It's clear. We can support by debug.gem or vscode-rdbg (maybe), let me take a time to consider about it.

    here is the (start of) vscode-rdbg solution: ruby/vscode-rdbg#42

  12. mbsmartee commented on Jun 10, 2022

    @mbsmartee

    +1 This is important for teams using VSCode and Docker setups too.

  13. booleanbetrayal commented on Jun 22, 2022

    @booleanbetrayal

    We are running into the inability to use the official debugger running in Docker in tandem with VSCode due to this path resolution issue. We're currently tracking @firien 's implementation but would not be opposed to an upstream fix in the Gem if possible, either. =]

  14. added a commit that references this issue on Jul 6, 2022
  15. added a commit that references this issue on Jul 6, 2022
  16. added a commit that references this issue on Jul 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions