summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2023-01-13 22:54:52 +0100
committerRoman Smrž <roman.smrz@seznam.cz>2023-01-13 22:54:52 +0100
commit6deeb46561c122f22bb289522520bc458636a796 (patch)
tree711e8e12ca2afd2949f727b2716d3981887a9a99
parent27abb1cc73606741e7f54133f789d86fcff10dcb (diff)
GDB: replay last command on empty input
-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 ()