Qore Programming Language - C/C++ Library  0.8.13.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
QoreDebugProgram.h
1 /* -*- mode: c++; indent-tabs-mode: nil -*- */
2 /*
3  QoreDebugProgram.h
4 
5  Program Debug Object Definition
6 
7  Qore Programming Language
8 
9  Copyright (C) 2003 - 2017 Qore Technologies, s.r.o.
10 
11  Permission is hereby granted, free of charge, to any person obtaining a
12  copy of this software and associated documentation files (the "Software"),
13  to deal in the Software without restriction, including without limitation
14  the rights to use, copy, modify, merge, publish, distribute, sublicense,
15  and/or sell copies of the Software, and to permit persons to whom the
16  Software is furnished to do so, subject to the following conditions:
17 
18  The above copyright notice and this permission notice shall be included in
19  all copies or substantial portions of the Software.
20 
21  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
26  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
27  DEALINGS IN THE SOFTWARE.
28 
29  Note that the Qore library is released under a choice of three open-source
30  licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
31  information.
32 */
33 
34 #ifndef INCLUDE_QORE_QOREDEBUGPROGRAM_H_
35 #define INCLUDE_QORE_QOREDEBUGPROGRAM_H_
36 
37 #include <qore/AbstractPrivateData.h>
38 #include <qore/Restrictions.h>
39 #include <qore/support.h>
40 
41 class QoreProgram;
42 class ExceptionSink;
43 class AbstractStatement;
44 class StatementBlock;
45 class QoreBreakpoint;
46 class qore_program_private;
47 class qore_debug_program_private;
48 
49 enum DebugRunStateEnum : unsigned char {
50  DBG_RS_DETACH = 0,
51  DBG_RS_RUN = 1,
52  DBG_RS_STEP = 2,
53  DBG_RS_STEP_OVER = 3,
54  DBG_RS_UNTIL_RETURN = 4,
55  DBG_RS_STOPPED = 5, // last one, see assert in setRunState
56 };
57 
59 
67  friend class qore_program_private;
68  friend class qore_debug_program_private;
69 private:
71  qore_debug_program_private* priv;
72 
74  DLLLOCAL QoreDebugProgram(const QoreDebugProgram&);
75 
77  DLLLOCAL QoreDebugProgram& operator=(const QoreDebugProgram&);
78 
79 protected:
81 
83  DLLLOCAL virtual ~QoreDebugProgram();
84 
85 public:
87  DLLEXPORT QoreDebugProgram();
88 
89 
90  DLLEXPORT void addProgram(QoreProgram *pgm, ExceptionSink* xsink);
91  DLLEXPORT void removeProgram(QoreProgram *pgm);
92  DLLEXPORT QoreListNode* getAllProgramObjects();
93 
94  DLLEXPORT virtual void onAttach(QoreProgram *pgm, DebugRunStateEnum &rs, ExceptionSink* xsink);
95 
96  DLLEXPORT virtual void onDetach(QoreProgram *pgm, DebugRunStateEnum &rs, ExceptionSink* xsink);
97 
105  DLLEXPORT virtual void onStep(QoreProgram *pgm, const StatementBlock *blockStatement, const AbstractStatement *statement, unsigned bkptId, int &flow, DebugRunStateEnum &rs, ExceptionSink* xsink);
106 
110  DLLEXPORT virtual void onFunctionEnter(QoreProgram *pgm, const StatementBlock *statement, DebugRunStateEnum &rs, ExceptionSink* xsink);
111 
115  DLLEXPORT virtual void onFunctionExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue& returnValue, DebugRunStateEnum &rs, ExceptionSink* xsink);
116 
120  DLLEXPORT virtual void onException(QoreProgram *pgm, const AbstractStatement *statement, DebugRunStateEnum &rs, ExceptionSink* xsink);
121 
125  DLLEXPORT virtual void onExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue& returnValue, DebugRunStateEnum &rs, ExceptionSink* xsink);
126 
131  DLLEXPORT int breakProgramThread(QoreProgram *pgm, int tid) const;
132 
137  DLLEXPORT int breakProgram(QoreProgram *pgm) const;
138 
140 
143  DLLEXPORT void waitForTerminationAndClear(ExceptionSink* xsink);
144 
146 
148  DLLEXPORT int getInterruptedCount();
149 };
150 
151 #endif /* INCLUDE_QORE_QOREDEBUGPROGRAM_H_ */
152 
153 
virtual DLLEXPORT void onExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue &returnValue, DebugRunStateEnum &rs, ExceptionSink *xsink)
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
DLLEXPORT int breakProgramThread(QoreProgram *pgm, int tid) const
virtual DLLEXPORT void onException(QoreProgram *pgm, const AbstractStatement *statement, DebugRunStateEnum &rs, ExceptionSink *xsink)
Class implementing breakpoint for debugging.
Definition: QoreProgram.h:918
virtual DLLEXPORT void onStep(QoreProgram *pgm, const StatementBlock *blockStatement, const AbstractStatement *statement, unsigned bkptId, int &flow, DebugRunStateEnum &rs, ExceptionSink *xsink)
DLLEXPORT void waitForTerminationAndClear(ExceptionSink *xsink)
remove programs and wait till the program&#39;s last thread terminates
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
virtual DLLEXPORT void onFunctionEnter(QoreProgram *pgm, const StatementBlock *statement, DebugRunStateEnum &rs, ExceptionSink *xsink)
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreDebugProgram.h:66
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:112
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreProgram.h:117
DLLEXPORT int breakProgram(QoreProgram *pgm) const
container for holding Qore-language exception information and also for registering a &quot;thread_exit&quot; ca...
Definition: ExceptionSink.h:47
DLLEXPORT int getInterruptedCount()
get number of program currently interrupted
virtual DLLLOCAL ~QoreDebugProgram()
the destructor is private in order to prohibit the object from being allocated on the stack ...
DLLEXPORT QoreDebugProgram()
creates the object
virtual DLLEXPORT void onFunctionExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue &returnValue, DebugRunStateEnum &rs, ExceptionSink *xsink)