Skip to content

How to use the debugger - #12416

Open
philderbeast wants to merge 9 commits into
haskell:masterfrom
cabalism:doc/haskell-debugger-use
Open

philderbeast wants to merge 9 commits into
haskell:masterfrom
cabalism:doc/haskell-debugger-use

Conversation

@philderbeast

@philderbeast philderbeast commented Oct 7, 2026 •

Copy link
Copy Markdown
Collaborator

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, in hdb but I'm not sure that we want to load 676 modules instead of the 531 loaded with the cabal.hdb.project.

I'll squash commits before applying the merge label if this pull request is approved.


  • Patches conform to the coding conventions.
  • Is this a PR that fixes CI? If so, it will need to be backported to older cabal release branches (ask maintainers for directions).

Comment thread CONTRIBUTING.md

## Using the Haskell Debugger

We can debug `cabal` with the [Haskell debugger][hdb] to set breakpoints, step

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@philderbeast philderbeast mentioned this pull request Oct 7, 2026
1 of 2 tasks
Comment thread CONTRIBUTING.md
Comment on lines +326 to +345
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"
```

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@alt-romes is this a good way to get a test suite to run next to its fixtures when being debugged?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That snippet has two examples, one for the command line and one for use with an editor.

@philderbeast
philderbeast force-pushed the doc/haskell-debugger-use branch from 64c77ba to ce68f96 Compare October 8, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add haskell-debugger notes to contributing guide

2 participants