QoreDebugProgram.h
/* -*- mode: c++; indent-tabs-mode: nil -*- */
/*
QoreDebugProgram.h
Program Debug Object Definition
Qore Programming Language
Copyright (C) 2003 - 2022 Qore Technologies, s.r.o.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Note that the Qore library is released under a choice of three open-source
licenses: MIT (as above), LGPL 2+, or GPL 2+; see README-LICENSE for more
information.
*/
#ifndef INCLUDE_QORE_QOREDEBUGPROGRAM_H_
#define INCLUDE_QORE_QOREDEBUGPROGRAM_H_
#include <qore/AbstractPrivateData.h>
#include <qore/Restrictions.h>
#include <qore/support.h>
class QoreProgram;
class ExceptionSink;
class AbstractStatement;
class StatementBlock;
class QoreBreakpoint;
class qore_program_private;
class qore_debug_program_private;
enum DebugRunStateEnum : unsigned char {
DBG_RS_DETACH = 0,
DBG_RS_RUN = 1,
DBG_RS_STEP = 2,
DBG_RS_STEP_OVER = 3,
DBG_RS_UNTIL_RETURN = 4,
DBG_RS_STOPPED = 5, // last one, see assert in setRunState
};
class QoreDebugProgram : public AbstractPrivateData {
friend class qore_program_private;
friend class qore_debug_program_private;
private:
qore_debug_program_private* priv;
DLLLOCAL QoreDebugProgram(const QoreDebugProgram&);
DLLLOCAL QoreDebugProgram& operator=(const QoreDebugProgram&);
protected:
DLLLOCAL virtual ~QoreDebugProgram();
public:
DLLEXPORT QoreDebugProgram();
DLLEXPORT void addProgram(QoreProgram *pgm, ExceptionSink* xsink);
DLLEXPORT void removeProgram(QoreProgram *pgm);
DLLEXPORT QoreListNode* getAllProgramObjects();
DLLEXPORT virtual void onAttach(QoreProgram *pgm, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
DLLEXPORT virtual void onDetach(QoreProgram *pgm, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
DLLEXPORT virtual void onStep(QoreProgram *pgm, const StatementBlock *blockStatement, const AbstractStatement *statement, unsigned bkptId, int &flow, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
DLLEXPORT virtual void onFunctionEnter(QoreProgram *pgm, const StatementBlock *statement, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
DLLEXPORT virtual void onFunctionExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue& returnValue, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
DLLEXPORT virtual void onException(QoreProgram *pgm, const AbstractStatement *statement, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
DLLEXPORT virtual void onExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue& returnValue, DebugRunStateEnum &rs, const AbstractStatement* &rts, ExceptionSink* xsink);
DLLEXPORT int breakProgramThread(QoreProgram *pgm, int tid) const;
DLLEXPORT int breakProgram(QoreProgram *pgm) const;
DLLEXPORT void waitForTerminationAndClear(ExceptionSink* xsink);
DLLEXPORT int getInterruptedCount();
};
#endif /* INCLUDE_QORE_QOREDEBUGPROGRAM_H_ */
QoreDebugProgram::breakProgramThread
DLLEXPORT int breakProgramThread(QoreProgram *pgm, int tid) const
AbstractPrivateData
the base class for all data to be used as private data of Qore objects
Definition: AbstractPrivateData.h:44
Restrictions.h
QoreBreakpoint
Class implementing breakpoint for debugging.
Definition: QoreProgram.h:1038
QoreDebugProgram::onStep
virtual DLLEXPORT void onStep(QoreProgram *pgm, const StatementBlock *blockStatement, const AbstractStatement *statement, unsigned bkptId, int &flow, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
QoreDebugProgram::waitForTerminationAndClear
DLLEXPORT void waitForTerminationAndClear(ExceptionSink *xsink)
remove programs and wait till the program&#39;s last thread terminates
QoreDebugProgram::onFunctionEnter
virtual DLLEXPORT void onFunctionEnter(QoreProgram *pgm, const StatementBlock *statement, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
QoreListNode
This is the list container type in Qore, dynamically allocated only, reference counted.
Definition: QoreListNode.h:52
QoreDebugProgram
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreDebugProgram.h:66
QoreValue
The main value class in Qore, designed to be passed by value.
Definition: QoreValue.h:275
QoreProgram
supports parsing and executing Qore-language code, reference counted, dynamically-allocated only ...
Definition: QoreProgram.h:127
ExceptionSink
container for holding Qore-language exception information and also for registering a "thread_exit" ca...
Definition: ExceptionSink.h:48
QoreDebugProgram::onException
virtual DLLEXPORT void onException(QoreProgram *pgm, const AbstractStatement *statement, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
QoreDebugProgram::onExit
virtual DLLEXPORT void onExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue &returnValue, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
QoreDebugProgram::breakProgram
DLLEXPORT int breakProgram(QoreProgram *pgm) const
QoreDebugProgram::getInterruptedCount
DLLEXPORT int getInterruptedCount()
get number of program currently interrupted
QoreDebugProgram::onFunctionExit
virtual DLLEXPORT void onFunctionExit(QoreProgram *pgm, const StatementBlock *statement, QoreValue &returnValue, DebugRunStateEnum &rs, const AbstractStatement *&rts, ExceptionSink *xsink)
QoreDebugProgram::~QoreDebugProgram
virtual DLLLOCAL ~QoreDebugProgram()
the destructor is private in order to prohibit the object from being allocated on the stack ...
QoreDebugProgram::QoreDebugProgram
DLLEXPORT QoreDebugProgram()
creates the object