phoityne / hdx4vsc

Haskell Debugger Extension for Visual Studio Code.
https://marketplace.visualstudio.com/items?itemName=phoityne.phoityne-vscode
BSD 3-Clause "New" or "Revised" License
50 stars 9 forks source link

debugger does not work with vscode-1.28 #1

Open phoityne opened 6 years ago

phoityne commented 6 years ago

debugger starts. can not continue(f5).

phoityne commented 6 years ago

set stopOnEntry false in the launch.json, then works.

jgefele commented 6 years ago

I noted that with stopOnEntry=false there is a :trace main in ghci in the debug console that is missing with stopOnEntry=true. If I type it manually and hit F5 the stopOnEntry mode works, too. VS code 1.29.1

Maybe it's obvious to you, but maybe it helps.

jgefele commented 6 years ago

I have to correct myself: it is enough to press Enter and then F5 in the debug console.

tomcur commented 5 years ago

For me putting stopOnEntry at false just gives :trace main but it does nothing else. Putting the same ghciCmd into a command prompt manually, and giving the same inputs as this extension, works fine. With stopOnEntry at true it stops in the main but cannot continue.

The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: spl-compiler
GHCi, version 8.0.2: http://www.haskell.org/ghc/  :? for help
Prelude>:set prompt "H>>= "
 H>>= :set prompt2 "H>>= "
H>>= :load app/Main.hs
Ok, modules loaded: ...
H>>= :module + ...
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>>= :trace main

Here it seemingly gets stuck. Running the exact same commands on a command prompt works fine.

GHCi 8.0.2 VSCode version 1.29.1 GHCi Debug Adapter Extension 0.0.20 phoityne-vscode-0.0.27.0 haskell-dap-0.0.9.0

phoityne commented 5 years ago

Hi.

@jgefele Thank you for your information.

@Beskhue Could you add "--with-ghc=haskell-dap" to ghciCmd in the launch.json file ?

  , "ghciCmd": "stack ghci --with-ghc=haskell-dap --test  . . .",

Although you have installed haskell-dap, but your log is not seems using it.

tomcur commented 5 years ago

@phoityne I've tried with both

"ghciCmd": "stack ghci --no-load --no-build --main-is TARGET --ghci-options -fghci-hist-size=5 --ghci-options -fprint-evld-with-show`"

and

"ghciCmd": "stack ghci --with-ghc=haskell-dap --no-load --no-build --main-is TARGET --ghci-options -fghci-hist-size=5 --ghci-options -fprint-evld-with-show"

(and some other forms.)

Both do seem to work now, actually, though I'm unable to inspect variable values. Unfortunately, using --with-ghc=haskell-dap no IO output is shown in the console.

However, it seems there is one main issue related to continuing: using getLine :: IO String, and providing input through the debug console, it appears the program never receives the line, and never continues. This is true whether using haskell-dap or not.

Should I open a separate issue for this?

phoityne commented 5 years ago

With haskell-dap, set logLevel to INFO for showing console output.

It is a limitation of phoityne that you can not use STDIO function in the debug target.

tomcur commented 5 years ago

@phoityne Thanks! It shows output now. It also shows variable values on breakpoints.

I figured out why it wasn't stopping on all breakpoints for me: using the {-# LANGUAGE CPP #-} pragma prevents GHCi from debugging the module correctly.

0x11901 commented 5 years ago

same problem in vscode-1.31.1 on macox 10.14.3