eclipsesource / eclipsesource/J2V8
How to pause V8 execution (for debugging)
- Dominant language
- Java
- Stars
- 2.6k
- Forks
- 387
- PR merge metrics
- No merged PRs in 30d
Description
Generally all J2V8 debug API are "well documented" by [test cases](https://github.com/eclipsesource/J2V8/blob/c97922e95c3ba7d6e544f81bcf6bf14b788e03a0/src/test/java/com/eclipsesource/v8/debug/DebugHandlerTest.java#L152).
The only thing, which I am not able to find is _"pause v8 execution"_ neither in the debug api nor in V8 itself.
I was expecting v8 being paused when `DebugEvent.Break` is received by BreakHandler - but it's not the case. V8 keep running and other `DebugEvent.Break` are fired afterwards _(if other breakpoints were set before)_.
@irbull in #293 you was mentioning, that it's possible to build debugger _(using Stetho)_. Can you please share the info of how v8 could be paused?
E.g. I would like to pause it when `DebugEvent.Break` is received by BreakHandler and invoke resume method later manually.
I was able to "hack" it by suspending Java thread in the `onBreak()` call-back of BreakHandler by `CountDownLatch.await()`. But it does not looks like nice solution from my point of view _(I suspect, that there is proper api for this)_ . Also I am not sure wether it will work nice with [multi-threaded J2V8](https://eclipsesource.com/blogs/2015/05/12/multithreaded-javascript-with-j2v8/), which I am planing to use in the future.
Contributor guide
Assessment
This issue has not been assessed yet.