diff options
author | Tristan Gingold <gingold@adacore.com> | 2015-12-02 07:36:20 +0100 |
---|---|---|
committer | Tristan Gingold <gingold@adacore.com> | 2015-12-03 05:23:27 +0100 |
commit | 5632cc08482c6bca1c7af342725ea00145a91e84 (patch) | |
tree | 8e816709d3263604e8faac0b634d77a98296c821 /src/vhdl | |
parent | c80fac000e38dc41dc6b81d5a361ab3a4a1c81c7 (diff) | |
download | ghdl-5632cc08482c6bca1c7af342725ea00145a91e84.tar.gz ghdl-5632cc08482c6bca1c7af342725ea00145a91e84.tar.bz2 ghdl-5632cc08482c6bca1c7af342725ea00145a91e84.zip |
ghdl_simul debugger: handle break on operator, handle end of file.
Diffstat (limited to 'src/vhdl')
-rw-r--r-- | src/vhdl/parse.adb | 8 | ||||
-rw-r--r-- | src/vhdl/parse.ads | 7 | ||||
-rw-r--r-- | src/vhdl/simulate/debugger.adb | 35 | ||||
-rw-r--r-- | src/vhdl/simulate/iir_values.adb | 2 |
4 files changed, 45 insertions, 7 deletions
diff --git a/src/vhdl/parse.adb b/src/vhdl/parse.adb index a56c785f5..b3a8cd91b 100644 --- a/src/vhdl/parse.adb +++ b/src/vhdl/parse.adb @@ -17,7 +17,6 @@ -- 02111-1307, USA. with Iir_Chains; use Iir_Chains; with Ada.Text_IO; use Ada.Text_IO; -with Types; use Types; with Tokens; use Tokens; with Scanner; use Scanner; with Iirs_Utils; use Iirs_Utils; @@ -5292,7 +5291,10 @@ package body Parse is loop Set_Condition (Clause, Parse_Expression); Expect (Tok_Then, "'then' is expected here"); + + -- Skip 'then'. Scan; + Set_Sequential_Statement_Chain (Clause, Parse_Sequential_Statements (Res)); exit when Current_Token = Tok_End; @@ -5301,11 +5303,15 @@ package body Parse is Set_Else_Clause (Clause, N_Clause); Clause := N_Clause; if Current_Token = Tok_Else then + + -- Skip 'else'. Scan; + Set_Sequential_Statement_Chain (Clause, Parse_Sequential_Statements (Res)); exit; elsif Current_Token = Tok_Elsif then + -- Skip 'elsif'. Scan; else Error_Msg_Parse ("'else' or 'elsif' expected"); diff --git a/src/vhdl/parse.ads b/src/vhdl/parse.ads index 26bdef3ec..ea7c56cf0 100644 --- a/src/vhdl/parse.ads +++ b/src/vhdl/parse.ads @@ -15,6 +15,7 @@ -- along with GHDL; see the file COPYING. If not, write to the Free -- Software Foundation, 59 Temple Place - Suite 330, Boston, MA -- 02111-1307, USA. +with Types; use Types; with Iirs; use Iirs; package Parse is @@ -29,6 +30,12 @@ package Parse is -- Parse an relationnal operator and its rhs. function Parse_Relation_Rhs (Left : Iir) return Iir; + -- Convert the STR (0 .. LEN - 1) into a operator symbol identifier. + -- Emit an error message if the name is not an operator name. + function Str_To_Operator_Name (Str_Id : String8_Id; + Len : Nat32; + Loc : Location_Type) return Name_Id; + -- Parse a single design unit. -- The scanner must have been initialized, however, the current_token -- shouldn't have been set. diff --git a/src/vhdl/simulate/debugger.adb b/src/vhdl/simulate/debugger.adb index af475472a..b56efafc6 100644 --- a/src/vhdl/simulate/debugger.adb +++ b/src/vhdl/simulate/debugger.adb @@ -22,6 +22,7 @@ with GNAT.Table; with Types; use Types; with Iir_Values; use Iir_Values; with Name_Table; +with Str_Table; with Files_Map; with Parse; with Scanner; @@ -895,7 +896,7 @@ package body Debugger is Len := 0; loop C := Buf (Pos + Len); - exit when C = ASCII.CR or C = ASCII.LF or C = ASCII.NUL; + exit when C = ASCII.CR or C = ASCII.LF or C = ASCII.EOT; Len := Len + 1; end loop; @@ -917,7 +918,7 @@ package body Debugger is Put_Line (String (Buf (Pos .. Pos + Len - 1))); -- Skip EOL. - exit when C = ASCII.NUL; + exit when C = ASCII.EOT; Pos := Pos + Len + 1; if C = ASCII.CR then if Buf (Pos) = ASCII.LF then @@ -1127,7 +1128,10 @@ package body Debugger is case Get_Kind (El) is when Iir_Kind_Function_Declaration | Iir_Kind_Procedure_Declaration => - if Get_Identifier (El) = Break_Id then + if Get_Identifier (El) = Break_Id + and then + Get_Implicit_Definition (El) not in Iir_Predefined_Implicit + then Set_Breakpoint (Get_Sequential_Statement_Chain (Get_Subprogram_Body (El))); end if; @@ -1143,7 +1147,28 @@ package body Debugger is P : Natural; begin P := Skip_Blanks (Line); - Break_Id := Name_Table.Get_Identifier (Line (P .. Line'Last)); + if Line (P) = '"' then + -- An operator name. + declare + use Str_Table; + Str : String8_Id; + Len : Nat32; + begin + Str := Create_String8; + Len := 0; + P := P + 1; + while Line (P) /= '"' loop + Append_String8_Char (Line (P)); + Len := Len + 1; + P := P + 1; + end loop; + Break_Id := Parse.Str_To_Operator_Name (Str, Len, No_Location); + -- FIXME: free string. + -- FIXME: catch error. + end; + else + Break_Id := Name_Table.Get_Identifier (Line (P .. Line'Last)); + end if; Status := Walk_Declarations (Cb_Set_Break'Access); pragma Assert (Status = Walk_Continue); end Break_Proc; @@ -1710,7 +1735,7 @@ package body Debugger is Menu_Next : aliased Menu_Entry := (Kind => Menu_Command, Name => new String'("n*ext"), - Next => Menu_Estmt'Access, + Next => Menu_Fstmt'Access, Proc => Next_Proc'Access); Menu_Step : aliased Menu_Entry := diff --git a/src/vhdl/simulate/iir_values.adb b/src/vhdl/simulate/iir_values.adb index 040879943..4fadb51f9 100644 --- a/src/vhdl/simulate/iir_values.adb +++ b/src/vhdl/simulate/iir_values.adb @@ -952,7 +952,7 @@ package body Iir_Values is end loop; case Last_Enum is when None => - Put (""""); + Put (""""""); -- Simply "" when Identifier => null; when Char => |