summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTristan Gingold2015-11-30 08:01:00 +0100
committerTristan Gingold2015-11-30 20:10:26 +0100
commitf7b737b52f57a46c2f96ad87ee50741abc415ed3 (patch)
treead5e3779ba7da934f15829e07556502e2648af29
parent1ce6fb9504a9f9451342e07af55a195e2f1dbda5 (diff)
downloadghdl-f7b737b52f57a46c2f96ad87ee50741abc415ed3.tar.gz
ghdl-f7b737b52f57a46c2f96ad87ee50741abc415ed3.tar.bz2
ghdl-f7b737b52f57a46c2f96ad87ee50741abc415ed3.zip
ghdl_simul debugger: add auto-repeat.
-rw-r--r--src/vhdl/simulate/debugger.adb24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/vhdl/simulate/debugger.adb b/src/vhdl/simulate/debugger.adb
index 83a241b..dd07f98 100644
--- a/src/vhdl/simulate/debugger.adb
+++ b/src/vhdl/simulate/debugger.adb
@@ -50,6 +50,12 @@ package body Debugger is
-- to the prompt.
Command_Error : exception;
+ type Menu_Procedure is access procedure (Line : String);
+
+ -- If set (by commands), call this procedure on empty line to repeat
+ -- last command.
+ Cmd_Repeat : Menu_Procedure;
+
-- For the list command: current file and current line.
List_Current_File : Source_File_Entry := No_Source_File_Entry;
List_Current_Line : Natural := 0;
@@ -943,8 +949,6 @@ package body Debugger is
type Cst_String_Acc is access constant String;
- type Menu_Procedure is access procedure (Line : String);
-
type Menu_Entry (Kind : Menu_Kind) is record
Name : Cst_String_Acc;
Next : Menu_Entry_Acc;
@@ -1053,6 +1057,7 @@ package body Debugger is
Exec_Instance := Dbg_Top_Frame;
Flag_Need_Debug := True;
Command_Status := Status_Quit;
+ Cmd_Repeat := Next_Proc'Access;
end Next_Proc;
procedure Step_Proc (Line : String)
@@ -1911,7 +1916,20 @@ package body Debugger is
loop
Raw_Line := Readline (Prompt);
-- Skip empty lines
- exit when Raw_Line /= null and then Raw_Line (1) /= ASCII.NUL;
+ if Raw_Line = null or else Raw_Line (1) = ASCII.NUL then
+ if Cmd_Repeat /= null then
+ Cmd_Repeat.all ("");
+ case Command_Status is
+ when Status_Default =>
+ null;
+ when Status_Quit =>
+ return;
+ end case;
+ end if;
+ else
+ Cmd_Repeat := null;
+ exit;
+ end if;
end loop;
declare
Line_Last : constant Natural := Strlen (Raw_Line);