Esempio n. 1
0
bool wxLuaDebuggerBase::EnumerateStackEntry(int stackEntry)
{
    return CheckSocketConnected(true, wxT("Debugger EnumerateStackEntry")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_ENUMERATE_STACK_ENTRY) &&
           GetSocketBase()->WriteInt32(stackEntry),
           wxT("Debugger EnumerateStackEntry"));
}
Esempio n. 2
0
bool wxLuaDebuggerBase::CheckSocketConnected(bool send_event, const wxString& msg)
{
    if (GetSocketBase() == NULL)
    {
        if (send_event)
        {
            wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED, this);
            debugEvent.SetMessage(wxT("Debugger socket not created. ") + msg);
            SendEvent(debugEvent);
        }

        return false;
    }
    else if (!GetSocketBase()->IsConnected())
    {
        if (send_event)
        {
            wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_DEBUGGEE_DISCONNECTED, this);
            debugEvent.SetMessage(wxT("Debugger socket not connected. ") + msg);
            SendEvent(debugEvent);
        }

        return false;
    }

    return true;
}
Esempio n. 3
0
bool wxLuaDebuggerBase::EvaluateExpr(int exprRef, const wxString &strExpression)
{
    return CheckSocketConnected(true, wxT("Debugger EvaluateExpr")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_EVALUATE_EXPR) &&
           GetSocketBase()->WriteInt32(exprRef) &&
           GetSocketBase()->WriteString(strExpression),
           wxT("Debugger EvaluateExpr"));
}
Esempio n. 4
0
bool wxLuaDebuggerBase::Run(const wxString &fileName, const wxString &buffer)
{
    return CheckSocketConnected(true, wxT("Debugger Run")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_RUN_BUFFER) &&
           GetSocketBase()->WriteString(fileName) &&
           GetSocketBase()->WriteString(buffer),
           wxT("Debugger Run"));
}
Esempio n. 5
0
bool wxLuaDebuggerBase::EnableBreakPoint(const wxString &fileName, int lineNumber)
{
    return CheckSocketConnected(true, wxT("Debugger EnableBreakPoint")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_ENABLE_BREAKPOINT) &&
           GetSocketBase()->WriteString(fileName) &&
           GetSocketBase()->WriteInt32(lineNumber),
           wxT("Debugger EnableBreakPoint"));
}
Esempio n. 6
0
bool wxLuaDebuggerBase::EnumerateTable(int tableRef, int nIndex, long nItemNode)
{
    return CheckSocketConnected(true, wxT("Debugger EnumerateTable")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_ENUMERATE_TABLE_REF) &&
           GetSocketBase()->WriteInt32(tableRef) &&
           GetSocketBase()->WriteInt32(nIndex) &&
           GetSocketBase()->WriteLong(nItemNode),
           wxT("Debugger EnumerateTable"));
}
Esempio n. 7
0
// This function shouldn't modify any internal variables without using a
// critical section since the wxLuaDebuggerCServer calls it from the thread.
int wxLuaDebuggerBase::HandleDebuggeeEvent(int event_type)
{
    wxCHECK_MSG(GetSocketBase(), event_type, wxT("Invalid socket"));

    //wxLuaDebuggerEvent d(wxEVT_WXLUA_DEBUGGER_PRINT, this);
    //d.SetMessage(wxT("wxLuaDebugger : ") + wxLuaSocketCmdEventMsg(event_type));
    //SendEvent(d);

    switch (event_type)
    {
        case wxLUA_DEBUGGEE_EVENT_BREAK:
        {
            wxString fileName;
            wxInt32  lineNumber = 0;

            if (CheckSocketRead(
                GetSocketBase()->ReadString(fileName) &&
                GetSocketBase()->ReadInt32(lineNumber),
                wxT("Debugger wxLUA_DEBUGGEE_EVENT_BREAK")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_BREAK, this, lineNumber, fileName);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUA_DEBUGGEE_EVENT_PRINT:
        {
            wxString strMessage;

            if (CheckSocketRead(
                GetSocketBase()->ReadString(strMessage),
                wxT("Debugger wxLUA_DEBUGGEE_EVENT_PRINT")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_PRINT, this);
                debugEvent.SetMessage(strMessage);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUA_DEBUGGEE_EVENT_ERROR:
        {
            wxString strMessage;

            if (CheckSocketRead(
                GetSocketBase()->ReadString(strMessage),
                wxT("Debugger wxLUA_DEBUGGEE_EVENT_ERROR")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_ERROR, this);
                debugEvent.SetMessage(strMessage);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUA_DEBUGGEE_EVENT_EXIT:
        {
            wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_EXIT, this);
            wxPostEvent(this, debugEvent);
            break;
        }
        case wxLUA_DEBUGGEE_EVENT_STACK_ENUM:
        {
            wxLuaDebugData debugData(true);

            if (CheckSocketRead(
                GetSocketBase()->ReadDebugData(debugData),
                wxT("Debugger wxLUA_DEBUGGEE_EVENT_STACK_ENUM")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_STACK_ENUM, this);
                debugEvent.SetDebugData(-1, debugData);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUA_DEBUGGEE_EVENT_STACK_ENTRY_ENUM:
        {
            wxInt32 stackRef = 0;
            wxLuaDebugData debugData(true);

            if (CheckSocketRead(
                GetSocketBase()->ReadInt32(stackRef) &&
                GetSocketBase()->ReadDebugData(debugData),
                wxT("Debugger wxLUA_DEBUGGEE_EVENT_STACK_ENTRY_ENUM")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_STACK_ENTRY_ENUM, this);
                debugEvent.SetDebugData(stackRef, debugData);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUA_DEBUGGEE_EVENT_TABLE_ENUM:
        {
            long itemNode = 0;
            wxLuaDebugData debugData(true);

            if (CheckSocketRead(
                GetSocketBase()->ReadLong(itemNode) &&
                GetSocketBase()->ReadDebugData(debugData),
                wxT("Debugger wxLUA_DEBUGGEE_EVENT_TABLE_ENUM")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_TABLE_ENUM, this);
                debugEvent.SetDebugData(itemNode, debugData);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        case wxLUA_DEBUGGEE_EVENT_EVALUATE_EXPR:
        {
            wxInt32 exprRef = 0;
            wxString strResult;

            if (CheckSocketRead(
                GetSocketBase()->ReadInt32(exprRef) &&
                GetSocketBase()->ReadString(strResult),
                wxT("Debugger wxLUA_DEBUGGEE_EVENT_EVALUATE_EXPR")))
            {
                wxLuaDebuggerEvent debugEvent(wxEVT_WXLUA_DEBUGGER_EVALUATE_EXPR, this);
                debugEvent.SetMessage(strResult);
                debugEvent.SetDebugData(exprRef);
                SendEvent(debugEvent);
            }
            else return -1;

            break;
        }
        default : return -1; // don't know this event?
    }

    return event_type;
}
Esempio n. 8
0
bool wxLuaDebuggerBase::ClearDebugReferences()
{
    return CheckSocketConnected(true, wxT("Debugger ClearDebugReferences")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_CLEAR_DEBUG_REFERENCES),
           wxT("Debugger ClearDebugReferences"));
}
Esempio n. 9
0
bool wxLuaDebuggerBase::EnumerateStack()
{
    return CheckSocketConnected(true, wxT("Debugger EnumerateStack")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_ENUMERATE_STACK),
           wxT("Debugger EnumerateStack"));
}
Esempio n. 10
0
bool wxLuaDebuggerBase::Reset()
{
    return CheckSocketConnected(true, wxT("Debugger Reset")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_RESET),
           wxT("Debugger Reset"));
}
Esempio n. 11
0
bool wxLuaDebuggerBase::Break()
{
    return CheckSocketConnected(true, wxT("Debugger Break")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_DEBUG_BREAK),
           wxT("Debugger Break"));
}
Esempio n. 12
0
bool wxLuaDebuggerBase::Continue()
{
    return CheckSocketConnected(true, wxT("Debugger Continue")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_DEBUG_CONTINUE),
           wxT("Debugger Continue"));
}
Esempio n. 13
0
bool wxLuaDebuggerBase::StepOut()
{
    return CheckSocketConnected(true, wxT("Debugger StepOut")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_DEBUG_STEPOUT),
           wxT("Debugger StepOut"));
}
Esempio n. 14
0
bool wxLuaDebuggerBase::ClearAllBreakPoints()
{
    return CheckSocketConnected(true, wxT("Debugger ClearAllBreakPoints")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUA_DEBUGGER_CMD_CLEAR_ALL_BREAKPOINTS),
           wxT("Debugger ClearAllBreakPoints"));
}
Esempio n. 15
0
bool wxLuaDebuggerBase::StepOver()
{
    return CheckSocketConnected(true, wxT("Debugger StepOver")) && CheckSocketWrite(
           GetSocketBase()->WriteCmd(wxLUASOCKET_DEBUGGER_CMD_DEBUG_STEPOVER),
           wxT("Debugger StepOver"));
}