コード例 #1
0
void CodeLiteLLDBApp::EvalExpression(const LLDBCommand& command)
{
    wxPrintf("codelite-lldb: evaluating expression '%s'\n", command.GetExpression());

    if(CanInteract()) {
        lldb::SBExpressionOptions options;
        lldb::SBValue value = m_target.EvaluateExpression(command.GetExpression().mb_str(wxConvUTF8).data(), options);
        if(value.IsValid()) {

            LLDBReply reply;
            reply.SetReplyType(kReplyTypeExprEvaluated);
            reply.SetExpression(command.GetExpression());

            LLDBVariable::Vect_t vars;
            LLDBVariable::Ptr_t var(new LLDBVariable(value));
            vars.push_back(var);
            reply.SetVariables(vars);
            VariableWrapper wrapper;
            wrapper.value = value;
            // Cache the expanded variable (we will need it later for tooltip expansion
            m_variables.insert(std::make_pair(value.GetID(), wrapper));

            SendReply(reply);
        }
    }
}
コード例 #2
0
void CodeLiteLLDBApp::EvalExpression(const LLDBCommand& command)
{
    wxPrintf("codelite-lldb: evaluating expression '%s'\n", command.GetExpression());

    if(CanInteract()) {
        // Evaluate the expression based on the current frame
        wxString expression = command.GetExpression();
        expression.Trim().Trim(false);
        lldb::SBValue value = m_target.GetProcess().GetSelectedThread().GetSelectedFrame().GetValueForVariablePath(
            expression.mb_str(wxConvUTF8).data());
        if(value.IsValid()) {

            LLDBReply reply;
            reply.SetReplyType(kReplyTypeExprEvaluated);
            reply.SetExpression(command.GetExpression());

            LLDBVariable::Vect_t vars;
            LLDBVariable::Ptr_t var(new LLDBVariable(value));
            vars.push_back(var);
            reply.SetVariables(vars);
            VariableWrapper wrapper;
            wrapper.value = value;
            // Cache the expanded variable (we will need it later for tooltip expansion
            m_variables.insert(std::make_pair(value.GetID(), wrapper));

            SendReply(reply);
        }
    }
}
コード例 #3
0
void CodeLiteLLDBApp::ExecuteInterperterCommand(const LLDBCommand& command)
{
    
    lldb::SBCommandReturnObject ret;
    std::string c_command = command.GetExpression().mb_str(wxConvUTF8).data();
    wxPrintf("codelite-lldb: ExecuteInterperterCommand: '%s'\n", c_command.c_str());
    m_debugger.GetCommandInterpreter().HandleCommand(c_command.c_str(), ret);
    
    if(ret.GetOutput()) {
        LLDBReply reply;
        reply.SetText(ret.GetOutput());
        reply.SetReplyType(kReplyTypeInterperterReply);
        SendReply(reply);
    } else if(ret.GetError()) {
        LLDBReply reply;
        reply.SetText(ret.GetError());
        reply.SetReplyType(kReplyTypeInterperterReply);
        SendReply(reply);
    }
}
コード例 #4
0
void CodeLiteLLDBApp::AddWatch(const LLDBCommand& command)
{
    wxString expr = command.GetExpression();
    wxPrintf("codelite-lldb: adding watch '%s'\n", expr);
    m_watches.Add(command.GetExpression());
}