diff options
Diffstat (limited to 'deps/v8/tools/inspect-d8.js')
-rw-r--r-- | deps/v8/tools/inspect-d8.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/deps/v8/tools/inspect-d8.js b/deps/v8/tools/inspect-d8.js new file mode 100644 index 0000000000..b87a7586b2 --- /dev/null +++ b/deps/v8/tools/inspect-d8.js @@ -0,0 +1,30 @@ +// Copyright 2019 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// This helper allows to debug d8 using Chrome DevTools. +// +// It runs a simple REPL for inspector messages and relies on +// websocketd (https://github.com/joewalnes/websocketd) for the WebSocket +// communication. +// +// You can start a session with a debug build of d8 like: +// +// $ websocketd out/x64.debug/d8 YOUR_SCRIPT.js tools/inspect-d8.js +// +// After that, copy the URL from console and pass it as `ws=` parameter to +// the Chrome DevTools frontend like: +// +// chrome-devtools://devtools/bundled/js_app.html?ws=localhost:80 + +function receive(msg) { + print(msg); +} + +function handleInspectorMessage() { + send(readline()); +} + +while (true) { + handleInspectorMessage(); +} |