~ubuntu-branches/ubuntu/trusty/monodevelop/trusty-proposed

« back to all changes in this revision

Viewing changes to src/addins/MonoDevelop.Debugger/MonoDevelop.Debugger/BreakpointPropertiesDialog.cs

  • Committer: Package Import Robot
  • Author(s): Jo Shields
  • Date: 2013-05-12 09:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 29.
  • Revision ID: package-import@ubuntu.com-20130512094603-mad323bzcxvmcam0
Tags: upstream-4.0.5+dfsg
ImportĀ upstreamĀ versionĀ 4.0.5+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
//
27
27
 
28
28
using System;
 
29
using System.Collections.Generic;
 
30
 
29
31
using MonoDevelop.Core;
30
32
using Mono.Debugging.Client;
31
33
using MonoDevelop.Projects;
73
75
                                // Function breakpoints only support breaking on the first line
74
76
                                hboxLineColumn.Destroy ();
75
77
                                labelLine.Destroy ();
76
 
                                table1.NRows--;
 
78
                                tableLocation.NRows--;
77
79
                        } else {
78
80
                                labelFileFunction.LabelProp = GettextCatalog.GetString ("File:");
79
81
                                entryFileFunction.Text = ((Breakpoint) bp).FileName;
83
85
                                entryFileFunction.ModifyBase (Gtk.StateType.Active, Style.Backgrounds [(int)Gtk.StateType.Insensitive]);
84
86
                                entryFileFunction.IsEditable = false;
85
87
                                
86
 
                                //spinColumn.Value = bp.Column;
 
88
                                spinColumn.Value = bp.Column;
87
89
                                spinLine.Value = bp.Line;
88
90
                                
89
91
                                if (!isNew) {
92
94
                                        spinLine.IsEditable = false;
93
95
                                        spinLine.Sensitive = false;
94
96
                                }
95
 
                                
96
 
                                // Note: We hide the column spin button for now because we don't support it yet
97
 
                                hboxColumn.Hide ();
98
97
                        }
99
98
                        
100
99
                        if (string.IsNullOrEmpty (bp.ConditionExpression)) {
102
101
                        } else {
103
102
                                entryCondition.Text = bp.ConditionExpression;
104
103
                                if (bp.BreakIfConditionChanges)
105
 
                                        radioBreakChange.Active = true;
 
104
                                        radioBreakWhenChanges.Active = true;
106
105
                                else
107
 
                                        radioBreakTrue.Active = true;
 
106
                                        radioBreakWhenTrue.Active = true;
108
107
                        }
109
 
                        
 
108
 
 
109
                        comboHitCountMode.Changed += OnHitCountModeChanged;
 
110
                        comboHitCountMode.Active = (int) bp.HitCountMode;
110
111
                        spinHitCount.Value = bp.HitCount;
111
112
                        
112
 
                        if (bp.HitAction == HitAction.Break)
 
113
                        if (bp.HitAction == HitAction.Break) {
113
114
                                radioActionBreak.Active = true;
114
 
                        else {
 
115
                        } else {
115
116
                                radioActionTrace.Active = true;
116
 
                                entryTraceExpr.Text = bp.TraceExpression;
 
117
                                entryTraceExpression.Text = bp.TraceExpression;
117
118
                        }
118
119
                        
119
120
                        Project project = null;
123
124
                        if (project != null) {
124
125
                                // Check the startup project of the solution too, since the current project may be a library
125
126
                                SolutionEntityItem startup = project.ParentSolution.StartupItem;
126
 
                                boxConditionOptions.Sensitive = DebuggingService.IsFeatureSupported (project, DebuggerFeatures.ConditionalBreakpoints) ||
 
127
                                vboxConditionOptions.Sensitive = DebuggingService.IsFeatureSupported (project, DebuggerFeatures.ConditionalBreakpoints) ||
127
128
                                        DebuggingService.IsFeatureSupported (startup, DebuggerFeatures.ConditionalBreakpoints);
128
 
                                boxAction.Sensitive = DebuggingService.IsFeatureSupported (project, DebuggerFeatures.Tracepoints) ||
 
129
                                vboxAction.Sensitive = DebuggingService.IsFeatureSupported (project, DebuggerFeatures.Tracepoints) ||
129
130
                                        DebuggingService.IsFeatureSupported (startup, DebuggerFeatures.Tracepoints);
130
131
                        }
131
132
                        
135
136
                void UpdateControls ()
136
137
                {
137
138
                        boxTraceExpression.Sensitive = radioActionTrace.Active;
138
 
                        boxCondition.Sensitive = !radioBreakAlways.Active;
 
139
                        hboxConditionExpression.Sensitive = !radioBreakAlways.Active;
 
140
 
 
141
                        if (comboHitCountMode.Active == 0)
 
142
                                spinHitCount.Hide ();
 
143
                        else
 
144
                                spinHitCount.Show ();
139
145
                }
140
146
                
141
 
                bool TryParseFunction (string signature, out string function, out string[] paramTypes)
 
147
                static bool TryParseFunction (string signature, out string function, out string[] paramTypes)
142
148
                {
143
 
                        // FIXME: this is a hack, but it'll work until we get actual language parsers...
144
149
                        int paramListStart = signature.IndexOf ('(');
145
 
                        int paramListEnd;
146
 
                        
147
 
                        if (paramListStart == -1) {
 
150
                        int paramListEnd = signature.IndexOf (')');
 
151
 
 
152
                        if (paramListStart == -1 && paramListEnd == -1) {
148
153
                                function = signature;
149
154
                                paramTypes = null;
150
155
                                return true;
151
156
                        }
 
157
 
 
158
                        if (paramListEnd != signature.Length - 1) {
 
159
                                paramTypes = null;
 
160
                                function = null;
 
161
                                return false;
 
162
                        }
152
163
                        
153
 
                        function = signature.Substring (0, paramListStart).TrimEnd ();
 
164
                        function = signature.Substring (0, paramListStart).Trim ();
154
165
                        
155
166
                        paramListStart++;
156
 
                        paramListEnd = paramListStart;
157
 
                        while (paramListEnd < signature.Length && signature[paramListEnd] != ')')
158
 
                                paramListEnd++;
159
 
                        
160
 
                        if (paramListEnd == signature.Length) {
 
167
 
 
168
                        if (!FunctionBreakpoint.TryParseParameters (signature, paramListStart, paramListEnd, out paramTypes)) {
 
169
                                paramTypes = null;
161
170
                                function = null;
162
 
                                paramTypes = null;
163
171
                                return false;
164
172
                        }
165
173
                        
166
 
                        paramTypes = signature.Substring (paramListStart, paramListEnd - paramListStart).Split (new char [] { ',' });
167
 
                        for (int i = 0; i < paramTypes.Length; i++)
168
 
                                paramTypes[i] = paramTypes[i].Trim ();
169
 
                        
170
174
                        return true;
171
175
                }
172
176
                
173
177
                public bool Check ()
174
178
                {
175
179
                        if (bp is FunctionBreakpoint) {
176
 
                                if (entryFileFunction.Text.Length == 0) {
 
180
                                string text = entryFileFunction.Text.Trim ();
 
181
 
 
182
                                if (text.Length == 0) {
177
183
                                        MessageService.ShowError (GettextCatalog.GetString ("Function name not specified"));
178
184
                                        return false;
179
185
                                }
180
 
                                
181
 
                                if (!TryParseFunction (entryFileFunction.Text.Trim (), out parsedFunction, out parsedParamTypes)) {
 
186
 
 
187
                                if (!TryParseFunction (text, out parsedFunction, out parsedParamTypes)) {
182
188
                                        MessageService.ShowError (GettextCatalog.GetString ("Invalid function syntax"));
183
189
                                        return false;
184
190
                                }
189
195
                                return false;
190
196
                        }
191
197
                        
192
 
                        if (radioActionTrace.Active && entryTraceExpr.Text.Length == 0) {
 
198
                        if (radioActionTrace.Active && entryTraceExpression.Text.Length == 0) {
193
199
                                MessageService.ShowError (GettextCatalog.GetString ("Trace expression not specified"));
194
200
                                return false;
195
201
                        }
206
212
                                        fb.FunctionName = parsedFunction;
207
213
                                        fb.ParamTypes = parsedParamTypes;
208
214
                                } else {
209
 
                                        //bp.SetColumn ((int) spinColumn.Value);
 
215
                                        bp.SetColumn ((int) spinColumn.Value);
210
216
                                        bp.SetLine ((int) spinLine.Value);
211
217
                                }
212
218
                        }
213
219
                        
214
220
                        if (!radioBreakAlways.Active) {
215
221
                                bp.ConditionExpression = entryCondition.Text;
216
 
                                bp.BreakIfConditionChanges = radioBreakChange.Active;
 
222
                                bp.BreakIfConditionChanges = radioBreakWhenChanges.Active;
217
223
                        } else
218
224
                                bp.ConditionExpression = null;
219
 
                        
220
 
                        bp.HitCount = (int) spinHitCount.Value;
221
 
                        
222
 
                        if (radioActionBreak.Active)
 
225
 
 
226
                        bp.HitCountMode = (HitCountMode) comboHitCountMode.Active;
 
227
                        if (bp.HitCountMode != HitCountMode.None)
 
228
                                bp.HitCount = (int) spinHitCount.Value;
 
229
                        else
 
230
                                bp.HitCount = 0;
 
231
                        
 
232
                        if (radioActionBreak.Active) {
223
233
                                bp.HitAction = HitAction.Break;
224
 
                        else {
 
234
                        } else {
225
235
                                bp.HitAction = HitAction.PrintExpression;
226
 
                                bp.TraceExpression = entryTraceExpr.Text;
 
236
                                bp.TraceExpression = entryTraceExpression.Text;
227
237
                        }
 
238
 
228
239
                        bp.CommitChanges ();
229
240
                }
230
241
 
231
 
                protected virtual void OnButtonOkClicked (object sender, System.EventArgs e)
 
242
                protected virtual void OnButtonOkClicked (object sender, EventArgs e)
232
243
                {
233
244
                        if (Check ()) {
234
245
                                Save ();
236
247
                        }
237
248
                }
238
249
 
239
 
                protected virtual void OnRadioBreakAlwaysToggled (object sender, System.EventArgs e)
240
 
                {
241
 
                        UpdateControls ();
242
 
                }
243
 
 
244
 
                protected virtual void OnRadioActionBreakToggled (object sender, System.EventArgs e)
 
250
                protected virtual void OnRadioBreakAlwaysToggled (object sender, EventArgs e)
 
251
                {
 
252
                        UpdateControls ();
 
253
                }
 
254
 
 
255
                protected virtual void OnRadioActionBreakToggled (object sender,EventArgs e)
 
256
                {
 
257
                        UpdateControls ();
 
258
                }
 
259
 
 
260
                void OnHitCountModeChanged (object sender, EventArgs e)
245
261
                {
246
262
                        UpdateControls ();
247
263
                }