Quantcast
Channel: C++ Team Blog
Viewing all articles
Browse latest Browse all 1541

Creating a C++ Project from a PDB file: PDB Project

$
0
0

We are thrilled to announce PDB Project on the VS Gallery Extension. PDB Project, as the name suggest, takes information contained in the .pdb to create a C++ project. Information includes all source files (.c, .cpp) used for building. It even includes sources from the libraries linked. Once created, the project will light up the IDE features. Intellisense, Find all Reference, Navigate To, etc. will work with the PDB project. In the current version of the tool, the produced project can’t build, so it won’t replace any existing build system.

Using PDB Project

The PDB Project is publicly available to install form Visual Studio Gallery. Once installed, a.pdb extension under File->Open->Project/Solution will be listed as a new supported project file format. Choose a PDB file and click open. A list of source files from the PDB will be displayed. Some files might be automatically resolved to the same location on the disk. In case some files are still unresolved, “Folder Mapping” dialog is used to provide other locations (ie. a remote location on a shared drive). When relevant files are resolved, click “Finish” and “Save”. The tool will load a newly created .vcxproj.

Watch the demo on Channel 9!

Peeking Under the Hood

The PDB loader uses DIA SDK COM to extract the information from the PDB. This was easy to use after learning the structures and patterns. The sample included in the SDK is a good starting point.

The UI prompts for file/folder mapping. This part went through several iterations. First, adding the browse button and then adding the “Suggestions” field. Final iteration reduced the keyboard interaction and streamlined the workflow. If the pdb was built on the same machine, then just click “Finish” and “Save” without touching the keyboard. The default path to save the .vcxproj right next to the .pdb. If the .pdb was opened from the network where you might not have write access, it will default to the temporary folder instead.

The project creator uses MSBuild Construction Model to create the vcxproj. PDB project was initially coded to be used outside of the IDE, thus it couldn't leverage the Project System. As a side effect, the project file will differ slightly from a normal .vcxproj.

One major issue during development, we found Intellisense was about ~20 seconds slow per cpp file. On average, it should take no more than 2-3 seconds. With some investigation, we found that missing header files was causing the Intellisense to ignore using PCH. PCH skips for completeness because once a PCH is created, it only tracks the files used to construct it. Any missing files aren't tracked. When header file would appear later, the PCH would not trigger a refresh. To address slow load, PDB Project will detect missing header files and create a blank dummy file. This will let Intellisense to be fast even when dealing with incomplete projects.

Is PDB Project for everyone?

No. Most VC users would not need this extension. It is targeted for advance users who have non-vcxproj based project system. Without a project, the IDE can't provide its reach of features. The PDB project will help bridge this gap.

We Want Your Feedback

If you use PDB Project, we would love your feedback. Feel free to post comments to this blog or email Felix or Balaji

Thanks!

Felix Huang (yuehuang@microsoft.com) & Balaji Thumbavanam Kachapeswaran (bathumba@microsoft.com). and the VC++ team 


Viewing all articles
Browse latest Browse all 1541

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>