1 /* src/vm/breakpoint.hpp - breakpoint handling header
4 CACAOVM - Verein zur Foerderung der freien virtuellen Maschine CACAO
6 This file is part of CACAO.
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.
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.
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
26 #ifndef _BREAKPOINT_HPP
27 #define _BREAKPOINT_HPP
36 * This structure contains information about a breakpoint. Feel
37 * free to extend it to hold all the information you need. It is
38 * the responsibility of the user to set the fields accordingly.
40 typedef struct Breakpoint {
41 bool is_oneshot; ///< Indicates a "one-shot".
43 #if defined(ENABLE_JVMTI)
44 int32_t location; ///< Used for JVMTI breakpoints.
45 methodinfo* method; ///< Used for JVMTI breakpoints.
51 * This class is used to record breakpoints in the methodinfo
52 * structure. The term "location" is used to refer to the bytecode
53 * index at which the breakpoint should be placed.
55 class BreakpointTable {
57 std::map<int32_t, Breakpoint> _breakpoints;
60 // Querying operations.
62 bool contains(int32_t location);
64 // Modification operations.
65 Breakpoint* add_breakpoint (int32_t location);
66 Breakpoint* get_breakpoint (int32_t location);
67 void remove_breakpoint(int32_t location);
71 inline bool BreakpointTable::is_empty()
73 return _breakpoints.empty();
76 inline bool BreakpointTable::contains(int32_t location)
78 return (_breakpoints.find(location) != _breakpoints.end());
81 inline Breakpoint* BreakpointTable::add_breakpoint(int32_t location)
83 assert(!contains(location));
84 _breakpoints.insert(std::make_pair(location, Breakpoint()));
85 return &(_breakpoints.find(location)->second);
88 inline Breakpoint* BreakpointTable::get_breakpoint(int32_t location)
90 assert(contains(location));
91 return &(_breakpoints.find(location)->second);
94 inline void BreakpointTable::remove_breakpoint(int32_t location)
96 assert(contains(location));
97 _breakpoints.erase(location);
102 typedef struct BreakpointTable BreakpointTable;
103 #endif // __cplusplus
105 #endif /* _BREAKPOINT_HPP */
109 * These are local overrides for various environment variables in Emacs.
110 * Please do not remove this and leave it at the end of the file, where
111 * Emacs will automagically detect them.
112 * ---------------------------------------------------------------------
115 * indent-tabs-mode: t
119 * vim:noexpandtab:sw=4:ts=4: