views:

527

answers:

5

I've been looking for a tool to extract exception information from a C++ program. The most wanted feature I'm looking for: I want to know all the exceptions that can be thrown from a function (which would include all the function that is called from that function recursively).

I've always thought that documenting errors and exceptions in particular is very hard (and takes a lot of effort to keep up to date). But if there is some way to automate that, it would be very helpful.

A tool for windows and Visual Studio would be preferred but not necessary, I could always work around that.

+4  A: 

PC-Lint claims to do static exception analysis of C++ code.
Coverity is another static C++ code analysis tool that apparently informs you of unhandled exceptions.
AQtime claims to have exception tracing as part of its code analysis. Plus, they advertise Visual Studio integration.
Here is a list of several static code analysis tools.

postfuturist
+1  A: 

Thanks for you answer. Some comments on that:

PC-Lint: They do mention that they have "no-holds-barred C++ exception analysis" not sure what that means. And unfortunately they do not offer a trial version. And I don't have the money to buy a $239 software without knowing that it will solve my problem. But I will mail them and ask.

Coverty: Couldnt find any mention of exceptions at all in their description. They say they have a 3rd interface where its possible to make a plugin to analyze that. Not really what I'm looking for.

AQtime: Only have execution time analysis of exception.

Magnus Westin
A: 

I got an answer from PC-Lint. And while they do analyze exception, it seems more from a stand point of catching errors in your code. Actually, from the example page they sent me, the whole package seems to be to analyze the code for errors and mistakes.

That's not what I want, I need something like a call graph but for exceptions.

I guess my search continues...

Magnus Westin
+3  A: 

DISCLAIMER: Working on this tool is my day job.

Its hard for me to write this without it looking like a sales pitch, so I apologise in advance.

As well as other analysis, QA C++ outputs the list of types that are thrown from the body of functions and the call tree. I believe that this would be all the information that you require.

Richard Corden
Thanks for the recommendation. I've just talked to them and I'm getting a demo. It looks good on paper, I really hope its can handle what I'm looking for.
Magnus Westin
+1  A: 

EDoC++ (http://edoc.sourceforge.net) is another alternative.