- 
                Notifications
    
You must be signed in to change notification settings  - Fork 50
 
Debugger #54
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
base: master
Are you sure you want to change the base?
Debugger #54
Conversation
There was a problem hiding this 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 !
        
          
                src/debugger/client.js
              
                Outdated
          
        
      | 
               | 
          ||
| const methods = ['step', 'next', 'previous']; | ||
| 
               | 
          ||
| class Client { | 
There was a problem hiding this comment.
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: () => {...}
});This provides encode() and decode() methods:
- encode() serializes machine state into a Buffer
- decode() expects an encoded Buffer and returns a plain object which
  is in the following form:
  { memory: uint16[], stack: uint16[], registers: object }
    
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
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 aBufferand returned to the client.Snapshots are decoded as:
{memory: uint16[], stack: uint16[], registers: object}Tasks
cpu.step()Inspector tasks
This will be a different package.
biased-openerFurther
(Not part of this PR)