Log in

View Full Version : Tools and tips to read and understand open source?


5aLIVE
August 23rd, 2006, 05:02
Hi,

I have downloaded some c++ open source code which I'd like to study to see how it all works. This is a multiple file project, so on first inspection there is a lot of navigation between header file and code files.

Naturally, I searched a little using Google and found a few IDEs that claim to help with the anaylsis of unknown code. Tools like Source Insight, Understand for C++, Source Publisher, UltraEdit and so on.
What tools do you guys use? (commercial or free).

I'd like to ask what you guys recommend to help accomplish a quick and reliable analysis?

This project may be complicated by the fact that I am learning C++ as I go along. Do you consider producing UML diagrams will be a helpful aid to my understanding of how things work together?

I appreciate recommendations to help me get this project off to a productive start.

Once I know how it all works I hope to add my own code to meet my requirements.

Thanks,
5aLIVE.

disavowed
August 23rd, 2006, 09:59
If you already have an idea of what functionality you want to add, you probably don't have a need to know "how it all works". Your best bet is to look for strings and/or API function references related to the functionality you want to modify/add and start reading the code around there. This is actually the same procedure when you only have a binary and no source code.

0xf001
August 28th, 2006, 17:40
very good question,

my personal experience is: reading the source code files somehow systematically is most helping for me. header files to get an overview of functions / objects, and implementation files for hardcore analysis
thereby using the search function of multiple file editor extensively. (or "grepping" on *nux/*nix).

the much i like graph(ic)s i havent ever used a tool that made understanding source useful, but i'd be interested on that, too.
syntax highlighting is probably the best invention

you might be able to integrate new code / update existing code by concentrating on what you want to change and finding the appropriate place to do so, even without understanding all code. the involved code parts you probably should read and read and read - there is no way about that i am afraid

regards, 0xf001

Silver
August 29th, 2006, 07:34
Visual Studio + Visual Assist is a godsend for quickly mapping large sources. Although you'll have to spend the time up front getting the VS workspace (sorry, solution, I still use VC6) configured properly if the code doesn't come with one.

LLXX
September 2nd, 2006, 04:54
You can't 'reverse' open-source code any more than you can unscrew a screw that's already out of its hole

The source is the source, if you want to understand it I recommend you start at any portion that interests you, or lacking that, main(). A text editor with multifile capability and a good Find function is an asset.

5aLIVE
September 2nd, 2006, 06:31
@disavowed,@0xf001, Having since taken the time to look through the code it is apparent that it would take forever to analyse if I were to try and understand how everything works. It is encouraging that I only need to digest only part of the code.

It doesn't seem like such an ambitious/overwhelming proposition as I first thought.

@Silver, Wow! Visual Assist X is absolutely fantastic! It completely transforms the usability of the VC6 IDE.
Thanks for the headsup. A must have tool.

@LLXX, I don't think I mentioned "reversing" in my post, however I'm not sure I agree with your statement.
I realise that the main function of reverse code engineering is to gain understanding of how a speific part of program works when the source code is not available.

Having said that, wouldn't you agree that trying to make sense of a third parties source code is a form of reverse engineering, producing UML diagrams after the code has been written is reverse engineering in itself.
Once, the code is understood, the program can be developed further which is what I would describe as the process of forward engineering. Maybe a misunderstanding of the term on my part (semantics).

Thanks for sharing your thoughts.

0xf001
September 2nd, 2006, 08:33
i think reversing source code is also, reversing, has not only to do with binaries, it is a part of i think
can also be very complex to understand all the concepts, interactions etc of an app. i must try that assist then once thx for the tip!

cheers, 0xf001

Silver
September 2nd, 2006, 12:20
5alive, VA-X is great, isn't it. Unfortunately as a friend of mine says, it's like crack cocaine for coding. Use it for a while and you won't realise just how dependant you become on it, then try to code without it and you'll be reduced to a quivering useless wreck