当前位置: 首页>>代码示例>>C++>>正文


C++ ProcessSP::GetTarget方法代码示例

本文整理汇总了C++中ProcessSP::GetTarget方法的典型用法代码示例。如果您正苦于以下问题:C++ ProcessSP::GetTarget方法的具体用法?C++ ProcessSP::GetTarget怎么用?C++ ProcessSP::GetTarget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProcessSP的用法示例。


在下文中一共展示了ProcessSP::GetTarget方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: modules_locker

MemoryHistorySP
MemoryHistoryASan::CreateInstance (const ProcessSP &process_sp)
{
    if (!process_sp.get())
        return NULL;

    Target & target = process_sp->GetTarget();

    const ModuleList &target_modules = target.GetImages();
    Mutex::Locker modules_locker(target_modules.GetMutex());
    const size_t num_modules = target_modules.GetSize();
    for (size_t i = 0; i < num_modules; ++i)
    {
        Module *module_pointer = target_modules.GetModulePointerAtIndexUnlocked(i);

        const Symbol* symbol = module_pointer->FindFirstSymbolWithNameAndType(
                ConstString("__asan_get_alloc_stack"),
                lldb::eSymbolTypeAny);

        if (symbol != nullptr)
            return MemoryHistorySP(new MemoryHistoryASan(process_sp));        
    }

    return MemoryHistorySP();
}
开发者ID:2asoft,项目名称:freebsd,代码行数:25,代码来源:MemoryHistoryASan.cpp

示例2: modules_locker

MemoryHistorySP
MemoryHistoryASan::CreateInstance (const ProcessSP &process_sp)
{
    if (!process_sp.get())
        return NULL;
    
    Target & target = process_sp->GetTarget();
    
    bool found_asan_runtime = false;
    
    const ModuleList &target_modules = target.GetImages();
    Mutex::Locker modules_locker(target_modules.GetMutex());
    const size_t num_modules = target_modules.GetSize();
    for (size_t i = 0; i < num_modules; ++i)
    {
        Module *module_pointer = target_modules.GetModulePointerAtIndexUnlocked(i);
        
        SymbolContextList sc_list;
        const bool include_symbols = true;
        const bool append = true;
        const bool include_inlines = true;

        size_t num_matches = module_pointer->FindFunctions(ConstString("__asan_get_alloc_stack"), NULL, eFunctionNameTypeAuto, include_symbols, include_inlines, append, sc_list);
        
        if (num_matches)
        {
            found_asan_runtime = true;
            break;
        }
    }
    
    if (! found_asan_runtime)
        return MemoryHistorySP();

    return MemoryHistorySP(new MemoryHistoryASan(process_sp));
}
开发者ID:BlueRiverInteractive,项目名称:lldb,代码行数:36,代码来源:MemoryHistoryASan.cpp

示例3: guard

void
CompactUnwindInfo::ScanIndex (const ProcessSP &process_sp)
{
    std::lock_guard<std::mutex> guard(m_mutex);
    if (m_indexes_computed == eLazyBoolYes && m_unwindinfo_data_computed)
        return;

    // We can't read the index for some reason.
    if (m_indexes_computed == eLazyBoolNo)
    {
        return;
    }

    Log *log (GetLogIfAllCategoriesSet (LIBLLDB_LOG_UNWIND));
    if (log)
        m_objfile.GetModule()->LogMessage(log, "Reading compact unwind first-level indexes");

    if (m_unwindinfo_data_computed == false)
    {
        if (m_section_sp->IsEncrypted())
        {
            // Can't get section contents of a protected/encrypted section until we have a live
            // process and can read them out of memory.
            if (process_sp.get() == nullptr)
                return;
            m_section_contents_if_encrypted.reset (new DataBufferHeap (m_section_sp->GetByteSize(), 0));
            Error error;
            if (process_sp->ReadMemory (
                        m_section_sp->GetLoadBaseAddress (&process_sp->GetTarget()), 
                        m_section_contents_if_encrypted->GetBytes(), 
                        m_section_sp->GetByteSize(), error) == m_section_sp->GetByteSize() && error.Success())
            {
                m_unwindinfo_data.SetAddressByteSize (process_sp->GetTarget().GetArchitecture().GetAddressByteSize());
                m_unwindinfo_data.SetByteOrder (process_sp->GetTarget().GetArchitecture().GetByteOrder());
                m_unwindinfo_data.SetData (m_section_contents_if_encrypted, 0);
            }
        }
        else
        {
            m_objfile.ReadSectionData (m_section_sp.get(), m_unwindinfo_data);
        }
        if (m_unwindinfo_data.GetByteSize() != m_section_sp->GetByteSize())
            return;
        m_unwindinfo_data_computed = true;
    }

    if (m_unwindinfo_data.GetByteSize() > 0)
    {
        offset_t offset = 0;

                // struct unwind_info_section_header
                // {
                // uint32_t    version;            // UNWIND_SECTION_VERSION
                // uint32_t    commonEncodingsArraySectionOffset;
                // uint32_t    commonEncodingsArrayCount;
                // uint32_t    personalityArraySectionOffset;
                // uint32_t    personalityArrayCount;
                // uint32_t    indexSectionOffset;
                // uint32_t    indexCount;
        
        m_unwind_header.version = m_unwindinfo_data.GetU32(&offset);
        m_unwind_header.common_encodings_array_offset = m_unwindinfo_data.GetU32(&offset);
        m_unwind_header.common_encodings_array_count = m_unwindinfo_data.GetU32(&offset);
        m_unwind_header.personality_array_offset = m_unwindinfo_data.GetU32(&offset);
        m_unwind_header.personality_array_count = m_unwindinfo_data.GetU32(&offset);
        uint32_t indexSectionOffset = m_unwindinfo_data.GetU32(&offset);

        uint32_t indexCount = m_unwindinfo_data.GetU32(&offset);

        if (m_unwind_header.common_encodings_array_offset > m_unwindinfo_data.GetByteSize()
            || m_unwind_header.personality_array_offset > m_unwindinfo_data.GetByteSize()
            || indexSectionOffset > m_unwindinfo_data.GetByteSize()
            || offset > m_unwindinfo_data.GetByteSize())
        {
            Host::SystemLog (Host::eSystemLogError,
                    "error: Invalid offset encountered in compact unwind info, skipping\n");
            // don't trust anything from this compact_unwind section if it looks
            // blatantly invalid data in the header.
            m_indexes_computed = eLazyBoolNo;
            return;
        }

        // Parse the basic information from the indexes
        // We wait to scan the second level page info until it's needed

            // struct unwind_info_section_header_index_entry 
            // {
            //     uint32_t        functionOffset;
            //     uint32_t        secondLevelPagesSectionOffset;
            //     uint32_t        lsdaIndexArraySectionOffset;
            // };

        offset = indexSectionOffset;
        for (uint32_t idx = 0; idx < indexCount; idx++)
        {
            uint32_t function_offset = m_unwindinfo_data.GetU32(&offset);      // functionOffset
            uint32_t second_level_offset = m_unwindinfo_data.GetU32(&offset);  // secondLevelPagesSectionOffset
            uint32_t lsda_offset = m_unwindinfo_data.GetU32(&offset);          // lsdaIndexArraySectionOffset

            if (second_level_offset > m_section_sp->GetByteSize() || lsda_offset > m_section_sp->GetByteSize())
//.........这里部分代码省略.........
开发者ID:envytools,项目名称:lldb,代码行数:101,代码来源:CompactUnwindInfo.cpp


注:本文中的ProcessSP::GetTarget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。