LCOV - code coverage report
Current view: top level - src - DbgBreakpoint.h (source / functions) Hit Total Coverage
Test: app.info Lines: 0 7 0.0 %
Date: 2010-12-13 Functions: 0 7 0.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // $Id: DbgBreakpoint.h 80 2004-07-14 20:15:50Z jason $
       2                 :            : 
       3                 :            : // Structures and methods for implementing breakpoints in the Bro debugger.
       4                 :            : 
       5                 :            : #ifndef DbgBreakpoint_h
       6                 :            : #define DbgBreakpoint_h
       7                 :            : 
       8                 :            : #include "Debug.h"
       9                 :            : 
      10                 :            : enum BreakCode { bcNoHit, bcHit, bcHitAndDelete };
      11                 :            : class DbgBreakpoint {
      12                 :            :         enum Kind { BP_STMT = 0, BP_FUNC, BP_LINE, BP_TIME };
      13                 :            : 
      14                 :            : public:
      15                 :            :         DbgBreakpoint();
      16                 :            :         ~DbgBreakpoint();
      17                 :            : 
      18                 :          0 :         int GetID() const       { return BPID; }
      19                 :          0 :         void SetID(int newID)   { BPID = newID; }
      20                 :            : 
      21                 :            :         // True if breakpoint could be set; false otherwise
      22                 :            :         bool SetLocation(ParseLocationRec plr, string loc_str);
      23                 :            :         bool SetLocation(Stmt* stmt);
      24                 :            :         bool SetLocation(double time);
      25                 :            : 
      26                 :            :         bool Reset();   // cancel and re-apply bpt when restarting execution
      27                 :            : 
      28                 :            :         // Temporary = disable (remove?) the breakpoint right after it's hit.
      29                 :          0 :         bool IsTemporary() const        { return temporary; }
      30                 :          0 :         void SetTemporary(bool is_temporary)    { temporary = is_temporary; }
      31                 :            : 
      32                 :            :         // Feed it a Stmt* or a time and see if this breakpoint should
      33                 :            :         // hit.  bcHitAndDelete means that it has hit, and should now be
      34                 :            :         // deleted entirely.
      35                 :            :         //
      36                 :            :         // NOTE: If it returns a hit, the DbgBreakpoint object will take
      37                 :            :         // appropriate action (e.g., resetting counters).
      38                 :            :         BreakCode ShouldBreak(Stmt* s);
      39                 :            :         BreakCode ShouldBreak(double t);
      40                 :            : 
      41                 :            :         const string& GetCondition() const  { return condition; }
      42                 :            :         bool SetCondition(const string& new_condition);
      43                 :            : 
      44                 :          0 :         int GetRepeatCount() const      { return repeat_count; }
      45                 :            :         bool SetRepeatCount(int count); // implements function of ignore command in gdb
      46                 :            : 
      47                 :          0 :         bool IsEnabled() const  { return enabled; }
      48                 :            :         bool SetEnable(bool do_enable);
      49                 :            : 
      50                 :            :         // e.g. "FooBar() at foo.c:23"
      51                 :          0 :         const char * Description() const        { return description; }
      52                 :            : 
      53                 :            : protected:
      54                 :            :         void AddToGlobalMap();
      55                 :            :         void RemoveFromGlobalMap();
      56                 :            : 
      57                 :            :         void AddToStmt();
      58                 :            :         void RemoveFromStmt();
      59                 :            : 
      60                 :            :         BreakCode HasHit();     // a breakpoint hit, update state, return proper code.
      61                 :            :         void PrintHitMsg();     // display reason when the breakpoint hits
      62                 :            : 
      63                 :            :         Kind kind;
      64                 :            :         bool enabled;   // ### comment this and next
      65                 :            :         bool temporary;
      66                 :            :         int BPID;
      67                 :            : 
      68                 :            :         char description[512];
      69                 :            :         string function_name;   // location
      70                 :            :         const char* source_filename;
      71                 :            :         int source_line;
      72                 :            : 
      73                 :            :         Stmt* at_stmt;
      74                 :            :         double at_time; // break when the virtual time is this
      75                 :            : 
      76                 :            :         // Support for conditional and N'th time breakpoints.
      77                 :            :         int repeat_count;       // if positive, break after this many hits
      78                 :            :         int hit_count;  // how many times it's been hit (w/o breaking)
      79                 :            : 
      80                 :            :         string condition;       // condition to evaluate; nil for none
      81                 :            : };
      82                 :            : 
      83                 :            : #endif

Generated by: LCOV version 1.8