change the content of debug view in eclipse
Asked Answered
T

1

8

I'm writing a java framework, for a class file, sample.class, it generates a proxy file sample_proxy.class. When sample.testMethod() is called, it excutes sample_proxy.class. I already make an eclipse plugin to make the breakpoint work, enter image description here

If I start from Main.java, and make a breakpoint in sample.testMethod(), the stack below looks like: Main.main-->sample.proxy_method-->sample_proxy.testMethod.
Is there any way to ingore the proxy to show like: Main.main-->sample.testMethod?

Theurich answered 19/7, 2015 at 12:36 Comment(1)
You can make sample as the abstract class, then it should not show the proxy..Rostellum
C
0

What you want to do is possible but a bit more complicated. First of all there is no way to change the StackTrace of a running program. So Thread.currentThread().getStackTrace() is not the way to go.

I'm writing a java framework, for a class file, sample.class, it generates a proxy file sample_proxy.class.

When you do that, you have to inline the called method, instead of simply calling it. That is non-trivial technique also being used by ProGuard. You will find that it does different kinds of inlining. Most interested you could be in the functionality of "inlining short methods".

I suggest you copy it from the code there. I good point to start would be http://sourceforge.net/p/proguard/code/ci/default/tree/src/proguard/optimize/Optimizer.java#l156

But be aware that this requires fundamental knowledge about the JVM itself, so there won't be a simple code snippet that does what you want, in the context you expect.

I hope it helps.

Compile answered 4/9, 2015 at 8:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.