473,748 Members | 2,502 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4996
"TCMA" <ma*******@yaho o.ca> wrote in message
news:22******** *************** ***@posting.goo gle.com...
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.na sa.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*******@yaho o.ca> wrote in message
news:22******** *************** ***@posting.goo gle.com...
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:rOdGr40LMP U3-pn2-BKOZgSmM4dmq@lo calhost...
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************ *************@v ecerina.com> wrote in message news:<cq******* ***@news.hispee d.ch>...
what about umbrello ?
Jul 22 '05 #8
"olivier" <wx*********@ya hoo.fr> wrote in message
news:61******** *************** ***@posting.goo gle.com...
"Ivan Vecerina" <IN************ *************@v ecerina.com> wrote in
message news:<cq******* ***@news.hispee d.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
7692
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 language. After being a python programmer for long time, I consider it painful to learn/use Java now (well, like many I will be forced to do that in my job). What makes such companies to choose Java over dynamic, productive languages like Python? ...
6
1374
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 call it
15
3390
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
1574
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
1863
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 error message is unintelligable -- to me anyway. Anyway: Here is the code, maybe someone can tell me what is wrong with it. */ //buysome.cpp //Joshua Moore //the part responsible for the buying part of the farm pos simulation program
1
1714
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
1028
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
8987
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8826
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9534
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9316
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4597
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4867
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2777
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2211
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.