Example #1
0
void CodeLiteLLDBApp::LocalVariables(const LLDBCommand& command)
{
    wxUnusedVar(command);
    LLDBVariable::Vect_t locals;
    m_variables.clear();

    wxPrintf("codelite-lldb: fetching local variables for selected frame\n");
    lldb::SBFrame frame = m_target.GetProcess().GetSelectedThread().GetSelectedFrame();
    if(!frame.IsValid()) {
        NotifyLocals(locals);
        return;
    }

    // get list of locals
    lldb::SBValueList args = frame.GetVariables(true, true, false, true);
    for(size_t i = 0; i < args.GetSize(); ++i) {
        lldb::SBValue value = args.GetValueAtIndex(i);
        if(value.IsValid()) {
            LLDBVariable::Ptr_t var(new LLDBVariable(value));
            VariableWrapper wrapper;
            wrapper.value = value;
            m_variables.insert(std::make_pair(value.GetID(), wrapper));
            locals.push_back(var);
        }
    }

    // next, add the watches
    for(size_t i = 0; i < m_watches.GetCount(); ++i) {
        lldb::SBValue value = frame.EvaluateExpression(m_watches.Item(i).mb_str(wxConvUTF8).data());
        if(value.IsValid()) {
            LLDBVariable::Ptr_t var(new LLDBVariable(value));
            var->SetIsWatch(true);
            // override the name with the actual expression that we want to watch
            var->SetName(m_watches.Item(i));

            // Keep the info about this watch
            VariableWrapper wrapper;
            wrapper.value = value;
            wrapper.isWatch = true;
            wrapper.expression = m_watches.Item(i);
            m_variables.insert(std::make_pair(value.GetID(), wrapper));
            locals.push_back(var);
        }
    }
    NotifyLocals(locals);
}
Example #2
0
void CodeLiteLLDBApp::LocalVariables(const LLDBCommand& command)
{
    wxUnusedVar( command );
    LLDBVariable::Vect_t locals;
    
    wxPrintf("codelite-lldb: fetching local variables for selected frame\n");
    lldb::SBFrame frame = m_target.GetProcess().GetSelectedThread().GetSelectedFrame();
    if ( !frame.IsValid() ) {
        NotifyLocals(locals);
        return;
    }

    // get list of locals
    lldb::SBValueList args = frame.GetVariables(true, true, false, true);
    for(size_t i=0; i<args.GetSize(); ++i) {
        lldb::SBValue value = args.GetValueAtIndex(i);
        if ( value.IsValid() ) {
            LLDBVariable::Ptr_t var( new LLDBVariable(value) );
            m_variables.insert( std::make_pair(value.GetID(), value) );
            locals.push_back( var );
        }
    }
    NotifyLocals( locals );
}