dev: split debug/ghcdebug flags, comment out the latter for now
Compilation with ghc-debug is failing, and it has not yet been used for anything. Separate the flag and leave it in place but commented for now.
This commit is contained in:
parent
4b4cc54a6a
commit
50bf401ea6
@ -184,7 +184,7 @@ import Control.Monad.IO.Class (MonadIO, liftIO)
|
|||||||
import Data.List hiding (uncons)
|
import Data.List hiding (uncons)
|
||||||
-- import Debug.Breakpoint
|
-- import Debug.Breakpoint
|
||||||
import Debug.Trace (trace, traceIO, traceShowId)
|
import Debug.Trace (trace, traceIO, traceShowId)
|
||||||
#ifdef DEBUG
|
#ifdef GHCDEBUG
|
||||||
import GHC.Debug.Stub (pause, withGhcDebug)
|
import GHC.Debug.Stub (pause, withGhcDebug)
|
||||||
#endif
|
#endif
|
||||||
import Safe (readDef)
|
import Safe (readDef)
|
||||||
@ -224,11 +224,12 @@ debugLevel = case dropWhile (/="--debug") progArgs of
|
|||||||
_ -> 0
|
_ -> 0
|
||||||
|
|
||||||
-- | Whether ghc-debug support is included in this build, and if so, how it will behave.
|
-- | Whether ghc-debug support is included in this build, and if so, how it will behave.
|
||||||
-- When hledger is built with the @debug@ cabal flag (off by default),
|
-- When hledger is built with the @ghcdebug@ cabal flag (off by default, because of extra deps),
|
||||||
-- it can listen (on unix ?) for connections from ghc-debug clients like ghc-debug-brick,
|
-- it can listen (on unix ?) for connections from ghc-debug clients like ghc-debug-brick,
|
||||||
-- for pausing/resuming the program and inspecting memory usage and profile information.
|
-- for pausing/resuming the program and inspecting memory usage and profile information.
|
||||||
--
|
--
|
||||||
-- This is enabled by running hledger with a negative --debug level, with three different modes:
|
-- With a ghc-debug-supporting build, ghc-debug can be enabled by running hledger with
|
||||||
|
-- a negative --debug level. There are three different modes:
|
||||||
-- --debug=-1 - run normally (can be paused/resumed by a ghc-debug client),
|
-- --debug=-1 - run normally (can be paused/resumed by a ghc-debug client),
|
||||||
-- --debug=-2 - pause and await client commands at program start (not useful currently),
|
-- --debug=-2 - pause and await client commands at program start (not useful currently),
|
||||||
-- --debug=-3 - pause and await client commands at program end.
|
-- --debug=-3 - pause and await client commands at program end.
|
||||||
@ -244,7 +245,7 @@ data GhcDebugMode =
|
|||||||
-- | Is the hledger-lib package built with ghc-debug support ?
|
-- | Is the hledger-lib package built with ghc-debug support ?
|
||||||
ghcDebugSupportedInLib :: Bool
|
ghcDebugSupportedInLib :: Bool
|
||||||
ghcDebugSupportedInLib =
|
ghcDebugSupportedInLib =
|
||||||
#ifdef DEBUG
|
#ifdef GHCDEBUG
|
||||||
True
|
True
|
||||||
#else
|
#else
|
||||||
False
|
False
|
||||||
@ -254,6 +255,7 @@ ghcDebugSupportedInLib =
|
|||||||
-- See GhcDebugMode.
|
-- See GhcDebugMode.
|
||||||
ghcDebugMode :: GhcDebugMode
|
ghcDebugMode :: GhcDebugMode
|
||||||
ghcDebugMode =
|
ghcDebugMode =
|
||||||
|
#ifdef GHCDEBUG
|
||||||
case debugLevel of
|
case debugLevel of
|
||||||
_ | not ghcDebugSupportedInLib -> GDNotSupported
|
_ | not ghcDebugSupportedInLib -> GDNotSupported
|
||||||
(-1) -> GDNoPause
|
(-1) -> GDNoPause
|
||||||
@ -261,11 +263,14 @@ ghcDebugMode =
|
|||||||
(-3) -> GDPauseAtEnd
|
(-3) -> GDPauseAtEnd
|
||||||
_ -> GDDisabled
|
_ -> GDDisabled
|
||||||
-- keep synced with GhcDebugMode
|
-- keep synced with GhcDebugMode
|
||||||
|
#else
|
||||||
|
GDNotSupported
|
||||||
|
#endif
|
||||||
|
|
||||||
-- | When ghc-debug support has been built into the program and enabled at runtime with --debug=-N,
|
-- | When ghc-debug support has been built into the program and enabled at runtime with --debug=-N,
|
||||||
-- this calls ghc-debug's withGhcDebug; otherwise it's a no-op.
|
-- this calls ghc-debug's withGhcDebug; otherwise it's a no-op.
|
||||||
withGhcDebug' =
|
withGhcDebug' =
|
||||||
#ifdef DEBUG
|
#ifdef GHCDEBUG
|
||||||
if ghcDebugMode > GDDisabled then withGhcDebug else id
|
if ghcDebugMode > GDDisabled then withGhcDebug else id
|
||||||
#else
|
#else
|
||||||
id
|
id
|
||||||
@ -274,7 +279,7 @@ withGhcDebug' =
|
|||||||
-- | When ghc-debug support has been built into the program, this calls ghc-debug's pause, otherwise it's a no-op.
|
-- | When ghc-debug support has been built into the program, this calls ghc-debug's pause, otherwise it's a no-op.
|
||||||
ghcDebugPause' :: IO ()
|
ghcDebugPause' :: IO ()
|
||||||
ghcDebugPause' =
|
ghcDebugPause' =
|
||||||
#ifdef DEBUG
|
#ifdef GHCDEBUG
|
||||||
pause
|
pause
|
||||||
#else
|
#else
|
||||||
return ()
|
return ()
|
||||||
|
|||||||
@ -46,7 +46,7 @@ source-repository head
|
|||||||
location: https://github.com/simonmichael/hledger
|
location: https://github.com/simonmichael/hledger
|
||||||
|
|
||||||
flag debug
|
flag debug
|
||||||
description: Build with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
@ -172,8 +172,6 @@ library
|
|||||||
pager >=0.1.1.0
|
pager >=0.1.1.0
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
|
|
||||||
test-suite doctest
|
test-suite doctest
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
@ -237,8 +235,6 @@ test-suite doctest
|
|||||||
pager >=0.1.1.0
|
pager >=0.1.1.0
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
if impl(ghc >= 9.0) && impl(ghc < 9.2)
|
if impl(ghc >= 9.0) && impl(ghc < 9.2)
|
||||||
buildable: False
|
buildable: False
|
||||||
|
|
||||||
@ -305,5 +301,3 @@ test-suite unittest
|
|||||||
pager >=0.1.1.0
|
pager >=0.1.1.0
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
|
|||||||
@ -97,9 +97,14 @@ ghc-options:
|
|||||||
|
|
||||||
flags:
|
flags:
|
||||||
debug:
|
debug:
|
||||||
description: Build with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
default: false
|
default: false
|
||||||
manual: true
|
manual: true
|
||||||
|
# bitrotted
|
||||||
|
# ghcdebug:
|
||||||
|
# description: Build with support for attaching a ghc-debug client
|
||||||
|
# default: false
|
||||||
|
# manual: true
|
||||||
|
|
||||||
when:
|
when:
|
||||||
- condition: (!(os(windows)))
|
- condition: (!(os(windows)))
|
||||||
@ -107,8 +112,10 @@ when:
|
|||||||
- pager >=0.1.1.0
|
- pager >=0.1.1.0
|
||||||
- condition: (flag(debug))
|
- condition: (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
dependencies:
|
# - condition: (flag(ghcdebug))
|
||||||
- ghc-debug-stub >=0.6.0.0 && <0.7
|
# cpp-options: -DGHCDEBUG
|
||||||
|
# dependencies:
|
||||||
|
# - ghc-debug-stub >=0.6.0.0 && <0.7
|
||||||
|
|
||||||
source-dirs:
|
source-dirs:
|
||||||
#- other/ledger-parse
|
#- other/ledger-parse
|
||||||
|
|||||||
@ -82,13 +82,18 @@ hledgerUiMain = withGhcDebug' $ withProgName "hledger-ui.log" $ do -- force Hle
|
|||||||
dbg1IO "args" progArgs
|
dbg1IO "args" progArgs
|
||||||
dbg1IO "debugLevel" debugLevel
|
dbg1IO "debugLevel" debugLevel
|
||||||
|
|
||||||
-- try to encourage user's $PAGER to properly display ANSI (in command line help)
|
opts1@UIOpts{uoCliOpts=copts@CliOpts{inputopts_=iopts,rawopts_=rawopts}} <- getHledgerUIOpts
|
||||||
usecolor <- useColorOnStdout
|
|
||||||
when usecolor setupPager
|
|
||||||
|
|
||||||
opts@UIOpts{uoCliOpts=copts@CliOpts{inputopts_=iopts,rawopts_=rawopts}} <- getHledgerUIOpts
|
|
||||||
-- when (debug_ $ cliopts_ opts) $ printf "%s\n" prognameandversion >> printf "opts: %s\n" (show opts)
|
-- when (debug_ $ cliopts_ opts) $ printf "%s\n" prognameandversion >> printf "opts: %s\n" (show opts)
|
||||||
|
|
||||||
|
usecolor <- useColorOnStdout
|
||||||
|
-- When ANSI colour/styling is available and enabled, encourage user's $PAGER to use it (for command line help).
|
||||||
|
when usecolor setupPager
|
||||||
|
-- And when it's not, disable colour in the TUI ?
|
||||||
|
-- Theme.hs's themes currently hard code various colours and styles provided by vty,
|
||||||
|
-- which probably are disabled automatically when terminal doesn't support them.
|
||||||
|
-- But we'll at least force hledger-ui's theme to a monochrome one.
|
||||||
|
let opts = if usecolor then opts1 else opts1{uoTheme=Just "terminal"}
|
||||||
|
|
||||||
-- always generate forecasted periodic transactions; their visibility will be toggled by the UI.
|
-- always generate forecasted periodic transactions; their visibility will be toggled by the UI.
|
||||||
let copts' = copts{inputopts_=iopts{forecast_=forecast_ iopts <|> Just nulldatespan}}
|
let copts' = copts{inputopts_=iopts{forecast_=forecast_ iopts <|> Just nulldatespan}}
|
||||||
|
|
||||||
|
|||||||
@ -33,7 +33,7 @@ prognameandversion :: String
|
|||||||
prognameandversion =
|
prognameandversion =
|
||||||
versionStringWith
|
versionStringWith
|
||||||
$$tGitInfoCwdTry
|
$$tGitInfoCwdTry
|
||||||
#ifdef DEBUG
|
#ifdef GHCDEBUG
|
||||||
True
|
True
|
||||||
#else
|
#else
|
||||||
False
|
False
|
||||||
|
|||||||
@ -40,7 +40,7 @@ source-repository head
|
|||||||
location: https://github.com/simonmichael/hledger
|
location: https://github.com/simonmichael/hledger
|
||||||
|
|
||||||
flag debug
|
flag debug
|
||||||
description: Build with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
@ -107,8 +107,6 @@ library
|
|||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
if os(windows)
|
if os(windows)
|
||||||
build-depends:
|
build-depends:
|
||||||
vty-windows >=0.2.0.1 && <0.3.0.0
|
vty-windows >=0.2.0.1 && <0.3.0.0
|
||||||
@ -130,7 +128,5 @@ executable hledger-ui
|
|||||||
default-language: Haskell2010
|
default-language: Haskell2010
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
if flag(threaded)
|
if flag(threaded)
|
||||||
ghc-options: -threaded -with-rtsopts=-T
|
ghc-options: -threaded -with-rtsopts=-T
|
||||||
|
|||||||
@ -38,9 +38,14 @@ flags:
|
|||||||
default: true
|
default: true
|
||||||
manual: false
|
manual: false
|
||||||
debug:
|
debug:
|
||||||
description: Build with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
default: false
|
default: false
|
||||||
manual: true
|
manual: true
|
||||||
|
# bitrotted
|
||||||
|
# ghcdebug:
|
||||||
|
# description: Build with support for attaching a ghc-debug client
|
||||||
|
# default: false
|
||||||
|
# manual: true
|
||||||
|
|
||||||
cpp-options: -DVERSION="1.40.99"
|
cpp-options: -DVERSION="1.40.99"
|
||||||
|
|
||||||
@ -58,8 +63,10 @@ dependencies:
|
|||||||
when:
|
when:
|
||||||
- condition: (flag(debug))
|
- condition: (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
dependencies:
|
# - condition: (flag(ghcdebug))
|
||||||
- ghc-debug-stub >=0.6.0.0 && <0.7
|
# cpp-options: -DGHCDEBUG
|
||||||
|
# dependencies:
|
||||||
|
# - ghc-debug-stub >=0.6.0.0 && <0.7
|
||||||
|
|
||||||
# curses is required to build terminfo for vty for hledger-ui.
|
# curses is required to build terminfo for vty for hledger-ui.
|
||||||
# On POSIX systems it might be not present.
|
# On POSIX systems it might be not present.
|
||||||
|
|||||||
@ -43,7 +43,7 @@ prognameandversion :: String
|
|||||||
prognameandversion =
|
prognameandversion =
|
||||||
versionStringWith
|
versionStringWith
|
||||||
$$tGitInfoCwdTry
|
$$tGitInfoCwdTry
|
||||||
#ifdef DEBUG
|
#ifdef GHCDEBUG
|
||||||
True
|
True
|
||||||
#else
|
#else
|
||||||
False
|
False
|
||||||
|
|||||||
@ -113,7 +113,7 @@ source-repository head
|
|||||||
location: https://github.com/simonmichael/hledger
|
location: https://github.com/simonmichael/hledger
|
||||||
|
|
||||||
flag debug
|
flag debug
|
||||||
description: Build with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
@ -214,8 +214,6 @@ library
|
|||||||
ghc-options: -O0
|
ghc-options: -O0
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
|
|
||||||
executable hledger-web
|
executable hledger-web
|
||||||
main-is: main.hs
|
main-is: main.hs
|
||||||
@ -236,8 +234,6 @@ executable hledger-web
|
|||||||
ghc-options: -O0
|
ghc-options: -O0
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
if flag(library-only)
|
if flag(library-only)
|
||||||
buildable: False
|
buildable: False
|
||||||
if flag(threaded)
|
if flag(threaded)
|
||||||
@ -261,5 +257,3 @@ test-suite test
|
|||||||
ghc-options: -O0
|
ghc-options: -O0
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
|
|||||||
@ -60,9 +60,14 @@ flags:
|
|||||||
default: true
|
default: true
|
||||||
manual: false
|
manual: false
|
||||||
debug:
|
debug:
|
||||||
description: Build with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
default: false
|
default: false
|
||||||
manual: true
|
manual: true
|
||||||
|
# bitrotted
|
||||||
|
# ghcdebug:
|
||||||
|
# description: Build with support for attaching a ghc-debug client
|
||||||
|
# default: false
|
||||||
|
# manual: true
|
||||||
|
|
||||||
ghc-options:
|
ghc-options:
|
||||||
- -Wall
|
- -Wall
|
||||||
@ -82,8 +87,10 @@ when:
|
|||||||
ghc-options: -O0
|
ghc-options: -O0
|
||||||
- condition: (flag(debug))
|
- condition: (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
dependencies:
|
# - condition: (flag(ghcdebug))
|
||||||
- ghc-debug-stub >=0.6.0.0 && <0.7
|
# cpp-options: -DGHCDEBUG
|
||||||
|
# dependencies:
|
||||||
|
# - ghc-debug-stub >=0.6.0.0 && <0.7
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- base >=4.14 && <4.21
|
- base >=4.14 && <4.21
|
||||||
|
|||||||
@ -134,7 +134,7 @@ prognameandversion :: String
|
|||||||
prognameandversion =
|
prognameandversion =
|
||||||
versionStringWith
|
versionStringWith
|
||||||
$$tGitInfoCwdTry
|
$$tGitInfoCwdTry
|
||||||
#ifdef DEBUG
|
#ifdef GHCDEBUG
|
||||||
True
|
True
|
||||||
#else
|
#else
|
||||||
False
|
False
|
||||||
|
|||||||
@ -93,7 +93,7 @@ source-repository head
|
|||||||
location: https://github.com/simonmichael/hledger
|
location: https://github.com/simonmichael/hledger
|
||||||
|
|
||||||
flag debug
|
flag debug
|
||||||
description: Build with GHC 9.10+'s stack traces enabled, and with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
manual: True
|
manual: True
|
||||||
default: False
|
default: False
|
||||||
|
|
||||||
@ -198,8 +198,6 @@ library
|
|||||||
terminfo
|
terminfo
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
|
|
||||||
executable hledger
|
executable hledger
|
||||||
main-is: hledger-cli.hs
|
main-is: hledger-cli.hs
|
||||||
@ -252,8 +250,6 @@ executable hledger
|
|||||||
terminfo
|
terminfo
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
if flag(threaded)
|
if flag(threaded)
|
||||||
ghc-options: -threaded -with-rtsopts=-T
|
ghc-options: -threaded -with-rtsopts=-T
|
||||||
|
|
||||||
@ -307,8 +303,6 @@ test-suite unittest
|
|||||||
terminfo
|
terminfo
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
|
|
||||||
benchmark bench
|
benchmark bench
|
||||||
type: exitcode-stdio-1.0
|
type: exitcode-stdio-1.0
|
||||||
@ -362,5 +356,3 @@ benchmark bench
|
|||||||
terminfo
|
terminfo
|
||||||
if (flag(debug))
|
if (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
build-depends:
|
|
||||||
ghc-debug-stub >=0.6.0.0 && <0.7
|
|
||||||
|
|||||||
@ -100,9 +100,14 @@ flags:
|
|||||||
default: true
|
default: true
|
||||||
manual: false
|
manual: false
|
||||||
debug:
|
debug:
|
||||||
description: Build with GHC 9.10+'s stack traces enabled, and with support for attaching a ghc-debug client
|
description: Build with GHC 9.10+'s stack traces enabled
|
||||||
default: false
|
default: false
|
||||||
manual: true
|
manual: true
|
||||||
|
# bitrotted
|
||||||
|
# ghcdebug:
|
||||||
|
# description: Build with support for attaching a ghc-debug client
|
||||||
|
# default: false
|
||||||
|
# manual: true
|
||||||
|
|
||||||
ghc-options:
|
ghc-options:
|
||||||
- -Wall
|
- -Wall
|
||||||
@ -157,8 +162,10 @@ when:
|
|||||||
- terminfo
|
- terminfo
|
||||||
- condition: (flag(debug))
|
- condition: (flag(debug))
|
||||||
cpp-options: -DDEBUG
|
cpp-options: -DDEBUG
|
||||||
dependencies:
|
# - condition: (flag(ghcdebug))
|
||||||
- ghc-debug-stub >=0.6.0.0 && <0.7
|
# cpp-options: -DGHCDEBUG
|
||||||
|
# dependencies:
|
||||||
|
# - ghc-debug-stub >=0.6.0.0 && <0.7
|
||||||
|
|
||||||
library:
|
library:
|
||||||
cpp-options: -DVERSION="1.40.99"
|
cpp-options: -DVERSION="1.40.99"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user