|
1 |
| -# dap <img src="https://user-images.githubusercontent.com/875324/235317448-1cf2d543-40a8-4eaa-b765-6576ddd7f84f.png" width="5%" /> |
| 1 | +# Haskell ESTGi Debugger |
2 | 2 |
|
3 |
| -A [Debug Adaptor Protocol](https://microsoft.github.io/debug-adapter-protocol) (DAP) library. |
| 3 | +This repository contains the components for Haskell debugging based on the Debug Adapter Protocol ([DAP](https://microsoft.github.io/debug-adapter-protocol)). |
4 | 4 |
|
5 |
| -This library can be used for constructing debug adaptors for any programming language. |
| 5 | +* [`dap/`](dap/): Language and backend independent simple DAP library |
| 6 | +* [`dap-estgi-server/`](dap-estgi-server/): DAP server for External STG Interpreter (DAP-ESTGi) |
| 7 | +* [`dap-estgi-vscode-extension/`](dap-estgi-vscode-extension/): VSCode extension to support Haskell debugging using DAP-ESTGi server |
6 | 8 |
|
| 9 | +## Overview |
7 | 10 |
|
| 11 | +The `dap-estgi-vscode-extension` turns VSCode into a Haskell debugger. |
| 12 | +VSCode offers a nice debugger UI while the debugger features are provided by the External STG Interpreter DAP Server. |
8 | 13 |
|
| 14 | +```mermaid |
| 15 | +flowchart LR |
| 16 | + subgraph User Interface |
| 17 | + A(VSCode) -.- |Plugin API| B(DAP ESTGi Extension) |
| 18 | + end |
| 19 | + B <-->|DAP via network| C(DAP ESTGi Server) |
| 20 | + subgraph Debugger |
| 21 | + C -.- |HS library API| D(External STG Interpreter) |
| 22 | + end |
9 | 23 |
|
| 24 | +``` |
| 25 | + |
| 26 | +The `dap-estgi-server` and `dap-estgi-vscode-extension` are application specific components, while the |
| 27 | +`dap` library is designed to be application independent to support any project that needs a simple DAP framework. |
| 28 | + |
| 29 | +## Setup |
| 30 | + |
| 31 | +1. VSCode setup |
| 32 | + Enable `allow breakpoints everywhere` option in VSCode settings. |
| 33 | +2. Run `dap-estgi-extension` |
| 34 | + * Run: `(cd dap-estgi-vscode-extension ; npm install)` |
| 35 | + * Open `dap-estgi-vscode-extension` folder by using the `Files/Open Folder` menu. |
| 36 | + * Open the `src/extension.ts` file. |
| 37 | + * Press F5 to run the extension in a new VSCode [Extension Development Host] window. |
| 38 | +3. Start `dap-estgi-server` |
| 39 | + `(cd dap-estgi-server ; stack run)` |
| 40 | +4. Compile debuggee program with GHC-WPC using stack |
| 41 | + * Add the following lines to debuggee's `stack.yaml`: |
| 42 | + ``` |
| 43 | + # use custom ext-stg whole program compiler GHC |
| 44 | + compiler: ghc-9.2.7 |
| 45 | + compiler-check: match-exact |
| 46 | + ghc-variant: wpc |
| 47 | + setup-info: |
| 48 | + ghc: |
| 49 | + linux64-custom-wpc-tinfo6: |
| 50 | + 9.2.7: |
| 51 | + url: "https://github.com/grin-compiler/foundation-pak/releases/download/ghc-9.2.7/ghc-9.2.7-x86_64-unknown-linux.tar.xz" |
| 52 | + macosx-custom-wpc: |
| 53 | + 9.2.7: |
| 54 | + url: "https://github.com/grin-compiler/foundation-pak/releases/download/ghc-9.2.7/ghc-9.2.7-x86_64-apple-darwin.tar.xz" |
| 55 | + ``` |
| 56 | + * Run: `stack build` |
| 57 | +5. Open debuggee program in VSCode [Extension Development Host] |
| 58 | + * Open debugge project folder by using the `Files/Open Folder` menu. |
| 59 | + * Select the debug view on the side bar |
| 60 | + * Click to `create a launch.json file`, then select `Haskell DAP ESTGi` |
| 61 | + * Press F5 or the `Play` button to start debugging |
| 62 | +
|
| 63 | +## Setup in video |
| 64 | +1. VSCode setup |
| 65 | +  |
| 66 | +2. Run `dap-estgi-extension` |
| 67 | +  |
| 68 | +3. Start `dap-estgi-server` |
| 69 | +  |
| 70 | +4. Compile debuggee program with GHC-WPC using stack |
| 71 | +  |
| 72 | +5. Open debuggee program in VSCode [Extension Development Host] |
| 73 | +  |
0 commit comments