Skip to content

Commit

Permalink
Buildable README example
Browse files Browse the repository at this point in the history
  • Loading branch information
sorki committed Dec 27, 2023
1 parent 068b8b3 commit 212bc0f
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.lhs
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
```
5 changes: 2 additions & 3 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
packages:
./hgdbmi.cabal
packages: hgdbmi.cabal

package hgdbmi
flags: +io-testsuite
flags: +build-readme +io-testsuite
18 changes: 18 additions & 0 deletions hgdbmi.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 212bc0f

Please sign in to comment.