code-debug icon indicating copy to clipboard operation
code-debug copied to clipboard

Does this extension support Remote SSH mode (the MS addon)?

Open Darker opened this issue 3 years ago • 1 comments

VS Code supoorts remote development via SSH tunnel and that is what I am currently using. Here is the description of the feature: https://code.visualstudio.com/docs/remote/ssh

The way I understand it, extensions should generally be unaware of this and think they are running on the remote machine.

With that in mind, I set up the launch config as if it was a local GDB launch:

        {
            "type": "gdb",
            "request": "launch",
            "name": "Debug bootcamp",
            "target": "../build/myexecutable",
            "cwd": "${workspaceRoot}",
            "valuesFormatting": "parseText"
        }

However, I get no results. When I start the debugging, the Debug console will show "Running executable" in orange text and nothing else will really happen. On the top side of the screen, I can see the Pause/Step/Stop controls, but pause does not really do anything.

So is this compatible with the remote SSH feature, or do I have to use GDB server? Obviously using GDB directly would be nicer as it does not require additional config of hostname and port.

Darker avatar Jul 11 '22 13:07 Darker

It depends on the question where the debug extension is executed, if it is on the remote then your setup should work (but it would help to have full logs to verify what is actually happen - to do so add the following to your launch.json:

			"stopOnEntry": true, // only to ensure that you did not miss to set a breakpoint and the program runs in a loop
			"showDevDebugOutput": true, "printCalls": true,  // full logging

But in any case: using this extension does not need GDB server, or non-free other extensions as you can use ssh to debug a remote directly.

GitMensch avatar Jul 11 '22 13:07 GitMensch

Are there any other ways to debug this extension on SSH mode?

  • I have my vscode connected via SSH to remote machine.
  • I have Native Debug extension installed on remote.
  • My launch configuration is:
{
	"type": "gdb",
	"request": "launch",
	"name": "Launch UT",
	"target": "/path/to/project/build/unitTests",
	"cwd": "/path/to/project",
	"valuesFormatting": "parseText",
	"internalConsoleOptions": "openOnSessionStart",
	"stopAtEntry": true,
	"showDevDebugOutput": true,
	"printCalls": true
}

When I choose image

Then nothing happens and on vscode's DEBUG CONSOLE I can see:

1-gdb-set target-async on
2-list-features
3-environment-directory "/path/to/project"
4-file-exec-and-symbols "/path/to/project/build/unitTests"
GDB -> App: {"outOfBandRecord":[{"isStream":false,"type":"notify","asyncClass":"thread-group-added","output":[["id","i1"]]}]}
GDB -> App: {"token":1,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[]}}
GDB -> App: {"token":2,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["features",["frozen-varobjs","pending-breakpoints","thread-info","data-read-memory-bytes","breakpoint-notifications","ada-task-info","python"]]]}}
GDB -> App: {"token":3,"outOfBandRecord":[],"resultRecords":{"resultClass":"done","results":[["source-path","/path/to/project:$cdir:$cwd"]]}}
-gdb-exit

That's it. I don't know what is wrong 😔

EDIT [SOLVED]

gdb was just crashing at the start

KyrietS avatar Dec 14 '22 15:12 KyrietS

There's no crash visible in your output. You may want to recheck with "showDevDebugOutput": true, "printCalls": true, in launch.json, this way we may be able to catch that and return a useful message to the user.

... in any case: if gdb chrashes then this seems to be unrelated to this extension and you may want to close this issue.

To the question: "Are there any other ways to debug this extension on SSH mode?", which I read as "to debug with this extension on SSH remote": sure connecting with jeanp413.open-remote-ssh, then debug. In the case you want to do that with a WSL container, have a look at https://github.com/jeanp413/open-remote-ssh/issues/96.

GitMensch avatar Jun 06 '23 17:06 GitMensch

Hi @GitMensch, from my PoV the issue is solved. My gdb was too old and it needed an update. After that it didn't crash and everything worked. I am not the author of this issue but I guess it's not going to be solved any further for @Darker 😄

And BTW, I really meant "debug this extension" as I was getting no output whatsoever and it just didn't work. I didn't know about "showDevDebugOutput": true, "printCalls": true so thank you for pointing them out.

KyrietS avatar Jun 06 '23 19:06 KyrietS