microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.
MIT License
813 stars 219 forks source link

Question: Configuration to debug an existing executable? #238

Open g40 opened 8 years ago

g40 commented 8 years ago

Hello and kudos on a very nice project.

The case I've got in mind is analogous to the 'Exe project file' option in VS. Is it possible to point VS at a Linux executable for example and then set up the project to use the MIEngine via remote GDB (or similar)?

edit: oops. missed this.

https://github.com/Microsoft/MIEngine/wiki/Start-debugging-other-platforms-using-the-MIEngine

Many thanks

Jerry

seanshpark commented 8 years ago

@g40 , The explanation in the link seems hard to understand but once you get the idea how to, it works. I've tried with cross compilation to Raspberry Pi on Windows and through MIEngine + GDB, began to run and stop at the break point.

g40 commented 8 years ago

If you have an example of a working configuration and how you invoke it with VS I'd be most interested! Thank you.

seanshpark commented 8 years ago

OK, this is what I've done to understand how to use. You don't have to build MIEngine from source, VS2015 (Update 1 for mine) already has it.

1) install Visual studio GDB extension, https://visualstudiogallery.msdn.microsoft.com/35dbae07-8c1a-4f9d-94b7-bac16cad9c01

<PipeLaunchOptions xmlns="http://schemas.microsoft.com/vstudio/MDDDebuggerOptions/2014" 
    PipePath="plink.exe" 
    PipeArguments="-i private.ppk user@server -batch -t gdb --interpreter=mi" 
    ExePath="/home/user/YourDir/exe" ExeArguments="" 
    TargetArchitecture="X64" 
    WorkingDirectory="/home/user/YourDir" 
    AdditionalSOLibSearchPath=""> 
</PipeLaunchOptions>

2) install GNU Toolchain for Raspberry Pi, http://gnutoolchains.com/raspberry/

3) Add a break-point with the code from 1) and hit Debug

4) With the above XML, save it to a file, with appropriate information, path and etc.

5) as described in the document, In VS2015, View->Other Windows->Command Window

g40 commented 8 years ago

SaiHie, heroic stuff. I thank you. I'll try this.

gregg-miskelly commented 8 years ago

BTW: The C++ team also recently released a VS extension for connecting to Linux: https://visualstudiogallery.msdn.microsoft.com/725025cf-7067-45c2-8d01-1e0fd359ae6e

g40 commented 8 years ago

Hi Greg, and thanks. I have also built a launcher for MIEngine based on earlier work in the Native Debug Engine example on Codeplex. Are you interested in a PR?

gregg-miskelly commented 8 years ago

Quite possibly. Can you tell me more? -- This is a dialog box reachable from a menu item I assume? How do you enter the options?

g40 commented 8 years ago

The extension adds a Tools menu entry. Dialog has file pickers for XML config file and target executable. This works fine in my context where Linux target always has /home/user mapped to a Windows share.

The correct thing to do would be create the XML content from dialog items (username/target directory/GDB command line etc.). This would play nicer with the 'unmapped ' taget scenario I think.

Ideally this would persist somewhere as well. Am unsure how/what/where if you see what I mean.

Comments/suggestions welcomed. I am far from dogmatic as to the best way to do this.

Cheers.