Read more about the feature in the Jetbrains blog.
In IDEA 2017.3 Async Stack Traces were implemented using the dedicated java agent, which works with much lower overhead, and most settings from this repository were hardcoded into the agent settings. Project specific setup is still available via the code annotations.
- download the xml settings file:
- click on the required xml file
- right click on Raw and choose "save link as..."
- go to IDEA Settings | Build, Execution, Deployment | Debugger | Async Stacktraces and use the Import action
- enable the points you need
- start debugging
Capture point is a place in your program where debugger collects and saves the stack frames for later use. It is specified by the method name (and containing class) and the key expression which is evaluated and the resulting object is used later to get the information. So first go to your IDEA Settings | Build, Execution, Deployment | Debugger | Async Stacktraces and create a new capture point. Specify the method and the key expression. Usually the key expression is just a parameter name.
For example, javax.swing.SwingUtilities.invokeLater with the key "doRun"
will capture all invocations of the invokeLater and associate them with the Runnable instance parameter
When the debugger stops it starts matching stack frames with insertion point, which is another method and expression. If the method is matched, it evalautes the expression and if the value has some related stack information, it replaces the rest of the stack with it. This way you see what "was happening" at the related capture point.
For example, java.awt.event.InvocationEvent.dispatch with the insert key "runnable"
will insert information captured for invokeLater to the place where the Runnable is executed
Evaluating key expression may slow down your application, so try to use simple expressions, e.g.:
- this
- method param name (also you can use param_N, where N is a zero-based param number)
- local variable or field name
Method invocations are much slower and highly not recommended.
more implementation details here
- create a new capture point in the IDEA, test it
- go to IDEA Settings | Build, Execution, Deployment | Debugger | Async Stacktraces
- select capture points and use export action
- create a pull request here with the file created