Changes between Version 61 and Version 62 of NewGhciDebugger


Ignore:
Timestamp:
Apr 9, 2007 5:33:55 PM (7 years ago)
Author:
guest
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • NewGhciDebugger

    v61 v62  
    268268---- 
    269269 
    270  
    271  
    272270== Todo == 
    273271 
    274272=== Pending === 
    275273 
    276  * Replace Loc with a proper source span type 
    277  
    278  * Look at slow behaviour of :print command on long list of chars (I've asked Pepe about this). 
    279  
    280  * Investigate whether the compiler is eta contracting this def: "bar xs = print xs", this could be a problem if we want to print out "xs". 
    281  
    282  * Implement show command (to list currently set breakpoints) 
    283  
    284  * Fix the ghci help command 
    285  
    286  * Implement the delete command (to delete one or more breakpoints) 
     274 * Replace Loc with a proper source span type. (EASY) 
     275 
     276 * Investigate whether the compiler is eta contracting this def: "bar xs = print xs", this could be a problem if we want to print out "xs". (MODERATE) 
     277 
     278 * Fix the ghci help command. (EASY) 
    287279 
    288280 * Save/restore the link environment at break points. At a breakpoint we modify both the hsc_env of the current Session, and 
    289 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. 
    290  
    291  * Remove dependency on -fhpc flag, put debugging on by default and have a flag to turn it off 
     281also 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) 
     282 
     283 * Remove dependency on -fhpc flag, put debugging on by default and have a flag to turn it off. (EASY) 
    292284 
    293285 * Allow break points to be set by function name. Some questions: what about local functions? What about functions inside 
    294   type class instances, and default methods of classes? 
    295  
    296  * Support Unicode in data constructor names inside info tables 
    297  
    298  * Fix the slow search of the ticktree for larger modules, perhaps by keeping the ticktree in the module info, rather than re-generating it each time. 
    299  
    300  * Use a primop for inspecting the STACK_AP, rather than a foreign C call 
    301  
    302  * timing and correctness tests 
    303  
    304  * Wolfgang's patch for PIC seems to break the strings in Info tables, so we need to fix that. 
    305  
    306  * stabilise the API 
    307  
    308  * user documentation 
    309  
    310  * fix the calculation of free variables at tick sites (currently done too late in the pipeline, gives some wrong results). Note a possible problem with letrecs, which means some locals vars are missing in where clause. 
     286  type class instances, and default methods of classes? (MODERATE) 
     287 
     288 * Support Unicode in data constructor names inside info tables. (MODERATE) 
     289 
     290 * Fix the slow search of the ticktree for larger modules, perhaps by keeping the ticktree in the module info, rather than re-generating it each time. (MODERATE) 
     291 
     292 * Use a primop for inspecting the STACK_AP, rather than a foreign C call. (MODERATE) 
     293 
     294 * Timing and correctness tests. (MODERATE) 
     295 
     296 * Wolfgang's patch for PIC seems to break the strings in Info tables, so we need to fix that. (MODERATE) 
     297 
     298 * Stabilise the API. (MODERATE) 
     299 
     300 * Fix the calculation of free variables at tick sites (currently done too late in the pipeline, gives some wrong results). Note a possible problem with letrecs, which means some locals vars are missing in where clause. (MODERATE/DIFFICULT) 
     301 
     302 * Extend the stack inspection primitive to allow unboxed things to be grabbed. (MODERATE) 
    311303 
    312304 
    313305=== Partially done === 
    314306 
     307 * The delete command. It is fairly primitive, and probably not done in the best way. This will be fixed when the API is finalised. 
     308 
     309 * Look at slow behaviour of :print command on long list of chars. I've asked Pepe about this, he has an idea of what the problem is and will be working on a solution soon. 
     310 
     311 * User documentation. You're looking at it. The user manual will have to move into the main GHC docs at some point. 
     312 
    315313=== Tentative === 
    316314 
    317  * perhaps there are some redundant ticks we can delete, such as ones which begin at the same start position? 
    318  
    319  * allow breakpoints to be enabled and disabled without deleting them, as in gdb 
    320  
    321  * extend breaks and step with counters, so that we stop after N hits, rather than immediately 
    322  
    323  * revert to adding tick information to the BCO directly, and remove the byte code instructions for breaks 
    324  
    325 ---- 
    326  
     315 * Perhaps there are some redundant ticks we can delete, such as ones which begin at the same start position? 
     316 
     317 * Allow breakpoints to be enabled and disabled without deleting them, as in gdb. 
     318 
     319 * Extend breaks and step with counters, so that we stop after N hits, rather than immediately. 
     320 
     321 * Revert to adding tick information to the BCO directly, and remove the byte code instructions for breaks. I'm not sure that this is worth it. In some ways the implementation based on a byte code instruction is a little cleaner than adding breaks on BCOs directly. Though the bc instruction method may be a little slower than the other way. 
     322 
     323---- 
    327324 
    328325== Implementation notes == 
    329326 
    330  
     327How does the debugger work? 
     328 
     329=== Source code instrumentation === 
     330 
     331At the front end of the compiler we annotate the source code with '''ticks''', based on the program coverage tool of Andy Gill and Colin Runciman. Ticks are uniquely numbered with respect to a particular module. Ticks are annotations on expressions, so each tick is associated with a source span, which identifies the start and end locations of the ticked expression. 
     332 
     333Roughly, if `E` is an expression to be ticked, its annotated form becomes: 
     334{{{ 
     335   case tick<N> of _ -> E 
     336}}} 
     337where `<N>` is the module-unique number of the tick.  
     338 
     339The ticks are added in the de-sugaring phase of the front end, and the instrumentation is implemented in `deSugar/Coverage.lhs`. Note, we may eventually want to merge the source coverage tool and the debugger. If we do this, it would be useful to have a single piece of code for adding tick annotations. At the moment the debugger does not use all the ticks that the coverage tool uses.  
     340 
     341Slightly later in the de-sugarer we add arguments ticks which correspond to the free variables in scope at the ticked expression. This is done in `deSugar/DsUtils.lhs`, by the function `mkTickBox`. If `a,b,c` are the free variables of a ticked expression `E`, then the annotation from above is elaborated to: 
     342{{{ 
     343   case tick<N> a b c of _ -> E 
     344}}} 
     345To make the core lint happy, we must conjure up a type for `tick<N>`. If `a::T1, b::T2, c::T3` then the type is: 
     346{{{ 
     347   tick<N> :: T1 -> T2 -> T3 -> State# RealWorld 
     348}}} 
     349 
     350=== Byte code generation === 
     351 
     352=== Stopping at a breakpoint at runtime in the byte code interpreter ===