We have created a new feature for SDE. You can now debug applications that run under SDE on Windows using Visual Studio 2012. The experience is just like debugging a native application in Visual Studio, except that you are debugging an application as it is emulated by SDE.
Thanks to Greg Lueck for the pinADX "glue" that sits between SDE/pin and MSVS2012 and Andria Pazarloglou for the GUI integration windows. Thanks to Marc Enst for integration testing. And of course thanks to the Pin and SDE teams.
The SDE extensions to MSVS give you the following new features:
- The ability to launch a debug session under SDE.
- An extension to the standard MSVS disassembly window that knows about the new instructions. You can set breakpoints and single-step over new instructions.
- A new emulated register window that displays the new register values that are emulated by SDE. The values can be displayed in various formats.
- A new “SDE console” window which can be used to pass additional commands to SDE for debugging.
A future version of the emulated register window will allow editing of the values in the emulated register window. That is currently a work-in-progress. Also process-attach is WIP.
- Windows 7 (or windows server 2008)
- Visual Studio 2012 – You can use any of the editions (Ultimate, Professional, etc.), except that the Express edition doesn’t work. Also, make sure you have an RTM release, and not one of the Beta or RC releases.
- Installing the latest SDE kit for BDW or SKL: 5.23 available on the SDE shares.
- Install the new SDE / VS2012 extension using the MSI from here
The SDE MSI contains the MSVS GUI integration feature. It is not paired to any particular SDE version or chip architecture. It contains no confidential or restricted secret information. You just have to use SDE >= version 5.23. You can upgrade SDE without changing the MSI. As new features become available in the MSVS integration, we will provide new MSIs.
First, install the prerequisites listed above. Then, do the following to enable debugging with SDE:
- If you do not already have an MSVS project file, you must create one. I typically create an empty project and specify the executable that I want to debug in the “Application Command” property. Also set the “Application Command Arguments”, if you have any.
- At the top of the project properties there is a drop-down labeled “Debugger to launch”. Change this drop-down to “SDE Debugger”.
- Set the “SDE Kit Directory” property to point to the root of your SDE kit. There is a <Browse> option that allows you to choose the directory with the file browser.
- Click OK to save your changes.
(The picture below uses SDE version 5.22; do not use 5.22 with the MSVS2012 integration; I will update the picture shortly)
For versions >= 1.0.5, the "SDE Kit Directory" is specified under: Debug -> Options and Settings ... -> Intel(R) SDE debugger
Then set the "Application command" and relevant "SDE Command Arguments" fields in project properties:
Before starting the debugger, you probably want to set some breakpoints in your application. Do this by opening a source file in MSVS, navigate to a line, and press F9. When you are ready, start debugging either by pressing F5 or by clicking on
Once a debugger session is started, you can view the emulated registers and see the emulated instructions. Open the Emulated Registers window by choosing “DEBUG->Windows->Emulated Registers” in the IDE. Open the disassembly window by choosing “DEBUG->Windows->Disassembly”.
By right clicking on a register, you can change its display format to various signed/unsigned integer widths, single, double, hex and binary.
In the SDE console window, you have various lower level options for talking to SDE using the same command syntax we use with GDB on Linux. Open this window by choosing “DEBUG->Windows->Intel(R) SDE Console”.
Known bugs and missing features:
1) You cannot attach to running processes. This is an important feature planned for a future release.
2) The disassembly window spacing/formatting is not very good. We need to talk to someone at Microsoft about that to see if there is anything we can do to improve the spacing.
3) You cannot use the "Express" edition of MSVS; It does not support the required extensions. You cannot use windbg; It does not support the required APIs.