summaryrefslogtreecommitdiff
path: root/src/GDB.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GDB.hs')
-rw-r--r--src/GDB.hs13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/GDB.hs b/src/GDB.hs
index 76c33c1..8e04c42 100644
--- a/src/GDB.hs
+++ b/src/GDB.hs
@@ -12,6 +12,7 @@ import Data.Text.IO qualified as T
import System.IO.Error
import System.Process
+import Output
import Process
gdbCmd :: String
@@ -29,10 +30,14 @@ addInferior gdb i pid = do
send gdb $ T.pack $ "-target-attach --thread-group i" ++ show i ++ " " ++ show pid
send gdb $ T.pack $ "-exec-continue --thread-group i" ++ show i
-gdbSession :: MonadIO m => Process -> m ()
-gdbSession gdb = liftIO $ do
- catchIOError (Just <$> T.getLine) (\e -> if isEOFError e then return Nothing else ioError e) >>= \case
+gdbSession :: MonadOutput m => Process -> m ()
+gdbSession gdb = do
+ outPrompt $ T.pack "gdb> "
+ liftIO loop
+ outClearPrompt
+ where
+ loop = catchIOError (Just <$> T.getLine) (\e -> if isEOFError e then return Nothing else ioError e) >>= \case
Just line -> do
send gdb (T.pack "-interpreter-exec console \"" `T.append` line `T.append` T.pack "\"")
- gdbSession gdb
+ loop
Nothing -> return ()