Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Visual studio + remote gdb debugging

What is best way to do remote live gdb debugging and use Visual studio as the front end.

In my case: I have a C++ application (compiled for debugging) running on a Linux server

  1. Can I use Visual studio on my windows machine as a front end to do live debugging on the C++ application. Is this even possible for a large scale application (OR)
  2. If above is not possible, can I use eclipse on my windows or on a different linux box to do the same remote live debugging
  3. Any other better IDE options ?

Thanks.

like image 734
cached Avatar asked Apr 13 '12 17:04

cached


People also ask

How will you do remote debugging using GDB?

To start remote debugging, run GDB on the host machine, and specify as an executable file the program that is running in the remote machine. This tells GDB how to find your program's symbols and the contents of its pure text. Start GDB on the host, and connect to the target (see section Connecting to a remote target).

How do I debug a remote app in Visual Studio?

Select Configure remote debugging to configure the firewall and start the remote debugger. When configuration is complete, the Remote Debugger window appears. The remote debugger is now waiting for a connection. Use the server name and port number shown to set the remote connection configuration in Visual Studio.

Can you use GDB in VSCode?

GDB in VSCode SetupVSCode can be used as front end to GDB that provides a convenient environment to execute and debug your code directly in the editor. Note some level of VSCode familiarity is assumed in the following instructions. Add the following two JSON files to the . vscode directory.


1 Answers

You can easily do it with VisualGDB:

  1. Build your app on the Linux machine and ensure that you can run it.
  2. Install VisualGDB on your Windows machine with Visual Studio.
  3. Run the VisualGDB build server on the Linux machine.
  4. In Visual Studio, create new project, select C++->VisualGDB
  5. In the wizard select Linux Application -> Import Existing -> Import from Remote machine
  6. Select the directory where you have built the Linux app. If it's not based on GNU Make, also specify the build command line.
  7. Specify whether you want to synchronize IntelliSense directories with Visual Studio.
  8. On the last wizard page specify the executable name of your project so that VisualGDB knows what to debug.

When you press "finish", the Wizard will create a Visual Studio wrapper project around your Linux project so that you can edit the files, built the project and debug it from Visual Studio.

There's a more detailed tutorial here: http://visualgdb.com/tutorials/linux/import/

like image 133
Ivan Shcherbakov Avatar answered Oct 21 '22 17:10

Ivan Shcherbakov