LCOV - code coverage report
Current view: top level - src - Frame.h (source / functions) Hit Total Coverage
Test: app.info Lines: 14 22 63.6 %
Date: 2010-12-13 Functions: 10 16 62.5 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : // $Id: Frame.h 6219 2008-10-01 05:39:07Z vern $
       2                 :            : //
       3                 :            : // See the file "COPYING" in the main distribution directory for copyright.
       4                 :            : 
       5                 :            : #ifndef frame_h
       6                 :            : #define frame_h
       7                 :            : 
       8                 :            : #include <vector>
       9                 :            : using namespace std;
      10                 :            : 
      11                 :            : #include "Val.h"
      12                 :            : 
      13                 :            : class BroFunc;
      14                 :            : class Trigger;
      15                 :            : class CallExpr;
      16                 :            : 
      17                 :            : class Frame : public BroObj {
      18                 :            : public:
      19                 :            :         Frame(int size, const BroFunc* func, const val_list *fn_args);
      20                 :            :         ~Frame();
      21                 :            : 
      22                 :     769252 :         Val* NthElement(int n)          { return frame[n]; }
      23                 :     425261 :         void SetElement(int n, Val* v)
      24                 :            :                 {
      25                 :     425261 :                 Unref(frame[n]);
      26                 :     425261 :                 frame[n] = v;
      27                 :     425261 :                 }
      28                 :            : 
      29                 :            :         void Release();
      30                 :            : 
      31                 :            :         void Describe(ODesc* d) const;
      32                 :            : 
      33                 :            :         // For which function is this stack frame.
      34                 :          0 :         const BroFunc* GetFunction() const      { return function; }
      35                 :          0 :         const val_list* GetFuncArgs() const     { return func_args; }
      36                 :            : 
      37                 :            :         // Next statement to be executed in the context of this frame.
      38                 :     636210 :         void SetNextStmt(Stmt* stmt)    { next_stmt = stmt; }
      39                 :          0 :         Stmt* GetNextStmt() const       { return next_stmt; }
      40                 :            : 
      41                 :            :         // Used to implement "next" command in debugger.
      42                 :          0 :         void BreakBeforeNextStmt(bool should_break)
      43                 :          0 :                 { break_before_next_stmt = should_break; }
      44                 :     113427 :         bool BreakBeforeNextStmt() const
      45                 :     113427 :                 { return break_before_next_stmt; }
      46                 :            : 
      47                 :            :         // Used to implement "finish" command in debugger.
      48                 :          0 :         void BreakOnReturn(bool should_break)
      49                 :          0 :                 { break_on_return = should_break; }
      50                 :     113427 :         bool BreakOnReturn() const      { return break_on_return; }
      51                 :            : 
      52                 :            :         // Deep-copies values.
      53                 :            :         Frame* Clone();
      54                 :            : 
      55                 :            :         // If the frame is run in the context of a trigger condition evaluation,
      56                 :            :         // the trigger needs to be registered.
      57                 :            :         void SetTrigger(Trigger* arg_trigger);
      58                 :            :         void ClearTrigger();
      59                 :     270484 :         Trigger* GetTrigger() const             { return trigger; }
      60                 :            : 
      61                 :     270484 :         void SetCall(const CallExpr* arg_call)  { call = arg_call; }
      62                 :     200536 :         void ClearCall()                        { call = 0; }
      63                 :      69948 :         const CallExpr* GetCall() const         { return call; }
      64                 :            : 
      65                 :          0 :         void SetDelayed()       { delayed = true; }
      66                 :     486458 :         bool HasDelayed() const { return delayed; }
      67                 :            : 
      68                 :            : protected:
      69                 :            :         void Clear();
      70                 :            : 
      71                 :            :         Val** frame;
      72                 :            :         int size;
      73                 :            : 
      74                 :            :         const BroFunc* function;
      75                 :            :         const val_list* func_args;
      76                 :            :         Stmt* next_stmt;
      77                 :            : 
      78                 :            :         bool break_before_next_stmt;
      79                 :            :         bool break_on_return;
      80                 :            : 
      81                 :            :         Trigger* trigger;
      82                 :            :         const CallExpr* call;
      83                 :            :         bool delayed;
      84                 :            : };
      85                 :            : 
      86                 :            : extern vector<Frame*> g_frame_stack;
      87                 :            : 
      88                 :            : #endif

Generated by: LCOV version 1.8