Is it possible to attach to a remote gdb target with vscode? - gdb

I'm trying to setup the configuration to attach to a remote C/C++ gdb target running gdbserver with visual studio code. Is this currently supported? If so, how do I get around these limitations:
The address and port options indicate that they aren't supported for C/C++.
I can force code to use the special remote enabled version of gdb, but its trying to run the target application locally and not connecting to the target gdbserver platform.
Will PowerPC remote targets be supported assuming I can solve #1 and #2?

This is a bit late, but I just set this up right now.
I'm debugging an linux application running on a remote ARM device
I installed the Native Debug extension for VS Code.
Here is my launch.json configuration
"configurations": [
{
"type": "gdb",
"request": "attach",
"name": "Attach to gdbserver",
"executable": "<path to exe relative to workspace root>",
"target": "X.X.X.X:9999",
"remote": true,
"cwd": "${workspaceRoot}",
"gdbpath": "D:/gcc-ma/bin/arm-linux-gnueabihf-gdb.exe"
}]
So on my arm device running linux:
gdbserver localhost:9999 ./<application>
Then on windows, I attach to that server.
I have gdbpath set up because i need to use a version of gdb that understands arm. I got the correct windows binaries from here
I had lots of help along the way
http://austinhanson.com/vscode-gdb-and-debugging-an-os
https://github.com/WebFreak001/code-debug
https://github.com/Microsoft/vscode-cpptools/issues/78

VS code (local) and gdb(remote) are installed
install ssh remote plugin
open your workspace in your Vs code using remote ssh coneection
In the vs_code debug tab, click the setting icon, it should open the launch.json / create one if doesn' exist
add following code in launch.json (edit binary, workspace root, process_id)
{
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "${path to binary}",
"processId": "${process id to attach to}",
"MIMode": "gdb",
"cwd":"${workspaceRoot}",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
]
}
Save changes, and click Green Start button on Run and Debug tab.

Related

How to debug angular frontend with django server on vscode (Unverified Breakpoint)?

I'm running a django server for the backend of my application and angular for the frontend side.
Basicaly to make my application work I start my django server:
python manage.py runserver
And on angular I use:
ng build --output-path django_static_folder/ang --watch --output-hashing none
I'm trying to debug angular code using vscode. I have an issue with "Unverified Breakpoint" on vscode. I checked many thread about this issue but none of them talked about how to debug when the server is not managed by angular using ng serve
Here is my actual configuration:
{
"version": "0.1.0",
"configurations": [
{
"name": "Angular debug",
"type": "firefox",
"request": "launch",
"url": "http://127.0.0.1:8000/",
"webRoot": "${workspaceFolder}",
}
]
}
The workspaceFolder is my angular workspace folder.
The url is the one from django server. So when I start the debugger, the firefox app launch and I'm in my application but I cannot put any breakpoint.
I believe that the issue is coming from the fact that I'm not using angular server. Maybe I should but then I don't know how to redirect to the correct url on the django server side ?
Can anyone help me on this subject ?

VS code resets launch.json configuration after restart

I'm writing c++ application in VS code. I've already configured launch.json and I saved it. After reopening VS code, launch.json resets to some "default" configuration. Why and how can I prevent this?

packer: Error when building from source ova

I am trying to build an .ova file using another .ova as source:
My configuration is as follows:
"builders": [
{
"type": "vmware-vmx",
"source_path": "builds/my-base.ova",
"vmx_data": {
"memsize": "8192",
"numvcpus": "4"
},
(the template validates successfully btw)
I am using:
$ vmplayer --version
VMware Player 14.1.2 build-8497320
(although I have installed VMWare Workstation Pro in trial mode)
$ packer --version
1.2.4
When running packer build I get the following error:
... Build 'vmware-vmx' errored: Cloning is not supported with VMWare
Player version 5. Please use VMWare Player version 6, or greater.
==> Some builds didn't complete successfully and had errors:
--> vmware-vmx: Cloning is not supported with VMWare Player version 5. Please use VMWare Player version 6, or greater.
==> Builds finished but no artifacts were created.
Looking as some past issues on the Packer repo, it looks like the Trial license may cause this error. Example: https://github.com/hashicorp/packer/issues/972#issuecomment-48640599

Why isn't ionic updating package.json when installing a plugin or adding a platform?

In my Ionic 2 app (latest beta [quickstart tutorial]) I installed a few additional plugins (e.g. cordova-plugin-geolocation) and platforms (e.g. android)
Plugins were installed via
ionic plugin add cordova-plugin-file --save #this added the plugin to config.xml but not package.json
Platforms instead:
ionic platform add android
cordovaPlugins and cordovaPlatforms are in package.json (as follows) but weren't modified by the 2 command above:
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": []
Now I'm not sure if this is really an issue (if so, I'll open a bug on the official repository) but apparently when running the project on another machine I need to run
ionic state restore
(I found the answer just after posting)
Apparently ionic state save does the trick

Remote debugging C++ application with Eclipse GUI

I followed the steps in this link
and I manage to debug a binary which resides in linux host from my windows machine from command prompt.
I have gdbserver in linux and I installed gdb with the help of mingw in windows. As I told I can prompt "target remote x.x.x.x:10000 test" to command in windows and debug my test application.
My problem is I can't do the same with eclipse gui, it seems to me it has tones of buttons, options but they make no sense to me.
I am choosing debug_configurations-->C/C++ Remote Application(the only one which allows me to input linux machine ip/port), in "Main" tab to connection I am inputting my linux ip. In same menu under Debugger tab I am inputting my window's gdb path and gdbserver port.
After doing all those I believe I gave enough info to eclipse for connect gdb server but it never enough for eclipse. I am checking gdbserver logs by starting gdbserver with --debug, gdbserver never gets triggered, it does not writes a single line of log. Eclipse even does not starts a connection. But instead it gives me a error like "Error during file upload." which makes no sense to me.
I am using "Eclipse Version: Juno Service Release 2" . Any help will be appreciated .
I believe that the "C/C++ Remote Application" option uses Eclipse's RDT (Remote Development Tools) and RSE (Remote System Explorer) to connect, upload, execute, and debug the application itself. It
If all you want to do is connect to a gdbserver, then create a "C/C++ Attach to Application" debug configuration, and under the Debugger tab, set Debugger to gdbserver.
I also encountered this error message for other reason on Eclipse version 2019-09 R (4.13.0).
I very recommend to read paragraph "How do I debug a remote application?" from this great guide.
It explains which of three remote debugging options you should be using - Automatic Remote Launcher, Manual Remote Launcher and Remote Attach Launcher and how to use each one.
I was using the wrong launcher and hence got the error, while on the remote side gdbserver was listening and waiting for a connection. Switching to Manual Remote Launcher solved it.
for example it says:
If you don't have RSE installed, you cannot use the "Automatic Remote
Launch"
RSE = Remote System Explorer End-User Runtime
Launcher setting is configured from the bottom of the Remote Debug Configuration window - "Using GDB (DSF) Automatic/Manual Remote Debugging Launcher".