Get objects involved in Java stacktrace

前端 未结 3 1846
感情败类
感情败类 2021-01-05 14:03

I can retreive the current stacktrace using Thread.currentThread().getStackTrace() but this gives me only the classes involved in the call. Is it possible to re

相关标签:
3条回答
  • 2021-01-05 14:43

    It is a very interesting idea, but, unfortunately in whole no, you could not, it is impossible.

    UPD: One of the reasons why answer is "no" is that fact, that if it could be possible, then some List of references to all created objects must exist. But in this case Java GC would not work at all.

    0 讨论(0)
  • 2021-01-05 14:52

    You may try housemd. It's developed by an engineer@alibaba and safe to be used even in a production environment, e.g. taobao.com.

    Its feature include:

    Display object field value
    Output invocation stack trace
    

    Following is an example screenshot: enter image description here

    0 讨论(0)
  • 2021-01-05 15:00

    Try the Eclipse debugger in order to view the value of objects used in a particular method. Place breakpoints on the lines where you want to pause the program.

    0 讨论(0)
提交回复
热议问题