better documentation

This commit is contained in:
Torsten Ruger 2015-10-07 12:24:02 +03:00
parent ed5b946a70
commit e48b7f5c7a
7 changed files with 114 additions and 19 deletions

View File

@ -9,28 +9,35 @@ After some tryouts it ended up being an Opal application. That is ruby as javasc
- next a view of the Virtual Instructions
- last section, current block with current Register Instruction highlighted
- step (next) button for single stepping
- status: starting , running , exited
- bottom row are the registers. If the register hold an object the variables are shown.
(also should have hover info) , the first letter indicates the class, the number is the address
- state: starting , running , exited
- bottom row are the registers. If the register holds an object the variables are shown.
So lots to do, but a good start.
## Register View
The Register view is now greatly improved, especially in it's dynamic features:
- when the contents update the register obviously updates
- when the object that the register holds updates, the new value is shown immediately
- hovering over a variable will **expand that variable** .
- the hovering works recursively, so it is possible to drill pdown into objects for sevaral levels
### Debugging the debugger
I don't want to use gdb anymore, and it would be easier without using the qemu setup, so:
Opal is pre 1.0 and is a wip. While current source map support is quite good, one only gets
real lines when switching debug on. Debug make it load every single file seperately, slooows it
down in other words. Set DEBUG environement to swithc it on.
- single step debugging of the register machine level (as close to arm as need be)
- visual transitions for steps
- visualisation of data in registers (some kind of link to the object)
- show the current instruction and a few around
- show vm object (message etc)
- show effect of register transitions on vm objects
- visualize vm object content (again some links)
I set the sprockets cache to mem-cache and that increase load time from 12s to 1 , so it's quite
usable and restarting a debug is fine.
## Todos
# Space
Currently only one source is supported. I change the code.rb file to debug a new problem.
- Visualise the object space in some way
- Visualise single object, bit like atoms
- values immediate
- objects as link
Parsing (parslet) does not work in opal. So s-expressions are used. I use the parser or interpreter
to spew those out. Having a dropdown would be nice, and not even so difficult, but it happens rarely.
Breakpoints would be nice at some point. Both in step count and variable value.
Seeing the source code should be possible, just have to keep it around.

View File

@ -1,12 +1,17 @@
require_relative "element_view"
# A very simple ElementView with constant text and class. It uses the ElementView.div function
# to generate the html, see there for details
#
class ConstantView < ElementView
# store the class and text
def initialize class_or_id , text = nil
@class_or_id = class_or_id
@text = text
end
# use ElementView.div to create html from the class and text
def draw
@element = div(@class_or_id , @text)
end

View File

@ -1,3 +1,12 @@
# The basic idea is somewhat that of a shadow dom.
#
# ElementView wraps a single div with whatever content you want (derive to implement the view)
#
# It must have an element, which is drawn. Draw returns the div or whatever. An ElementView
# does not draw itself, but rather is drawn.
#
# Listviews provide structure
#
class ElementView
def initialize

View File

@ -1,5 +1,14 @@
require_relative "element_view"
# Listviews hold an array of elements and are responsible for drawing (and re-drawing them)
#
# A ListView hold the elements, but also the drawn html divs. You can change the element
# structure by adding/removing/replacing and the ListView will take care of redrawing the html
#
# A ListView is itself an ElementView so one can build recursive structures.
#
# Also one can easily change the root html element, or by deriving wrap or edit the resulting html
#
class ListView < ElementView
def initialize children

View File

@ -1,8 +1,59 @@
include AST::Sexp
CODE = s(:expressions,
CODE =
s(:expressions,
s(:class, :Integer,
s(:derives, :Object),
s(:expressions,
s(:function, :ref,
s(:name, :digit),
s(:parameters,
s(:parameter, :int, :rest)),
s(:expressions,
s(:if,
s(:condition,
s(:operator, "==",
s(:name, :rest),
s(:int, 5))),
s(:if_true,
s(:return,
s(:string, "5"))),
s(:if_false, nil)),
s(:if,
s(:condition,
s(:operator, "==",
s(:name, :rest),
s(:int, 1))),
s(:if_true,
s(:return,
s(:string, "1"))),
s(:if_false, nil)),
s(:if,
s(:condition,
s(:operator, "==",
s(:name, :rest),
s(:int, 2))),
s(:if_true,
s(:return,
s(:string, "2"))),
s(:if_false, nil)),
s(:if,
s(:condition,
s(:operator, "==",
s(:name, :rest),
s(:int, 3))),
s(:if_true,
s(:return,
s(:string, "3"))),
s(:if_false, nil)),
s(:if,
s(:condition,
s(:operator, "==",
s(:name, :rest),
s(:int, 4))),
s(:if_true,
s(:return,
s(:string, "4"))),
s(:if_false, nil)))),
s(:function, :ref,
s(:name, :add_string),
s(:parameters,
@ -55,4 +106,16 @@ CODE = s(:expressions,
s(:call,
s(:name, :add_string),
s(:arguments,
s(:name, :start)))))))))
s(:name, :start)))))))),
s(:class, :Object,
s(:derives, nil),
s(:expressions,
s(:function, :int,
s(:name, :main),
s(:parameters),
s(:expressions,
s(:call,
s(:name, :to_string),
s(:arguments),
s(:receiver,
s(:int, 5))))))))

View File

@ -9,7 +9,9 @@ require "salama"
require "salama-reader"
require "ast"
require "interpreter/interpreter"
# the base, our own litle framework, allows for child and parent views and handles updates
require "base/list_view"
# each seperate view is in it's own class.
require_relative "classes_view"
require_relative "status_view"
require_relative "file_view"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 357 KiB