ANN: GhciExt 0.6 for GHC 6.10.3
Peter Hercek
phercek at gmail.com
Thu May 14 17:24:40 EDT 2009
Hi,
I know there were 4 unique IP addresses which checked it out. Since I do
not know who they are I just spam this list again :)
You can get it here: http://www.hck.sk/users/peter/pub/
If you decide to give it a try then read the README file before installing.
It should work with the stock GHC 6.10.2 and higher, but I only tried
briefly with GHC 6.10.3 (as it was released) and I use it without any
problem with my customized GHC 6.10.3 (dirty support for ansi escape
sequences in ':set prompt' for color highlighting of the prompt, patch
for ticket http://hackage.haskell.org/trac/ghc/ticket/3084 (allow macros
to redefine builtin GHCi commands), and few more details).
Here is what it does:
Prelude> :defs long
:. <file> -- source commands from <file>
:* <count> <cmd>... -- run <cmd> <count> times
:x <cmd>... -- run <cmd> with stdout suppressed
:out -- redirect ghci stdout back to console
:redir <var> <cmd>... -- execute <cmd> redirecting stdout to <var>
:grep <args> < <cmd>... -- run grep <args> on <cmd> output
Runs grep from your OS on the output of <cmd>. This means all the options
of your OS grep are available. '<' separates grep options from the command.
:find <cmd> [-]<var> -- step with <cmd> until <var> is found
Prepend variable name with '-' to disable printing of its value.
:locate <cmd> <bpArgs> -- step with <cmd> until location <bpArgs> is hit
:bp <bpArgs> -- put breakpoint at <bpArgs> (adds hit count)
:inject <cc> <c> <sc> <b> -- at location <b> run <c> if <cc> and stop if
<sc>
There are two special identifiers which can be used in the breakpoint
code (<c>) and the breakpoint stop condition (<sc>); but which are not
usable in the breakpoint code condition (<cc>). These are:
- ghciExt_BpId - macro name; translates to breakpoint id
- ghciExt_HitCnt - macro name; translates to breakpoint hit count
:strobe ["<c>"] <b> -- at location <b> show hit count if <c>
:monitor ["<c>"] <vs> <b> -- show comma-sep. variables at location <b>
if <c>
:watch <cond> <bpArgs> -- break at location <bpArgs> when <cond> is True
:count <N> [<bpArgs>] -- count/stop execution at <bpArgs> or query
bp hits
There are three ways how to use this command:
- :count 0 <bpArgs> - never stops; counts hits and extends trace history
- :count N <bpArgs> - stops when location <bpArgs> is hit N-th time
- :count N - shows hit count of a ghciExt breakpoint with number N.
:hl <cmd>... -- highlight the output of <cmd>
:defs [long] -- list user commands (possibly with long help)
General information for all GhciExt commands:
- Most arguments may be in quotation marks (to allow spaces in them).
- Instead of a regular quotation mark, @x can be used to start a string
argument too. In such a case the argument is finished when character
x appears again after `@x' string. Use any character in place of x.
This was added so that one does not need to escape quotation marks
and back-slashes in arguments (especially those representing code).
Prelude>
Not so much obsolete description of how it works (and how to use it) is
here:
http://permalink.gmane.org/gmane.comp.lang.haskell.glasgow.user/16270
Notable changes are:
* much better :grep command (you can even get color highlighted output)
* you do not need to prefix commands :main, :continute, :step, and :trace with :x any more
* :findex replaced with much better :locate
It works on linux. The only reason I recall it would not work on windows is the use of '/dev/null'. But I never tried on windows.
Enjoy,
Peter.
More information about the Glasgow-haskell-users
mailing list