LCOV - code coverage report
Current view: top level - vm - breakpoint.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 6 0.0 %
Date: 2017-07-14 10:03:36 Functions: 0 3 0.0 %

          Line data    Source code
       1             : /* src/vm/breakpoint.hpp - breakpoint handling header
       2             : 
       3             :    Copyright (C) 2009-2013
       4             :    CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
       5             : 
       6             :    This file is part of CACAO.
       7             : 
       8             :    This program is free software; you can redistribute it and/or
       9             :    modify it under the terms of the GNU General Public License as
      10             :    published by the Free Software Foundation; either version 2, or (at
      11             :    your option) any later version.
      12             : 
      13             :    This program is distributed in the hope that it will be useful, but
      14             :    WITHOUT ANY WARRANTY; without even the implied warranty of
      15             :    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      16             :    General Public License for more details.
      17             : 
      18             :    You should have received a copy of the GNU General Public License
      19             :    along with this program; if not, write to the Free Software
      20             :    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
      21             :    02110-1301, USA.
      22             : 
      23             :  */
      24             : 
      25             : 
      26             : #ifndef _BREAKPOINT_HPP
      27             : #define _BREAKPOINT_HPP
      28             : 
      29             : #include "config.h"
      30             : 
      31             : #include <cassert>
      32             : //#include <cstdint> <- requires C++0x
      33             : #include <stdint.h>
      34             : #include <map>
      35             : 
      36             : /**
      37             :  * This structure contains information about a breakpoint. Feel
      38             :  * free to extend it to hold all the information you need. It is
      39             :  * the responsibility of the user to set the fields accordingly.
      40             :  */
      41             : typedef struct Breakpoint {
      42             :         bool        is_oneshot;             ///< Indicates a "one-shot".
      43             : 
      44             : #if defined(ENABLE_JVMTI)
      45             :         int32_t     location;               ///< Used for JVMTI breakpoints.
      46             :         methodinfo* method;                 ///< Used for JVMTI breakpoints.
      47             : #endif
      48             : } Breakpoint;
      49             : 
      50             : 
      51             : /**
      52             :  * This class is used to record breakpoints in the methodinfo
      53             :  * structure. The term "location" is used to refer to the bytecode
      54             :  * index at which the breakpoint should be placed.
      55             :  */
      56           0 : class BreakpointTable {
      57             : private:
      58             :         std::map<int32_t, Breakpoint> _breakpoints;
      59             : 
      60             : public:
      61             :         // Querying operations.
      62             :         bool is_empty();
      63             :         bool contains(int32_t location);
      64             : 
      65             :         // Modification operations.
      66             :         Breakpoint* add_breakpoint   (int32_t location);
      67             :         Breakpoint* get_breakpoint   (int32_t location);
      68             :         void        remove_breakpoint(int32_t location);
      69             : };
      70             : 
      71             : 
      72             : inline bool BreakpointTable::is_empty()
      73             : {
      74             :         return _breakpoints.empty();
      75             : }
      76             : 
      77           0 : inline bool BreakpointTable::contains(int32_t location)
      78             : {
      79           0 :         return (_breakpoints.find(location) != _breakpoints.end());
      80             : }
      81             : 
      82             : inline Breakpoint* BreakpointTable::add_breakpoint(int32_t location)
      83             : {
      84             :         assert(!contains(location));
      85             :         _breakpoints.insert(std::make_pair(location, Breakpoint()));
      86             :         return &(_breakpoints.find(location)->second);
      87             : }
      88             : 
      89           0 : inline Breakpoint* BreakpointTable::get_breakpoint(int32_t location)
      90             : {
      91           0 :         assert(contains(location));
      92           0 :         return &(_breakpoints.find(location)->second);
      93             : }
      94             : 
      95             : inline void BreakpointTable::remove_breakpoint(int32_t location)
      96             : {
      97             :         assert(contains(location));
      98             :         _breakpoints.erase(location);
      99             : }
     100             : 
     101             : #endif /* _BREAKPOINT_HPP */
     102             : 
     103             : 
     104             : /*
     105             :  * These are local overrides for various environment variables in Emacs.
     106             :  * Please do not remove this and leave it at the end of the file, where
     107             :  * Emacs will automagically detect them.
     108             :  * ---------------------------------------------------------------------
     109             :  * Local variables:
     110             :  * mode: c++
     111             :  * indent-tabs-mode: t
     112             :  * c-basic-offset: 4
     113             :  * tab-width: 4
     114             :  * End:
     115             :  * vim:noexpandtab:sw=4:ts=4:
     116             :  */

Generated by: LCOV version 1.11