Qore Programming Language 1.16.0
Loading...
Searching...
No Matches
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 - 2023 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
41class QoreProgram;
42class ExceptionSink;
43class AbstractStatement;
44class StatementBlock;
45class QoreBreakpoint;
46class qore_program_private;
47class qore_debug_program_private;
48
49enum 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;
69private:
71 qore_debug_program_private* priv;
72
74 DLLLOCAL QoreDebugProgram(const QoreDebugProgram&);
75
77 DLLLOCAL QoreDebugProgram& operator=(const QoreDebugProgram&);
78
79protected:
81
83 DLLLOCAL virtual ~QoreDebugProgram();
84
85public:
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, const AbstractStatement* &rts, ExceptionSink* xsink);
95
96 DLLEXPORT virtual void onDetach(QoreProgram *pgm, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
97
109 DLLEXPORT virtual void onStep(QoreProgram *pgm, const StatementBlock *blockStatement, const AbstractStatement *statement, unsigned bkptId, int &flow, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
110
114 DLLEXPORT virtual void onFunctionEnter(QoreProgram *pgm, const StatementBlock *statement, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
115
119 DLLEXPORT virtual void onFunctionExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue& returnValue, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
120
124 DLLEXPORT virtual void onException(QoreProgram *pgm, const AbstractStatement *statement, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
125
129 DLLEXPORT virtual void onExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue& returnValue, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
130
135 DLLEXPORT int breakProgramThread(QoreProgram *pgm, int tid) const;
136
141 DLLEXPORT int breakProgram(QoreProgram *pgm) const;
142
144
148
150
152 DLLEXPORT int getInterruptedCount();
153};
154
155#endif /* INCLUDE_QORE_QOREDEBUGPROGRAM_H_ */
156
157
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:50
Class implementing breakpoint for debugging.
Definition: QoreProgram.h:1040
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only
Definition: QoreDebugProgram.h:66
virtual DLLEXPORT void onFunctionEnter(QoreProgram *pgm, const StatementBlock *statement, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
virtual DLLEXPORT void onStep(QoreProgram *pgm, const StatementBlock *blockStatement, const AbstractStatement *statement, unsigned bkptId, int &flow, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
DLLEXPORT int breakProgramThread(QoreProgram *pgm, int tid) const
DLLEXPORT int breakProgram(QoreProgram *pgm) const
DLLEXPORT int getInterruptedCount()
get number of program currently interrupted
virtual DLLEXPORT void onFunctionExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue &returnValue, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
DLLEXPORT void waitForTerminationAndClear(ExceptionSink *xsink)
remove programs and wait till the program's last thread terminates
virtual DLLEXPORT void onExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue &returnValue, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
virtual DLLEXPORT void onException(QoreProgram *pgm, const AbstractStatement *statement, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
DLLEXPORT QoreDebugProgram()
creates the object
virtual DLLLOCAL ~QoreDebugProgram()
the destructor is private in order to prohibit the object from being allocated on the stack
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only
Definition: QoreProgram.h:128
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:276