blob: b87a7586b2c1da37f7a335a71123c77bb88af641 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
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();
}
|