NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
NumeReDebugger Class Reference

#include <debugger.hpp>

Collaboration diagram for NumeReDebugger:

Public Member Functions

 NumeReDebugger ()
 Constructor. More...
 
void reset ()
 This member function resets the debugger after a thrown and displayed error. More...
 
void finalize ()
 
void finalizeCatched ()
 
bool validDebuggingInformations () const
 
unsigned int getLineNumber () const
 
std::string getErrorModule () const
 
std::string getErrorMessage () const
 
size_t getStackSize () const
 
bool isActive () const
 
void setActive (bool active)
 
BreakpointManagergetBreakpointManager ()
 
void showError (const std::string &sTitle)
 This member function shows the debugger with the passed error message. More...
 
void showError (std::exception_ptr e_ptr)
 
void throwException (SyntaxError error)
 This member function shows the debugger with the corresponding error message obtained by the passed SyntaxError object and throws the corresponding exception afterwards. More...
 
int showBreakPoint ()
 This member function shows the debugger for the current breakpoint and returns the debugger code (i.e. the chosen command) obtained from the user. More...
 
bool select (size_t nStackElement)
 This member function can be used to select a specific element in the current stack trace to read the state at this position. More...
 
void pushStackItem (const std::string &sStackItem, Procedure *_currentProcedure)
 This member function adds a new stack item to the monitored stack. Additionally, it cleanes the procedure's names for the stack trace display. More...
 
void popStackItem ()
 This member function removes the last item from the stack. More...
 
void gatherInformations (ProcedureVarFactory *_varFactory, const std::string &_sErraticCommand, const std::string &_sErraticModule, unsigned int _nLineNumber)
 This member function gathers all information from the current workspace and stores them internally to display them to the user. More...
 
void gatherInformations (const std::map< std::string, std::pair< std::string, mu::value_type * > > &_mLocalVars, const std::map< std::string, std::pair< std::string, std::string > > &_mLocalStrings, const std::map< std::string, std::string > &_mLocalTables, const std::map< std::string, std::string > &_mLocalClusters, const std::map< std::string, std::string > &_mArguments, const std::string &_sErraticCommand, const std::string &_sErraticModule, unsigned int _nLineNumber)
 
void gatherLoopBasedInformations (const std::string &_sErraticCommand, unsigned int _nLineNumber, std::map< std::string, std::string > &mVarMap, const std::vector< mu::value_type > &vVarArray, const std::vector< std::string > &sVarArray)
 This member funciton gathers the necessary debugging informations from the current executed control flow block. More...
 
std::vector< std::string > getModuleInformations ()
 This member function returns the module informations as a vector. More...
 
std::vector< std::string > getStackTrace ()
 This member function returns the stack trace as a vector. More...
 
std::vector< std::string > getNumVars ()
 This member function returns the numerical variables as a vector. More...
 
std::vector< std::string > getStringVars ()
 This member function returns the string variables as a vector. More...
 
std::vector< std::string > getTables ()
 This member function returns the tables as a vector. More...
 
std::vector< std::string > getClusters ()
 This member function returns the clusters as a vector. More...
 
std::vector< std::string > getArguments ()
 This member function returns the procedure argument as a vector. More...
 
std::vector< std::string > getGlobals ()
 This member function returns the current global variables as a vector. More...
 

Private Member Functions

int showEvent (const std::string &sTitle)
 This private member function shows the debugger for the current selected event and returns the debugger code (i.e. the chosen command) obtained from the user. More...
 
void resetBP ()
 This member function resets the debugger after an evaluated breakpoint. This excludes resetting the stacktrace. More...
 
void formatMessage ()
 This function replaces unmasked dollars with regular line break characters and also removes the masking characters in front of masked dollars. More...
 
std::string decodeType (std::string &sArgumentValue, const std::string &sArgumentName="")
 This private member function decodes the type of the arguments by looking at their values and apply some guesses. More...
 

Private Attributes

BreakpointManager _breakpointManager
 
std::vector< std::pair< std::string, Procedure * > > vStackTrace
 
unsigned int nLineNumber
 
std::string sErraticCommand
 
std::string sErraticModule
 
std::string sErrorMessage
 
std::map< std::string, mu::value_typemLocalVars
 
std::map< std::string, std::string > mLocalStrings
 
std::map< std::string, std::string > mLocalTables
 
std::map< std::string, std::string > mLocalClusters
 
std::map< std::string, std::string > mArguments
 
bool bAlreadyThrown
 
bool bExceptionHandled
 
size_t nCurrentStackElement
 
bool bDebuggerActive
 

Detailed Description

Definition at line 42 of file debugger.hpp.

Constructor & Destructor Documentation

◆ NumeReDebugger()

NumeReDebugger::NumeReDebugger ( )

Member Function Documentation

◆ decodeType()

string NumeReDebugger::decodeType ( std::string &  sArgumentValue,
const std::string &  sArgumentName = "" 
)
private

◆ finalize()

void NumeReDebugger::finalize ( )
inline

Definition at line 71 of file debugger.hpp.

References bExceptionHandled, and reset().

Referenced by NumeReKernel::resetAfterError().

Here is the call graph for this function:

◆ finalizeCatched()

void NumeReDebugger::finalizeCatched ( )
inline

Definition at line 76 of file debugger.hpp.

References bExceptionHandled, and resetBP().

Referenced by Procedure::catchExceptionForTest(), and FlowCtrl::try_catch().

Here is the call graph for this function:

◆ formatMessage()

void NumeReDebugger::formatMessage ( )
private

This function replaces unmasked dollars with regular line break characters and also removes the masking characters in front of masked dollars.

Returns
void

Definition at line 210 of file debugger.cpp.

References sErrorMessage.

Referenced by showError().

◆ gatherInformations() [1/2]

void NumeReDebugger::gatherInformations ( const std::map< std::string, std::pair< std::string, mu::value_type * > > &  _mLocalVars,
const std::map< std::string, std::pair< std::string, std::string > > &  _mLocalStrings,
const std::map< std::string, std::string > &  _mLocalTables,
const std::map< std::string, std::string > &  _mLocalClusters,
const std::map< std::string, std::string > &  _mArguments,
const std::string &  _sErraticCommand,
const std::string &  _sErraticModule,
unsigned int  _nLineNumber 
)

◆ gatherInformations() [2/2]

void NumeReDebugger::gatherInformations ( ProcedureVarFactory _varFactory,
const std::string &  _sErraticCommand,
const std::string &  _sErraticModule,
unsigned int  _nLineNumber 
)

This member function gathers all information from the current workspace and stores them internally to display them to the user.

Parameters
_varFactoryProcedureVarFactory*
_sErraticCommandconst string&
_sErraticModuleconst string&
_nLineNumberunsigned int
Returns
void

This member function is a wrapper for the more complicated signature further below.

Definition at line 516 of file debugger.cpp.

References bAlreadyThrown, bDebuggerActive, gatherInformations(), ProcedureVarFactory::mArguments, ProcedureVarFactory::mLocalClusters, ProcedureVarFactory::mLocalStrings, ProcedureVarFactory::mLocalTables, and ProcedureVarFactory::mLocalVars.

Referenced by ProcedureVarFactory::checkArgument(), ProcedureVarFactory::checkArgumentValue(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::createProcedureArguments(), NumeReKernel::evalDebuggerBreakPoint(), Procedure::evalDebuggerBreakPoint(), ProcedureVarFactory::evaluateProcedureArguments(), Procedure::execute(), gatherInformations(), Procedure::getErrorInformationForDebugger(), and select().

Here is the call graph for this function:

◆ gatherLoopBasedInformations()

void NumeReDebugger::gatherLoopBasedInformations ( const std::string &  _sErraticCommand,
unsigned int  _nLineNumber,
std::map< std::string, std::string > &  mVarMap,
const std::vector< mu::value_type > &  vVarArray,
const std::vector< std::string > &  sVarArray 
)

This member funciton gathers the necessary debugging informations from the current executed control flow block.

Parameters
_sErraticCommandconst string&
_nLineNumberunsigned int
map<string
mVarMapstring>&
vVarArrayconst std::vector<mu::value_type>&
sVarArrayconst std::vector<std::string>&
Returns
void

Definition at line 701 of file debugger.cpp.

References bAlreadyThrown, bDebuggerActive, NumeRe::ClusterManager::getCluster(), NumeRe::Cluster::getDouble(), NumeReKernel::getInstance(), NumeReKernel::getMemoryManager(), NumeRe::Cluster::getString(), NumeReKernel::getStringParser(), NumeRe::StringVarFactory::getStringValue(), NumeRe::Cluster::getType(), NumeRe::StringVarFactory::isStringVar(), NumeRe::ClusterItem::ITEMTYPE_DOUBLE, NumeRe::ClusterItem::ITEMTYPE_STRING, mLocalStrings, mLocalVars, nLineNumber, sErraticCommand, StrToInt(), and toExternalString().

Referenced by FlowCtrl::calc(), FlowCtrl::compile(), FlowCtrl::evalHeader(), FlowCtrl::evalRangeBasedHeader(), FlowCtrl::for_loop(), FlowCtrl::if_fork(), FlowCtrl::range_based_for_loop(), select(), FlowCtrl::switch_fork(), FlowCtrl::try_catch(), and FlowCtrl::while_loop().

Here is the call graph for this function:

◆ getArguments()

vector< string > NumeReDebugger::getArguments ( )

This member function returns the procedure argument as a vector.

Returns
vector<string>

Definition at line 904 of file debugger.cpp.

References decodeType(), and mArguments.

Referenced by DebugViewer::getInformationByStackId().

Here is the call graph for this function:

◆ getBreakpointManager()

◆ getClusters()

vector< string > NumeReDebugger::getClusters ( )

This member function returns the clusters as a vector.

Returns
vector<string>

Definition at line 884 of file debugger.cpp.

References mLocalClusters.

Referenced by DebugViewer::getInformationByStackId().

◆ getErrorMessage()

std::string NumeReDebugger::getErrorMessage ( ) const
inline

Definition at line 93 of file debugger.hpp.

References sErrorMessage.

◆ getErrorModule()

std::string NumeReDebugger::getErrorModule ( ) const
inline

Definition at line 89 of file debugger.hpp.

References sErraticModule.

◆ getGlobals()

◆ getLineNumber()

unsigned int NumeReDebugger::getLineNumber ( ) const
inline

Definition at line 85 of file debugger.hpp.

References nLineNumber.

◆ getModuleInformations()

vector< string > NumeReDebugger::getModuleInformations ( )

This member function returns the module informations as a vector.

Returns
vector<string>

Definition at line 763 of file debugger.cpp.

References nLineNumber, sErraticCommand, sErraticModule, sErrorMessage, and toString().

Referenced by DebugViewer::getInformationByStackId().

Here is the call graph for this function:

◆ getNumVars()

vector< string > NumeReDebugger::getNumVars ( )

This member function returns the numerical variables as a vector.

Returns
vector<string>

Definition at line 812 of file debugger.cpp.

References DEFAULT_NUM_PRECISION, mu::isnan(), mLocalVars, and toString().

Referenced by DebugViewer::getInformationByStackId().

Here is the call graph for this function:

◆ getStackSize()

size_t NumeReDebugger::getStackSize ( ) const
inline

Definition at line 97 of file debugger.hpp.

References vStackTrace.

◆ getStackTrace()

vector< string > NumeReDebugger::getStackTrace ( )

This member function returns the stack trace as a vector.

Returns
vector<string>

Definition at line 781 of file debugger.cpp.

References _lang, Language::get(), Procedure::GetCurrentLine(), nLineNumber, Procedure::sCurrentProcedureName, sErraticModule, toString(), and vStackTrace.

Referenced by showEvent().

Here is the call graph for this function:

◆ getStringVars()

vector< string > NumeReDebugger::getStringVars ( )

This member function returns the string variables as a vector.

Returns
vector<string>

Definition at line 841 of file debugger.cpp.

References mLocalStrings.

Referenced by DebugViewer::getInformationByStackId().

◆ getTables()

vector< string > NumeReDebugger::getTables ( )

This member function returns the tables as a vector.

Returns
vector<string>

Definition at line 864 of file debugger.cpp.

References mLocalTables.

Referenced by DebugViewer::getInformationByStackId().

◆ isActive()

bool NumeReDebugger::isActive ( ) const
inline

Definition at line 101 of file debugger.hpp.

References bDebuggerActive.

◆ popStackItem()

void NumeReDebugger::popStackItem ( )

This member function removes the last item from the stack.

Returns
void

Definition at line 489 of file debugger.cpp.

References nCurrentStackElement, and vStackTrace.

Referenced by ProcedureVarFactory::createProcedureArguments(), Procedure::execute(), and Procedure::resetProcedure().

◆ pushStackItem()

void NumeReDebugger::pushStackItem ( const std::string &  sStackItem,
Procedure _currentProcedure 
)

This member function adds a new stack item to the monitored stack. Additionally, it cleanes the procedure's names for the stack trace display.

Parameters
sStackItemconst string&
_currentProcedureProcedure*
Returns
void

Definition at line 457 of file debugger.cpp.

References nCurrentStackElement, and vStackTrace.

Referenced by Procedure::execute().

◆ reset()

void NumeReDebugger::reset ( )

This member function resets the debugger after a thrown and displayed error.

Returns
void

Definition at line 414 of file debugger.cpp.

References resetBP(), sErrorMessage, and vStackTrace.

Referenced by finalize().

Here is the call graph for this function:

◆ resetBP()

void NumeReDebugger::resetBP ( )
private

This member function resets the debugger after an evaluated breakpoint. This excludes resetting the stacktrace.

Returns
void

Definition at line 431 of file debugger.cpp.

References bAlreadyThrown, mArguments, mLocalClusters, mLocalStrings, mLocalTables, mLocalVars, nLineNumber, sErraticCommand, and sErraticModule.

Referenced by finalizeCatched(), reset(), select(), showBreakPoint(), and showError().

◆ select()

bool NumeReDebugger::select ( size_t  nStackElement)

This member function can be used to select a specific element in the current stack trace to read the state at this position.

Parameters
nStackElementsize_t
Returns
bool

Definition at line 370 of file debugger.cpp.

References Procedure::_varFactory, FlowCtrl::bEvaluatingFlowControlStatements, gatherInformations(), gatherLoopBasedInformations(), FlowCtrl::getCurrentCommand(), Procedure::GetCurrentLine(), FlowCtrl::getCurrentLineNumber(), NumeReKernel::gotoLine(), FlowCtrl::mVarMap, nCurrentStackElement, nLineNumber, resetBP(), Procedure::sCurrentProcedureName, sErraticModule, Procedure::sProcCommandLine, FlowCtrl::sVarArray, vStackTrace, and FlowCtrl::vVarArray.

Referenced by DebugViewer::getInformationByStackId().

Here is the call graph for this function:

◆ setActive()

void NumeReDebugger::setActive ( bool  active)
inline

Definition at line 105 of file debugger.hpp.

References bDebuggerActive.

Referenced by cmd_set(), and NumeReKernel::setKernelSettings().

◆ showBreakPoint()

int NumeReDebugger::showBreakPoint ( )

This member function shows the debugger for the current breakpoint and returns the debugger code (i.e. the chosen command) obtained from the user.

Returns
int

Definition at line 158 of file debugger.cpp.

References _lang, Language::get(), resetBP(), sErrorMessage, and showEvent().

Referenced by NumeReKernel::evalDebuggerBreakPoint(), and Procedure::evalDebuggerBreakPoint().

Here is the call graph for this function:

◆ showError() [1/2]

void NumeReDebugger::showError ( const std::string &  sTitle)

◆ showError() [2/2]

void NumeReDebugger::showError ( std::exception_ptr  e_ptr)

◆ showEvent()

int NumeReDebugger::showEvent ( const std::string &  sTitle)
private

This private member function shows the debugger for the current selected event and returns the debugger code (i.e. the chosen command) obtained from the user.

Parameters
sTitleconst string&
Returns
int

Definition at line 178 of file debugger.cpp.

References bDebuggerActive, NumeReKernel::DEBUGGER_CONTINUE, getStackTrace(), NumeReKernel::gotoLine(), nLineNumber, sErraticModule, NumeReKernel::showDebugEvent(), validDebuggingInformations(), and NumeReKernel::waitForContinue().

Referenced by showBreakPoint(), and showError().

Here is the call graph for this function:

◆ throwException()

void NumeReDebugger::throwException ( SyntaxError  error)

◆ validDebuggingInformations()

bool NumeReDebugger::validDebuggingInformations ( ) const
inline

Definition at line 81 of file debugger.hpp.

References bAlreadyThrown.

Referenced by showEvent().

Member Data Documentation

◆ _breakpointManager

BreakpointManager NumeReDebugger::_breakpointManager
private

Definition at line 45 of file debugger.hpp.

Referenced by getBreakpointManager().

◆ bAlreadyThrown

bool NumeReDebugger::bAlreadyThrown
private

◆ bDebuggerActive

bool NumeReDebugger::bDebuggerActive
private

◆ bExceptionHandled

bool NumeReDebugger::bExceptionHandled
private

Definition at line 57 of file debugger.hpp.

Referenced by finalize(), finalizeCatched(), NumeReDebugger(), and showError().

◆ mArguments

std::map<std::string,std::string> NumeReDebugger::mArguments
private

Definition at line 55 of file debugger.hpp.

Referenced by getArguments(), and resetBP().

◆ mLocalClusters

std::map<std::string,std::string> NumeReDebugger::mLocalClusters
private

Definition at line 54 of file debugger.hpp.

Referenced by getClusters(), and resetBP().

◆ mLocalStrings

std::map<std::string,std::string> NumeReDebugger::mLocalStrings
private

Definition at line 52 of file debugger.hpp.

Referenced by gatherLoopBasedInformations(), getStringVars(), and resetBP().

◆ mLocalTables

std::map<std::string,std::string> NumeReDebugger::mLocalTables
private

Definition at line 53 of file debugger.hpp.

Referenced by getTables(), and resetBP().

◆ mLocalVars

std::map<std::string,mu::value_type> NumeReDebugger::mLocalVars
private

Definition at line 51 of file debugger.hpp.

Referenced by gatherLoopBasedInformations(), getNumVars(), and resetBP().

◆ nCurrentStackElement

size_t NumeReDebugger::nCurrentStackElement
private

Definition at line 58 of file debugger.hpp.

Referenced by decodeType(), NumeReDebugger(), popStackItem(), pushStackItem(), and select().

◆ nLineNumber

unsigned int NumeReDebugger::nLineNumber
private

◆ sErraticCommand

std::string NumeReDebugger::sErraticCommand
private

◆ sErraticModule

std::string NumeReDebugger::sErraticModule
private

◆ sErrorMessage

std::string NumeReDebugger::sErrorMessage
private

◆ vStackTrace

std::vector<std::pair<std::string, Procedure*> > NumeReDebugger::vStackTrace
private

The documentation for this class was generated from the following files: