| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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"
|
|
|
|
|
|
|
|
|
| |
* 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!
|
|
|
|
| |
Unqualified it's ambiguous with some configurations.
|
| |
|
|
|
|
|
|
| |
together with src locs
Purely for convenience and user friendliness
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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...
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
|
|
|
|
| |
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.)
|
|
|
|
|
|
| |
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
|
| |
|
| |
|
|
|
|
| |
This has been a long-standing ToDo.
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
| |
We had no way of getting the right value of HscTarget to use to
request object files as output.
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
| |
|
|
|
|
| |
so completion can now complete names of local bindings
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
Also share the code that extends the InteractiveContext between
tcRnStmt and GHC.extendEnvironment.
|
| |
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
Instead, we keep the original tyvars.
The plan is to exploit type relationships among closures to recover more types.
|
| |
|
| |
|
|
|
|
| |
we shouldn't be binding 'it' until the computation has actually finished.
|
| |
|
|
|
|
|
|
| |
So that we don't accumulate bindings from previous breakpoints, which
could lead to a space leak.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
- 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
|
|
|
|
| |
The module that GHCi uses for its default scope should be exactly
base:Prelude, not whatever Prelude is found on the search path.
|
|
|
|
|
|
|
|
|
|
| |
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).
|
|
|
|
|
|
|
| |
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!
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
| |
pprTypeApp :: SDoc -> [Type] -> SDoc
pprTypeApp pp tys = hang pp 2 (sep (map pprParendType tys))
|
| |
|
| |
|