yast2-core
Public Types | Public Member Functions | Private Attributes | List of all members
YaST::ExecutionEnvironment Class Reference

#include <ExecutionEnvironment.h>

Public Types

typedef vector< const CallFrame * > CallStack
 

Public Member Functions

 ExecutionEnvironment ()
 
 ~ExecutionEnvironment ()
 
int linenumber () const
 
void setLinenumber (int line)
 
const string & filename () const
 
void setFilename (const string &filename)
 
YStatementPtr statement () const
 
void setStatement (YStatementPtr s)
 
bool endlessRecursion ()
 
void pushframe (YECallPtr called_function, YCPValue params[])
 
void popframe ()
 
void backtrace (loglevel_t level, uint skip=0) const
 
CallStack callstack () const
 

Private Attributes

int m_linenumber
 
string m_filename
 
bool m_forced_filename
 
YStatementPtr m_statement
 
CallStack m_backtrace
 
size_t m_recursion_limit
 

Detailed Description

Class to track current execution environment. Typically used for logging and debugging.

m_forced_filename is a way to enforce a given filename until another block is entered (or the current one is left). Used for include statements, where top level block does not exist.

Member Typedef Documentation

Constructor & Destructor Documentation

YaST::ExecutionEnvironment::ExecutionEnvironment ( )
YaST::ExecutionEnvironment::~ExecutionEnvironment ( )
inline

Member Function Documentation

void YaST::ExecutionEnvironment::backtrace ( loglevel_t  level,
uint  skip = 0 
) const

Report the current backtrace to log.

Parameters
skipnumber of the top call frames to be omitted from the backtrace

References m_backtrace, y2logger, and ycp2log.

Referenced by Y2FDebug(), Y2FError(), Y2FInternal(), Y2FMilestone(), Y2FSecurity(), and Y2FWarning().

ExecutionEnvironment::CallStack YaST::ExecutionEnvironment::callstack ( ) const

Returns a copy of the call stack for debugging etc.

The stack itself may safely be modified. The pointers it contains, however, may not.

References m_backtrace.

Referenced by Debugger::findSymbol(), and Debugger::generateBacktrace().

bool YaST::ExecutionEnvironment::endlessRecursion ( )

Report error if there are too many stack frames

References m_backtrace, m_recursion_limit, y2error, and YaST::Y2RECURSIONLIMIT.

const string & YaST::ExecutionEnvironment::filename ( ) const
int YaST::ExecutionEnvironment::linenumber ( ) const
void YaST::ExecutionEnvironment::popframe ( )

Pop the top call frame from the backtrace stack.

References m_backtrace, and y2debug.

Referenced by YEFunction::evaluate().

void YaST::ExecutionEnvironment::pushframe ( YECallPtr  called_function,
YCPValue  params[] 
)

Push another call frame to the backtrace stack according to the current information.

Parameters
called_functionname of the function to be called at this point

References filename(), linenumber(), m_backtrace, and y2debug.

Referenced by YEFunction::evaluate().

void YaST::ExecutionEnvironment::setFilename ( const string &  filename)
void YaST::ExecutionEnvironment::setLinenumber ( int  line)
void YaST::ExecutionEnvironment::setStatement ( YStatementPtr  s)

Set the currently evaluated statement.

References m_linenumber, and m_statement.

Referenced by YBlock::evaluate(), and YBlock::evaluateFrom().

YStatementPtr YaST::ExecutionEnvironment::statement ( ) const

Return the currently evaluated statement.

References m_statement.

Referenced by Debugger::processInput().

Member Data Documentation

CallStack YaST::ExecutionEnvironment::m_backtrace
private
string YaST::ExecutionEnvironment::m_filename
private

Referenced by filename(), and setFilename().

bool YaST::ExecutionEnvironment::m_forced_filename
private

Referenced by setFilename().

int YaST::ExecutionEnvironment::m_linenumber
private
size_t YaST::ExecutionEnvironment::m_recursion_limit
private

There is a limit of 1001 call frames (overridable by Y2RECURSIONLIMIT in the environment). After that, a call is skipped and nil is returned instead.

Referenced by endlessRecursion(), and ExecutionEnvironment().

YStatementPtr YaST::ExecutionEnvironment::m_statement
private

Referenced by setStatement(), and statement().


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

Generated on a sunny day for yast2-core by doxygen 1.8.5