Path: blob/main/contrib/llvm-project/lldb/source/Symbol/ObjectContainer.cpp
39587 views
//===-- ObjectContainer.cpp -----------------------------------------------===//1//2// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.3// See https://llvm.org/LICENSE.txt for license information.4// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception5//6//===----------------------------------------------------------------------===//78#include "lldb/Symbol/ObjectContainer.h"9#include "lldb/Core/Module.h"10#include "lldb/Core/PluginManager.h"11#include "lldb/Target/Process.h"12#include "lldb/Utility/Timer.h"1314using namespace lldb;15using namespace lldb_private;1617ObjectContainer::ObjectContainer(const lldb::ModuleSP &module_sp,18const FileSpec *file,19lldb::offset_t file_offset,20lldb::offset_t length,21lldb::DataBufferSP data_sp,22lldb::offset_t data_offset)23: ModuleChild(module_sp),24m_file(), // This file can be different than the module's file spec25m_offset(file_offset), m_length(length) {26if (file)27m_file = *file;28if (data_sp)29m_data.SetData(data_sp, data_offset, length);30}3132ObjectContainerSP ObjectContainer::FindPlugin(const lldb::ModuleSP &module_sp,33const ProcessSP &process_sp,34lldb::addr_t header_addr,35WritableDataBufferSP data_sp) {36if (!module_sp)37return {};3839LLDB_SCOPED_TIMERF("ObjectContainer::FindPlugin (module = "40"%s, process = %p, header_addr = "41"0x%" PRIx64 ")",42module_sp->GetFileSpec().GetPath().c_str(),43static_cast<void *>(process_sp.get()), header_addr);4445ObjectContainerCreateMemoryInstance create_callback;46for (size_t idx = 0;47(create_callback =48PluginManager::GetObjectContainerCreateMemoryCallbackAtIndex(49idx)) != nullptr;50++idx) {51ObjectContainerSP object_container_sp(52create_callback(module_sp, data_sp, process_sp, header_addr));53if (object_container_sp)54return object_container_sp;55}5657return {};58}596061