Skip to content

Commit 6442b9d

Browse files
BoulangerAdrienBoulanger
authored andcommitted
Don't rely on Col_Num for DAP breakpoint actions
This column contains the empty string when the debugger is started. Add logic to retrieve the breakpoint's ID from an iter. Fix dump_tree_model removing "False" results. (Adapt tests) Fix "Apply" creating a new breakpoint and not modifying the selected one. Modify dialog_utils Create_Child function to also name its child. Add tests. For eng/ide/gnatstudio#267 For eng/ide/gnatstudio#271
1 parent cc419a0 commit 6442b9d

File tree

25 files changed

+589
-213
lines changed

25 files changed

+589
-213
lines changed

common/ui/src/dialog_utils.adb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,7 @@ package body Dialog_Utils is
692692

693693
-- Insert it in the dialog view children map if a key has been specified
694694
if Child_Key /= "" then
695+
Widget.Set_Name (Child_Key);
695696
Self.Parent_View.Children_Map.Insert
696697
(Child_Key, Gtk_Flow_Box_Child (Child_Box.Get_Parent));
697698
end if;

common/ui/src/dialog_utils.ads

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,8 @@ package Dialog_Utils is
265265
-- associating it with an optional Child_Key.
266266
--
267267
-- If a Child_Key is specified, it will allow you to interact with this
268-
-- child (see the 'Set_Child_Highlighted' subprogram).
268+
-- child (see the 'Set_Child_Highlighted' subprogram). It will also be set
269+
-- as the widget name.
269270
--
270271
-- The final child's layout depends on the optional parameters:
271272
--

dap/src/dap-clients-breakpoint_managers.adb

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -847,6 +847,34 @@ package body DAP.Clients.Breakpoint_Managers is
847847
Self.Synchonize_Breakpoints (Sync_Data);
848848
end Set_Breakpoints_State;
849849

850+
-------------------------------
851+
-- Get_Breakpoint_From_Index --
852+
-------------------------------
853+
854+
function Get_Breakpoint_From_Index
855+
(Self : not null access Breakpoint_Manager_Type;
856+
Index : Positive)
857+
return DAP.Types.Breakpoints.Breakpoint_Data is
858+
begin
859+
return Self.Holder.Get_Breakpoint_From_Index (Index);
860+
end Get_Breakpoint_From_Index;
861+
862+
------------------------------
863+
-- Set_Breakpoints_At_Index --
864+
------------------------------
865+
866+
procedure Replace_Breakpoint_At_Index
867+
(Self : not null access Breakpoint_Manager_Type;
868+
Data : DAP.Types.Breakpoints.Breakpoint_Data;
869+
Index : Positive)
870+
is
871+
Sync_Data : Synchonization_Data;
872+
begin
873+
Self.Holder.Replace (Data, Index);
874+
Update_Sychronization_Data (Sync_Data, Data);
875+
Self.Synchonize_Breakpoints (Sync_Data);
876+
end Replace_Breakpoint_At_Index;
877+
850878
----------------------
851879
-- Set_Ignore_Count --
852880
----------------------

dap/src/dap-clients-breakpoint_managers.ads

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,18 @@ package DAP.Clients.Breakpoint_Managers is
125125
State : Boolean);
126126
-- Enable/disable breakpoints
127127

128+
function Get_Breakpoint_From_Index
129+
(Self : not null access Breakpoint_Manager_Type;
130+
Index : Positive)
131+
return DAP.Types.Breakpoints.Breakpoint_Data;
132+
-- Retrieve data for breakpoint at Index
133+
134+
procedure Replace_Breakpoint_At_Index
135+
(Self : not null access Breakpoint_Manager_Type;
136+
Data : DAP.Types.Breakpoints.Breakpoint_Data;
137+
Index : Positive);
138+
-- Replace data for breakpoint at Index
139+
128140
procedure Set_Breakpoint_Command
129141
(Self : not null access Breakpoint_Manager_Type;
130142
Id : Breakpoint_Identifier;

dap/src/dap-module-breakpoints.adb

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,6 +1108,40 @@ package body DAP.Module.Breakpoints is
11081108
end if;
11091109
end Set_Breakpoints_State;
11101110

1111+
-------------------------------
1112+
-- Get_Breakpoint_From_Index --
1113+
-------------------------------
1114+
1115+
function Get_Breakpoint_From_Index
1116+
(Index : Positive) return Breakpoint_Data is
1117+
begin
1118+
if DAP.Module.Get_Current_Debugger = null then
1119+
return Persistent_Breakpoints.Get_Breakpoint_From_Index (Index);
1120+
else
1121+
return DAP.Module.Get_Current_Debugger.Get_Breakpoints_Manager.
1122+
Get_Breakpoint_From_Index (Index);
1123+
end if;
1124+
end Get_Breakpoint_From_Index;
1125+
1126+
-----------------------------
1127+
-- Set_Breakpoint_At_Index --
1128+
-----------------------------
1129+
1130+
procedure Set_Breakpoint_At_Index
1131+
(Kernel : not null access Kernel_Handle_Record'Class;
1132+
Data : Breakpoint_Data;
1133+
Index : Positive) is
1134+
begin
1135+
if DAP.Module.Get_Current_Debugger = null then
1136+
Persistent_Breakpoints.Replace (Data, Index);
1137+
GPS.Kernel.Hooks.Debugger_Breakpoints_Changed_Hook.Run
1138+
(Kernel, null);
1139+
else
1140+
DAP.Module.Get_Current_Debugger.Get_Breakpoints_Manager.
1141+
Replace_Breakpoint_At_Index (Data, Index);
1142+
end if;
1143+
end Set_Breakpoint_At_Index;
1144+
11111145
-------------------------
11121146
-- Store_As_Persistent --
11131147
-------------------------

dap/src/dap-module-breakpoints.ads

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,16 @@ package DAP.Module.Breakpoints is
4545
-- Return the breakpoint with the given ID.
4646
-- An empty breakpoint is returned if there is no breakpoint for this ID.
4747

48+
function Get_Breakpoint_From_Index
49+
(Index : Positive) return Breakpoint_Data;
50+
-- Retrieve breakpoint at the given index.
51+
52+
procedure Set_Breakpoint_At_Index
53+
(Kernel : not null access Kernel_Handle_Record'Class;
54+
Data : Breakpoint_Data;
55+
Index : Positive);
56+
-- Update breakpoint at the given index.
57+
4858
procedure Delete_Multiple_Breakpoints
4959
(Kernel : not null access Kernel_Handle_Record'Class;
5060
Indexes : Breakpoint_Index_Lists.List);

0 commit comments

Comments
 (0)