When you have a BreakpointEvent
or StepEvent
in JDI (Java Debug Interface), what happens is that the currently executing program(debugee) is suspended until the debugger processes the breakpoint event and resumes the debugee.
But if you have many breakpoints this becomes slow, even if the debugger resumes the debugee immediately each time it receives a breakpoint event (communication between debugger and debugee is over sockets or shared memory which is not instant).
But if you'd like to build a tool where you just need the events' information to store them and process them later (e.g. when building a profiler etc.) how can you set these breakpoints not to suspend the program? Or in other words, how can stack traces and variable information be extracted from the running program in an asynchronous way?