Finding the actual runtime call tree of a Java Program

后端 未结 2 2041
星月不相逢
星月不相逢 2021-01-01 08:09

Suppose I have a big program that consists of hundreds of methods in it. And according to the nature of input the program flow is getting changed.

Think I want to m

2条回答
  •  梦谈多话
    2021-01-01 08:27

    You could use AspectJ to log the name of all methods called without changing your original program.

    See tracing for instance.

    aspect SimpleTracing {
        pointcut tracedCall():
            call(void FigureElement.draw(GraphicsContext));
    
        before(): tracedCall() {
            System.out.println("Entering: " + thisJoinPoint);
        }
    }
    

提交回复
热议问题