Ejemplo n.º 1
0
bool
TargetList::DeleteTarget (TargetSP &target_sp)
{
    Mutex::Locker locker(m_target_list_mutex);
    collection::iterator pos, end = m_target_list.end();

    for (pos = m_target_list.begin(); pos != end; ++pos)
    {
        if (pos->get() == target_sp.get())
        {
            m_target_list.erase(pos);
            return true;
        }
    }
    return false;
}
Ejemplo n.º 2
0
ValueObjectSP
OperatingSystemGo::FindGlobal(TargetSP target, const char *name)
{
    VariableList variable_list;
    const bool append = true;

    Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_OS));

    if (log)
    {
        log->Printf("exe: %s", target->GetExecutableModule()->GetSpecificationDescription().c_str());
        log->Printf("modules: %zu", target->GetImages().GetSize());
    }

    uint32_t match_count = target->GetImages().FindGlobalVariables(ConstString(name), append, 1, variable_list);
    if (match_count > 0)
    {
        ExecutionContextScope *exe_scope = target->GetProcessSP().get();
        if (exe_scope == NULL)
            exe_scope = target.get();
        return ValueObjectVariable::Create(exe_scope, variable_list.GetVariableAtIndex(0));
    }
    return ValueObjectSP();
}
Ejemplo n.º 3
0
Error
TargetList::CreateTarget
(
    Debugger &debugger,
    const FileSpec& file,
    const ArchSpec& arch,
    const UUID *uuid_ptr,
    bool get_dependent_files,
    TargetSP &target_sp
)
{
    Timer scoped_timer (__PRETTY_FUNCTION__,
                        "TargetList::CreateTarget (file = '%s/%s', arch = '%s', uuid = %p)",
                        file.GetDirectory().AsCString(),
                        file.GetFilename().AsCString(),
                        arch.AsCString(),
                        uuid_ptr);
    ModuleSP exe_module_sp;
    FileSpec resolved_file(file);
    if (!Host::ResolveExecutableInBundle (&resolved_file))
        resolved_file = file;

    Error error = ModuleList::GetSharedModule(resolved_file, 
                                              arch, 
                                              uuid_ptr, 
                                              NULL, 
                                              0, 
                                              exe_module_sp, 
                                              NULL, 
                                              NULL);
    if (exe_module_sp)
    {
        target_sp.reset(new Target(debugger));
        target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);

        if (target_sp.get())
        {
            Mutex::Locker locker(m_target_list_mutex);
            m_current_target_idx = m_target_list.size();
            m_target_list.push_back(target_sp);
        }

//        target_sp.reset(new Target);
//        // Let the target resolve any funky bundle paths before we try and get
//        // the object file...
//        target_sp->SetExecutableModule (exe_module_sp, get_dependent_files);
//        if (exe_module_sp->GetObjectFile() == NULL)
//        {
//            error.SetErrorStringWithFormat("%s%s%s: doesn't contain architecture %s",
//                                           file.GetDirectory().AsCString(),
//                                           file.GetDirectory() ? "/" : "",
//                                           file.GetFilename().AsCString(),
//                                           arch.AsCString());
//        }
//        else
//        {
//            if (target_sp.get())
//            {
//                error.Clear();
//                Mutex::Locker locker(m_target_list_mutex);
//                m_current_target_idx = m_target_list.size();
//                m_target_list.push_back(target_sp);
//            }
//        }
    }
    else
    {
        target_sp.reset();
    }

    return error;
}