Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

is there any tool to trace the methods the program control travels ? I am using Java in eclipse .

I am looking for a tool , that will

  1. Give the method names that the control has travelled.

  2. Give the input parameters and the return type of the methods .

share|improve this question

closed as off-topic by gnat, GlenH7, MichaelT, Dan Pichelman, Robert Harvey Oct 5 '13 at 18:19

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking us to recommend a tool, library or favorite off-site resource are off-topic for Programmers as they tend to attract opinionated answers and spam. Instead, describe the problem and what has been done so far to solve it." – gnat, GlenH7, MichaelT, Dan Pichelman, Robert Harvey
If this question can be reworded to fit the rules in the help center, please edit the question.

    
there was a tool that hooked calls for auditing thick clients written in java...can't remember the name right now, but it was presented at a small conference last year. if i find it, I'll post –  hbdgaf Mar 8 '11 at 6:47
1  
AspectJ might allow you to hook the calls. –  Peter Taylor Mar 8 '11 at 7:06
    
Agree with @Peter - you need to look into byte code rewriting to be able to do this, as this information is not made available by the code as it is.. –  user1249 Mar 8 '11 at 7:09
    
@Thorbjørn, or using the same VM hooks as jdb - but I think there's more likely to be a convenient tool based around byte code rewriting. –  Peter Taylor Mar 8 '11 at 7:12
    
I found the API I was looking for although not the tool that uses it. Gets you most of the way there... –  hbdgaf Mar 12 '11 at 18:45
add comment

3 Answers

Actually, having thought about this a bit more, jvisualvm allows you to hook into a running VM and specify a set of classes or methods at which to start profiling (and classes or methods not to profile). This is probably the most straightforward approach. It won't give you the parameter values, but I interpret your question as asking for full method signatures, and that it will do.

share|improve this answer
add comment

Although you mentioned Eclipse as your IDE, you may be interested in looking at Intellij which offers the "Analyze Data Flow to Here" and "Analyze Data Flow from Here" features.

http://blogs.jetbrains.com/idea/2009/08/analyzing-dataflow-with-intellij-idea/

share|improve this answer
    
In eclipse this feature is called "Open Call Hierarchy" –  Michael Borgwardt Aug 24 '11 at 8:23
add comment

The reflection API lets you do this type of thing. Basic intro here: http://download.oracle.com/javase/tutorial/reflect/index.html

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.