summaryrefslogtreecommitdiff
path: root/compiler/main/GHC.hs
Commit message (Collapse)AuthorAgeFilesLines
...
* A partial attempt to improve :stepoverPepe Iborra2007-08-221-1/+6
| | | | | | | | | | | | | | With this patch, :stepover can effectively appear to step over recursive calls and calls to locally bound functions (in a where clause). However, when we run out of ticks in the current expression, the illusion vanishes and laziness brings us to the body of the last function we "stepped over". This is not desired at all, it is potentially very confusing. As a countermeasure, when this happens :stepover emits a warning "Warning: no more breakpoints in this function body, switching to :step"
* annotate C-- calls that do not returnNorman Ramsey2007-08-201-1/+1
| | | | | | | | | * The correct definition of C-- requires that a procedure not 'fall off the end'. The 'never returns' annotation tells us if a (foreign) call is not going to return. Validated!
* Use the qualified name for catchIan Lynagh2007-08-181-2/+2
| | | | Unqualified it's ambiguous with some configurations.
* Fix trac #1565: :r DoesNotExist needs to remove any let-bound valuesIan Lynagh2007-08-181-3/+10
|
* Teach :history to show the name of the enclosing declaration Pepe Iborra2007-08-151-1/+8
| | | | | | together with src locs Purely for convenience and user friendliness
* A new :stepover command for the debuggerPepe Iborra2007-08-091-1/+1
| | | | | | | | | | | | | | | | | | | Step from statement to statement without leaving the block. Tries to do the sensible thing when used on expressions. The idea is to: 1 - Step to the next breakpoint and examine the srcloc 2 - If it is contained in the same statement block as we were, then stop and give control to the user, else continue to the next breakpoint 3 - Repeat from 1. If we reach the end of the statement block, i.e. no more ticks in this expression after the current one, then step normally. Replace statement block with 'declaration block' (of an expression) in the pseudo algo. above. Let's see how well this idea works in practice...
* Further compileToCore improvementsTim Chevalier2007-06-291-44/+39
| | | | | | | | | | | Per suggestions from Simon M: * Changed GHC.checkModule so that it doesn't call depanal. * Changed GHC.checkModule to optionally return Core bindings as a component of the CheckedModule that it returns (and resulting changes to HscMain.hscFileCheck). * As a result, simplified GHC.compileToCore and changed it to load the given file so that the caller doesn't have to.
* Modify compileToCore to take just a filenameTim Chevalier2007-06-271-5/+11
| | | | | | Modified compileToCore to take just a session and a filename, rather than a module name as well, since the module name can be computed from the filename.
* Add a compileToCore function to the GHC APITim Chevalier2007-06-251-2/+33
| | | | | | | | | | Added a compileToCore function to the GHC API that takes a session, module, and filename, and returns a list of Core bindings if successful. This is just a first try and could probably be improved (for example, there's probably a way to get the filename from the module so that it doesn't have to be passed in, I just don't see it offhand.)
* remove #if branches for pre-ghc-6.0Isaac Dupree2007-06-051-6/+1
| | | | | | I skipped utils/hsc2hs/Main.hs since its ifs also involved checking for old versions of nhc98 (I don't want to figure that out), but removed everything else I found relating to building with pre-6.0
* fix panic in #1379Simon Marlow2007-06-051-1/+1
|
* export noSrcLoc, noSrcSpanSimon Marlow2007-05-301-2/+2
|
* Store a SrcSpan instead of a SrcLoc inside a NameSimon Marlow2007-05-111-2/+2
| | | | This has been a long-standing ToDo.
* FIX #1181: parseStaticFlags should not be requiredSimon Marlow2007-05-101-0/+3
| | | | | | | - parseStaticFlags is now not required, but if it is called, it should be called only once and before newSession, otherwise you get an error. - parseStaticFlags is exported from GHC
* add defaultObjectTarget to the GHC APISimon Marlow2007-05-071-1/+1
| | | | | We had no way of getting the right value of HscTarget to use to request object files as output.
* Add history/trace functionality to the GHCi debuggerSimon Marlow2007-05-031-3/+7
| | | | | | | | The debugger can now log each step of the evaluation without actually stopping, keeping a history of the recent steps (currently 50). When a (real) breakpoint is hit, you can examine previous steps in the history (and their free variables) using the :history, :back and :forward commands.
* cancel out some reverses by changing the order of ic_tmp_idsSimon Marlow2007-05-031-3/+9
|
* Refactoring, tidyup and improve layeringSimon Marlow2007-05-021-512/+18
| | | | | | | | | | | | | | | The stack of breakpoint resume contexts is now part of the InteractiveContext and managed by the GHC API. This prevents misuse of the resume context by the client (e.g. resuming a breakpoint that isn't the topmost, which would lead to a confused IC at the least). I changed the TypeEnv in the IC to a [Id]. It only contained Ids anyway, and this allows us to have shadowing, which removes an ugly and annoying restriction. The parts of the GHC API which deal with interactive evaluation are now in a module of their own, InteractiveEval.
* don't forget to enable ^C after a :cont or :stepSimon Marlow2007-04-301-0/+1
|
* outside of runStmt, if a breakpoint is hit then just print a messageSimon Marlow2007-04-271-12/+22
|
* Breakpoints: don't attempt to bind variables with unboxed typesSimon Marlow2007-04-271-16/+21
|
* getRdrNamesInScope: return interactively-bound names tooSimon Marlow2007-04-261-2/+9
| | | | so completion can now complete names of local bindings
* unused importSimon Marlow2007-04-261-1/+0
|
* Give a better error message when we try to print a value of unknown typeSimon Marlow2007-04-261-1/+1
| | | | | | | | | | | | Stopped at ../Test3.hs:(1,0)-(2,30) _result :: [a] [../Test3.hs:(1,0)-(2,30)] *Main> _result <interactive>:1:0: Ambiguous type variable `a' in the constraint: `Show a' arising from a use of `print' at <interactive>:1:0-6 Cannot resolve unkonwn runtime types: a Use :print or :force to determine these types
* Tidy types of free vars at a breakpointSimon Marlow2007-04-251-18/+15
| | | | | Also share the code that extends the InteractiveContext between tcRnStmt and GHC.extendEnvironment.
* remember the type of _resultSimon Marlow2007-04-251-20/+37
|
* Keep track of free type variables in the interactive bindingsSimon Marlow2007-04-251-8/+9
| | | | | | | | Now, the type checker won't attempt to generalise over the skolem variables in the interactive bindings. If we end up trying to show one of these types, there will be an unresolved predicate 'Show t' which causes a type error (albeit a strange one, I'll fix that later).
* convert type variables to TcTyVars, otherwise the typechecker gets confusedSimon Marlow2007-04-241-2/+13
|
* DebuggerTys doesn't exist any moreSimon Marlow2007-04-241-1/+0
|
* Breakpoints: get the names of the free variables rightSimon Marlow2007-04-241-18/+38
| | | | | | | | | | | | Previously we relied on the names of the Ids attached to a tick being the same as the names of the original variables in the source code. Sometimes this worked, sometimes it didn't because the simplifier would inline away the Id. So now we do this properly and retain the original OccNames from the source code for each breakpoint, and use these to construct the new Ids when we stop. Doing this involved moving the tracking of in-scope variables from the desugarer to the coverage pass.
* We no longer instantiate tyvars to Unknown types in the :print mechanismPepe Iborra2007-04-241-7/+1
| | | | | | Instead, we keep the original tyvars. The plan is to exploit type relationships among closures to recover more types.
* remove a ToDoSimon Marlow2007-04-201-1/+1
|
* export SrcSpan & utils from GHCSimon Marlow2007-04-201-0/+8
|
* Get the InteractiveContext right when stopped at a breakpointSimon Marlow2007-04-191-18/+26
| | | | we shouldn't be binding 'it' until the computation has actually finished.
* more layering cleanup: BreakArray should come from GHCSimon Marlow2007-04-191-0/+2
|
* Restore the interactive context when resuming a breakpointSimon Marlow2007-04-181-20/+44
| | | | | | So that we don't accumulate bindings from previous breakpoints, which could lead to a space leak.
* remove dead codeSimon Marlow2007-04-181-8/+0
|
* Various cleanups and improvements to the breakpoint supportSimon Marlow2007-04-181-77/+121
| | | | | | | | | | | | | | | | | | | | | | | | | - move parts of the debugger implementation below the GHC API where they belong. There is still more in Debugger that violates the layering, hopefully I'll get to that later. - instead of returning an IO action from runStmt for resuming, return a ResumeHandle that is passed to GHC.resume. - breakpoints now return [Name] which is displayed in the same way as when a binding statement is executed. - :load, :add, :reload now clear the active breakpoints and context - :break gives a sensible error when used on a non-interpreted module - export breakpoint-related types from GHC - remove a bunch of layer-violating imports from InteractiveUI - remove some more vestiges of the old breakpoint code (topLevel in the GHCi state). - remove TickTree and use a simple array instead, cached per module
* Re-working of the breakpoint supportSimon Marlow2007-04-171-113/+61
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the result of Bernie Pope's internship work at MSR Cambridge, with some subsequent improvements by me. The main plan was to (a) Reduce the overhead for breakpoints, so we could enable the feature by default without incurrent a significant penalty (b) Scatter more breakpoint sites throughout the code Currently we can set a breakpoint on almost any subexpression, and the overhead is around 1.5x slower than normal GHCi. I hope to be able to get this down further and/or allow breakpoints to be turned off. This patch also fixes up :print following the recent changes to constructor info tables. (most of the :print tests now pass) We now support single-stepping, which just enables all breakpoints. :step <expr> executes <expr> with single-stepping turned on :step single-steps from the current breakpoint The mechanism is quite different to the previous implementation. We share code with the HPC (haskell program coverage) implementation now. The coverage pass annotates source code with "tick" locations which are tracked by the coverage tool. In GHCi, each "tick" becomes a potential breakpoint location. Previously breakpoints were compiled into code that magically invoked a nested instance of GHCi. Now, a breakpoint causes the current thread to block and control is returned to GHCi. See the wiki page for more details and the current ToDo list: http://hackage.haskell.org/trac/ghc/wiki/NewGhciDebugger
* Rationalise GhcMode, HscTarget and GhcLinkSimon Marlow2007-04-111-91/+124
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch cleans up the GHC API, and adds some functionality: we can now compile to object code inside GHCi. Previously we had: data GhcMode = BatchCompile | Interactive | OneShot | JustTypecheck | MkDepend data HscTarget = HscC | HscAsm | HscJava | HscInterpreted | HscNothing There was redundancy here; if GhcMode is Interactive, then only HscInterpreted makes sense, and JustTypecheck required HscNothing. Now we have: data GhcMode = CompManager -- ^ --make, GHCi, etc. | OneShot -- ^ ghc -c Foo.hs | MkDepend -- ^ ghc -M, see Finder for why we need this and HscTarget remains as before. Previously GhcLink looked like this: data GhcLink = NoLink | StaticLink Now we have: data GhcLink = NoLink | LinkBinary | LinkInMemory The idea being that you can have an HscTarget of HscAsm (for example) and still link in memory. There are two new flags: -fobject-code selects object code as the target (selects either -fasm or -fvia-C, whichever is the default) This can be usd with ':set' in GHCi, or on the command line. -fbyte-code sets byte-code as the target. Only works in GHCi. One day maybe this could save the byte code in a file when used outside GHCi. (names chosen for consistency with -fno-code). Changes to the GHC API: newSession no longer takes the GhcMode argument. The GhcMode defaults to CompManager, which is usually what you want. To do JustTypecheck now, just set hscTarget to HscNothing.
* Fix C/Haskell type mismatchesIan Lynagh2007-04-041-0/+3
|
* make GHCi use base:Prelude, not just PreludeSimon Marlow2007-03-271-1/+1
| | | | | The module that GHCi uses for its default scope should be exactly base:Prelude, not whatever Prelude is found on the search path.
* Improving the performance of breakpoints up to 50% (by playing with laziness)Pepe Iborra2007-02-211-20/+17
| | | | | | | | | | This patch performs several optimizations with the goal of minimizing the cost of building the arguments to breakpointJump: - Group them all in a single tuple, to minimize closure creation in heap - Wrap this with the GHC.Base.lazy combinator, to induce max laziness - Remove as many literal strings as possible * injecting a module-local CAF to store the module name and use that * eliminating the package string (not needed).
* Extend the local bindings at a breakpoint with one for the wrapped expressionPepe Iborra2007-02-021-2/+8
| | | | | | | By popular request, in a breakpoint it is possible now to inspect the result of the expression wrapped by the breakpoint. The user interface for this is right now preliminar; there is a new binding called '_result' at every breakpoint. Suggestions are welcome!
* Always pay attention to -keep-tmp-files when we want to delete filesIan Lynagh2007-01-311-3/+2
|
* Add obtainTerm1 to the GHC apiPepe Iborra2007-01-201-1/+4
|
* Added the new :breakpoint continue optionPepe Iborra2007-01-111-2/+8
| | | | | | | | | | | Previously, when in a breakpoint, :quit was used to continue execution. This is not the right thing to do, so this patch restores :quit to its original meaning whether or not ghci is in an inferior session. The continue behavior is now provided by ":breakpoint continue". I added a synonim command in :continue because it is much shorter, but this is optional
* Add the function TypeRep.pprTypeApp, and use itsimonpj@microsoft.com2007-01-111-3/+5
| | | | | pprTypeApp :: SDoc -> [Type] -> SDoc pprTypeApp pp tys = hang pp 2 (sep (map pprParendType tys))
* Remove uses of Data.Traversable to fix stage1 on pre ghc-6.6 systemsPepe Iborra2006-12-181-1/+0
|
* Adjust code from manual mergesPepe Iborra2006-12-111-3/+3
|