Debugging via "Debug perspective"

Help
asop
2012-08-04
2012-12-06
  • asop
    asop
    2012-08-04

    Hi,

    I get something weird when debugging and terminating the program early :

    1)I open my haskell project and switch to the debug perspective.
    2)Put breakpoints at relevant places.
    3)Menu : Run->Debug
    4)In Console window type "main"
    5)The code stops at the breakpoint in Main.hs, and there is an -> arrow at breakpoint
    6)Then in console window I click red button (Terminate)
    7)The -> arrow is still on the breakpoint.
    8) In order to get rid of it I have to do : Run->Resume
    9)I get an error message. At this point the -> arrow disappears

    Thanks

     
  • asop
    asop
    2012-08-04

    I am using eclipse Version: 4.2.0 on windows 7

     
  • asop
    asop
    2012-08-04

    I have also noticed another thing.

    1)If I do as above until point (5).
    2)Menu : Run->Resume then program finishes
    3)Now if I type "main" into the console window, program runs without stopping at breakpoint.

    Why does program stop at breakpoint first time and not at second time. Clearly I can terminate and start the program again, but this is tedious to do!  Thanks

     
  • JP Moresmau
    JP Moresmau
    2012-10-24

    Sorry, I forgot to deal with these messages. Your first problem I can reproduce, there are actually two things. When you terminate and you're on a breakpoint, we weren't sending all the proper events, hence the arrow stayed in place. Then the resume button cannot be selected, once you terminated, GHCi is killed, so you can just restart a new session.
    The second problem I can't reproduce, I always stop at my breakpoint, but there may be things linked to your code, lazy evaluation, etc…

     
  • asop
    asop
    2012-10-27

    Hi, the piece of code is :

    ****************
    module Main where

    main = print (myadd 2 4)

    myadd :: Int -> Int -> Int
    myadd a b = a + b
    ***********************

    where the breakpoint is at "myadd a b = a + b". Just to clarify this is what I do :

    1)open my haskell project and switch to the debug perspective.
    2)Breakpoint at "myadd a b = a + b"
    3)Menu : Run->Debug
    4)In Console window type "main"
    5)Code stops at breakpoint
    6)Menu : Run->Resume then program finishes
    7)Now if I type "main" into the console window, program runs without stopping at breakpoint.

     
  • asop
    asop
    2012-10-27

    Note that if I press "Run->Debug" again (before doing the second "main" in the Console) it stops again at the breakpoint. But in the above I did the "Run->Debug" only once.

     
  • JP Moresmau
    JP Moresmau
    2012-10-27

    GHCI does that outside of EclipseFP, nothing to do with me:
    d:\dev\haskell\jp-github\runtime-New_configuration\DebugP\src>ghci Main.hs
    GHCi, version 7.4.1: http://www.haskell.org/ghc/  :? for help
    Loading package ghc-prim … linking … done.
    Loading package integer-gmp … linking … done.
    Loading package base … linking … done.
    Compiling Main             ( Main.hs, interpreted )
    Ok, modules loaded: Main.
    *Main> :b 11
    Breakpoint 0 activated at Main.hs:11:1-17
    *Main> main
    Loading package array-0.4.0.0 … linking … done.
    Loading package bytestring-0.9.2.1 … linking … done.
    Loading package deepseq-1.3.0.0 … linking … done.
    Loading package text-0.11.2.0 … linking … done.
    Loading package containers-0.4.2.1 … linking … done.
    Loading package tagsoup-0.12.8 … linking … done.
    Stopped at Main.hs:11:1-17
    _result :: Int = _
    *Main> :continue
    6
    *Main> main
    6

    Does not stop on the second invocation at the breakpoint…

     
  • asop
    asop
    2012-10-27

    Aha. Very interesting. Maybe I'll have to trouble someone else about this one!:) Thanks