Searching for a C++ code browser which will....

A

Alan Mackenzie

I've recently moved onto a C++ project with a large number of directories
(several hundred) containing an even larger number of C++ source files.

There are vastly more ways in C++ to obfuscate a program than there are
in C, and it seems somebody laid a bet on the original development team
to prove that this is the case. ;-( Unfortunately, I have no contact
with the original programmers, who live and work on a different
continent.

In the course of tracking down a bug, I need a browser which can tell me
all the places in the code where `ClimbMountain', as in:

Arizona::ClimbMountain (*crevasse lookout) ;

gets called. That is, I want the browser to identify lines of code like

*state.phoenix->ClimbMountain (Hoi) ;

, because `phoenix' here is an array of Arizona pointers. However, I
want this browser to _avoid_ telling me about lines like

*state.StPaul.ClimbMountain (Hi) ;

, because the StPaul in that line is an array of Minnesotas, not an array
of Arizonas. Needless to say, there is no chain of inheritance between
the classes Minnesota and Arizona - at least, none that I'm aware of, but
since there is a great deal of multiple inheritance used within the
program, I could be wrong.

I tried downloading SourceNav from SourceForge yesterday. The
documentation's list of SourceNav's capabilities is somewhat on the vague
side, so I therefore tried the program out - unless I'm mistaken, this
browser can only tell me that `ClimbMountain' is "used" in the definition
of the class `Arizona', not the places where instances of Arizona invoke
`ClimbMountain'.

Does there exist a C++ browser (preferably free or open-source running
on MS-Windows or on Unices), powerful enough to give me the info I need?
If so, please tell me its name and its URL.

Thanks in advance for the help!
 
J

Jesper Madsen

I think find&replace with a regex string can do it.. Bot VC++ and Metrowerks
Codewarrior supports these...
 
R

Richard Herring

Jesper said:
. That is, I want the browser to identify lines of code like

*state.phoenix->ClimbMountain (Hoi) ;

, because `phoenix' here is an array of Arizona pointers. However, I
want this browser to _avoid_ telling me about lines like

*state.StPaul.ClimbMountain (Hi) ;

, because the StPaul in that line is an array of Minnesotas, not an array
of Arizonas. Needless to say, there is no chain of inheritance between
the classes Minnesota and Arizona - at least, none that I'm aware of, but
since there is a great deal of multiple inheritance used within the
program, I could be wrong.

[...]I think find&replace with a regex string can do it.. Bot VC++ and Metrowerks
Codewarrior supports these...


You have a remarkable implementation of regex if it can distinguish
between the two ClimbMountain lines above.
 
A

Alan Mackenzie

Paul Schauble said:
I've recently moved onto a C++ project with a large number of directories
(several hundred) containing an even larger number of C++ source files.
There are vastly more ways in C++ to obfuscate a program than there are
in C, and it seems somebody laid a bet on the original development team
to prove that this is the case. ;-( Unfortunately, I have no contact
with the original programmers, who live and work on a different
continent.
In the course of tracking down a bug, I need a browser which can tell me
all the places in the code where `ClimbMountain', as in:
Arizona::ClimbMountain (*crevasse lookout) ;
gets called. That is, I want the browser to identify lines of code like
*state.phoenix->ClimbMountain (Hoi) ;
, because `phoenix' here is an array of Arizona pointers. However, I
want this browser to _avoid_ telling me about lines like
*state.StPaul.ClimbMountain (Hi) ;
, because the StPaul in that line is an array of Minnesotas, not an array
of Arizonas. Needless to say, there is no chain of inheritance between
the classes Minnesota and Arizona - at least, none that I'm aware of, but
since there is a great deal of multiple inheritance used within the
program, I could be wrong.
I tried downloading SourceNav from SourceForge yesterday. The
documentation's list of SourceNav's capabilities is somewhat on the vague
side, so I therefore tried the program out - unless I'm mistaken, this
browser can only tell me that `ClimbMountain' is "used" in the definition
of the class `Arizona', not the places where instances of Arizona invoke
`ClimbMountain'.
Does there exist a C++ browser (preferably free or open-source running
on MS-Windows or on Unices), powerful enough to give me the info I need?
If so, please tell me its name and its URL.


I've been trying the trial version of Source Insight in an odd few hours
over the last week. Sadly, SI appears to do little more than crude
grepping through the all the sources. I've got a Posix system handy
where I can do all my grepping directly anyway, so SI's searching doesn't
really give me much extra. When I ask it to find
"Arizona.ClimbMountain", it merely finds the appropriate _declaration_ of
ClimbMountain. This is a pity, because on opening up (almost) any source
file, and hovering the mouse over the pertinent place, it displays the
type of the variable. I find this too cumbersome for the searching I
need to do.

Our sources are even worse than I thought. There are _lots_ of
identifiers with names like "DoIt" which are distinguished only by being
in different namespaces. YUCK! SI can't distinguish these either.

[<rant mode> Why on earth are the various designers of C++ so opposed to
context-free identifiers? OK, C had context-dependant identifiers a bit
(members of a struct or union), and C++ classes are an extension of this.
But namespaces? sheesh! These designers must have really _hated_ us
poor maintenance programmers ;-) <\rant mode>]

Anyhow, I sent an email to SourceInsight, asking them to consider
enhancing their product.

Thanks for the suggestion.
 
D

Dave Rahardja

Alan said:


I've been trying the trial version of Source Insight in an odd few hours
over the last week. Sadly, SI appears to do little more than crude
grepping through the all the sources. I've got a Posix system handy
where I can do all my grepping directly anyway, so SI's searching doesn't
really give me much extra. When I ask it to find
"Arizona.ClimbMountain", it merely finds the appropriate _declaration_ of
ClimbMountain. This is a pity, because on opening up (almost) any source
file, and hovering the mouse over the pertinent place, it displays the
type of the variable. I find this too cumbersome for the searching I
need to do.

Our sources are even worse than I thought. There are _lots_ of
identifiers with names like "DoIt" which are distinguished only by being
in different namespaces. YUCK! SI can't distinguish these either.

[<rant mode> Why on earth are the various designers of C++ so opposed to
context-free identifiers? OK, C had context-dependant identifiers a bit
(members of a struct or union), and C++ classes are an extension of this.
But namespaces? sheesh! These designers must have really _hated_ us
poor maintenance programmers ;-) <\rant mode>]

Anyhow, I sent an email to SourceInsight, asking them to consider
enhancing their product.

Thanks for the suggestion.

I've had really good luck with Doxygen (http://www.doxygen.org -- it's
free!), and Understand for C++ (http://www.scitools.com/ucpp.html). Try
em both.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top