Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

53 lines (40 sloc) 2.875 kb
<html>
<head>
<link rel="stylesheet" href="../../../PRODUCT_PLUGIN/book.css" type="text/css">
</head>
<body>
<h1>Debugging</h1>
<p>This plug-in supports debugging of Haskell modules using GHCi. That means that the features
in this section are available only if the module is run within a GHCi session. To do this,
right-click the module, and select <b>Debug As &gt; GHCi session</b>.</p>
<p>You can add breakpoints in your code double-clicking in the left margin of the source code
editor. A small blue circle will appear in the selected line. You can delete the breakpoint
double-clicking one of those circles. Note that currently EclipseFP does not allow to set
breakpoints in particular expressions, only in entire lines.</p>
<p>Once you start running functions in your module, it is recommended to change to the
<i>Debug</i> perspective by going to the main menu and selecting
<b>Window &gt; Open Perspective &gt; Debug</b>. This gives you access to the debugging tools.</p>
<p>When a breakpoint is reached, the expression being evaluated is shown with a different
background in the code editor. You can step or continue using the buttons available in
the <i>Debug</i> view.</p>
<p>You can also inspect the value of the variables in the <i>Variables</i> view. As withing GHCi,
variables that aren't yet evaluated are shown as <code>_</code>. Typing something in the variable value field causes
evaluation of the variable, which may modify the performance or behavior of your program.</p>
<p>You can also add Expressions in the Expressions view. You can create new expressions by typing the full code, and you can also
select expressions in your code, right click and choose <b>Watch</b>. If you only want to see the value of an expression at
one point in time you can just select the expression in the code, right click and choose <b>Display</b>. A popup will appear with the
current value.</p>
<p>GHCi does not have the concept of stack traces (which are not always relevant in a lazy language). However it can keep the
history of expressions it has evaluated. EclipseFP translates this history in stack frames in the <i>Debug</i> view. Just
launch your function with :trace to get reliable history information (For example, if you want to launch your main function in GHCi,
type in <code>:trace main</code>);</p>
<h3>Debugging an executable</h3>
<p>EclipseFP does not support direct debugging of executables. However, you can simulate it
following these steps:
<li>Right-click your main module and select debugging within GHCi,</li>
<li>If you havne't done it yet, add breakpoints to your code,</li>
<li>In the GHCi console, write <code>main</code> and press the Enter key. This will
execute the <code>main</code> function, which is the entry point of your application.</li>
</p>
</body>
</html>
Jump to Line
Something went wrong with that request. Please try again.