Repository navigation
How to use the debugger - #12416
How to use the debugger#12416philderbeast wants to merge 9 commits into
Conversation
|
|
||
| ## Using the Haskell Debugger | ||
|
|
||
| We can debug `cabal` with the [Haskell debugger][hdb] to set breakpoints, step |
There was a problem hiding this comment.
Can this be condensed? Or portions moved somewhere where only the debugger users look? Or maybe the link to the blog post already covers most of this?
There was a problem hiding this comment.
I think we can assume anyone using the debugger would know what debugging is but I thought I should say something about it as an intro. What do you suggest? Should I dive right into the setup?
There was a problem hiding this comment.
Or maybe the link to the blog post already covers most of this?
The link is to a flashy new web site for the Haskell Debugger!
There was a problem hiding this comment.
I deleted the list of commands.
A lot of the other stuff is cabal-specific. The warning about cabal-testsuite and its setup-depends can go when we merge #12369. I'd like the tips to stay. It is important to mention the way to change directory before debugging a testsuite with relative fixtures. Perhaps the "Debugging from VS Code" section could go but having it means we cover the most common editor case in a paste and go fashion.
| A test suite runs in the root of the repository, not in the directory of its | ||
| package. Some tests read or write files relative to the directory of their | ||
| package. To run a test suite from there with the command line debugger, start | ||
| `hdb` in the package directory, giving it the absolute path of the cradle and | ||
| paths relative to the package for the file with `main` and for breakpoints: | ||
|
|
||
| ``` | ||
| $ cd cabal-install | ||
| $ hdb --cradle-file "$(realpath ../hie-hdb.yaml)" tests/UnitTests.hs -- --pattern simpleTest1 | ||
| (hdb) break tests/UnitTests.hs 32 | ||
| ``` | ||
|
|
||
| `hdb` has no setting for the working directory of the program being debugged. | ||
| When it is started from an editor, the way to change directory is to stop at a | ||
| breakpoint on the first line of `main` and evaluate this, in the debug console | ||
| for VS Code, before continuing: | ||
|
|
||
| ``` | ||
| System.Directory.setCurrentDirectory "cabal-install" | ||
| ``` |
There was a problem hiding this comment.
@alt-romes is this a good way to get a test suite to run next to its fixtures when being debugged?
There was a problem hiding this comment.
That snippet has two examples, one for the command line and one for use with an editor.
64c77ba to
ce68f96
Compare
Fixes #11427. Adds a section to the contributors guide on using the Haskell Debugger with the packages in this repo.
Adds a project for use with the debugger that doesn't load all components and a cradle. No tests are in the cradle but the guide shows how to add a test suite.
Note
Once #12348 or #12369 lands with its bumping of Cabal in the custom setup of
cabal-testsuite, we'll be able to load the default project,cabal.project, inhdbbut I'm not sure that we want to load 676 modules instead of the 531 loaded with thecabal.hdb.project.I'll squash commits before applying the merge label if this pull request is approved.