Added highway demo.
Updated the tool. the doc is completed syntax was updated again svn: r132
This commit is contained in:
parent
99eb4de4f7
commit
65d16858c8
|
@ -16,7 +16,8 @@
|
|||
; ;;;;
|
||||
|
||||
(module debugger-tool mzscheme
|
||||
(require (lib "etc.ss")
|
||||
(require "mztake.ss"
|
||||
(lib "etc.ss")
|
||||
(lib "list.ss")
|
||||
(lib "class.ss")
|
||||
(lib "unitsig.ss")
|
||||
|
@ -81,7 +82,7 @@
|
|||
(define/public (get-module)
|
||||
'(lib "mztake-syntax.ss" "mztake"))
|
||||
(define/public (get-one-line-summary)
|
||||
"MzTake Debugger")
|
||||
(format "MzTake Debugger (~a)" mztake-version))
|
||||
(define/public (get-language-url) #f)
|
||||
(define/public (get-reader)
|
||||
(lambda (name port offsets)
|
||||
|
@ -116,7 +117,7 @@
|
|||
|
||||
(define debugger-bitmap
|
||||
(drscheme:unit:make-bitmap
|
||||
"Syntax Offset"
|
||||
"Syntax Location"
|
||||
(build-path (collection-path "mztake") "stock_macro-check-brackets-16.png")))
|
||||
|
||||
(define (debugger-unit-frame-mixin super%)
|
||||
|
@ -136,8 +137,8 @@
|
|||
[column (- pos (send (get-definitions-text) line-start-position
|
||||
(send (get-definitions-text) position-line pos)))])
|
||||
|
||||
(message-box "Syntax Offset"
|
||||
(format "Line: ~a~nColumn: ~a~nOffset: ~a" (add1 line) column pos))))))
|
||||
(message-box "Syntax Location"
|
||||
(format "Line: ~a~nColumn: ~a" (add1 line) column))))))
|
||||
(send (get-button-panel) change-children
|
||||
(lambda (_) (cons debugger-button (remq debugger-button _))))))
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
(require (lib "animation.ss" "frtime"))
|
||||
|
||||
(debug-process p ("highway.ss" [values-of-speed 3 4 bind 'speed]))
|
||||
(mztake-process p ("highway.ss" [values-of-speed 3 4 bind 'speed]))
|
||||
|
||||
(printf-b "last ten speeds: ~a" (history-b 10 values-of-speed))
|
||||
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
(require (lib "mztake.ss" "mztake"))
|
||||
|
||||
; tests catching of anonymously threaded exceptions
|
||||
|
||||
exceptions
|
||||
|
||||
(debug-process p ("exception.ss"))
|
||||
(mztake-process p ("exception.ss"))
|
||||
|
||||
(printf-b "exception.ss exited? ~a" (process:exited? p))
|
||||
;; Prints out a behavior that tells you whether the debug-process is still running...
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
;tests higher order annotation and redefinition of bindings
|
||||
|
||||
(debug-process p ("higher-order.ss" [x-before-let 3 29 bind 'x]
|
||||
(mztake-process p ("higher-order.ss" [x-before-let 3 29 bind 'x]
|
||||
[x-in-let 4 25 bind 'x]
|
||||
[x-after-let 5 11 bind 'x]))
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
(open-graphics)
|
||||
(define window (open-viewport "Debugger" 400 400))
|
||||
|
||||
(debug-process p ("montecarlo.ss" [x/y/pi-trace 12 18 bind '(x y pi)]))
|
||||
(mztake-process p ("montecarlo.ss" [x/y/pi-trace 12 18 bind '(x y pi)]))
|
||||
|
||||
(define x/y/pi (hold x/y/pi-trace))
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
(open-graphics)
|
||||
(define window (open-viewport "Debugger" 600 500))
|
||||
|
||||
(debug-process p ("random-Xs.ss" [x-trace 4 6 bind 'x]))
|
||||
(mztake-process p ("random-Xs.ss" [x-trace 4 6 bind 'x]))
|
||||
|
||||
(define x (hold x-trace))
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
(require (lib "animation.ss" "frtime")) ;; needed for display-shapes
|
||||
|
||||
|
||||
(debug-process p ("sine.ss" [sin/x-trace 5 8 bind '(sin-x x)]))
|
||||
(mztake-process p ("sine.ss" [sin/x-trace 5 8 bind '(sin-x x)]))
|
||||
#| * Create a process to debug for sine.ss
|
||||
|
||||
* Add a tracepoint at line 5, column 8; in the program,
|
||||
|
@ -23,7 +23,7 @@
|
|||
|
||||
|
||||
(printf-b "sine.ss exited? ~a" (process:exited? p))
|
||||
;; Prints out a behavior that tells you whether the debug-process is still running...
|
||||
;; Prints out a behavior that tells you whether the mztake-process is still running...
|
||||
|
||||
|
||||
(define sin/x (hold sin/x-trace))
|
||||
|
|
|
@ -162,13 +162,17 @@ _Installing Watch Points_
|
|||
the pause function (below), execution resumes after
|
||||
the MzTake script processed the event.
|
||||
|
||||
[*] All valid syntax begins to the left of "(", "["
|
||||
or the before the first character of a symbol/name.
|
||||
See Known Issues for more information.
|
||||
|
||||
[*] To obtain accurate line/column information when
|
||||
setting up watch points, make sure you turn off
|
||||
DrScheme's "Wrap Test" feature under the "Edit"
|
||||
DrScheme's "Wrap Text" feature under the "Edit"
|
||||
menu. Alternatively, you can click MzTake's
|
||||
"Syntax Location" to obtain the line and column
|
||||
number for the position under the cursor.
|
||||
"Syntax Location" button, on the toolbar, to
|
||||
obtain the line and column number for the
|
||||
position under the cursor.
|
||||
|
||||
|
||||
_Operations on MzTake Processes_
|
||||
|
@ -259,6 +263,96 @@ that are particularly useful when debugging.
|
|||
Display the value of the behaviors with the given format
|
||||
|
||||
|
||||
============================================================
|
||||
|
||||
Known Issues
|
||||
|
||||
* The break button will *not* kill runaway client processes.
|
||||
You must type (kill process-name) or (kill-all).
|
||||
|
||||
* Some valid join points, such as ("->"):
|
||||
(define x 12)
|
||||
(->let ->(->[>x (add1 x)]) x)
|
||||
do *not* produce any values for the bindings, just an empty
|
||||
eventstream -- particularily in "let"s.
|
||||
|
||||
Legal (recommended) bind points ("->"):
|
||||
(define x 12)
|
||||
->(let ([x ->(->add1 ->x)]) ->x)
|
||||
|
||||
* Don't rely completely on bind to complain when you change
|
||||
target code and your line/col offsets are out of date in a
|
||||
script. Sometimes you may write a bunch of code and the
|
||||
values will still be on valid syntax join points, albeit
|
||||
not the correct ones, so you get the wrong values.
|
||||
|
||||
* Order matters -- if you have more than one kind of trace at
|
||||
an identical syntax location, the order events occur is
|
||||
undefined.
|
||||
- You may have a bind that when updated draws a graphic,
|
||||
and a breakpoint, you may want the breakpoint to happen
|
||||
before the bind happens.
|
||||
|
||||
- For now, the hack is to bind one at ->(code...)
|
||||
and the other (code...->(more-code...))
|
||||
immediately following at the next open parentheses.
|
||||
Often, not much happens on the same line between two
|
||||
valid trace points, so this gives you a definite order.
|
||||
|
||||
* Has not been tested for stability if the target is using
|
||||
multiple threads. This only applies to threaded modules
|
||||
*with* traces on them -- other 'require'd modules will work
|
||||
as expected.
|
||||
|
||||
|
||||
============================================================
|
||||
|
||||
Misc. Tips
|
||||
|
||||
* You may want to bind more than one variable at a certain point
|
||||
so that you only get one change event -- otherwise, you will
|
||||
get multiple change events even if at the same tracepoint
|
||||
(see Known Issues).
|
||||
|
||||
For instance, if you trace 'x and 'y seperately:
|
||||
'x 'y are up to date, then 'x updates, 'y is out of date,
|
||||
then 'y updates, and both are up to date.
|
||||
|
||||
But code that draws x and y locations will draw in two places,
|
||||
one for each update.
|
||||
|
||||
* You can trace the *same* file in different ways by using
|
||||
multiple processes on the same file, under different
|
||||
contexts, and compare results.
|
||||
|
||||
* Code such as (when (= num 100) (pause p)) pauses *after*
|
||||
num reaches 100, so the pause doesn't happen until the
|
||||
101st iteration.
|
||||
|
||||
* When you pause a mztake-process, you can play with
|
||||
current bindings and explore script code interactively.
|
||||
You *may* dynamically evaluate/add FrTime code to do
|
||||
things like pause or kill a mztake-process based on runtime,
|
||||
etc. You can even define new mztake-processes dynamically
|
||||
and start/resume them, integrating and exploring the traces.
|
||||
You cannot add or change existing traces dynamically.
|
||||
|
||||
* You can add watch points to first-class functions, and they
|
||||
will send events from no matter where they are evaluated.
|
||||
|
||||
* FrTime has two methods for drawing graphics. One runs in
|
||||
constant time, and is fast, because it simply accumulates
|
||||
pixels on the screen and doesn't redraw a list of objects.
|
||||
See the random-xs demo for this in action.
|
||||
|
||||
The other method is primarily for animations which need
|
||||
redrawing because things move. It slows down pretty quickly
|
||||
after you have more than 1000 objects to the shape list.
|
||||
See the sine demo for this in action.
|
||||
|
||||
For more information, refer to the FrTime documentation.
|
||||
|
||||
|
||||
============================================================
|
||||
|
||||
Authors and Thanks
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#|
|
||||
(debug-process p ("sine.ss" [sin/x 5 8 bind '(sin-x x)]
|
||||
(mztake-process p ("sine.ss" [sin/x 5 8 bind '(sin-x x)]
|
||||
[foo 10 20 bind '(sin-x x)])
|
||||
("sine-extra.ss"))
|
||||
|
||||
|
@ -21,9 +21,9 @@
|
|||
(require (lib "mztake.ss" "mztake")
|
||||
(lib "useful-code.ss" "mztake/private"))
|
||||
|
||||
(define-syntax debug-process
|
||||
(syntax-rules (debug-process)
|
||||
[(debug-process proc-id (client (trace line col cmd . args) ...) ...)
|
||||
(define-syntax mztake-process
|
||||
(syntax-rules (mztake-process)
|
||||
[(mztake-process proc-id (client (trace line col cmd . args) ...) ...)
|
||||
(begin
|
||||
(define proc-id (create-debug-process))
|
||||
(begin
|
||||
|
@ -33,7 +33,7 @@
|
|||
(create-trace tmp line col 'cmd . args)
|
||||
...))) ...))]))
|
||||
|
||||
(provide debug-process
|
||||
(provide mztake-process
|
||||
(all-from-except (lib "frtime-big.ss" "frtime") #%module-begin)
|
||||
(all-from (lib "mztake.ss" "mztake"))
|
||||
(all-from (lib "useful-code.ss" "mztake/private"))))
|
|
@ -1,111 +1,76 @@
|
|||
#| TODO
|
||||
|
||||
get time-per-event/milliseconds working
|
||||
(printf-b "~a ms per event" (time-per-event/milliseconds p (changes (hold sin/x-trace))))
|
||||
|
||||
implies that the first client created is always the main module
|
||||
|
||||
turn script errors into syntax errors
|
||||
|
||||
make sure that the main client for a process is in the list of clients being annotated
|
||||
|
||||
make syntax errors work for invalid bindings ... take the syntax when the binding is made and save it in a hashtable
|
||||
|
||||
---------LOAD ANNOTATOR BUGS::::::::::::::
|
||||
;catch oops exception
|
||||
;catch the other two exceptions that my loaders throw
|
||||
;detect if the source code for a certain module is missing and throw an error
|
||||
;do I want to parameterize it over a given namespace?
|
||||
:::::::::LOAD/ANNOTATOR BUGS::::::::::::::
|
||||
* catch oops exception
|
||||
* catch the other two exceptions that my loaders throw
|
||||
* detect if the source code for a certain module is missing and throw an exception
|
||||
* do I want to parameterize it over a given namespace?
|
||||
* does this handle module prefixes?
|
||||
* what happens if two modules have the same name in different directories
|
||||
* MAKE SURE THERE WONT BE COLLISIONS WHEN EVAL'NG MODULES...GIVE THEM UNIQUE NAMES BASED ON PATH!
|
||||
::::::::::::::::::::::::::::::::::::::::::
|
||||
|
||||
-------------------
|
||||
does this work on binary drscheme files?
|
||||
|
||||
make all exposed cells and evstreams read-only by lifting the identity function on them
|
||||
|
||||
does this handle module prefixes?
|
||||
|
||||
what happens if two modules have the same name in different directories
|
||||
MAKE SURE THERE WONT BE COLLISIONS WHEN EVAL'NG MODULES...GIVE THEM UNIQUE NAMES BASED ON PATH!
|
||||
----------------
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
Problem:
|
||||
When debugging multiple files ...
|
||||
|
||||
It is trivial to retrive values from from multiple files ... of course, you don't necessarily know the order that things will happen, and it may be difficult to relate the values correctly without writing a good debug script. For instance, if debugging vector.ss, it may be used in multiple contexts in the file being debugged. Can I provide a mechanism to turn breaks on and off based on other variables? i.e. only register the breakpoint or send values on the eventstream IF a certain condition is met.
|
||||
|
||||
what happens when a break happens in multiple files -- how do you know when it happens -- what does it mean when it happens -- in a single thread I assume that if a break happens deep in execution, all execution halts there until the semaphore gets posted to...
|
||||
|
||||
Of course, you don't know where or why.
|
||||
|
||||
With multiple threads... It is hard to differentiate between the threads since we do simple annotation that doesn't send which namespace, thread, custodian, eventspace... it came from. More importantly, how can multiple threads hold on the same semaphore? When you post to it ... which gets the post ... should one or all continue? Does it make sense for only one to continue, or should they all get posted too (most likely). When you want to pause the program, do you want to pause all the threads? (yes...) When you resume, resume all?
|
||||
|
||||
Otherwise if you stack them up, interact with one, resume, interact, resume... could be tedious. Also, one may negate the necessity for the other. What does it even mean to pause in vector.ss?
|
||||
|
||||
Problem with synchronysity in multiple threads too... Maybe we need to have the threaded breakpoints run in lockstep... Put a 'semaphore' *before* processing breakpoints to ensure that there is ever only one breakpoint happening at a time, and each thread waits in a queue. Big performance impact though... Does this solve all of our other problems -- I think we would only need one semaphore to continue then, and pausing will be global. Yes, if each thread causes a pause, then we will pause possibly annoyingly each time. We need a way to turn forced breaks on and off dynamically then. (does it make sense to be able to turn bind traces on and off too?)
|
||||
|
||||
Performance-wise, this turns a multi-threaded program into a single thread -- if there are t threads over an arbitrary number of modules, worst case is that you have t threads in the queue.
|
||||
|
||||
Last issue: Could this queue potentially cause a condition where threads A and B always get their breakpoints evaluated in the same order, a race condition, and they can't exit this until B comes before A? Should I have some sort of random insertion that guarantees that everyone will get a chance, but does not guarantee order?
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
With the syntax for debugging, you will not have to provide ways to create clients... they can only happen in one place at one time.!!!
|
||||
|
||||
Need to know where the program breaks at -- need to know *when* it breaks too -- print something out
|
||||
|
||||
DEMOS---------------------------------------------------------------------------------------
|
||||
Data structure examples
|
||||
Binary search over a tree, show which node is being examined, or the most commonly taken path
|
||||
Parse, graph the AST -- show OR and AND precedence getting messed up
|
||||
* Data structure examples
|
||||
Binary search over a tree, show which node is being examined, or the most commonly taken path
|
||||
Parse, graph the AST -- show OR and AND precedence getting messed up
|
||||
|
||||
MST example
|
||||
* MST example
|
||||
|
||||
Code something with multiple threads doing something and draw the threads in different colors in a window
|
||||
* something with multiple threads doing something and draw the threads in different colors in a window
|
||||
|
||||
* heap example
|
||||
|
||||
code the heap example
|
||||
|
||||
SCRIPT--------------------------------------------------------------------------------------
|
||||
provide a running? behavior for the scripts, which actually works.
|
||||
* process:time-per-event/milliseconds is broken
|
||||
(printf-b "~a ms per event" (time-per-event/milliseconds p (changes (hold sin/x-trace))))
|
||||
|
||||
make (script-error) map to some exception stream for script errors only.
|
||||
For now it is a synonym for (display)
|
||||
Find a way to signal the error outside of FrTime's eventspace so that it doesnt loop the error endlessly
|
||||
* process:running? is broken
|
||||
|
||||
make script errors highlight the location of the error
|
||||
* Make script errors highlight the location of the error
|
||||
|
||||
let traces take a line number without offset and find the first bindable location.
|
||||
* Let traces take a line number without offset and find the first bindable location.
|
||||
|
||||
provide a body to bind instead or returning an eventstream, like (list x y)
|
||||
* Provide a body to bind instead or returning an eventstream, like (list x y)
|
||||
Write a nested syntax for bind so that you can take a first-class function that defines a way to return variables, not just as a list
|
||||
|
||||
breaks dont pause at a client -- they just send a ping when they get hit -- if you want to pause you should say ((when-e breakpoint) . -=> . (pause p)); maybe take a thunk to do when the breakpoint is hit?
|
||||
|
||||
offer a way to install a special handler for exceptions -- somehow identify which client an exceptions comes from
|
||||
* Maybe take a thunk to do when a break-point is hit?
|
||||
|
||||
|
||||
OPTIMIZATIONS-------------------------------------------------------------------------------
|
||||
improve speed of lookup for line-col->pos; load them into a hashtable? not important since this is just startup time for the script.
|
||||
* improve speed of lookup for line-col->pos; load them into a hashtable? not important since this is just startup time for the script.
|
||||
|
||||
improve speed of load/annotate
|
||||
* improve speed of load/annotate
|
||||
|
||||
improve speed of functions in (run)
|
||||
* improve speed of functions in (run)
|
||||
|
||||
|
||||
ERROR-CHECKING------------------------------------------------------------------------------
|
||||
Test what happens when you bind to variables that don't exist.
|
||||
ERROR-CHECKING/HANDLING---------------------------------------------------------------------
|
||||
* Make (script-error) map to some exception stream for script errors only.
|
||||
|
||||
* Make all exposed cells and evstreams read-only by lifting the identity function on them
|
||||
|
||||
* Turn script errors into syntax errors (i.e. what happens when you bind to variables that don't exist)
|
||||
--take the syntax when the binding is made and save it in a hashtable
|
||||
|
||||
* Offer a way to install a special handler for exceptions -- somehow identify which client an exceptions comes from
|
||||
|
||||
|
||||
TESTING/CAPABILITIES------------------------------------------------------------------------
|
||||
Does user interaction work? Can we step through loops one line at a time waiting for input? GUIs?
|
||||
* Does user interaction work? Can we step through loops one line at a time waiting for input? GUIs?
|
||||
|
||||
We want a way to interactively step through code one line at a time when we hit a breakpoint. Provide way to check bindings at the same time -- EVEN IF NOT BOUND USING TRACE/BIND
|
||||
* We want a way to interactively step through code one line at a time when we hit a breakpoint.
|
||||
Provide way to check bindings at the same time -- EVEN IF NOT BOUND USING TRACE/BIND
|
||||
|
||||
what kind of interface do we want to dig into frames
|
||||
write a nested syntax for bind so that you can take a first-class function that defines a way to return variables, not just as a list
|
||||
* What kind of interface do we want to dig into frames
|
||||
|
||||
What do we do about binding to a variable and following it EVERYWHERE it goes. Even if it is assigned to something else. Need to talk to Shriram, Greg, and Guillaume about this.
|
||||
* Need to know where the program breaks at -- need to know *when* it breaks too -- print something out
|
||||
|
||||
Find a way to bind to the result of ananonymous expression: here->(add1 2)
|
||||
* What do we do about binding to a variable and following it EVERYWHERE it goes. Even if it is assigned to something else.
|
||||
|
||||
* Find a way to bind to the result of ananonymous expression: here->(add1 2)
|
||||
|#
|
||||
|
||||
(module mztake mzscheme
|
||||
|
@ -134,12 +99,14 @@ Find a way to bind to the result of ananonymous expression: here->(add1 2)
|
|||
(debug-process? . -> . frp:behavior?)]
|
||||
[rename debug-process-exited?
|
||||
process:exited?
|
||||
(debug-process? . -> . frp:behavior?)]
|
||||
#;[rename time-per-event/milliseconds
|
||||
process:time-per-event/milliseconds
|
||||
(debug-process? frp:behavior? . -> . frp:behavior?)])
|
||||
(debug-process? . -> . frp:behavior?)])
|
||||
|
||||
;; process:running? ; disabled until it works
|
||||
#| DISABLED - BROKEN
|
||||
[process:running? (debug-process? . -> . frp:behavior?)]
|
||||
[rename time-per-event/milliseconds
|
||||
process:time-per-event/milliseconds
|
||||
(debug-process? frp:behavior? . -> . frp:behavior?)]
|
||||
|#
|
||||
|
||||
|
||||
; ; ; ;
|
||||
|
@ -156,13 +123,15 @@ Find a way to bind to the result of ananonymous expression: here->(add1 2)
|
|||
; ;; ; ; ; ; ; ; ; ;; ; ; ; ; ;; ; ; ;
|
||||
; ;;;;;; ; ;;;; ;;;;;; ;;;; ; ; ; ;;;; ; ; ;;;;
|
||||
|
||||
|
||||
;Keeps track of all debugging processes
|
||||
(define all-debug-processes null)
|
||||
|
||||
; turns debug output on and off
|
||||
(define debugging? #f)
|
||||
|
||||
;
|
||||
(define mztake-version "Rev. Wed Aug 4, 2004 - 23:57:00")
|
||||
|
||||
;###########################################################################################################
|
||||
|
||||
|
||||
|
@ -569,8 +538,11 @@ Find a way to bind to the result of ananonymous expression: here->(add1 2)
|
|||
(trace-struct-evnt-rcvr trace)))
|
||||
|
||||
|
||||
(provide create-trace create-debug-process create-debug-client)
|
||||
(provide create-trace
|
||||
create-debug-process
|
||||
create-debug-client
|
||||
mztake-version)
|
||||
|
||||
;###########################################################################################################
|
||||
|
||||
)
|
||||
)
|
Loading…
Reference in New Issue
Block a user