GithubHelp home page GithubHelp logo

capture-points's Introduction

IDEA debugger Capture Points official JetBrains project

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.

To use the capture points

  1. download the xml settings file:
  2. click on the required xml file
  3. right click on Raw and choose "save link as..."
  4. go to IDEA Settings | Build, Execution, Deployment | Debugger | Async Stacktraces and use the Import action
  5. enable the points you need
  6. start debugging

How to write your own

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

How to contribute

  1. create a new capture point in the IDEA, test it
  2. go to IDEA Settings | Build, Execution, Deployment | Debugger | Async Stacktraces
  3. select capture points and use export action
  4. create a pull request here with the file created

capture-points's People

Contributors

gorrus avatar niktrop avatar ddimtirov avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.