Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pause V8 execution (for debugging) #411

Open
AlexTrotsenko opened this issue Aug 21, 2018 · 0 comments
Open

How to pause V8 execution (for debugging) #411

AlexTrotsenko opened this issue Aug 21, 2018 · 0 comments

Comments

@AlexTrotsenko
Copy link

AlexTrotsenko commented Aug 21, 2018

Generally all J2V8 debug API are "well documented" by test cases.

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, which I am planing to use in the future.

AlexTrotsenko added a commit to AlexTrotsenko/j2v8-debugger that referenced this issue Sep 28, 2018
…in Chrome DevTools: 1. Added pause on break-point in BreakHandler

(work-around using CountDownLatch until proper V8 pause api found - eclipsesource/J2V8#411)
2. Store BreakHandler in Debugger and resume V8 execution by calling .resume() when requested by Chrome DevTools
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant