debugger-hs 0.1.0.0 → 0.1.1.0
raw patch · 4 files changed
+24/−16 lines, 4 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Lib: someFunc :: IO ()
+ Debugger.Render: renderToStdOut :: Script -> IO ()
Files
- README.md +14/−6
- debugger-hs.cabal +2/−3
- src/Debugger/Render.hs +8/−1
- src/Lib.hs +0/−6
README.md view
@@ -32,6 +32,12 @@ Here's an example of how you can use this library to generate a GDB script: ```haskell+#!/usr/bin/env cabal+{- cabal:+build-depends: base, debugger-hs+-}++{-# LANGUAGE OverloadedStrings #-} module Main where import qualified Debugger.Builder as D@@ -46,14 +52,15 @@ D.print "42" D.continue --- And then we can render the GDB script to a file:+-- And then we can render the GDB script to stdout: main :: IO () main = do let gdbScript = D.runBuilder script- D.renderIO gdbScript "./script.gdb"+ D.renderToStdOut gdbScript ``` -This will render the following GDB scripts:+If you save this file as "GDB.hs" and run it using `cabal run GDB.hs`,+this will render the following GDB script: ```gdb break main@@ -64,11 +71,13 @@ end ``` +Now you can use the generated script with GDB as follows:+ ```bash # Replace $PROGRAM with the program you want to debug.-$ gdb $PROGRAM <<< $(< /path/to/stack-script)+$ gdb $PROGRAM <<< $(< cabal run GDB.hs) # or if your shell doesn't support the previous command:-$ /path/to/stack-script > ./script.gdb+$ cabal run GDB.hs > ./script.gdb $ gdb $PROGRAM -ex "source ./script.gdb" ``` @@ -77,7 +86,6 @@ - [x] Create core AST datatype - [x] Create builder monad for easily constructing GDB scripts using Haskell do-syntax. - [x] Write function for compiling AST -> GDB script-- [ ] Create CLI application (stack/nix?) that takes the DSL and outputs GDB to stdout. - [ ] Add helper functions for easily adding breakpoints (using tools like grep) - [ ] Extend core AST datatype to support more functionality - [ ] Add LLDB support also?
debugger-hs.cabal view
@@ -4,10 +4,10 @@ -- -- see: https://github.com/sol/hpack ----- hash: ab9171f6a3d676dafad59e27a5c0982d34707fbc6d4ed681346b09e602b2946c+-- hash: 27721024b9f4b3213147b8b01146bae9cbdfc8754b08626d1a3151d3bddb6d83 name: debugger-hs-version: 0.1.0.0+version: 0.1.1.0 synopsis: Write your GDB scripts in Haskell. description: Please see the README on GitHub at <https://github.com/luc-tielen/debugger-hs#readme> category: debugging@@ -31,7 +31,6 @@ Debugger.Builder Debugger.Render Debugger.Statement- Lib other-modules: Paths_debugger_hs hs-source-dirs:
src/Debugger/Render.hs view
@@ -1,5 +1,6 @@ module Debugger.Render- ( renderIO+ ( renderToStdOut+ , renderIO , renderScript ) where @@ -8,6 +9,12 @@ import qualified Data.Text.IO as TIO import Debugger.Statement ++-- | Renders a GDB script and writes it to stdout.+renderToStdOut :: Script -> IO ()+renderToStdOut script =+ let txt = renderScript script+ in TIO.putStrLn txt -- | Renders a GDB script and writes it to the given file path. renderIO :: Script -> FilePath -> IO ()
− src/Lib.hs
@@ -1,6 +0,0 @@-module Lib- ( someFunc- ) where--someFunc :: IO ()-someFunc = putStrLn "someFunc"