ide:debugger: completed conditional breakpoints (by expression and by call stack...
authorRejean Loyer <rejean.loyer@gmail.com>
Mon, 19 Mar 2012 10:38:38 +0000 (06:38 -0400)
committerRejean Loyer <rejean.loyer@gmail.com>
Tue, 20 Mar 2012 02:41:14 +0000 (22:41 -0400)
ide/src/debugger/Debugger.ec
ide/src/panels/BreakpointsView.ec

index d997186..6457ee1 100644 (file)
@@ -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;
index c9964b0..65f6f48 100644 (file)
@@ -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);
       }
    }