#include <wxldtarg.h>
Classes | |
class | LuaThread |
Public Member Functions | |
wxLuaDebugTarget (const wxLuaState &wxlState, const wxString &serverName, int portNumber) | |
virtual | ~wxLuaDebugTarget () |
bool | Run () |
void | Stop () |
void | ThreadFunction () |
bool | HandleDebuggerCmd (int cmd) |
void | DisplayError (const wxString &errorMsg) |
Protected Types | |
enum | debugOperations { DEBUG_STEP, DEBUG_STEPOVER, DEBUG_STEPOUT, DEBUG_GO } |
Protected Member Functions | |
void | EnterLuaCriticalSection () |
void | LeaveLuaCriticalSection () |
void | ExitThread () |
wxString | CreateBreakPoint (const wxString &fileName, int lineNumber) const |
bool | AtBreakPoint (const wxString &fileName, int lineNumber) const |
bool | AddBreakPoint (const wxString &fileName, int lineNumber) |
bool | RemoveBreakPoint (const wxString &fileName, int lineNumber) |
bool | ClearAllBreakPoints () |
bool | Run (const wxString &fileName, const wxString &buffer) |
bool | Step () |
bool | StepOver () |
bool | StepOut () |
bool | Continue () |
bool | Break () |
bool | Reset () |
bool | EnumerateStack () |
bool | EnumerateStackEntry (int stackRef) |
bool | EnumerateTable (int tableRef, int nIndex, long itemNode) |
bool | EvaluateExpr (int exprRef, const wxString &strExpr) |
bool | NotifyBreak (const wxString &fileName, int lineNumber) |
bool | NotifyPrint (const wxString &errorMsg) |
bool | NotifyError (const wxString &errorMsg) |
bool | NotifyExit () |
bool | NotifyStackEnumeration (const wxLuaDebugData &debugData) |
bool | NotifyStackEntryEnumeration (int stackRef, const wxLuaDebugData &debugData) |
bool | NotifyTableEnumeration (long itemNode, const wxLuaDebugData &debugData) |
bool | NotifyEvaluateExpr (int exprRef, const wxString &strResult) |
bool | DebugHook (int event) |
bool | IsConnected (bool wait_for_connect=true) const |
Static Protected Member Functions | |
static wxLuaDebugTarget * | GetDebugTarget (lua_State *L) |
static void LUACALL | LuaDebugHook (lua_State *L, lua_Debug *debug) |
static int LUACALL | LuaPrint (lua_State *L) |
Protected Attributes | |
wxLuaState | m_wxlState |
int | m_port_number |
wxString | m_serverName |
wxSortedArrayString | m_breakPointList |
wxMutex | m_debugMutex |
wxCondition | m_debugCondition |
wxLuaSocket | m_clientSocket |
debugOperations | m_nextOperation |
bool | m_forceBreak |
bool | m_resetRequested |
bool | m_fConnected |
bool | m_fRunning |
bool | m_fStopped |
bool | m_fExiting |
bool | m_fErrorsSeen |
int | m_nFramesUntilBreak |
wxMutex | m_runMutex |
wxCondition | m_runCondition |
wxArrayString | m_bufferArray |
LuaThread * | m_pThread |
wxArrayInt | m_references |
wxCriticalSection | m_luaCriticalSection |
wxCriticalSection | m_breakPointListCriticalSection |
Definition at line 24 of file wxldtarg.h.
enum wxLuaDebugTarget::debugOperations [protected] |
Definition at line 56 of file wxldtarg.h.
wxLuaDebugTarget::wxLuaDebugTarget | ( | const wxLuaState & | wxlState, | |
const wxString & | serverName, | |||
int | portNumber | |||
) |
Definition at line 44 of file wxldtarg.cpp.
References EnterLuaCriticalSection(), wxLuaState::GetLuaState(), LuaDebugHook(), LuaPrint(), m_clientSocket, wxLuaSocketBase::m_name, and m_wxlState.
wxLuaDebugTarget::~wxLuaDebugTarget | ( | ) | [virtual] |
Definition at line 79 of file wxldtarg.cpp.
References LeaveLuaCriticalSection().
bool wxLuaDebugTarget::AddBreakPoint | ( | const wxString & | fileName, | |
int | lineNumber | |||
) | [protected] |
Definition at line 353 of file wxldtarg.cpp.
References CreateBreakPoint(), m_breakPointList, and m_breakPointListCriticalSection.
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::AtBreakPoint | ( | const wxString & | fileName, | |
int | lineNumber | |||
) | const [protected] |
Definition at line 347 of file wxldtarg.cpp.
References CreateBreakPoint(), m_breakPointList, and m_breakPointListCriticalSection.
Referenced by DebugHook().
bool wxLuaDebugTarget::Break | ( | ) | [protected] |
Definition at line 430 of file wxldtarg.cpp.
References m_forceBreak.
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::ClearAllBreakPoints | ( | ) | [protected] |
Definition at line 367 of file wxldtarg.cpp.
References m_breakPointList, and m_breakPointListCriticalSection.
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::Continue | ( | ) | [protected] |
Definition at line 418 of file wxldtarg.cpp.
References DEBUG_GO, m_debugCondition, m_fRunning, m_fStopped, m_nextOperation, and m_runCondition.
Referenced by HandleDebuggerCmd().
wxString wxLuaDebugTarget::CreateBreakPoint | ( | const wxString & | fileName, | |
int | lineNumber | |||
) | const [protected] |
Definition at line 342 of file wxldtarg.cpp.
Referenced by AddBreakPoint(), AtBreakPoint(), and RemoveBreakPoint().
bool wxLuaDebugTarget::DebugHook | ( | int | event | ) | [protected] |
Definition at line 656 of file wxldtarg.cpp.
References AtBreakPoint(), DEBUG_GO, DEBUG_STEP, DEBUG_STEPOVER, EnterLuaCriticalSection(), wxLuaState::GetLuaState(), INIT_LUA_DEBUG, LeaveLuaCriticalSection(), lua2wx(), m_debugCondition, m_fExiting, m_forceBreak, m_fStopped, m_nextOperation, m_nFramesUntilBreak, m_resetRequested, m_wxlState, and NotifyBreak().
Referenced by LuaDebugHook().
void wxLuaDebugTarget::DisplayError | ( | const wxString & | errorMsg | ) |
Definition at line 52 of file wxldtarg.h.
void wxLuaDebugTarget::EnterLuaCriticalSection | ( | ) | [protected] |
Definition at line 89 of file wxldtarg.h.
Referenced by DebugHook(), EnumerateStack(), EnumerateStackEntry(), EnumerateTable(), EvaluateExpr(), and wxLuaDebugTarget().
bool wxLuaDebugTarget::EnumerateStack | ( | ) | [protected] |
Definition at line 451 of file wxldtarg.cpp.
References EnterLuaCriticalSection(), wxLuaDebugData::EnumerateStack(), LeaveLuaCriticalSection(), m_wxlState, and NotifyStackEnumeration().
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::EnumerateStackEntry | ( | int | stackRef | ) | [protected] |
Definition at line 462 of file wxldtarg.cpp.
References EnterLuaCriticalSection(), wxLuaDebugData::EnumerateStackEntry(), LeaveLuaCriticalSection(), m_references, m_wxlState, and NotifyStackEntryEnumeration().
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::EnumerateTable | ( | int | tableRef, | |
int | nIndex, | |||
long | itemNode | |||
) | [protected] |
Definition at line 473 of file wxldtarg.cpp.
References EnterLuaCriticalSection(), wxLuaDebugData::EnumerateTable(), LeaveLuaCriticalSection(), m_references, m_wxlState, and NotifyTableEnumeration().
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::EvaluateExpr | ( | int | exprRef, | |
const wxString & | strExpr | |||
) | [protected] |
Definition at line 484 of file wxldtarg.cpp.
References EnterLuaCriticalSection(), wxLuaCharBuffer::GetData(), wxLuaState::GetLuaState(), wxLuaDebugData::GetTypeValue(), INIT_LUA_DEBUG, LeaveLuaCriticalSection(), wxLuaCharBuffer::Length(), lua2wx(), m_wxlState, NotifyEvaluateExpr(), wxlua_lreg_refs_key, wxlua_LUA_ERR_msg(), wxlua_pushwxString(), wxLuaState::wxluaR_GetRef(), wxLuaState::wxluaR_Ref(), wxLuaState::wxluaR_Unref(), and wxluaT_typename().
Referenced by HandleDebuggerCmd().
void wxLuaDebugTarget::ExitThread | ( | ) | [protected] |
wxLuaDebugTarget * wxLuaDebugTarget::GetDebugTarget | ( | lua_State * | L | ) | [static, protected] |
Definition at line 744 of file wxldtarg.cpp.
Referenced by LuaDebugHook(), and LuaPrint().
bool wxLuaDebugTarget::HandleDebuggerCmd | ( | int | cmd | ) |
Definition at line 193 of file wxldtarg.cpp.
References AddBreakPoint(), Break(), ClearAllBreakPoints(), Continue(), EnumerateStack(), EnumerateStackEntry(), EnumerateTable(), EvaluateExpr(), m_clientSocket, m_forceBreak, m_references, m_wxlState, wxLuaSocketBase::ReadInt32(), wxLuaSocketBase::ReadLong(), wxLuaSocketBase::ReadString(), RemoveBreakPoint(), Reset(), Run(), Step(), StepOut(), StepOver(), wxlua_lreg_debug_refs_key, wxLuaState::wxluaR_Unref(), wxLUASOCKET_DEBUGGER_CMD_ADD_BREAKPOINT, wxLUASOCKET_DEBUGGER_CMD_CLEAR_ALL_BREAKPOINTS, wxLUASOCKET_DEBUGGER_CMD_CLEAR_DEBUG_REFERENCES, wxLUASOCKET_DEBUGGER_CMD_DEBUG_BREAK, wxLUASOCKET_DEBUGGER_CMD_DEBUG_CONTINUE, wxLUASOCKET_DEBUGGER_CMD_DEBUG_STEP, wxLUASOCKET_DEBUGGER_CMD_DEBUG_STEPOUT, wxLUASOCKET_DEBUGGER_CMD_DEBUG_STEPOVER, wxLUASOCKET_DEBUGGER_CMD_DISABLE_BREAKPOINT, wxLUASOCKET_DEBUGGER_CMD_ENABLE_BREAKPOINT, wxLUASOCKET_DEBUGGER_CMD_ENUMERATE_STACK, wxLUASOCKET_DEBUGGER_CMD_ENUMERATE_STACK_ENTRY, wxLUASOCKET_DEBUGGER_CMD_ENUMERATE_TABLE_REF, wxLUASOCKET_DEBUGGER_CMD_EVALUATE_EXPR, wxLUASOCKET_DEBUGGER_CMD_NONE, wxLUASOCKET_DEBUGGER_CMD_REMOVE_BREAKPOINT, wxLUASOCKET_DEBUGGER_CMD_RESET, and wxLUASOCKET_DEBUGGER_CMD_RUN_BUFFER.
Referenced by ThreadFunction().
bool wxLuaDebugTarget::IsConnected | ( | bool | wait_for_connect = true |
) | const [protected] |
Definition at line 87 of file wxldtarg.cpp.
References m_fConnected, WXLUASOCKET_CONNECT_TIMEOUT, and wxMilliSleep.
Referenced by NotifyBreak(), NotifyError(), NotifyEvaluateExpr(), NotifyExit(), NotifyPrint(), NotifyStackEntryEnumeration(), NotifyStackEnumeration(), NotifyTableEnumeration(), and Run().
void wxLuaDebugTarget::LeaveLuaCriticalSection | ( | ) | [protected] |
Definition at line 90 of file wxldtarg.h.
Referenced by DebugHook(), EnumerateStack(), EnumerateStackEntry(), EnumerateTable(), EvaluateExpr(), and ~wxLuaDebugTarget().
void LUACALL wxLuaDebugTarget::LuaDebugHook | ( | lua_State * | L, | |
lua_Debug * | debug | |||
) | [static, protected] |
Definition at line 760 of file wxldtarg.cpp.
References DebugHook(), and GetDebugTarget().
Referenced by wxLuaDebugTarget().
int LUACALL wxLuaDebugTarget::LuaPrint | ( | lua_State * | L | ) | [static, protected] |
Definition at line 768 of file wxldtarg.cpp.
References GetDebugTarget(), lua2wx(), and NotifyPrint().
Referenced by wxLuaDebugTarget().
bool wxLuaDebugTarget::NotifyBreak | ( | const wxString & | fileName, | |
int | lineNumber | |||
) | [protected] |
Definition at line 584 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, m_resetRequested, wxLuaSocketBase::WriteCmd(), wxLuaSocketBase::WriteInt32(), wxLuaSocketBase::WriteString(), and wxLUASOCKET_DEBUGGEE_EVENT_BREAK.
Referenced by DebugHook().
bool wxLuaDebugTarget::NotifyError | ( | const wxString & | errorMsg | ) | [protected] |
Definition at line 599 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, m_fErrorsSeen, wxLuaSocketBase::WriteCmd(), wxLuaSocketBase::WriteString(), and wxLUASOCKET_DEBUGGEE_EVENT_ERROR.
Referenced by Run().
bool wxLuaDebugTarget::NotifyEvaluateExpr | ( | int | exprRef, | |
const wxString & | strResult | |||
) | [protected] |
Definition at line 647 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, wxLuaSocketBase::WriteCmd(), wxLuaSocketBase::WriteInt32(), wxLuaSocketBase::WriteString(), and wxLUASOCKET_DEBUGGEE_EVENT_EVALUATE_EXPR.
Referenced by EvaluateExpr().
bool wxLuaDebugTarget::NotifyExit | ( | ) | [protected] |
Definition at line 614 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, wxLuaSocketBase::WriteCmd(), and wxLUASOCKET_DEBUGGEE_EVENT_EXIT.
bool wxLuaDebugTarget::NotifyPrint | ( | const wxString & | errorMsg | ) | [protected] |
Definition at line 592 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, wxLuaSocketBase::WriteCmd(), wxLuaSocketBase::WriteString(), and wxLUASOCKET_DEBUGGEE_EVENT_PRINT.
Referenced by LuaPrint().
bool wxLuaDebugTarget::NotifyStackEntryEnumeration | ( | int | stackRef, | |
const wxLuaDebugData & | debugData | |||
) | [protected] |
Definition at line 629 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, wxLuaSocketBase::WriteCmd(), wxLuaSocketBase::WriteDebugData(), wxLuaSocketBase::WriteInt32(), and wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENTRY_ENUM.
Referenced by EnumerateStackEntry().
bool wxLuaDebugTarget::NotifyStackEnumeration | ( | const wxLuaDebugData & | debugData | ) | [protected] |
Definition at line 622 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, wxLuaSocketBase::WriteCmd(), wxLuaSocketBase::WriteDebugData(), and wxLUASOCKET_DEBUGGEE_EVENT_STACK_ENUM.
Referenced by EnumerateStack().
bool wxLuaDebugTarget::NotifyTableEnumeration | ( | long | itemNode, | |
const wxLuaDebugData & | debugData | |||
) | [protected] |
Definition at line 638 of file wxldtarg.cpp.
References IsConnected(), m_clientSocket, wxLuaSocketBase::WriteCmd(), wxLuaSocketBase::WriteDebugData(), wxLuaSocketBase::WriteLong(), and wxLUASOCKET_DEBUGGEE_EVENT_TABLE_ENUM.
Referenced by EnumerateTable().
bool wxLuaDebugTarget::RemoveBreakPoint | ( | const wxString & | fileName, | |
int | lineNumber | |||
) | [protected] |
Definition at line 360 of file wxldtarg.cpp.
References CreateBreakPoint(), m_breakPointList, and m_breakPointListCriticalSection.
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::Reset | ( | ) | [protected] |
Definition at line 436 of file wxldtarg.cpp.
References m_debugCondition, m_forceBreak, m_fRunning, m_fStopped, m_resetRequested, m_runCondition, and NotifyExit().
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::Run | ( | const wxString & | fileName, | |
const wxString & | buffer | |||
) | [protected] |
Definition at line 374 of file wxldtarg.cpp.
References m_bufferArray.
bool wxLuaDebugTarget::Run | ( | ) |
Definition at line 101 of file wxldtarg.cpp.
References IsConnected(), wxLuaCharBuffer::Length(), wxLuaState::LuaDoBuffer(), m_bufferArray, m_fErrorsSeen, m_fRunning, m_pThread, m_runCondition, m_wxlState, NotifyError(), wx2lua(), and wxlua_LUA_ERR_msg().
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::Step | ( | ) | [protected] |
Definition at line 380 of file wxldtarg.cpp.
References DEBUG_STEP, m_debugCondition, m_fRunning, m_fStopped, m_nextOperation, and m_runCondition.
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::StepOut | ( | ) | [protected] |
Definition at line 405 of file wxldtarg.cpp.
References DEBUG_STEPOVER, m_debugCondition, m_fRunning, m_fStopped, m_nextOperation, m_nFramesUntilBreak, and m_runCondition.
Referenced by HandleDebuggerCmd().
bool wxLuaDebugTarget::StepOver | ( | ) | [protected] |
Definition at line 392 of file wxldtarg.cpp.
References DEBUG_STEPOVER, m_debugCondition, m_fRunning, m_fStopped, m_nextOperation, m_nFramesUntilBreak, and m_runCondition.
Referenced by HandleDebuggerCmd().
void wxLuaDebugTarget::Stop | ( | ) |
Definition at line 153 of file wxldtarg.cpp.
References wxLuaCSocket::Close(), m_clientSocket, m_fConnected, m_pThread, NotifyExit(), SD_BOTH, wxLuaCSocket::Shutdown(), and wxMilliSleep.
void wxLuaDebugTarget::ThreadFunction | ( | ) |
Definition at line 168 of file wxldtarg.cpp.
References wxLuaCSocket::Connect(), HandleDebuggerCmd(), m_clientSocket, m_fConnected, m_fExiting, m_port_number, m_pThread, m_resetRequested, m_serverName, and wxLuaSocketBase::ReadCmd().
Referenced by wxLuaDebugTarget::LuaThread::Entry().
wxSortedArrayString wxLuaDebugTarget::m_breakPointList [protected] |
Definition at line 67 of file wxldtarg.h.
Referenced by AddBreakPoint(), AtBreakPoint(), ClearAllBreakPoints(), and RemoveBreakPoint().
wxCriticalSection wxLuaDebugTarget::m_breakPointListCriticalSection [mutable, protected] |
Definition at line 86 of file wxldtarg.h.
Referenced by AddBreakPoint(), AtBreakPoint(), ClearAllBreakPoints(), and RemoveBreakPoint().
wxArrayString wxLuaDebugTarget::m_bufferArray [protected] |
Definition at line 82 of file wxldtarg.h.
Referenced by Run().
wxLuaSocket wxLuaDebugTarget::m_clientSocket [protected] |
Definition at line 70 of file wxldtarg.h.
Referenced by HandleDebuggerCmd(), NotifyBreak(), NotifyError(), NotifyEvaluateExpr(), NotifyExit(), NotifyPrint(), NotifyStackEntryEnumeration(), NotifyStackEnumeration(), NotifyTableEnumeration(), Stop(), ThreadFunction(), and wxLuaDebugTarget().
wxCondition wxLuaDebugTarget::m_debugCondition [protected] |
Definition at line 69 of file wxldtarg.h.
Referenced by Continue(), DebugHook(), Reset(), Step(), StepOut(), and StepOver().
wxMutex wxLuaDebugTarget::m_debugMutex [protected] |
Definition at line 68 of file wxldtarg.h.
bool wxLuaDebugTarget::m_fConnected [protected] |
Definition at line 74 of file wxldtarg.h.
Referenced by IsConnected(), Stop(), and ThreadFunction().
bool wxLuaDebugTarget::m_fErrorsSeen [protected] |
Definition at line 78 of file wxldtarg.h.
Referenced by NotifyError(), and Run().
bool wxLuaDebugTarget::m_fExiting [protected] |
Definition at line 77 of file wxldtarg.h.
Referenced by DebugHook(), and ThreadFunction().
bool wxLuaDebugTarget::m_forceBreak [protected] |
Definition at line 72 of file wxldtarg.h.
Referenced by Break(), DebugHook(), HandleDebuggerCmd(), and Reset().
bool wxLuaDebugTarget::m_fRunning [protected] |
Definition at line 75 of file wxldtarg.h.
Referenced by Continue(), Reset(), Run(), Step(), StepOut(), and StepOver().
bool wxLuaDebugTarget::m_fStopped [protected] |
Definition at line 76 of file wxldtarg.h.
Referenced by Continue(), DebugHook(), Reset(), Step(), StepOut(), and StepOver().
wxCriticalSection wxLuaDebugTarget::m_luaCriticalSection [protected] |
Definition at line 85 of file wxldtarg.h.
debugOperations wxLuaDebugTarget::m_nextOperation [protected] |
Definition at line 71 of file wxldtarg.h.
Referenced by Continue(), DebugHook(), Step(), StepOut(), and StepOver().
int wxLuaDebugTarget::m_nFramesUntilBreak [protected] |
Definition at line 79 of file wxldtarg.h.
Referenced by DebugHook(), StepOut(), and StepOver().
int wxLuaDebugTarget::m_port_number [protected] |
Definition at line 65 of file wxldtarg.h.
Referenced by ThreadFunction().
LuaThread* wxLuaDebugTarget::m_pThread [protected] |
Definition at line 83 of file wxldtarg.h.
Referenced by Run(), Stop(), and ThreadFunction().
wxArrayInt wxLuaDebugTarget::m_references [protected] |
Definition at line 84 of file wxldtarg.h.
Referenced by EnumerateStackEntry(), EnumerateTable(), and HandleDebuggerCmd().
bool wxLuaDebugTarget::m_resetRequested [protected] |
Definition at line 73 of file wxldtarg.h.
Referenced by DebugHook(), NotifyBreak(), Reset(), and ThreadFunction().
wxCondition wxLuaDebugTarget::m_runCondition [protected] |
Definition at line 81 of file wxldtarg.h.
Referenced by Continue(), Reset(), Run(), Step(), StepOut(), and StepOver().
wxMutex wxLuaDebugTarget::m_runMutex [protected] |
Definition at line 80 of file wxldtarg.h.
wxString wxLuaDebugTarget::m_serverName [protected] |
Definition at line 66 of file wxldtarg.h.
Referenced by ThreadFunction().
wxLuaState wxLuaDebugTarget::m_wxlState [protected] |
Definition at line 64 of file wxldtarg.h.
Referenced by DebugHook(), EnumerateStack(), EnumerateStackEntry(), EnumerateTable(), EvaluateExpr(), HandleDebuggerCmd(), Run(), and wxLuaDebugTarget().