Thread: Code flow analyzer

  1. #1
    Registered User
    Join Date
    May 2010
    Posts
    18

    Code flow analyzer

    Just curious. Just started to look at some C++ code that I am not familiar with, and it occurs to me that what would be really useful, would be a tool that reversed engineered the code into a method flow diagram of some sort. Something where, say, I could select a method I am interested in, and see all the methods that call it, and in turn those that call the calling methods etc. - are there tools like this that exist ?

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    I do not know offhand of any tool that does specifically what you want, but this kind of technology already exists in compiler optimisers and static code analysis tools, so it is not a far fetched possibility that the exact tool that you want exists.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    Registered User
    Join Date
    May 2010
    Posts
    18
    Quote Originally Posted by laserlight View Post
    I do not know offhand of any tool that does specifically what you want, but this kind of technology already exists in compiler optimisers and static code analysis tools, so it is not a far fetched possibility that the exact tool that you want exists.
    I just have a feeling that I have come across something like this at some time, I have a vague picture in my head. Must have been within a tool I have used somewhere, and the only things that come to mind are Rationals' Quantify or Purify.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Doesn't Microsoft's call browser do that? It's part of the Visual Studio suite.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

  5. #5
    Registered User
    Join Date
    May 2010
    Posts
    18
    Quote Originally Posted by CornedBee View Post
    Doesn't Microsoft's call browser do that? It's part of the Visual Studio suite.
    Actually, having had a little play, the Class View in Studio does approach something like what I wanted, but I was picturing something in diagramatic form. Never mind.

  6. #6
    Registered User jeffcobb's Avatar
    Join Date
    Dec 2009
    Location
    Henderson, NV
    Posts
    875
    If you are on Windows I cannot help. On Linux, open your favorite package manager and install Umbrello. It can suck up C++ source and spit out all kinds of UML diagrams showing code interaction and more. Just to do the referencing trick there is always ctags but if you are asking this question you are likely not wanting to go learn something that non-trivial..
    C/C++ Environment: GNU CC/Emacs
    Make system: CMake
    Debuggers: Valgrind/GDB

  7. #7
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  8. #8
    Registered User
    Join Date
    May 2010
    Posts
    18
    Quote Originally Posted by jeffcobb View Post
    If you are on Windows I cannot help. On Linux, open your favorite package manager and install Umbrello. It can suck up C++ source and spit out all kinds of UML diagrams showing code interaction and more. Just to do the referencing trick there is always ctags but if you are asking this question you are likely not wanting to go learn something that non-trivial..
    Is Windows I'm afraid, although the Umbrello sounds rather useful.

    I am qute capable of working through this code, I have nearly 30 years of prograaming experience, it just occurred to me that picking up some unfamilair code, how useful it would be to be able to pictorially see the method/call relationship - it would just make things a lot qucker ... and it would also help to develop "good" code.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Enforcing Machine Code Restrictions?
    By SMurf in forum Tech Board
    Replies: 21
    Last Post: 03-30-2009, 07:34 AM
  2. How to handle multiple cases which use common code?
    By tmaxx in forum C Programming
    Replies: 3
    Last Post: 10-03-2008, 07:42 AM
  3. Proposal: Code colouring
    By Perspective in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 05-14-2007, 07:23 AM
  4. Values changing without reason?
    By subtled in forum C Programming
    Replies: 2
    Last Post: 04-19-2007, 10:20 AM
  5. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM