phoityne / haskell-dap

Haskell implementation of DAP interface data.
https://hackage.haskell.org/package/haskell-dap
BSD 3-Clause "New" or "Revised" License
24 stars 3 forks source link

Using "--with-ghc=haskell-dap" in Visual Studio Code #9

Open steve3p0 opened 5 years ago

steve3p0 commented 5 years ago

Hello, I am trying to debug Haskell with Visual Studio Code.

I am using the following extensions:

But the "--with-ghc=haskell-dap" option causes the IDE to just hang. I made sure that phoityne-vscode and haskell-dap are configured properly.

Check configuration:

PS C:\gf-rgl> phoityne-vscode --version
phoityne-vscode-0.0.28.0

PS C:\gf-rgl> haskell-dap --version
[DAP][INFO] start haskell-dap-0.0.12.0.
The Glorious Glasgow Haskell Compilation System, version 8.6.4

So if I launch debugging in Visual Studio Code with ghciCmd set to the following in launch.json:

stack ghci --with-ghc=haskell-dap --test --no-load --no-build --main-is tests --ghci-options -fprint-evld-with-show

It spits out the output below and then just hangs. If I take the "--with-ghc=haskell-dap" option out, it runs without error. Can someone tell me briefly what these options do and why do we want these specific launch options to use in the Visual Studio Code IDE?

Thanks, Steve

Output of "stack ghci --with-ghc=haskell-dap" ghciCmd in launch.json:

CWD: C:\workspace_courses\gf_steve3po\gf-rgl\tests 
CMD: stack ghci --with-ghc=haskell-dap --test --no-load --no-build --main-is tests --ghci-options -fprint-evld-with-show 
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: tests
[DAP][INFO] start haskell-dap-0.0.12.0.
GHCi, version 8.6.4: http://www.haskell.org/ghc/  :? for help
Prelude>:set prompt "H>>= "
 H>>= :set prompt-cont "H>>= "
H>>= :load C:/workspace_courses/gf_steve3po/gf-rgl/tests/run.hs
[1 of 1] Compiling Main             ( C:\workspace_courses\gf_steve3po\gf-rgl\tests\run.hs, interpreted )
Ok, one module loaded.
H>>= :module + *Main
H>>= :set -fno-break-on-exception
H>>= :set -fno-break-on-error
H>>= 
  Now, ghci launched and configuration done.
  Press F5 to start debugging.
  Or modify source code. it will be loaded to ghci automatically.

H>>= 
phoityne commented 5 years ago

Hi. The haskell-dap is a customized ghc which has some interfaces giving more detail of debugging condition, data, etc.

You can specify the ghc(debugger) implementation with the option "--with-ghc", therefore you have changed from default ghc.exe to haskell-dap.exe by adding "--with-ghc=haskell-dap"

From your output, it seems that haskell-dap worked well. Could you show debug log, by changing debugLevel to "DEBUG" in the launch.json. And let me know the setting value of "stopOnEntry" attribute in the launch.json too.

Regards.