Debug C app using visual studio code and Vagrant runnig ubuntu

泄露秘密 提交于 2021-01-25 01:43:47

问题


I boot up ubuntu using Vagrant to compile some C code, now i like to debug this code using Visual Studio Code.
How can i setup some kind of remote debug where the compiler and source code and all on the Ubuntu VM
And I only using VSCode from windows?
PS.
This used to work very well with windows WSL linux .
But now i like to achieve the same result with Ubuntu using Vagrant ( using Virtual Box ). Can it be done? UPDATE I tried as suggested but I'm getting error :

my virtual box config from vscode :

Host 127.0.0.1:2222
  HostName 127.0.0.1:2222
  IdentityFile c:/HashiCorp/ubuntu-20.04/.vagrant/machines/default/virtualbox/private_key
  User vagrant

The error :

[13:27:45.945] "install" terminal command done
[13:27:45.945] Install terminal quit with output: The process tried to write to a nonexistent pipe.
[13:27:45.945] Received install output: The process tried to write to a nonexistent pipe.
[13:27:45.950] Resolver error: Error: The process tried to write to a nonexistent pipe
    at Function.Offline (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:64330)
    at c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:59961
    at Object.t.handleInstallOutput (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:60339)
    at I (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:311112)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:309029
    at async Object.t.withShowDetailsEvent (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:403706)
    at async Object.t.resolve (c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:1:312426)
    at async c:\Users\foo\.vscode\extensions\ms-vscode-remote.remote-ssh-0.62.0\out\extension.js:127:110280
[13:27:45.954] ------

回答1:


Yes, as long as you have SSH configured in the VM, you can use the Remote - SSH extension as I detailed in this answer.



来源:https://stackoverflow.com/questions/65709446/debug-c-app-using-visual-studio-code-and-vagrant-runnig-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!