Changes between Version 74 and Version 75 of NewGhciDebugger


Ignore:
Timestamp:
Apr 10, 2007 12:33:31 PM (8 years ago)
Author:
guest
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewGhciDebugger

    v74 v75  
    392392The first three constructors are part of the original code, and the last one, `RunBreak` was added for the debugger. Hopefully the first three are self-explanatory; we will explain `RunBreak` in due course.
    393393
    394 Normally what happens is that `runStmt` forks a new thread to handle the evaluation of the expression. It then blocks on an `MVar` and waits for the thread to finish. When the thread finishes it fills in the `MVar`, which wakes up `runStmt`, and it returns a `RunResult`. Ultimately this gets passed back to the GHCi command line. Actually, GHCi is merely a ''client'' of the API, and other clients could also call `runStmt` if they wanted something evaluated.
     394Normally what happens is that `runStmt` forks a new thread to handle the evaluation of the expression. It then blocks on an `MVar` and waits for the thread to finish. This MVar is (now) called `statusMVar`, because it carries the execution status of the computation which is being evaluated. We will discuss its type shortly. When the thread finishes it fills in `statusMVar`, which wakes up `runStmt`, and it returns a `RunResult`. Ultimately this gets passed back to the GHCi command line. Actually, GHCi is merely a ''client'' of the API, and other clients could also call `runStmt` if they wanted something evaluated.
    395395
    396396To make the discussion comprehensible let us distinguish two threads:
     
    410410 * What happens if the expression thread forks more threads?
    411411
    412 To synchronise the GHCi thread and the expression thread when it hits a breakpoint we introduce a second MVar.
     412To arrange the early return of the expression thread when it hits a breakpoint we introduce a second MVar. At this point it is useful to give names to the two MVars:
     413  2. `statusMVar`
     414  1. `breakMVar`
     415
     416
    413417
    414418=== Inspecting values ===