コード例 #1
0
ファイル: NodeJSDebugger.cpp プロジェクト: lpc1996/codelite
void NodeJSDebugger::OnEvalExpression(clDebugEvent& event)
{
    event.Skip();

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "evaluate");
    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);
    args.addProperty("expression", event.GetString());

    // Write the command
    m_socket->WriteRequest(request, new NodeJSEvaluateExprHandler(event.GetString(), kNodeJSContextConsole));
}
コード例 #2
0
void NodeJSDebuggerPane::OnConsoleLog(clDebugEvent& event)
{
    event.Skip();
    m_consoleLog->AppendText(event.GetString());
    ::clRecalculateSTCHScrollBar(m_consoleLog);
    m_consoleLog->ScrollToEnd();
}
コード例 #3
0
ファイル: LLDBPlugin.cpp プロジェクト: eranif/codelite
void LLDBPlugin::OnDebugTooltip(clDebugEvent& event)
{
    CHECK_IS_LLDB_SESSION();

    // FIXME: use the function ::GetCppExpressionFromPos() to get a better expression
    wxString expression = event.GetString();
    if(expression.IsEmpty()) return;

    m_connector.EvaluateExpression(expression);
}
コード例 #4
0
ファイル: XDebugManager.cpp プロジェクト: gahr/codelite
void XDebugManager::OnTooltip(clDebugEvent& e)
{
    CHECK_XDEBUG_SESSION_ACTIVE(e);
    
    wxString expression = e.GetString();
    if ( expression.IsEmpty() )
        return;

    expression.Prepend("print_r(").Append(", true)");
    SendEvalCommand( expression, XDebugEvalCmdHandler::kEvalForTooltip );
}
コード例 #5
0
void NodeJSDebuggerPane::OnUpdateCallstack(clDebugEvent& event)
{
    event.Skip();
    wxWindowUpdateLocker locker(m_dataviewLocals);
    ClearCallstack();

    JSONRoot root(event.GetString());
    JSONElement frames = root.toElement().namedObject("body").namedObject("frames");
    JSONElement refs = root.toElement().namedObject("refs");

    // Load the handlers into a map
    m_handles.clear();
    ParseRefsArray(refs);

    int count = frames.arraySize();
    for(int i = 0; i < count; ++i) {
        JSONElement frame = frames.arrayItem(i);
        int index = frame.namedObject("index").toInt();
        int funcRef = frame.namedObject("func").namedObject("ref").toInt();
        int fileRef = frame.namedObject("script").namedObject("ref").toInt();
        int line = frame.namedObject("line").toInt() + 1;

        wxVector<wxVariant> cols;
        cols.push_back(wxString() << index);
        wxString file, func;
        if(m_handles.count(funcRef)) {
            func = m_handles.find(funcRef)->second.value;
        }
        if(m_handles.count(funcRef)) {
            file = m_handles.find(fileRef)->second.value;
        }
        cols.push_back(func);
        cols.push_back(file);
        cols.push_back(wxString() << line);

        FrameData* cd = new FrameData();
        cd->file = file;
        cd->line = line;
        cd->function = func;
        cd->index = i;
        m_dvListCtrlCallstack->AppendItem(cols, (wxUIntPtr)cd);

        if(i == 0) {
            // Notify the debugger to use frame #0 for the indicator
            clDebugEvent event(wxEVT_NODEJS_DEBUGGER_MARK_LINE);
            event.SetLineNumber(line);
            event.SetFileName(file);
            EventNotifier::Get()->AddPendingEvent(event);
            BuildLocals(frame);
            BuildArguments(frame);
        }
    }
}
コード例 #6
0
void NodeJSDebuggerPane::OnExpressionEvaluated(clDebugEvent& event)
{
    event.Skip();
    wxString message;
    message << "eval(" << m_textCtrlExpression->GetValue() << "):\n" << event.GetString();
    
    wxString currentText = m_consoleLog->GetValue();
    if(!currentText.EndsWith("\n")) {
        message.Prepend("\n");
    }
    if(!message.EndsWith("\n")) {
        message << "\n";
    }
    m_consoleLog->AppendText(message);
    m_consoleLog->ScrollToEnd();
    
    // Restore the focus to the text control
    m_textCtrlExpression->CallAfter(&wxTextCtrl::SetFocus);
}
コード例 #7
0
void NodeJSDebuggerPane::OnFrameSelected(clDebugEvent& event)
{
    event.Skip();
    wxWindowUpdateLocker locker(m_dataviewLocals);
    m_dataviewLocalsModel->Clear();
    m_dataviewLocals->Enable(true);

    JSONRoot root(event.GetString());
    JSONElement json = root.toElement();
    JSONElement frame = json.namedObject("body");
    JSONElement refs = json.namedObject("refs");

    // Load the handlers into a map
    m_handles.clear();
    ParseRefsArray(refs);

    int index = frame.namedObject("index").toInt();
    int funcRef = frame.namedObject("func").namedObject("ref").toInt();
    int fileRef = frame.namedObject("script").namedObject("ref").toInt();
    int line = frame.namedObject("line").toInt() + 1;

    wxVector<wxVariant> cols;
    cols.push_back(wxString() << index);
    wxString file, func;
    if(m_handles.count(funcRef)) {
        func = m_handles.find(funcRef)->second.value;
    }
    if(m_handles.count(funcRef)) {
        file = m_handles.find(fileRef)->second.value;
    }
    cols.push_back(func);
    cols.push_back(file);
    cols.push_back(wxString() << line);

    // Notify the debugger to use frame #0 for the indicator
    clDebugEvent eventHighlight(wxEVT_NODEJS_DEBUGGER_MARK_LINE);
    eventHighlight.SetLineNumber(line);
    eventHighlight.SetFileName(file);
    EventNotifier::Get()->AddPendingEvent(eventHighlight);
    BuildLocals(frame);
    BuildArguments(frame);
}
コード例 #8
0
void NodeJSDebugger::OnTooltip(clDebugEvent& event)
{
    event.Skip();
    CHECK_RUNNING();
    event.Skip(false);

    CHECK_PTR_RET(clGetManager()->GetActiveEditor());

    wxString selection = event.GetString();
    CHECK_COND_RET(!selection.IsEmpty());

    // Build the request
    JSONElement request = JSONElement::createObject();
    request.addProperty("type", "request");
    request.addProperty("command", "evaluate");
    JSONElement args = JSONElement::createObject("arguments");
    request.append(args);
    args.addProperty("expression", selection);

    // Write the command
    m_socket->WriteRequest(request, new NodeJSEvaluateExprHandler(selection));
}