Code evaluation for method breakpoints
已回答
Hi
I would like to evaluate an expression when certain method is called during debugging session. There is no source code provided to the IDE so I use "Method Breakpoints" which do matching by class and method names. There is a feature called "Evaluate and log" and it is quite clear how to use it for source code based breakpoints. But in my case I cannot figure how to correctly use it with method breakpoints and if there really is a way to do that I'm happy to learn about it.
请先登录再写评论。
You can't use it without the source code available.
Thank you, Serge.
Would making a small plugin be a right way to solve this problem? Looking for a way to ease the burden of walking trough the breakpoints manually and observing arguments for the method invocation.
It might be easier to bulk decompile your classes in the command line and attach the decompiled sources to the library. If it's accurate enough and there was no obfuscation used, it may help you with using the regular breakpoints.
Thanks, that might be a way to go. I assume byte code is also required to make source code breakpoints available, right? That might be even more simple, since the methods I'm tracing are actually from a library with open source. Probably this case is quite unusual and there is no ready-made tool for the job. On the other hand it seems that debugger has all the features at hand to make this tracing without access to the code or byte code. Also it would have been sufficient if the log made by IDEA contained method arguments along with the stack trace.
You always have the bytecode available in the form of .class files. Attaching sources just makes debugging much easier. I don't see any reason not to use the sources, especially if it's an open-source library.