Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide stack frames in IDE Debugger (e.g. Java9 StackWalker)

Java9's new StackWalker feature made me realize that it would be great if Eclipse (preferably, or IntelliJ) could be configured to use a custom StackWalker that could modify the normal Call Stack view in the IDE's Debugger.

What I want to do is to hide e.g. specific technical stack entries when debugging JavaEE programs, but also in many third party support libraries. In general I want the option to leave out specific (customizable) stack frames that are not typically of interest, for instance based on (wildcards of) package or class names. Ideally, "step in" would also automatically skip such frames and step until back inside a "not-suppressed" stack frame.

Does anybody know if such a feature is already available in either Eclipse or IntelliJ. It's OK if it doesn't specifically use StackWalker but something conceptually similar. Or do you know if such a feature is planned in either IDE.

like image 802
geert3 Avatar asked Dec 02 '17 17:12

geert3


2 Answers

IntelliJ has a stack filter in the debugger window. It lets you hide entries from libraries that are not your own code. It is the little filter hopper icon in the top right corner of the stack-frame window

img

Once turned on, I only see frames coming from my code. As far as I can tell, the debugger respects that selection and does not step into methods that lead to an external library as long as there are stack-frames belonging to your code.

Quickly checking the plugin repository did not reveal any promising plugins that provide additional features.

like image 154
halirutan Avatar answered Sep 20 '22 15:09

halirutan


An excellent feature which makes me wonder why both IDE's don't already have this in their core functionality.

Eclipse:

Someone described how to do that without Java9 in Eclipse: https://stackoverflow.com/a/27332733/3931225. Sadly that currently only works for Eclipse Luna (4.4).

His work is based on the stackfilter plugin from Intersult, which only works up to Eclipse Indigo (3.7).

Eclipse call stack without any filter: Eclipse no filter

Eclipse call stack with stackfilter plugin: Eclipse with filter

IntelliJ:

I did not find any way to filter the call stack in IntelliJ, but it does have a step filter

like image 27
KompjoeFriek Avatar answered Sep 21 '22 15:09

KompjoeFriek