By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,441 Members | 998 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,441 IT Pros & Developers. It's quick & easy.

understand source code of a C++ program written by someone else

P: n/a
I am looking for some tools to help me understand source code of a
program written in C++ by someone else.
Are there any non-commercial, open source C or C++ tools to reverse
engineer C or C++ programs with source codes on linux?
i.e. It parses any sized C or C++ project to help reverse engineer,
document, draw UML diagram and understand it and thus maintain it
better.
Jul 22 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a
"TCMA" <ma*******@yahoo.ca> wrote in message
news:22**************************@posting.google.c om...
I am looking for some tools to help me understand source code of a
program written in C++ by someone else.
Are there any non-commercial, open source C or C++ tools to reverse
engineer C or C++ programs with source codes on linux?
i.e. It parses any sized C or C++ project to help reverse engineer,
document, draw UML diagram and understand it and thus maintain it
better.

As a free tool, try doxygen (www.doxygen.com).
It can generate hyperlinked HTML from source code, class hierarchy
graphs, called-by lists, and more...

hth,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- e-mail contact form

Jul 22 '05 #2

P: n/a
TCMA wrote:
I am looking for some tools to help me understand source code of a
program written in C++ by someone else.
Are there any non-commercial, open source C or C++ tools to reverse
engineer C or C++ programs with source codes on linux?
i.e. It parses any sized C or C++ project to help reverse engineer,
document, draw UML diagram and understand it and thus maintain it
better.


No.
There is no tool that can make sense out of nonsense.
There are programs like Doxygen

http://www.doxygen.org/

that will automatically create documentation
from comments embedded in your source code
so that you can maintain your code an documentation together.
Jul 22 '05 #3

P: n/a
"E. Robert Tisdale" <E.**************@jpl.nasa.gov> wrote in message
news:cq**********@nntp1.jpl.nasa.gov...
TCMA wrote:
I am looking for some tools to help me understand source code of a
program written in C++ by someone else.
Are there any non-commercial, open source C or C++ tools to reverse
engineer C or C++ programs with source codes on linux?
i.e. It parses any sized C or C++ project to help reverse engineer,
document, draw UML diagram and understand it and thus maintain it
better.


No.
There is no tool that can make sense out of nonsense.
There are programs like Doxygen

http://www.doxygen.org/

that will automatically create documentation
from comments embedded in your source code
so that you can maintain your code an documentation together.


Just because this is easily misunderstood, I would like to insist
that doxygen can generate a lot of useful information, also from
code that does not contain any (doxygen) comments.
The output can still include:
- hyperlinked source code (click an identifier -> shows its definition)
- header dependencies (includes & included-by graphs)
- function call dependencies (links to all calls to a function)
- class hierarchies (graphs, links)
- index of namespaces, class names, etc...

There are IDEs that can provide some of the navigation interactively.
Nevertheless, doxygen generates valuable information (and even more
once you use doxygen-specific comments), expecially when reviewing
the structure of a program.
Regards,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Jul 22 '05 #4

P: n/a

"TCMA" <ma*******@yahoo.ca> wrote in message
news:22**************************@posting.google.c om...
I am looking for some tools to help me understand source code of a
program written in C++ by someone else.
Are there any non-commercial, open source C or C++ tools to reverse
engineer C or C++ programs with source codes on linux?
i.e. It parses any sized C or C++ project to help reverse engineer,
document, draw UML diagram and understand it and thus maintain it
better.


Some compilers have pretty good class browsers that will help. I'm not sure
about their ability to format the output for printers...you'd have to check.
But CodeWarrior (which I use) does a pretty good class tree diagram.

Rational Rose will do the job of creating UML from source, I think. (But
it's insanely expensive!)

Just a little (nit-picky) side note: source code doesn't require "reverse
engineering", since it's already source code. That term usually means
taking raw machine code and creating some form of assembler or source code
from it.

-Howard

Jul 22 '05 #5

P: n/a
On Tue, 21 Dec 2004 04:47:35 UTC, ma*******@yahoo.ca (TCMA) wrote:
I am looking for some tools to help me understand source code of a
program written in C++ by someone else.
Are there any non-commercial, open source C or C++ tools to reverse
engineer C or C++ programs with source codes on linux?
i.e. It parses any sized C or C++ project to help reverse engineer,
document, draw UML diagram and understand it and thus maintain it
better.


Any tool that you could acquire would only rearrange the facts
already laid down in the source you have. Nothing will help you
get at the meaning of the source until you decide to sit down and
explore it. It will take time. It took someone else time to
write it. You weren't there, so you'll have to make up your own
mental model. It doesn't have to agree with what the source or
what the original developer had in mind.

If it is functional, explore the various UI components. What
does it expose and what was the mental work model the develoer
laid out? Explore the source. Start at the beginning if you
can find it. Also explore various components and try to
understand what they may do. At some point the fragments of
a large jigsaw puzzle will appear and you'll figure out how the
the pieces fit together. You may find some parts you want to
change and others you may want to use later. Only after you've
understood what is there and what the mental work model is can
you then use that base to extend the model the way you'd like
it to be.

Have fun,

David
Jul 22 '05 #6

P: n/a
"David" <Fl************@United.Com> wrote in message
news:rOdGr40LMPU3-pn2-BKOZgSmM4dmq@localhost...
On Tue, 21 Dec 2004 04:47:35 UTC, ma*******@yahoo.ca (TCMA) wrote:
I am looking for some tools to help me understand source code of a
program written in C++ by someone else.
Are there any non-commercial, open source C or C++ tools to reverse
engineer C or C++ programs with source codes on linux?
i.e. It parses any sized C or C++ project to help reverse engineer,
document, draw UML diagram and understand it and thus maintain it
better.
Any tool that you could acquire would only rearrange the facts
already laid down in the source you have. Nothing will help you
get at the meaning of the source until you decide to sit down and
explore it. It will take time. It took someone else time to
write it. You weren't there, so you'll have to make up your own
mental model. It doesn't have to agree with what the source or
what the original developer had in mind.


I mostly agree with your comment, but the usefulness of a
code browsing/analysis tool should not be dismissed.

A good code browser (IDE-integrated or e.g. doxygen-generated)
does help navigate through the code and connect bits and pieces
together. Getting an overview of class hierarchies and file
dependencies also can be invaluable in helping you create a
mental model of a piece of code.

If it is functional, explore the various UI components. What
does it expose and what was the mental work model the develoer
laid out? Explore the source. Start at the beginning if you
can find it. Also explore various components and try to
understand what they may do. At some point the fragments of
a large jigsaw puzzle will appear and you'll figure out how the
the pieces fit together. You may find some parts you want to
change and others you may want to use later. Only after you've
understood what is there and what the mental work model is can
you then use that base to extend the model the way you'd like
it to be.


Just one addition here: using a debugger and stepping through
code often is a good way to get an understanding of how things
work.
Also very important, as you go, is to add comments about the
design/function of the code you reviewed. Don't let yourself
or anyone else do this tedious analysis work again.
Cheers,
Ivan

--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form

Jul 22 '05 #7

P: n/a
"Ivan Vecerina" <IN*************************@vecerina.com> wrote in message news:<cq**********@news.hispeed.ch>...
what about umbrello ?
Jul 22 '05 #8

P: n/a
"olivier" <wx*********@yahoo.fr> wrote in message
news:61**************************@posting.google.c om...
"Ivan Vecerina" <IN*************************@vecerina.com> wrote in
message news:<cq**********@news.hispeed.ch>...
what about umbrello ?


Found here: http://uml.sourceforge.net
I had never tried it. It looks like a nice UML modeler and code generator.
Thanks, I will look into it.

However, the original question was about extracting design information
from existing source code. Umbrello does not seem to have that capability.
Cheers,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Jul 22 '05 #9

P: n/a
There's also the Source-Navigator IDE.

http://sourcenav.sourceforge.net/
I've never actually used it, but it looks promising.

Joseph

Jul 22 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.