Skip to content

Commit

Permalink
Some cleanup of executor
Browse files Browse the repository at this point in the history
- Remove unused debug states
- Rename members for consistency
  • Loading branch information
KevinEady committed May 15, 2023
1 parent 01bfac7 commit 994e2b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
10 changes: 5 additions & 5 deletions pol-core/bscript/executor.cpp
Expand Up @@ -105,7 +105,7 @@ Executor::Executor()

Executor::~Executor()
{
if ( std::shared_ptr<ExecutorDebugListener> listener = _listener.lock() )
if ( std::shared_ptr<ExecutorDebugListener> listener = listener_.lock() )
listener->on_destroy();

{
Expand Down Expand Up @@ -2991,7 +2991,7 @@ void Executor::sethalt( bool halt )
halt_ = halt;

if ( halt )
if ( std::shared_ptr<ExecutorDebugListener> listener = _listener.lock() )
if ( std::shared_ptr<ExecutorDebugListener> listener = listener_.lock() )
listener->on_halt();

calcrunnable();
Expand Down Expand Up @@ -3281,11 +3281,11 @@ bool Executor::attach_debugger( std::weak_ptr<ExecutorDebugListener> listener )
// debugger is attached. This works for `os::Debugger()` but not for poldbg cmd_attach.
if ( !listener.expired() )
{
if ( !_listener.expired() )
if ( !listener_.expired() )
{
return false;
}
_listener = listener;
listener_ = listener;
}

setdebugging( true );
Expand All @@ -3295,7 +3295,7 @@ bool Executor::attach_debugger( std::weak_ptr<ExecutorDebugListener> listener )

void Executor::detach_debugger()
{
_listener.reset();
listener_.reset();
setdebugging( false );
debug_state_ = DEBUG_STATE_NONE;
sethalt( false );
Expand Down
4 changes: 1 addition & 3 deletions pol-core/bscript/executor.h
Expand Up @@ -418,15 +418,13 @@ class Executor
DEBUG_STATE_ATTACHING,
DEBUG_STATE_ATTACHED,
DEBUG_STATE_INS_TRACE,
DEBUG_STATE_INS_TRACE_BRK,
DEBUG_STATE_RUN,
DEBUG_STATE_BREAK_INTO,
DEBUG_STATE_STEP_INTO,
DEBUG_STATE_STEPPING_INTO,
DEBUG_STATE_STEP_OVER,
DEBUG_STATE_STEPPING_OVER,
DEBUG_STATE_STEP_OUT,
DEBUG_STATE_STEPPING_OUT,
};
DEBUG_STATE debug_state_;
std::set<unsigned> breakpoints_;
Expand All @@ -437,13 +435,13 @@ class Executor
size_t control;
} break_on_linechange_from_;
unsigned bp_skip_;
std::weak_ptr<ExecutorDebugListener> listener_;

BObjectImp* func_result_;

private: // not implemented
Executor( const Executor& exec );
Executor& operator=( const Executor& exec );
std::weak_ptr<ExecutorDebugListener> _listener;
#ifdef ESCRIPT_PROFILE
unsigned long GetTimeUs();
void profile_escript( std::string name, unsigned long profile_start );
Expand Down

0 comments on commit 994e2b9

Please sign in to comment.