简体   繁体   中英

Eclipse debugging getting full stack

I just have a simple question, consider the following method

public void do_something(long arg){
//some work
}

and in eclipse, I added a break point for the above method and run the program, everything is fine, but I cannot find out the stack of current point?! for example

call do_something
push id
call previous_method
call xyz
pop z
call useZ
push z

I mean this method is called by 10 different methods and different stack, how would I find out the full stack of the thread(including methods) with eclipse?! should I change some default property or what?!

To put an image, I repeat my comment as an answer.

In the Debug View you can find the call stack and in the Variables View you can find the actual parameters and values of the local variables:

调用Stack for单线程应用程序

To get the actual parameters and values of local variables of an other method in the call stack just click in the Debug View on a method above the current method.

This isn't working for a multi-threaded application. You can only see the call stack for the current thread where the method is running in it. Look at: 调用堆栈用于多线程应用程序

In the method foo a thread is created by creating a timer. If the jvm suspend on bar , it only sees the call stack of TimerTask.run -> bar but not main -> foo -> run -> bar .

What you've described isn't a stack.

It's a history.

Eclipse isn't designed to give you a history. However, there are other tools that can show you the history, such as Chronon. However, that might be too expensive for you! It also might use too much memory if your application is very complex.

The simplest way to get a history, however, is to put System.out.println("some message") in lots of places.

It can be inconvenient to use System.out.println everywhere, so a couple of other ideas have been developed to improve on this:

  1. Logging frameworks handle common tasks such as printing the time when something happened, rotating big log files etc.
  2. Aspect-oriented programming allows you to inject logging in lots of places at once.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM