FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 07-16-2008, 04:57 PM
Amit Uttamchandani
 
Default How to Analyze/Study Source Code?

Hey everyone,

Just wondering how you guys go about studying code? Do you read every
single source file and then make notes? Or is there a tool that goes
about and draws out relationships between source code files?

I ask this because I am looking into adding a feature/fix to pcmanfm
but it looks like its going to take me a while to understand how
everything works together.

Thanks,
Amit


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-16-2008, 05:45 PM
"Sam Kuper"
 
Default How to Analyze/Study Source Code?

2008/7/16 Amit Uttamchandani <auttamchandani@canoga.com>:

Just wondering how you guys go about studying code?

My guess is: different people use different techniques, some more formal than others. I'm looking forward with interest to replies from more experienced coders, though.

However, note that as this mailing list is for users rather than developers, it might not have been the most useful place to ask.
Sam
 
Old 07-16-2008, 08:50 PM
Amit Uttamchandani
 
Default How to Analyze/Study Source Code?

On Wed, 16 Jul 2008 18:45:54 +0100
"Sam Kuper" <sam.kuper@uclmail.net> wrote:

> 2008/7/16 Amit Uttamchandani <auttamchandani@canoga.com>:
>
> > Just wondering how you guys go about studying code?
> >
>
> My guess is: different people use different techniques, some more
> formal than others. I'm looking forward with interest to replies from
> more experienced coders, though.
>
> However, note that as this mailing list is for users rather than
> developers, it might not have been the most useful place to ask.
>
> Sam
>

Thanks for the reply.

You are right, I might forward this post to the developers mailing
list. I did a little bit of research and found the following:

1. cbrowser - tk/tcl front end to cscope. Seems like it is
unmaintained. According to sourceforge last file upload was 07/03/2000.

2. kscope - Qt front end to csope. Last update was in Jan 2008. Looks
very promising and powerful.

3. csope - the mother. CLI interface. At version 15.6!! (Almost as old
as emacs ). Last update was in 2006 but it looks like it is still
maintaned.

4. doc++ - Documentation system that generates LaTeX/html. Latest
upload was on dec 2002.

5. gonzui - code search engine. looks to be unmaintained but good
potential. Does online code search, not sure if it can do offline
search.

Most of the above are either for c/c++. I'm still trying to look for
something that covers other languages.

Amit


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-16-2008, 10:48 PM
"Jordi Gutiérrez Hermoso"
 
Default How to Analyze/Study Source Code?

2008/7/16 Amit Uttamchandani <auttamchandani@canoga.com>:

> 4. doc++ - Documentation system that generates LaTeX/html. Latest
> upload was on dec 2002.

Doxygen could also work here. It's more recent, and it does more
languages than just C or C++. I frequently use it to document my own
code, and for undocumented code, you can run it through Doxygen and at
least get call graphs, class hierarchies, and other rough indications
of what's going on with the code.

When faced with new code, if I want to figure out what's going on,
usually the first thing I do is first figure out what I want to know
about the code, then run the code through a debugger, break when
something interesting is going on, see where in the code that
happened, and then trace the code from there. Sometimes I also just
grep the code for what could be interesting things, if I already have
a rough idea of what I'm looking for. Other times I wander aimlessly
through it.

HTH,
- Jordi G. H.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-16-2008, 11:35 PM
Amit Uttamchandani
 
Default How to Analyze/Study Source Code?

On Wed, 16 Jul 2008 17:48:02 -0500
"Jordi Gutiérrez Hermoso" <jordigh@gmail.com> wrote:

> 2008/7/16 Amit Uttamchandani <auttamchandani@canoga.com>:
>
> > 4. doc++ - Documentation system that generates LaTeX/html. Latest
> > upload was on dec 2002.
>
> Doxygen could also work here. It's more recent, and it does more
> languages than just C or C++. I frequently use it to document my own
> code, and for undocumented code, you can run it through Doxygen and at
> least get call graphs, class hierarchies, and other rough indications
> of what's going on with the code.
>
> When faced with new code, if I want to figure out what's going on,
> usually the first thing I do is first figure out what I want to know
> about the code, then run the code through a debugger, break when
> something interesting is going on, see where in the code that
> happened, and then trace the code from there. Sometimes I also just
> grep the code for what could be interesting things, if I already have
> a rough idea of what I'm looking for. Other times I wander aimlessly
> through it.
>
> HTH,
> - Jordi G. H.
>


Thanks for the tip!

Doxygen definitely looks very capable. I will try that out. Thanks.

Amit


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-18-2008, 05:02 AM
Kamaraju S Kusumanchi
 
Default How to Analyze/Study Source Code?

Amit Uttamchandani wrote:

> Hey everyone,
>
> Just wondering how you guys go about studying code? Do you read every
> single source file and then make notes? Or is there a tool that goes
> about and draws out relationships between source code files?
>
> I ask this because I am looking into adding a feature/fix to pcmanfm
> but it looks like its going to take me a while to understand how
> everything works together.
>
> Thanks,
> Amit

I might not be doing this efficiently but here is the general outline...

First I run ctags -R on that source code's parent directory. That way when I
am browsing the code, it will be easy to jump across different parts. See
the declaration of variables etc.,

Next I try to compile the code using make and store the output on the
screen. I use something like "make 2>&1 | tee make_$(date +%Y%m%d).log .
This gives an overview of the dependencies... For example if I am
interested in file10. I will now know that it depends upon file8, file5
etc., This in turn gives an idea of what files to browse and what files to
skip ...

After that it is pretty much looking at the code/comments (and pulling my
hair figuring out stuff... :-)).

hth
raju
--
Kamaraju S Kusumanchi
http://www.people.cornell.edu/pages/kk288/
http://malayamaarutham.blogspot.com/


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 07-19-2008, 10:35 AM
"James Youngman"
 
Default How to Analyze/Study Source Code?

On Wed, Jul 16, 2008 at 5:57 PM, Amit Uttamchandani
<auttamchandani@canoga.com> wrote:
> Hey everyone,
>
> Just wondering how you guys go about studying code? Do you read every
> single source file and then make notes? Or is there a tool that goes
> about and draws out relationships between source code files?
>
> I ask this because I am looking into adding a feature/fix to pcmanfm
> but it looks like its going to take me a while to understand how
> everything works together.

I generally start by reading the documentation that comes with it,
including files like HACKING and TODO. Then I read the Makefile and
run etags to generate a symbol index. Then I try to understand the
particular bit of the program I'm proposing to work on. Frequently
reading the code is enough. If not though, I often use strace to "see
through" the code to what the program actually does. While I know
about cflow, I rarely use it.

It's not uncommon for me to want to patch a program, but in general
50% of the total time I spend doing that is occupied with finding the
source repository, checking the code out and making it build.
Actually understanding the code, changing it and testing the result
takes only about half the total time.

James.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 04:39 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org