diff options
author | Roman Smrž <roman.smrz@seznam.cz> | 2023-01-13 22:54:52 +0100 |
---|---|---|
committer | Roman Smrž <roman.smrz@seznam.cz> | 2023-01-13 22:54:52 +0100 |
commit | 6deeb46561c122f22bb289522520bc458636a796 (patch) | |
tree | 711e8e12ca2afd2949f727b2716d3981887a9a99 /src/GDB.hs | |
parent | 27abb1cc73606741e7f54133f789d86fcff10dcb (diff) |
GDB: replay last command on empty input
Diffstat (limited to 'src/GDB.hs')
-rw-r--r-- | src/GDB.hs | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -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 () |