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

Function Call Tree Command in UNIX.

P: n/a
Hi Everybody

I have been looking out for a Function call tree command in Unix
environment.

Given a piece of source code(millions of lines), there is a function
F1() calling F2() calling F3().

The tools should analyse the C/C++ source code & provide a tree-like
structure denoting the sequence of calls made by a particular
function..

I know that VC++ IDE do provides this facilities, but not aware in the
case of UNIX.

Please let me know if any body has come across such a tool in UNIX
environment.

Thanks & Regards,
- Vinay
Nov 14 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Vinay wrote:
Hi Everybody

I have been looking out for a Function call tree command in Unix
environment.

Given a piece of source code(millions of lines), there is a function
F1() calling F2() calling F3().

The tools should analyse the C/C++ source code & provide a tree-like
structure denoting the sequence of calls made by a particular
function..

I know that VC++ IDE do provides this facilities, but not aware in the
case of UNIX.

Please let me know if any body has come across such a tool in UNIX
environment.

Thanks & Regards,
- Vinay

The QIDE does that under linux. It is a port of the lcc-win32 IDE to Linux.

You can buy it at
http://www.q-software-solutions.com
Nov 14 '05 #2

P: n/a
Vinay <vi***********@gmail.com> wrote:
Hi Everybody

I have been looking out for a Function call tree command in Unix
environment.

Given a piece of source code(millions of lines), there is a function
F1() calling F2() calling F3().

The tools should analyse the C/C++ source code & provide a tree-like
structure denoting the sequence of calls made by a particular
function..

I know that VC++ IDE do provides this facilities, but not aware in the
case of UNIX.

Please let me know if any body has come across such a tool in UNIX
environment.

Thanks & Regards,
- Vinay


Take a look at "gprof".

Nov 14 '05 #3

P: n/a
vi***********@gmail.com (Vinay) wrote in message news:<a7**************************@posting.google. com>...
Hi Everybody

I have been looking out for a Function call tree command in Unix
environment.

Given a piece of source code(millions of lines), there is a function
F1() calling F2() calling F3().

The tools should analyse the C/C++ source code & provide a tree-like
structure denoting the sequence of calls made by a particular
function..


cscope (http://cscope.sourceforge.net) is probably what you want.

Personally I find ctags + vim's tags support to be a godsend; this
combination allows you to drill down through the call stack--you can
put your cursor on a call to func1() and hit C-] and you jump to the
definition of func1; then when func1 calls func2(), hit C-] again and
you jump to the definition of func2. Once you've seen what func2
does, hit C-t to pop back up to func1 and then hit C-t again to pop
back to the original call to func1. It's a very useful tool for
navigating through source code (off-topic: ctags supports other
languages as well, including Java, C++, Python, Perl, Visual Basic,
C#, HTML, JavaScript, Lisp, SQL, PHP, etc).
Nov 14 '05 #4

P: n/a
sj*******@yahoo.com (G. S. Hayes) wrote in message news:<96**************************@posting.google. com>...
vi***********@gmail.com (Vinay) wrote in message news:<a7**************************@posting.google. com>...
Hi Everybody

I have been looking out for a Function call tree command in Unix
environment.

Given a piece of source code(millions of lines), there is a function
F1() calling F2() calling F3().

The tools should analyse the C/C++ source code & provide a tree-like
structure denoting the sequence of calls made by a particular
function..


cscope (http://cscope.sourceforge.net) is probably what you want.

Personally I find ctags + vim's tags support to be a godsend; this
combination allows you to drill down through the call stack--you can
put your cursor on a call to func1() and hit C-] and you jump to the
definition of func1; then when func1 calls func2(), hit C-] again and
you jump to the definition of func2. Once you've seen what func2
does, hit C-t to pop back up to func1 and then hit C-t again to pop
back to the original call to func1. It's a very useful tool for
navigating through source code (off-topic: ctags supports other
languages as well, including Java, C++, Python, Perl, Visual Basic,
C#, HTML, JavaScript, Lisp, SQL, PHP, etc).

Yes I do know about ctags. But ctags don't work if the function has
same name. I have been working on 2-3 demoans which either use some
shared code or implement the same function in their code & avoid the
shared code. if i use ctags on the shared code then ctags+vi won't
show me about multiple declarion of the same function & will direct me
to some other path.
Nov 14 '05 #5

P: n/a
vi***********@gmail.com (Vinay) wrote in message news:<a7**************************@posting.google. com>...
sj*******@yahoo.com (G. S. Hayes) wrote in message news:<96**************************@posting.google. com>...
vi***********@gmail.com (Vinay) wrote in message news:<a7**************************@posting.google. com>...
Personally I find ctags + vim's tags support to be a godsend; this

Yes I do know about ctags. But ctags don't work if the function has
same name.


This is getting way off-topic. Sadly google groups won't let me set
followups.

With vim+exuberant ctags you can differentiate same-named functions a
couple of ways. First, if a function is statically scoped it'll only
jump there from the same file or if there are no other matches. It'll
prefer externs in the current file over externs in other files, and
it'll prefer statics in the current file over externs in general.

Second, after you hit C-] you can use :tn to get the next matching
tag. So if a.c and b.c both have a frob() function and C-] takes you
to a.c's frob(), you can use :tn to get to b.c's frob() (use :tp to
get the previous tag; this mechanism will go to statically scoped
functions in other files after it runs out of alternatives).

Third, if you have a top-level dir with:
main.c
daemon1/wobble.c
daemon2/wobble.c

make sure you use per-directory tags files (so that you have tags,
daemon1/tags, and daemon2/tags) and set tags appropriately so it
searches the current directory first; that way you'll automatically go
to the tag in the current directory first (but can still use :tnext
and :tprev to see the other matches if you want).
Nov 14 '05 #6

P: n/a
sj*******@yahoo.com (G. S. Hayes) wrote in message news:<96**************************@posting.google. com>...
vi***********@gmail.com (Vinay) wrote in message news:<a7**************************@posting.google. com>...
sj*******@yahoo.com (G. S. Hayes) wrote in message news:<96**************************@posting.google. com>...
vi***********@gmail.com (Vinay) wrote in message news:<a7**************************@posting.google. com>...
Personally I find ctags + vim's tags support to be a godsend; this

Yes I do know about ctags. But ctags don't work if the function has
same name.


This is getting way off-topic. Sadly google groups won't let me set
followups.

With vim+exuberant ctags you can differentiate same-named functions a
couple of ways. First, if a function is statically scoped it'll only
jump there from the same file or if there are no other matches. It'll
prefer externs in the current file over externs in other files, and
it'll prefer statics in the current file over externs in general.

Second, after you hit C-] you can use :tn to get the next matching
tag. So if a.c and b.c both have a frob() function and C-] takes you
to a.c's frob(), you can use :tn to get to b.c's frob() (use :tp to
get the previous tag; this mechanism will go to statically scoped
functions in other files after it runs out of alternatives).

Third, if you have a top-level dir with:
main.c
daemon1/wobble.c
daemon2/wobble.c

make sure you use per-directory tags files (so that you have tags,
daemon1/tags, and daemon2/tags) and set tags appropriately so it
searches the current directory first; that way you'll automatically go
to the tag in the current directory first (but can still use :tnext
and :tprev to see the other matches if you want).


Thanks a lot!!!
- Vinay.
Nov 14 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.