473,385 Members | 1,772 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

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

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
9 4966
"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
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
"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

"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
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
"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
"Ivan Vecerina" <IN*************************@vecerina.com> wrote in message news:<cq**********@news.hispeed.ch>...
what about umbrello ?
Jul 22 '05 #8
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

198
by: Sridhar R | last post by:
>From technical point of view, I could not understand the the reasoning behind using Java in major companies. Sure that Python, is used in some, but still Java is considered as a sure-job...
6
by: baumann | last post by:
hi all, i couldn't understand why code 1) can solve the problem of code 2) has. code 1) template<class T> T* clone(const T* tp) { return tp->clone(); } and change our make_unique member to...
15
by: Enzo | last post by:
Hi Ng, It's possible to protect the source code of a js file? With PHP? Thanks in advance! Enzo
7
Monolux
by: Monolux | last post by:
There's something till today that I don't understand. Source code is a denomination to a program. Or can just a simple "2+2" in a shell window, be considerd a source code?
8
by: Joshua Moore | last post by:
/* Hi, I was hoping someone could help me with this problem. I did my work and worked my way through the usual compiler messages, but I have run against some problem I can't identify. The compiler...
1
by: kavir | last post by:
hello I need a source code program(socket programing with java) that: 1- for a car parking 2-send&save car details to server DB 3-Enter & exit & perice 4-report 5-login
1
by: Jon Skeet [C# MVP] | last post by:
On Jul 24, 2:17 pm, Dan Holmes <dan.hol...@routematch.comwrote: Could I suggest you ask on a SQL group? You're more likely to get accurate responses there than here (a C# group). Jon
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.