diff --git a/README.lhs b/README.lhs new file mode 120000 index 0000000..42061c0 --- /dev/null +++ b/README.lhs @@ -0,0 +1 @@ +README.md \ No newline at end of file diff --git a/README.md b/README.md index c2bc917..bc1b4f5 100644 --- a/README.md +++ b/README.md @@ -13,3 +13,22 @@ which is fork of [hgdbmi v0.1](https://hackage.haskell.org/package/hgdbmi-0.1). * [GDM Machine Interface](http://sourceware.org/gdb/current/onlinedocs/gdb/GDB_002fMI.html) * [libgdbmi](http://sourceforge.net/projects/libmigdb/) C/C++ implementation for reference * [Debugger Machine Interface (DMI) Working Group](https://wiki.linuxfoundation.org/en/Debugger_Machine_Interface_(DMI)) + +## Example + +```haskell +import Gdb + +main :: IO () +main = runGDB example >>= print + +example + :: MonadGDB m + => m String +example = do + file "example" + breakpoint' (file_function_location "example.c" "print") + _ <- run + onBreak $ \_stopped -> do + eval "i" +``` diff --git a/cabal.project b/cabal.project index 762e6cd..7885084 100644 --- a/cabal.project +++ b/cabal.project @@ -1,5 +1,4 @@ -packages: - ./hgdbmi.cabal +packages: hgdbmi.cabal package hgdbmi - flags: +io-testsuite + flags: +build-readme +io-testsuite diff --git a/hgdbmi.cabal b/hgdbmi.cabal index 2775380..31720f5 100644 --- a/hgdbmi.cabal +++ b/hgdbmi.cabal @@ -36,6 +36,12 @@ flag io-testsuite description: Enable testsuite, which requires external binaries +flag build-readme + default: + False + description: + Build README.lhs example + source-repository head type: git location: git://github.com/DistRap/hgdbmi.git @@ -67,6 +73,18 @@ library ghc-options: -Wall default-language: Haskell2010 +executable hgdbmi-readme + if !flag(build-readme) + buildable: False + build-depends: + base >=4.12 && <5 + , hgdbmi + build-tool-depends: + markdown-unlit:markdown-unlit + default-language: Haskell2010 + main-is: README.lhs + ghc-options: -pgmL markdown-unlit -Wall + test-suite pure type: exitcode-stdio-1.0 main-is: pure.hs