Skip to content

Conversation

@tetsuo
Copy link
Contributor

@tetsuo tetsuo commented Aug 19, 2017

Debugger

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 using a nice RPC-like interface.

Example

const createServer = require('16bitjs/src/debugger/server');
const createClient = require('16bitjs/src/debugger/client');

const server = await createServer(cpu);
const client = createClient(server);
// ... load program 
const { memory, registers, stack } = await client.step()

Protocol

Messages can contain commands from the client (e.g. step(), next(), setBreakdown(), reset()), 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}

Tasks

  • Debugger server
  • Client that proxies to cpu.step()
  • Singletons issue
  • Allow setting breakdowns

Inspector tasks

This will be a different package.

  • Use biased-opener
  • Depends on 16bitjs
  • Breakpoints
  • Frontend with 90s graphics and beeps

Further

(Not part of this PR)

  • Optimization: Emit only snapshot patches
  • SSL support
  • UNIX sockets
  • Multi-user support
  • Use a sourcemap
  • Search
  • Set watch expressions
  • Gzip

Copy link
Owner

@francisrstokes francisrstokes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking really cool so far @tetsuo !


const methods = ['step', 'next', 'previous'];

class Client {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To keep with more style of the rest of the codebase I'd prefer if this was written in terms of a closure rather than a class:

const createClient = (ws, rpc, plex) => ({
  close: () => {...},
  step: () => {...}
});

@tetsuo tetsuo changed the title [WIP] Debugger protocol Debugger Oct 23, 2017
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

Successfully merging this pull request may close these issues.

2 participants