diff options
author | Tristan Gingold <tgingold@free.fr> | 2023-01-30 18:58:16 +0100 |
---|---|---|
committer | Tristan Gingold <tgingold@free.fr> | 2023-01-30 19:17:27 +0100 |
commit | 75fa271425d1be151bb451c1b14539cc4dc428ed (patch) | |
tree | 49ec573f055a46bf735d3725ee1a305e195c90ca /src | |
parent | c59ca34a1d9b2d810d8335a77ecbd8b5e78f550a (diff) | |
download | ghdl-75fa271425d1be151bb451c1b14539cc4dc428ed.tar.gz ghdl-75fa271425d1be151bb451c1b14539cc4dc428ed.tar.bz2 ghdl-75fa271425d1be151bb451c1b14539cc4dc428ed.zip |
elab-debugger: improve current context for print command
Diffstat (limited to 'src')
-rw-r--r-- | src/synth/elab-debugger.adb | 9 | ||||
-rw-r--r-- | src/synth/elab-debugger.ads | 4 | ||||
-rw-r--r-- | src/synth/elab-vhdl_debug.adb | 10 |
3 files changed, 17 insertions, 6 deletions
diff --git a/src/synth/elab-debugger.adb b/src/synth/elab-debugger.adb index c82e854a8..843e111e0 100644 --- a/src/synth/elab-debugger.adb +++ b/src/synth/elab-debugger.adb @@ -45,10 +45,12 @@ package body Elab.Debugger is Reason_Error ); - function Debug_Current_Instance return Synth_Instance_Acc is + procedure Get_Debug_Loc (Inst : out Synth_Instance_Acc; + Loc : out Node) is begin - return Current_Instance; - end Debug_Current_Instance; + Inst := Current_Instance; + Loc := Current_Loc; + end Get_Debug_Loc; package Breakpoints is new Tables (Table_Index_Type => Natural, @@ -610,6 +612,7 @@ package body Elab.Debugger is end if; end if; Current_Instance := Res; + Current_Loc := Null_Node; end Change_Hierarchy; procedure Print_Hierarchy_Path (Line : String) diff --git a/src/synth/elab-debugger.ads b/src/synth/elab-debugger.ads index bb8f91f90..88cfb21b0 100644 --- a/src/synth/elab-debugger.ads +++ b/src/synth/elab-debugger.ads @@ -53,7 +53,9 @@ package Elab.Debugger is pragma Convention (C, Error_Hook_Type); Error_Hook : Error_Hook_Type; - function Debug_Current_Instance return Synth_Instance_Acc; + -- Get the current location. + procedure Get_Debug_Loc (Inst : out Synth_Instance_Acc; + Loc : out Node); type Menu_Procedure is access procedure (Line : String); type Cst_String_Acc is access constant String; diff --git a/src/synth/elab-vhdl_debug.adb b/src/synth/elab-vhdl_debug.adb index 44f642d1e..6f618579c 100644 --- a/src/synth/elab-vhdl_debug.adb +++ b/src/synth/elab-vhdl_debug.adb @@ -1329,7 +1329,6 @@ package body Elab.Vhdl_Debug is is use Vhdl.Tokens; use Errorout; - Cur_Inst : constant Synth_Instance_Acc := Debug_Current_Instance; Prev_Nbr_Errors : constant Natural := Nbr_Errors; Index_Str : String := Natural'Image (Buffer_Index); File : Source_File_Entry; @@ -1339,6 +1338,7 @@ package body Elab.Vhdl_Debug is Opt_Name : Boolean := False; Opt_Type : Boolean := False; Marker : Mark_Type; + Cur_Inst : Synth_Instance_Acc; Cur_Scope : Node; begin -- Decode options: /v @@ -1374,7 +1374,13 @@ package body Elab.Vhdl_Debug is return; end if; - Cur_Scope := Elab.Vhdl_Context.Get_Source_Scope (Cur_Inst); + Get_Debug_Loc (Cur_Inst, Cur_Scope); + if Cur_Scope = Null_Node + or else Get_Kind (Cur_Scope) not in Iir_Kinds_Sequential_Statement + then + Cur_Scope := Elab.Vhdl_Context.Get_Source_Scope (Cur_Inst); + end if; + Enter_Scope (Cur_Scope); Expr := Vhdl.Sem_Expr.Sem_Expression_Universal (Expr); Leave_Scope (Cur_Scope); |