diff options
author | Tristan Gingold <tgingold@free.fr> | 2022-08-28 10:27:25 +0200 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2022-09-02 02:31:06 +0200 |
commit | 91303467eac522662572d9106e2a3cb724b24a0d (patch) | |
tree | 42225eb45dd10fa38a47f4bacebe82bfb6cb3934 /src | |
parent | 50f1990e59efaf927658c354aa6e2c81461964da (diff) | |
download | ghdl-91303467eac522662572d9106e2a3cb724b24a0d.tar.gz ghdl-91303467eac522662572d9106e2a3cb724b24a0d.tar.bz2 ghdl-91303467eac522662572d9106e2a3cb724b24a0d.zip |
synth: factorize code for tracing statements execution
Diffstat (limited to 'src')
-rw-r--r-- | src/simul/simul-vhdl_simul.adb | 10 | ||||
-rw-r--r-- | src/synth/elab-vhdl_debug.adb | 12 | ||||
-rw-r--r-- | src/synth/elab-vhdl_debug.ads | 2 | ||||
-rw-r--r-- | src/synth/synth-vhdl_stmts.adb | 15 |
4 files changed, 23 insertions, 16 deletions
diff --git a/src/simul/simul-vhdl_simul.adb b/src/simul/simul-vhdl_simul.adb index 4046b3dd0..1fe1f76a3 100644 --- a/src/simul/simul-vhdl_simul.adb +++ b/src/simul/simul-vhdl_simul.adb @@ -36,11 +36,12 @@ with PSL.NFAs; with PSL.NFAs.Utils; with PSL.Errors; +with Elab.Debugger; with Elab.Vhdl_Objtypes; use Elab.Vhdl_Objtypes; with Elab.Vhdl_Values; use Elab.Vhdl_Values; with Elab.Vhdl_Types; with Elab.Vhdl_Decls; -with Elab.Debugger; +with Elab.Vhdl_Debug; with Trans_Analyzes; @@ -954,6 +955,9 @@ package body Simul.Vhdl_Simul is loop Inst := Process.Instance; + if Synth.Flags.Flag_Trace_Statements then + Elab.Vhdl_Debug.Put_Stmt_Trace (Stmt); + end if; if Elab.Debugger.Flag_Need_Debug then Elab.Debugger.Debug_Break (Inst, Stmt); end if; @@ -1272,8 +1276,8 @@ package body Simul.Vhdl_Simul is -- Instance_Pool := Process.Pool'Access; if Synth.Flags.Flag_Trace_Statements then - Put (" run process: "); --- Disp_Instance_Name (Process.Top_Instance); + Put ("run process: "); + Elab.Vhdl_Debug.Disp_Instance_Path (Process.Top_Instance); Put_Line (" (" & Vhdl.Errors.Disp_Location (Process.Proc) & ")"); end if; diff --git a/src/synth/elab-vhdl_debug.adb b/src/synth/elab-vhdl_debug.adb index 87b45f799..08cbda879 100644 --- a/src/synth/elab-vhdl_debug.adb +++ b/src/synth/elab-vhdl_debug.adb @@ -44,6 +44,18 @@ with Vhdl.Std_Package; with Vhdl.Prints; package body Elab.Vhdl_Debug is + procedure Put_Stmt_Trace (Stmt : Iir) + is + Name : Name_Id; + Line : Natural; + Col : Natural; + begin + Files_Map.Location_To_Position (Get_Location (Stmt), Name, Line, Col); + Simple_IO.Put_Line ("Execute statement at " + & Name_Table.Image (Name) + & Natural'Image (Line)); + end Put_Stmt_Trace; + procedure Disp_Discrete_Value (Val : Int64; Btype : Node) is begin case Get_Kind (Btype) is diff --git a/src/synth/elab-vhdl_debug.ads b/src/synth/elab-vhdl_debug.ads index 0690c9c2e..a1200d621 100644 --- a/src/synth/elab-vhdl_debug.ads +++ b/src/synth/elab-vhdl_debug.ads @@ -48,5 +48,7 @@ package Elab.Vhdl_Debug is procedure Disp_Instance_Path (Inst : Synth_Instance_Acc; Components : Boolean := False); + procedure Put_Stmt_Trace (Stmt : Iir); + procedure Append_Commands; end Elab.Vhdl_Debug; diff --git a/src/synth/synth-vhdl_stmts.adb b/src/synth/synth-vhdl_stmts.adb index 68acfc94d..8cef43807 100644 --- a/src/synth/synth-vhdl_stmts.adb +++ b/src/synth/synth-vhdl_stmts.adb @@ -22,10 +22,8 @@ with Grt.Types; use Grt.Types; with Grt.Algos; with Grt.Severity; use Grt.Severity; with Areapools; -with Name_Table; with Std_Names; with Errorout; use Errorout; -with Files_Map; with Simple_IO; with Vhdl.Errors; use Vhdl.Errors; @@ -45,6 +43,7 @@ with Elab.Memtype; use Elab.Memtype; with Elab.Vhdl_Heap; with Elab.Vhdl_Types; use Elab.Vhdl_Types; with Elab.Vhdl_Expr; use Elab.Vhdl_Expr; +with Elab.Vhdl_Debug; with Elab.Debugger; with Synth.Errors; use Synth.Errors; @@ -3201,17 +3200,7 @@ package body Synth.Vhdl_Stmts is end if; if Flags.Flag_Trace_Statements then - declare - Name : Name_Id; - Line : Natural; - Col : Natural; - begin - Files_Map.Location_To_Position - (Get_Location (Stmt), Name, Line, Col); - Simple_IO.Put_Line ("Execute statement at " - & Name_Table.Image (Name) - & Natural'Image (Line)); - end; + Elab.Vhdl_Debug.Put_Stmt_Trace (Stmt); end if; if Elab.Debugger.Flag_Need_Debug then Elab.Debugger.Debug_Break (C.Inst, Stmt); |