Visual Studio .ncb文件的内部格式

时间:2023-01-14 18:57:17

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.

我已经决定,我真的需要获得一些流程图来反向工程我继承的一些代码。我没有VS的Team版本,所以我无法使用Team的Visio内置功能。所以我想我会解析.ncb(Parser Information)文件并使用dot制作图表(来自graphviz.org)。这有多难?但我找不到该文件内部的任何文档。

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++.

我真的不想使用商业应用程序来做流程图。我见过的免费插件都假设我使用的是C#或VB。但是,我使用的是C和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!

我确实尝试过具有“可视化编程流程图”工具的Microsoft“Visual Studio Learning Pack”。但它似乎不适用于C ++。很近!

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

那么,是否有人指向文件格式或其他建议(保持礼貌!)?

2 个解决方案

#1


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.

我认为您没有太多机会解析NCB文件。它们采用专有的二进制格式,可以在每个版本的visual studio之间进行更改和更改。根据我在某处读到的内容,在VS2010中可能会丢弃NCB并使用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

您可能考虑的另一个选项是使用一些其他工具来分析您的代码并构建图表和UML图表。 Doxygen在某种程度上做到了这一点,而且还有很多商业工具也可以。我对Rational Rose有一些个人经验(现在可能已经不复存在了......)和一个名为Together的工具。这个列表可能会有所帮助

#2


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(一个mozilla项目)进行分析,并且yed(www.yworks.com)图形显示。两者都是免费的。

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.

Dehydra在linux下运行,需要你的代码才能通过gcc编译。这不是一个太严重的障碍,因为VC可以生成makefile,可以手动修改为gnu make。在我的情况下,需要修补包含文件,但我终于可以获得所需的信息了。

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.

我花了3天的时间让DeHydra工作,另外2天调整makefile并包含3天以来调整javascript代码,DeHydra内部提取所需的信息。

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

DeHydra + Javascript现在在一个编译器中运行一个包含代码结构的graphml文件,该文件可以直接显示并以交互方式操作。

#1


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.

我认为您没有太多机会解析NCB文件。它们采用专有的二进制格式,可以在每个版本的visual studio之间进行更改和更改。根据我在某处读到的内容,在VS2010中可能会丢弃NCB并使用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

您可能考虑的另一个选项是使用一些其他工具来分析您的代码并构建图表和UML图表。 Doxygen在某种程度上做到了这一点,而且还有很多商业工具也可以。我对Rational Rose有一些个人经验(现在可能已经不复存在了......)和一个名为Together的工具。这个列表可能会有所帮助

#2


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(一个mozilla项目)进行分析,并且yed(www.yworks.com)图形显示。两者都是免费的。

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.

Dehydra在linux下运行,需要你的代码才能通过gcc编译。这不是一个太严重的障碍,因为VC可以生成makefile,可以手动修改为gnu make。在我的情况下,需要修补包含文件,但我终于可以获得所需的信息了。

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.

我花了3天的时间让DeHydra工作,另外2天调整makefile并包含3天以来调整javascript代码,DeHydra内部提取所需的信息。

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

DeHydra + Javascript现在在一个编译器中运行一个包含代码结构的graphml文件,该文件可以直接显示并以交互方式操作。