I have to track the flow of execution in eclipse

10,006

CTRL + ALT + H shows you the call hierarchy for a method. Perhaps that's what you wanted.

So it you highlight a method and click CTRL + ALT + H, it shows, in the Call Hierarchy window, all the methods the call that method, and for each of those methods, all the methods that call them, and so on ...

Share:
10,006

Related videos on Youtube

BelieveToLive
Author by

BelieveToLive

Updated on June 04, 2022

Comments

  • BelieveToLive
    BelieveToLive almost 2 years

    I know how to debug in eclipse, but I want to know an effective way of finding the flow of execution from a method.

    E g:

    class A
    {
        method S()
        {}
    
        method S1()
        {
            B.SS()
        }
    
        method S2() 
        {
            A.S1()
        }
    }
    
    class B
    {
        method SS()
        {    
            A.S()
        }
    
        method SS1()
        {
            B.SS2()
        }
    
        method SS2()
        {
            A.S2()
        }
    }
    

    Given these two classes, how can I trace the flow of the methods from A.S2() to A.S() other than debugging?

    • DevOps85
      DevOps85 over 9 years
      F5 into debug = "Step into"
    • BelieveToLive
      BelieveToLive over 9 years
      I just gave a flow. But I m asking in real time scenario. Just gave an example so as to clear with the concept rather giving bunch of codes and making it complex.
  • hfontanez
    hfontanez over 9 years
    This should be a last resort. There a methods to step through code without the need of "print" statements. My experience is that they tend to stay in the code when it is fixed.
  • hfontanez
    hfontanez over 9 years
    And do what afterwards? This doesn't answer the question at all. Your suggestion is incomplete.
  • hfontanez
    hfontanez over 9 years
    If this reply answers your question, please mark it as the answer. Additionally, you can do what Antonio Balduzzi suggested and run on debug mode by placing a breakpoint somewhere in the code and step through the code by pressing 'F5'. You can start the application on debug mode by selecting the debug button on the tool bar, or you can right-click the class that contains the main method and select "Debug As --> Java application"