Changes between Version 70 and Version 71 of NewGhciDebugger


Ignore:
Timestamp:
Apr 10, 2007 11:56:46 AM (8 years ago)
Author:
guest
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewGhciDebugger

    v70 v71  
    4747The debugger is integrated with GHCi, and it is on by default. The debugger slows program execution down by a factor of approximately XXX times. You can turn it off (to avoid the slowdown) using the `-fno-debug` command line argument, when you start GHCi.
    4848
    49 === Setting break points ===
     49=== Setting breakpoints ===
    5050
    5151The general rule of thumb for breakpoints is that you can set a breakpoint on any thing which is not a value (though there are some exceptions). For example, a literal character is a value, but a case expression is not.
     
    278278 * Fix the ghci help command. (EASY)
    279279
    280  * Save/restore the link environment at break points. At a breakpoint we modify both the hsc_env of the current Session, and also the persistent linker state. Both of these are held under IORefs, so we have to be careful about what we do here. The "obvious" option is to save both of these states on the resume stack when we enter a break point and then restore them when we continue execution. I have to check with Simon if there are any difficult issues that need to be resolved here, like gracefully handling exceptions etc. (MODERATE)
     280 * Save/restore the link environment at breakpoints. At a breakpoint we modify both the hsc_env of the current Session, and also the persistent linker state. Both of these are held under IORefs, so we have to be careful about what we do here. The "obvious" option is to save both of these states on the resume stack when we enter a breakpoint and then restore them when we continue execution. I have to check with Simon if there are any difficult issues that need to be resolved here, like gracefully handling exceptions etc. (MODERATE)
    281281
    282282 * Remove dependency on -fhpc flag, put debugging on by default and have a flag to turn it off. (EASY)
    283283
    284  * Allow break points to be set by function name. Some questions: what about local functions? What about functions inside
    285   type class instances, and default methods of classes? (MODERATE)
     284 * Allow breakpoints to be set by function name. Some questions: what about local functions? What about functions inside type class instances, and default methods of classes? (MODERATE)
    286285
    287286 * Support Unicode in data constructor names inside info tables. (MODERATE)
     
    393392We'll call the first one the ''GHCi thread'', and the second the ''expression thread''.
    394393
    395 In the debugger the process of evaluating an expression is made more intricate. The reason is that if the expression thread hits a breakpoint it will want to return ''early'' to the GHCi thread, so that the user can access the GHCi prompt, issue commands ''etcetera''.
     394In the debugger, the process of evaluating an expression is made more intricate. The reason is that if the expression thread hits a breakpoint it will want to return ''early'' to the GHCi thread, so that the user can access the GHCi prompt, issue commands ''etcetera''.
    396395
    397396This raises a few questions:
     
    399398 * What information needs to be passed from the expression thread to the GHCi thread, and how do we arrange that flow of information?
    400399 * How do we wake up the GHCi thread and return to the prompt?
    401  * How do we continue execution of the expression thread after we have hit a break point?
     400 * How do we continue execution of the expression thread after we have hit a breakpoint?
    402401 * What happens if we are running in the GHCi thread after a breakpoint, and we evaluate some other expression which also hits a breakpoint (i.e. what about nested breakpoints?)
    403402 * What happens if the expression thread forks more threads?
    404403
    405 Stay tuned for the answer in the next episode (crowd goes boo!).
     404To synchronise the GHCi thread and the expression thread when it hits a breakpoint we introduce a second MVar.
    406405
    407406=== Inspecting values ===