\hypertarget{class_qore_1_1_debug_program}{}\doxysection{Qore\+::Debug\+Program Class Reference} \label{class_qore_1_1_debug_program}\index{Qore::DebugProgram@{Qore::DebugProgram}} \mbox{\hyperlink{class_qore_1_1_debug_program}{Debug\+Program}} class supports Qore \mbox{\hyperlink{class_qore_1_1_program}{Program}} debugging via \mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}}. \doxysubsection*{Public Member Functions} \begin{DoxyCompactItemize} \item \mbox{\Hypertarget{class_qore_1_1_debug_program_af00ca169aed35d3533833ed6c9537875}\label{class_qore_1_1_debug_program_af00ca169aed35d3533833ed6c9537875}} nothing \mbox{\hyperlink{class_qore_1_1_debug_program_af00ca169aed35d3533833ed6c9537875}{add\+Program}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm) \begin{DoxyCompactList}\small\item\em Add program to debugging. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_a319ccf1772a73f344c279e3b74942664}\label{class_qore_1_1_debug_program_a319ccf1772a73f344c279e3b74942664}} \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_debug_program_a319ccf1772a73f344c279e3b74942664}{break\+Program}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm) \begin{DoxyCompactList}\small\item\em Break program, i.\+e. all threads. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_a037e76587a1731677fb4ce7843a45bc3}\label{class_qore_1_1_debug_program_a037e76587a1731677fb4ce7843a45bc3}} \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_debug_program_a037e76587a1731677fb4ce7843a45bc3}{break\+Program\+Thread}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} tid) \begin{DoxyCompactList}\small\item\em Break particular program thread. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_ada3f690b4f9391243747c16b2b925afe}\label{class_qore_1_1_debug_program_ada3f690b4f9391243747c16b2b925afe}} \mbox{\hyperlink{class_qore_1_1_debug_program_ada3f690b4f9391243747c16b2b925afe}{constructor}} () \begin{DoxyCompactList}\small\item\em Creates the debug program object with notification functions without any functionality. \end{DoxyCompactList}\item \mbox{\hyperlink{class_qore_1_1_debug_program_ae182473540521dcf74c683c5f707bb27}{copy}} () \begin{DoxyCompactList}\small\item\em Throws an exception to prevent objects of this class from being copied. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_aad949c4e00b880498aefe943ea7a92fd}\label{class_qore_1_1_debug_program_aad949c4e00b880498aefe943ea7a92fd}} \mbox{\hyperlink{class_qore_1_1_debug_program_aad949c4e00b880498aefe943ea7a92fd}{destructor}} () \begin{DoxyCompactList}\small\item\em Waits for all threads to finish executing, then deletes all global variables, dereferences the internal \mbox{\hyperlink{class_qore_1_1_program}{Program}} object and deletes the Qore object. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_a77b60d4fa6f273ac76ddd8810098de1f}\label{class_qore_1_1_debug_program_a77b60d4fa6f273ac76ddd8810098de1f}} \mbox{\hyperlink{group__type__conversion__functions_ga4b52a1cbee7a3aed46c32cb0a938629c}{list}} \mbox{\hyperlink{class_qore_1_1_debug_program_a77b60d4fa6f273ac76ddd8810098de1f}{get\+All\+Programs}} () \begin{DoxyCompactList}\small\item\em Get all programs being debugged. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_aeaa0b63e2fcf2d43f0810fd1ad013bb3}\label{class_qore_1_1_debug_program_aeaa0b63e2fcf2d43f0810fd1ad013bb3}} \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} \mbox{\hyperlink{class_qore_1_1_debug_program_aeaa0b63e2fcf2d43f0810fd1ad013bb3}{get\+Interrupted\+Count}} () \begin{DoxyCompactList}\small\item\em Get number of interrupted threads. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_af6128c85bed20aa75ff620395d3e650e}\label{class_qore_1_1_debug_program_af6128c85bed20aa75ff620395d3e650e}} abstract \mbox{\hyperlink{class_qore_1_1_debug_program_af6128c85bed20aa75ff620395d3e650e}{on\+Attach}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, reference rs, reference rtsid) \begin{DoxyCompactList}\small\item\em Executed when new thread is attached to program being debugged. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_a9a4109f8e3f5571e45b1a398ffe3944a}\label{class_qore_1_1_debug_program_a9a4109f8e3f5571e45b1a398ffe3944a}} abstract \mbox{\hyperlink{class_qore_1_1_debug_program_a9a4109f8e3f5571e45b1a398ffe3944a}{on\+Detach}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, reference rs, reference rtsid) \begin{DoxyCompactList}\small\item\em Executed when thread is datached from program being debugged. \end{DoxyCompactList}\item abstract \mbox{\hyperlink{class_qore_1_1_debug_program_a7875283d2d77e2f046f668ae1dbe1481}{on\+Exception}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} statement, \mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}} ex, reference dismiss, reference rs, reference rtsid) \begin{DoxyCompactList}\small\item\em Executed when an exception is raised. \end{DoxyCompactList}\item abstract \mbox{\hyperlink{class_qore_1_1_debug_program_aff4d8aa1dbc409efbe427cc497e6d6b9}{on\+Exit}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} statement, reference return\+Value, reference rs, reference rtsid) \begin{DoxyCompactList}\small\item\em Executed when a program/thread is exited. \end{DoxyCompactList}\item abstract \mbox{\hyperlink{class_qore_1_1_debug_program_a141bcffa9c0c190e1e7cfc0e6a7abc89}{on\+Function\+Enter}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} statement, reference rs, reference rtsid) \begin{DoxyCompactList}\small\item\em Executed when a function is entered. \end{DoxyCompactList}\item abstract \mbox{\hyperlink{class_qore_1_1_debug_program_a4312a29a6f9fc51f6a25a1c9441d2444}{on\+Function\+Exit}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} statement, reference return\+Value, reference rs, reference rtsid) \begin{DoxyCompactList}\small\item\em Executed when a function is exited. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_ad8cd7b6c9842b2f05888713d1deaf9c7}\label{class_qore_1_1_debug_program_ad8cd7b6c9842b2f05888713d1deaf9c7}} abstract \mbox{\hyperlink{class_qore_1_1_debug_program_ad8cd7b6c9842b2f05888713d1deaf9c7}{on\+Step}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm, \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} block\+Statement, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} statement, \+\_\+\+\_\+7\+\_\+ \mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}} breakpoint\+Id, reference flow, reference rs, reference rtsid) \begin{DoxyCompactList}\small\item\em Executed when step is performed. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_a3248a531df6eedc2ccbb921a968005dd}\label{class_qore_1_1_debug_program_a3248a531df6eedc2ccbb921a968005dd}} nothing \mbox{\hyperlink{class_qore_1_1_debug_program_a3248a531df6eedc2ccbb921a968005dd}{remove\+Program}} (\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} pgm) \begin{DoxyCompactList}\small\item\em Remove program from debugging. \end{DoxyCompactList}\item \mbox{\Hypertarget{class_qore_1_1_debug_program_aa2d8b9749741cfcc6f972a627d75cbd1}\label{class_qore_1_1_debug_program_aa2d8b9749741cfcc6f972a627d75cbd1}} nothing \mbox{\hyperlink{class_qore_1_1_debug_program_aa2d8b9749741cfcc6f972a627d75cbd1}{wait\+For\+Termination\+And\+Clear}} () \begin{DoxyCompactList}\small\item\em Clear all programs and wait for all threads to finish executing callbacks. \end{DoxyCompactList}\end{DoxyCompactItemize} \doxysubsection{Detailed Description} \mbox{\hyperlink{class_qore_1_1_debug_program}{Debug\+Program}} class supports Qore \mbox{\hyperlink{class_qore_1_1_program}{Program}} debugging via \mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}}. One instance may be assigned to one or more \mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} instances which may run in one or more threads. \mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}} is added to the debugging list, next the program being debugged notifies the debugger when the next execution event occurs. Calling of notification method is always performed in the program thread. When the program flow is to be interrupted then it happens in the notification method of this class. Then debugger decides to continue and then returns from the notification function and passes \mbox{\hyperlink{group__debug__rs__options}{Debug Run State Constants}} value \char`\"{}step option\char`\"{} code back. The debugger should probably handle control in separate thread. The \mbox{\hyperlink{class_qore_1_1_debug_program}{Debug\+Program}} class defines the interface and the real functionality should be implemented in a child class. \begin{DoxyParagraph}{Restrictions\+:} MUST HAVE\+: \mbox{\hyperlink{group__parse__options_gad0d38cd46f08bf4210d4010204269cc9}{Qore\+::\+PO\+\_\+\+ALLOW\+\_\+\+DEBUGGER}} \end{DoxyParagraph} \begin{DoxyParagraph}{Example\+:} \begin{DoxyCode}{0} \DoxyCodeLine{const code = \textcolor{stringliteral}{"{}for (int i=0; i<10; i++) \{\}"{}};} \DoxyCodeLine{} \DoxyCodeLine{\textcolor{keyword}{class }MyDebugProgram dbg() inherits DebugProgram \{} \DoxyCodeLine{private:} \DoxyCodeLine{ onAttach(ProgramControl pgm, reference rs) \{} \DoxyCodeLine{ rs = DebugStep;} \DoxyCodeLine{ \}} \DoxyCodeLine{\}} \DoxyCodeLine{} \DoxyCodeLine{ProgramControl p = ProgramControl::getProgram();} \DoxyCodeLine{dbg.addProgram(p);} \DoxyCodeLine{} \DoxyCodeLine{pgm.parse(code);} \DoxyCodeLine{pgm.saveProgram();} \DoxyCodeLine{pgm.run();} \end{DoxyCode} \end{DoxyParagraph} \begin{DoxySince}{Since} Qore 0.\+8.\+13 \end{DoxySince} \doxysubsection{Member Function Documentation} \mbox{\Hypertarget{class_qore_1_1_debug_program_ae182473540521dcf74c683c5f707bb27}\label{class_qore_1_1_debug_program_ae182473540521dcf74c683c5f707bb27}} \index{Qore::DebugProgram@{Qore::DebugProgram}!copy@{copy}} \index{copy@{copy}!Qore::DebugProgram@{Qore::DebugProgram}} \doxysubsubsection{\texorpdfstring{copy()}{copy()}} {\footnotesize\ttfamily Qore\+::\+Debug\+Program\+::copy (\begin{DoxyParamCaption}{ }\end{DoxyParamCaption})} Throws an exception to prevent objects of this class from being copied. \begin{DoxyExceptions}{Exceptions} {\em DEBUGPROGRAM-\/\+COPY-\/\+ERROR} & copying \mbox{\hyperlink{class_qore_1_1_debug_program}{Debug\+Program}} objects is unsupported \\ \hline \end{DoxyExceptions} \mbox{\Hypertarget{class_qore_1_1_debug_program_a7875283d2d77e2f046f668ae1dbe1481}\label{class_qore_1_1_debug_program_a7875283d2d77e2f046f668ae1dbe1481}} \index{Qore::DebugProgram@{Qore::DebugProgram}!onException@{onException}} \index{onException@{onException}!Qore::DebugProgram@{Qore::DebugProgram}} \doxysubsubsection{\texorpdfstring{onException()}{onException()}} {\footnotesize\ttfamily abstract Qore\+::\+Debug\+Program\+::on\+Exception (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}}}]{pgm, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{statement, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga0231dbb472dd230310af7c7c34f56e92}{hash}}}]{ex, }\item[{reference}]{dismiss, }\item[{reference}]{rs, }\item[{reference}]{rtsid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}} Executed when an exception is raised. \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_program_control_ada1ff792e44ca555e6c4f5d77c411153}{Program\+Control\+::get\+Statement\+Id\+Info}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_debug_program_aff4d8aa1dbc409efbe427cc497e6d6b9}\label{class_qore_1_1_debug_program_aff4d8aa1dbc409efbe427cc497e6d6b9}} \index{Qore::DebugProgram@{Qore::DebugProgram}!onExit@{onExit}} \index{onExit@{onExit}!Qore::DebugProgram@{Qore::DebugProgram}} \doxysubsubsection{\texorpdfstring{onExit()}{onExit()}} {\footnotesize\ttfamily abstract Qore\+::\+Debug\+Program\+::on\+Exit (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}}}]{pgm, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{statement, }\item[{reference}]{return\+Value, }\item[{reference}]{rs, }\item[{reference}]{rtsid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}} Executed when a program/thread is exited. \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_program_control_ada1ff792e44ca555e6c4f5d77c411153}{Program\+Control\+::get\+Statement\+Id\+Info}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_debug_program_a141bcffa9c0c190e1e7cfc0e6a7abc89}\label{class_qore_1_1_debug_program_a141bcffa9c0c190e1e7cfc0e6a7abc89}} \index{Qore::DebugProgram@{Qore::DebugProgram}!onFunctionEnter@{onFunctionEnter}} \index{onFunctionEnter@{onFunctionEnter}!Qore::DebugProgram@{Qore::DebugProgram}} \doxysubsubsection{\texorpdfstring{onFunctionEnter()}{onFunctionEnter()}} {\footnotesize\ttfamily abstract Qore\+::\+Debug\+Program\+::on\+Function\+Enter (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}}}]{pgm, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{statement, }\item[{reference}]{rs, }\item[{reference}]{rtsid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}} Executed when a function is entered. \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_program_control_ada1ff792e44ca555e6c4f5d77c411153}{Program\+Control\+::get\+Statement\+Id\+Info}} \end{DoxySeeAlso} \mbox{\Hypertarget{class_qore_1_1_debug_program_a4312a29a6f9fc51f6a25a1c9441d2444}\label{class_qore_1_1_debug_program_a4312a29a6f9fc51f6a25a1c9441d2444}} \index{Qore::DebugProgram@{Qore::DebugProgram}!onFunctionExit@{onFunctionExit}} \index{onFunctionExit@{onFunctionExit}!Qore::DebugProgram@{Qore::DebugProgram}} \doxysubsubsection{\texorpdfstring{onFunctionExit()}{onFunctionExit()}} {\footnotesize\ttfamily abstract Qore\+::\+Debug\+Program\+::on\+Function\+Exit (\begin{DoxyParamCaption}\item[{\mbox{\hyperlink{class_qore_1_1_program_control}{Program\+Control}}}]{pgm, }\item[{\mbox{\hyperlink{group__type__conversion__functions_ga2de8717e92c5f97ccc6511f6062d6502}{int}}}]{statement, }\item[{reference}]{return\+Value, }\item[{reference}]{rs, }\item[{reference}]{rtsid }\end{DoxyParamCaption})\hspace{0.3cm}{\ttfamily [pure virtual]}} Executed when a function is exited. \begin{DoxySeeAlso}{See also} \mbox{\hyperlink{class_qore_1_1_program_control_ada1ff792e44ca555e6c4f5d77c411153}{Program\+Control\+::get\+Statement\+Id\+Info}} \end{DoxySeeAlso}