From cab980efd1cedf325c73763b4075428cf3b6df62 Mon Sep 17 00:00:00 2001 From: Rejean Loyer Date: Mon, 19 Mar 2012 06:38:38 -0400 Subject: [PATCH] ide:debugger: completed conditional breakpoints (by expression and by call stack depth) and ignore breaks vs hits functionality --- ide/src/debugger/Debugger.ec | 14 ++++++++------ ide/src/panels/BreakpointsView.ec | 22 ++++++++++++++++------ 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/ide/src/debugger/Debugger.ec b/ide/src/debugger/Debugger.ec index d997186..6457ee1 100644 --- a/ide/src/debugger/Debugger.ec +++ b/ide/src/debugger/Debugger.ec @@ -1583,6 +1583,7 @@ class Debugger bpItem = null; bp.inserted = (bp.bp && bp.bp.number != 0); bp.hits = 0; + bp.breaks = 0; ValidateBreakpoint(bp); } else @@ -2626,12 +2627,12 @@ class Debugger case runToCursor: if(bp.condition) conditionMet = ResolveWatch(bp.condition); - if(conditionMet && (bp.level == -1 || bp.level == frameCount)) + bp.hits++; + if((bp.level == -1 || bp.level == frameCount-1) && conditionMet) { - bp.hits++; - ide.breakpointsView.UpdateBreakpoint(bp.row); - if(bp.hits > bp.ignore) + if(!bp.ignore) { + bp.breaks++; ignoreBreakpoints = false; // Why was SelectFrame missing here? SelectFrame(activeFrameLevel); @@ -2647,13 +2648,13 @@ class Debugger } else { - /*bp.ignore--; - ide.breakpointsView.UpdateBreakpoint(bp.row);*/ + bp.ignore--; GdbExecContinue(false); } } else GdbExecContinue(false); + ide.breakpointsView.UpdateBreakpoint(bp.row); break; } } @@ -3789,6 +3790,7 @@ class Breakpoint : struct int line; bool enabled; int hits; + int breaks; int ignore; int level; Watch condition; diff --git a/ide/src/panels/BreakpointsView.ec b/ide/src/panels/BreakpointsView.ec index c9964b0..65f6f48 100644 --- a/ide/src/panels/BreakpointsView.ec +++ b/ide/src/panels/BreakpointsView.ec @@ -61,6 +61,8 @@ class BreakpointsView : Window TrimRSpaces(string, string); value = atoi(string); } + else if(listBox.currentField == levelField) + value = -1; //str[0] = '\0'; //sprintf(str, "%d", value); //listBox.StopEditing(true); @@ -107,16 +109,20 @@ class BreakpointsView : Window } }; - DataField locationField { "char *", true, width = 180, header = $"Location" }; - DataField hitsField { "int", false, width = 72, header = $"Hits" }; - DataField ignoreField { "char *", true, width = 72, header = $"Ignore Count" }; - DataField levelField { "char *", true, width = 50, header = $"Hit Level" }; - DataField conditionField { "char *", true, width = 130, header = $"Condition" }; + // TODO: set field size based on font and i18n header string + // TODO: save column widths to ide settings + DataField locationField { "char *", true , width = 220, header = $"Location" }; + DataField hitsField { "int" , false, width = 28, header = $"Hits" }; + DataField breaksField { "int" , false, width = 46, header = $"Breaks" }; + DataField ignoreField { "char *", true , width = 80, header = $"Ignore Count" }; + DataField levelField { "char *", true , width = 74, header = $"Stack Depth" }; + DataField conditionField { "char *", true , width = 130, header = $"Condition" }; BreakpointsView() { listBox.AddField(locationField); listBox.AddField(hitsField); + listBox.AddField(breaksField); listBox.AddField(ignoreField); listBox.AddField(levelField); listBox.AddField(conditionField); @@ -215,7 +221,10 @@ class BreakpointsView : Window location = bp.LocationToString(); row.SetData(locationField, location); delete location; - sprintf(string, "%d", bp.ignore); + if(bp.ignore == 0) + string[0] = '\0'; + else + sprintf(string, "%d", bp.ignore); row.SetData(ignoreField, string); if(bp.level == -1) string[0] = '\0'; @@ -227,6 +236,7 @@ class BreakpointsView : Window else row.SetData(conditionField, null); row.SetData(hitsField, bp.hits); + row.SetData(breaksField, bp.breaks); } } -- 1.8.3.1