views:

46

answers:

3

While browsing through source code in my IDE I'll sometimes wish I could see a call stack/s or function call graph from a particular point in the code (while the program isn't running) to help me understand the sequence of events better.

An example of the functionality I'd like to see is: I click a function called 'sendNotificationEmail' And a 'stack' of functions is displayed (owner is to the right):

sendNotificationEmail->EmergencyNotificator->CheckIfServersOnFire->UpdateThread->Main

My question is: Can any ides/plugins/or otherwise display such information, and if not - why?

This question isn't IDE or language specific.

+1  A: 

Visual Studio 2005 can do this (I assume newer versions as well):

http://msdn.microsoft.com/en-us/library/z3zaa390(VS.80).aspx

The results are displayed as a tree in a separate view/window.

bosmacs
+1  A: 

This does tend to be IDE / language-specific. IntelliJ and Eclipse both have Call Hierarchies available for Java methods, which lets you look at callers and callees for a given method. Visual Studio offers similar facilities for MS languages.

For less mainstream languages, you might need to swallow some Rich Programmer Food if the available tools aren't up to it.

jabley
+1  A: 

Doxygen is a tool that can take your code and create call graphs, UML diagrams, class hierarchies, etc... It works on C++, Java, among others. It produces output in HTML and Latex, and others I think. It operates on Linux, Mac, and Windows.

For the most part, it is a standalone program. However, you can use it within the KDevelop IDE to do some basic previews of Doxygen output.

Chance