opened
tetsuo
username_0
# debugger protocol (wip)

## random sub-tasks

- [ ] Singletons issue
- [ ] Optimization: Emit only snapshot patches
- [ ] SSL support
- [ ] UNIX sockets
- [ ] Pass initial arguments to session init call (via querystring)
- [ ] Allow setting host/port which debug-server will live on
- [ ] Handle all the errors!
- [ ] Drain all the connections!
- [ ] Multi-user support
- [ ] Improve protocol
- [ ] Improve terminal frontend with 90s graphics and beeps
- [ ] Allow setting breakdowns
- [ ] Break on exceptions
- [ ] Use a sourcemap
- [ ] Search
- [ ] Set watch expressions
- [ ] Gzip

### inspector
- [ ] Use `biased-opener` maybe
- [ ] Depends on 16bitjs (debugger-client)
- [ ] Breakpoints

## goal

1- Create a server which will serve **snapshots**.
2- Establish a web socket connection to this host and exchange binary messages.
3- Do debugging on any UI.

## protocol

Messages can contain **commands** from the client (e.g. `step`, `next`, `setBreakdown`), or snapshots from the server. Snapshots (memory, stack, registers- in this order) are concatenated into a `Buffer` and returned to the client.

Snapshots are decoded as:  `{memory: uint16[], stack: uint16[], registers: object}`

## example usage

```javascript
const createServer = require('./debugger/server');
const createClient = require('./debugger/client');

createServer(cpu)
.then(server => {
  const client = createClient(server);
  client.step().then(snapshot => {
      if (!snapshot) {
        console.log('Exited')
      }
      console.log(snapshot)
    })
})
.catch(err => {
  console.error('could not start debug server: ' + err.message);
});
```

## new dependencies

- `multiplex-rpc`: https://github.com/substack/multiplex-rpc/
- `multiplex`: https://github.com/maxogden/multiplex
- `websocket-stream`: https://github.com/maxogden/websocket-stream
- `typedarray-to-buffer`: https://github.com/feross/typedarray-to-buffer
[WIP] Debugger protocol
issue
created
tetsuo
username_0
@francisrstokes I'm still on this by the way! Took me some time to onboard but my mind is still in this PR :) hhhoping to bring in some new stuff some time this week, learned a couple of new ES7 tricks 🏄 ✅
comment
created
tetsuo
username_0
This immediately looked like crap after having worked with `async/await` for like a month now 👍
comment