NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
|
#include <debugger.hpp>
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) |
BreakpointManager & | getBreakpointManager () |
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_type > | mLocalVars |
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 |
Definition at line 42 of file debugger.hpp.
NumeReDebugger::NumeReDebugger | ( | ) |
Constructor.
Definition at line 36 of file debugger.cpp.
References bAlreadyThrown, bDebuggerActive, bExceptionHandled, nCurrentStackElement, nLineNumber, sErraticCommand, sErraticModule, and sErrorMessage.
|
private |
This private member function decodes the type of the arguments by looking at their values and apply some guesses.
sArgumentValue | string& |
sArgumentName | const std::string& |
Definition at line 235 of file debugger.cpp.
References containsStrings(), DEFAULT_MINMAX_PRECISION, DEFAULT_NUM_PRECISION, NumeRe::ClusterManager::getCluster(), MemoryManager::getCols(), NumeReKernel::getInstance(), MemoryManager::getLines(), NumeReKernel::getMemoryManager(), getNextArgument(), NumeReKernel::getParser(), NumeRe::Cluster::getShortVectorRepresentation(), StringMemory::getStringCols(), NumeReKernel::getStringParser(), StringMemory::getStringSize(), NumeRe::StringVarFactory::getStringVars(), mu::ParserBase::GetVar(), NumeRe::ClusterManager::isCluster(), MemoryManager::isTable(), MemoryManager::max(), StringMemory::maxString(), MAXSTRINGLENGTH, MemoryManager::min(), StringMemory::minString(), nCurrentStackElement, replaceControlCharacters(), NumeRe::Cluster::size(), toString(), and vStackTrace.
Referenced by getArguments().
|
inline |
Definition at line 71 of file debugger.hpp.
References bExceptionHandled, and reset().
Referenced by NumeReKernel::resetAfterError().
|
inline |
Definition at line 76 of file debugger.hpp.
References bExceptionHandled, and resetBP().
Referenced by Procedure::catchExceptionForTest(), and FlowCtrl::try_catch().
|
private |
This function replaces unmasked dollars with regular line break characters and also removes the masking characters in front of masked dollars.
Definition at line 210 of file debugger.cpp.
References sErrorMessage.
Referenced by showError().
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 | ||
) |
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.
_varFactory | ProcedureVarFactory* |
_sErraticCommand | const string& |
_sErraticModule | const string& |
_nLineNumber | unsigned int |
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().
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.
_sErraticCommand | const string& |
_nLineNumber | unsigned int |
map<string | |
mVarMap | string>& |
vVarArray | const std::vector<mu::value_type>& |
sVarArray | const std::vector<std::string>& |
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().
vector< string > NumeReDebugger::getArguments | ( | ) |
This member function returns the procedure argument as a vector.
Definition at line 904 of file debugger.cpp.
References decodeType(), and mArguments.
Referenced by DebugViewer::getInformationByStackId().
|
inline |
Definition at line 110 of file debugger.hpp.
References _breakpointManager.
Referenced by NumeReTerminal::addBreakpoint(), NumeReTerminal::clearBreakpoints(), Procedure::execute(), Procedure::getInlined(), and NumeReTerminal::removeBreakpoint().
vector< string > NumeReDebugger::getClusters | ( | ) |
This member function returns the clusters as a vector.
Definition at line 884 of file debugger.cpp.
References mLocalClusters.
Referenced by DebugViewer::getInformationByStackId().
|
inline |
Definition at line 93 of file debugger.hpp.
References sErrorMessage.
|
inline |
Definition at line 89 of file debugger.hpp.
References sErraticModule.
vector< string > NumeReDebugger::getGlobals | ( | ) |
This member function returns the current global variables as a vector.
Definition at line 925 of file debugger.cpp.
References DEFAULT_MINMAX_PRECISION, DEFAULT_NUM_PRECISION, ellipsize(), NumeRe::ClusterManager::getClusterMap(), MemoryManager::getCols(), NumeReKernel::getInstance(), MemoryManager::getLines(), NumeReKernel::getMemoryManager(), NumeReKernel::getParser(), StringMemory::getStringCols(), StringMemory::getStringElements(), NumeReKernel::getStringParser(), NumeRe::StringVarFactory::getStringVars(), MemoryManager::getTableMap(), mu::ParserBase::GetVar(), mu::isnan(), MemoryManager::max(), StringMemory::maxString(), MAXSTRINGLENGTH, MemoryManager::min(), StringMemory::minString(), replaceControlCharacters(), toExternalString(), toString(), and vStackTrace.
Referenced by DebugViewer::getInformationByStackId().
|
inline |
Definition at line 85 of file debugger.hpp.
References nLineNumber.
vector< string > NumeReDebugger::getModuleInformations | ( | ) |
This member function returns the module informations as a vector.
Definition at line 763 of file debugger.cpp.
References nLineNumber, sErraticCommand, sErraticModule, sErrorMessage, and toString().
Referenced by DebugViewer::getInformationByStackId().
vector< string > NumeReDebugger::getNumVars | ( | ) |
This member function returns the numerical variables as a vector.
Definition at line 812 of file debugger.cpp.
References DEFAULT_NUM_PRECISION, mu::isnan(), mLocalVars, and toString().
Referenced by DebugViewer::getInformationByStackId().
|
inline |
Definition at line 97 of file debugger.hpp.
References vStackTrace.
vector< string > NumeReDebugger::getStackTrace | ( | ) |
This member function returns the stack trace as a vector.
Definition at line 781 of file debugger.cpp.
References _lang, Language::get(), Procedure::GetCurrentLine(), nLineNumber, Procedure::sCurrentProcedureName, sErraticModule, toString(), and vStackTrace.
Referenced by showEvent().
vector< string > NumeReDebugger::getStringVars | ( | ) |
This member function returns the string variables as a vector.
Definition at line 841 of file debugger.cpp.
References mLocalStrings.
Referenced by DebugViewer::getInformationByStackId().
vector< string > NumeReDebugger::getTables | ( | ) |
This member function returns the tables as a vector.
Definition at line 864 of file debugger.cpp.
References mLocalTables.
Referenced by DebugViewer::getInformationByStackId().
|
inline |
Definition at line 101 of file debugger.hpp.
References bDebuggerActive.
void NumeReDebugger::popStackItem | ( | ) |
This member function removes the last item from the stack.
Definition at line 489 of file debugger.cpp.
References nCurrentStackElement, and vStackTrace.
Referenced by ProcedureVarFactory::createProcedureArguments(), Procedure::execute(), and Procedure::resetProcedure().
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.
sStackItem | const string& |
_currentProcedure | Procedure* |
Definition at line 457 of file debugger.cpp.
References nCurrentStackElement, and vStackTrace.
Referenced by Procedure::execute().
void NumeReDebugger::reset | ( | ) |
This member function resets the debugger after a thrown and displayed error.
Definition at line 414 of file debugger.cpp.
References resetBP(), sErrorMessage, and vStackTrace.
Referenced by finalize().
|
private |
This member function resets the debugger after an evaluated breakpoint. This excludes resetting the stacktrace.
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().
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.
nStackElement | size_t |
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().
|
inline |
Definition at line 105 of file debugger.hpp.
References bDebuggerActive.
Referenced by cmd_set(), and NumeReKernel::setKernelSettings().
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.
Definition at line 158 of file debugger.cpp.
References _lang, Language::get(), resetBP(), sErrorMessage, and showEvent().
Referenced by NumeReKernel::evalDebuggerBreakPoint(), and Procedure::evalDebuggerBreakPoint().
void NumeReDebugger::showError | ( | const std::string & | sTitle | ) |
This member function shows the debugger with the passed error message.
sTitle | const string& |
Definition at line 96 of file debugger.cpp.
References bExceptionHandled, formatMessage(), resetBP(), and showEvent().
Referenced by ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::evaluateProcedureArguments(), Procedure::execute(), FlowCtrl::for_loop(), FlowCtrl::if_fork(), FlowCtrl::range_based_for_loop(), FlowCtrl::switch_fork(), throwException(), FlowCtrl::try_catch(), and FlowCtrl::while_loop().
void NumeReDebugger::showError | ( | std::exception_ptr | e_ptr | ) |
|
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.
sTitle | const string& |
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().
void NumeReDebugger::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.
error | SyntaxError |
Definition at line 120 of file debugger.cpp.
References _lang, SyntaxError::errorcode, Language::get(), SyntaxError::getIndices(), SyntaxError::getToken(), SyntaxError::LOOP_THROW, SyntaxError::PROCEDURE_THROW, SyntaxError::PROCESS_ABORTED_BY_USER, sErrorMessage, showError(), and toString().
Referenced by ProcedureVarFactory::checkArgument(), ProcedureVarFactory::checkArgumentValue(), ProcedureVarFactory::createLocalClusters(), ProcedureVarFactory::createLocalInlineStrings(), ProcedureVarFactory::createLocalInlineVars(), ProcedureVarFactory::createLocalStrings(), ProcedureVarFactory::createLocalTables(), ProcedureVarFactory::createLocalVars(), ProcedureVarFactory::createProcedureArguments(), FlowCtrl::evalHeader(), ProcedureVarFactory::evaluateProcedureArguments(), and Procedure::execute().
|
inline |
|
private |
Definition at line 45 of file debugger.hpp.
Referenced by getBreakpointManager().
|
private |
Definition at line 56 of file debugger.hpp.
Referenced by gatherInformations(), gatherLoopBasedInformations(), NumeReDebugger(), resetBP(), and validDebuggingInformations().
|
private |
Definition at line 60 of file debugger.hpp.
Referenced by gatherInformations(), gatherLoopBasedInformations(), isActive(), NumeReDebugger(), setActive(), and showEvent().
|
private |
Definition at line 57 of file debugger.hpp.
Referenced by finalize(), finalizeCatched(), NumeReDebugger(), and showError().
|
private |
Definition at line 55 of file debugger.hpp.
Referenced by getArguments(), and resetBP().
|
private |
Definition at line 54 of file debugger.hpp.
Referenced by getClusters(), and resetBP().
|
private |
Definition at line 52 of file debugger.hpp.
Referenced by gatherLoopBasedInformations(), getStringVars(), and resetBP().
|
private |
Definition at line 53 of file debugger.hpp.
Referenced by getTables(), and resetBP().
|
private |
Definition at line 51 of file debugger.hpp.
Referenced by gatherLoopBasedInformations(), getNumVars(), and resetBP().
|
private |
Definition at line 58 of file debugger.hpp.
Referenced by decodeType(), NumeReDebugger(), popStackItem(), pushStackItem(), and select().
|
private |
Definition at line 47 of file debugger.hpp.
Referenced by gatherLoopBasedInformations(), getLineNumber(), getModuleInformations(), getStackTrace(), NumeReDebugger(), resetBP(), select(), and showEvent().
|
private |
Definition at line 48 of file debugger.hpp.
Referenced by gatherLoopBasedInformations(), getModuleInformations(), NumeReDebugger(), and resetBP().
|
private |
Definition at line 49 of file debugger.hpp.
Referenced by getErrorModule(), getModuleInformations(), getStackTrace(), NumeReDebugger(), resetBP(), select(), and showEvent().
|
private |
Definition at line 50 of file debugger.hpp.
Referenced by formatMessage(), getErrorMessage(), getModuleInformations(), NumeReDebugger(), reset(), showBreakPoint(), and throwException().
|
private |
Definition at line 46 of file debugger.hpp.
Referenced by decodeType(), getGlobals(), getStackSize(), getStackTrace(), popStackItem(), pushStackItem(), reset(), and select().