tags:

views:

522

answers:

2

I have decided that I really need to get some flowcharts for reverse engineering some code I have inherited. I do not have the Team edition of VS so I cannot use Team's built-in capabilities with Visio. So I thought I would parse the .ncb (Parser Information) files and make charts with dot (from graphviz.org). How hard could that be? But I cannot find any documentation for the innards of that file.

I really don't want to use a commercial application to do the flowcharts. And the free addins I've seen all assume that I am using C# or VB. However, I am using C and C++.

I did try the Microsoft "Visual Studio Learning Pack" which has the "Visual Programming Flow Chart" tool. But it doesn't appear to work with C++. So close!

So, does anybody have pointers to the file format or other suggestions (keep it polite!)?

+1  A: 

I don't think you have much chance to be able to parse the NCB files. They are in a proprietary binary format that changes and is likely to change between every single version of visual studio. From what I read somewhere, it's possible that in VS2010 the NCB is going to be discarded and the intellisense information is going to be kept in normal database using SQL Server Express.

Another option you might consider is using some other tool that analyzes your code and builds diagrams and UML charts. Doxygen does this to some extent and there is a plethora of commercial tools that do as well. I have some personal experience with Rational Rose (which might be defunct by now..) and a tool called Together. This list might be of some help

shoosh
I have come to the conclusion that you are correct. However, it seems that there is something called the VCCodeModel which I might use to get the information I need. But no examples in ordinary C++...
Harold Bamford
A: 

For a structural analysis in the sense of "who calls what", "who inherits/overloads where" and "who reads/writes globals" I once used DeHydra (a mozilla project) for analysis and yed (www.yworks.com) for graph display. Both are free.

Dehydra runs under linux and requires your code to pass gcc compilation. This is not a too serious obstacle, as VC can generate makefiles, which can be hand-modified for gnu make. In my case, some patching of include files was required, but i could finally get the desired information out.

It took me 3 days to get DeHydra working, another 2 days to tweak makefile and includes and 3 more days to adapt javascript code, which inside DeHydra extracts the required information.

DeHydra + Javascript now delivers in one compiler run a graphml file containing the code structure, which can directly displayed and interactively manipulated in yed.

John Miller