summaryrefslogtreecommitdiff
path: root/src/GDB.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/GDB.hs')
-rw-r--r--src/GDB.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/GDB.hs b/src/GDB.hs
index f738bec..f360637 100644
--- a/src/GDB.hs
+++ b/src/GDB.hs
@@ -177,13 +177,14 @@ gdbCommand gdb cmd = do
gdbSession :: MonadOutput m => GDB -> m ()
gdbSession gdb = do
outPrompt "gdb> "
- loop
+ loop ""
outClearPrompt
where
- loop = liftIO (catchIOError (Just <$> T.getLine) (\e -> if isEOFError e then return Nothing else ioError e)) >>= \case
+ loop prev = liftIO (catchIOError (Just <$> T.getLine) (\e -> if isEOFError e then return Nothing else ioError e)) >>= \case
Just line -> do
- gdbCommand gdb ("-interpreter-exec console \"" <> line <> "\"")
- loop
+ let cmd = if T.null line then prev else line
+ gdbCommand gdb ("-interpreter-exec console \"" <> cmd <> "\"")
+ loop cmd
Nothing -> return ()