Пример #1
0
bool
SBDebugger::DeleteTarget (lldb::SBTarget &target)
{
    bool result = false;
    if (m_opaque_sp)
    {
        TargetSP target_sp(target.GetSP());
        if (target_sp)
        {
            // No need to lock, the target list is thread safe
            result = m_opaque_sp->GetTargetList().DeleteTarget (target_sp);
            target_sp->Destroy();
            target.Clear();
            const bool mandatory = true;
            ModuleList::RemoveOrphanSharedModules(mandatory);
        }
    }

    LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
    if (log)
    {
        log->Printf ("SBDebugger(%p)::DeleteTarget (SBTarget(%p)) => %i", m_opaque_sp.get(), target.m_opaque_sp.get(), result);
    }

    return result;
}
Пример #2
0
uint32_t
SBDebugger::GetIndexOfTarget (lldb::SBTarget target)
{

    lldb::TargetSP target_sp = target.GetSP();
    if (!target_sp)
        return UINT32_MAX;

    if (!m_opaque_sp)
        return UINT32_MAX;

    return m_opaque_sp->GetTargetList().GetIndexOfTarget (target.GetSP());
}
Пример #3
0
void
SBAddress::SetLoadAddress (lldb::addr_t load_addr, lldb::SBTarget &target)
{
    // Create the address object if we don't already have one
    ref();
    if (target.IsValid())
        *this = target.ResolveLoadAddress(load_addr);
    else
        m_opaque_ap->Clear();

    // Check if we weren't were able to resolve a section offset address.
    // If we weren't it is ok, the load address might be a location on the
    // stack or heap, so we should just have an address with no section and
    // a valid offset
    if (!m_opaque_ap->IsValid())
        m_opaque_ap->SetOffset(load_addr);
}
Пример #4
0
lldb::SBValueList
SBBlock::GetVariables (lldb::SBTarget& target,
                       bool arguments,
                       bool locals,
                       bool statics)
{
    Block *block = GetPtr();
    
    SBValueList value_list;
    if (block)
    {
        TargetSP target_sp(target.GetSP());
        
        VariableListSP variable_list_sp (block->GetBlockVariableList (true));
        
        if (variable_list_sp)
        {
            const size_t num_variables = variable_list_sp->GetSize();
            if (num_variables)
            {
                for (size_t i = 0; i < num_variables; ++i)
                {
                    VariableSP variable_sp (variable_list_sp->GetVariableAtIndex(i));
                    if (variable_sp)
                    {
                        bool add_variable = false;
                        switch (variable_sp->GetScope())
                        {
                            case eValueTypeVariableGlobal:
                            case eValueTypeVariableStatic:
                            case eValueTypeVariableThreadLocal:
                                add_variable = statics;
                                break;
                                
                            case eValueTypeVariableArgument:
                                add_variable = arguments;
                                break;
                                
                            case eValueTypeVariableLocal:
                                add_variable = locals;
                                break;
                                
                            default:
                                break;
                        }
                        if (add_variable)
                        {
                            if (target_sp)
                                value_list.Append (ValueObjectVariable::Create (target_sp.get(), variable_sp));
                        }
                    }
                }
            }
        }
    }        
    return value_list;
}
Пример #5
0
lldb::addr_t SBSection::GetLoadAddress(lldb::SBTarget &sb_target) {
  TargetSP target_sp(sb_target.GetSP());
  if (target_sp) {
    SectionSP section_sp(GetSP());
    if (section_sp)
      return section_sp->GetLoadBaseAddress(target_sp.get());
  }
  return LLDB_INVALID_ADDRESS;
}
Пример #6
0
SBExecutionContext::SBExecutionContext (const lldb::SBTarget &target) :
m_exe_ctx_sp(new ExecutionContextRef())
{
    m_exe_ctx_sp->SetTargetSP(target.GetSP());
}