LLDB mainline
Go to the documentation of this file.
1//===-- ObjectContainer.cpp -----------------------------------------------===//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
10#include "lldb/Core/Module.h"
12#include "lldb/Target/Process.h"
13#include "lldb/Utility/Timer.h"
15using namespace lldb;
16using namespace lldb_private;
19 const FileSpec *file,
20 lldb::offset_t file_offset,
21 lldb::offset_t length,
22 lldb::DataBufferSP data_sp,
23 lldb::offset_t data_offset)
24 : ModuleChild(module_sp),
25 m_file(), // This file can be different than the module's file spec
26 m_offset(file_offset), m_length(length) {
27 if (file)
28 m_file = *file;
29 if (data_sp)
30 m_data.SetData(data_sp, data_offset, length);
34 const ProcessSP &process_sp,
35 lldb::addr_t header_addr,
36 WritableDataBufferSP data_sp) {
37 if (!module_sp)
38 return {};
40 LLDB_SCOPED_TIMERF("ObjectContainer::FindPlugin (module = "
41 "%s, process = %p, header_addr = "
42 "0x%" PRIx64 ")",
43 module_sp->GetFileSpec().GetPath().c_str(),
44 static_cast<void *>(process_sp.get()), header_addr);
47 for (size_t idx = 0;
48 (create_callback =
50 idx)) != nullptr;
51 ++idx) {
52 ObjectContainerSP object_container_sp(
53 create_callback(module_sp, data_sp, process_sp, header_addr));
54 if (object_container_sp)
55 return object_container_sp;
56 }
58 return {};
Definition: Timer.h:86
lldb::offset_t SetData(const void *bytes, lldb::offset_t length, lldb::ByteOrder byte_order)
Set data with a buffer that is caller owned.
A file utility class.
Definition: FileSpec.h:56
A mix in class that contains a pointer back to the module that owns the object which inherits from it...
Definition: ModuleChild.h:19
DataExtractor m_data
The data for this object file so things can be parsed lazily.
static lldb::ObjectContainerSP FindPlugin(const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp, lldb::addr_t header_addr, lldb::WritableDataBufferSP file_data_sp)
FileSpec m_file
The file that represents this container objects (which can be different from the module's file).
ObjectContainer(const lldb::ModuleSP &module_sp, const FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length, lldb::DataBufferSP data_sp, lldb::offset_t data_offset)
Construct with a parent module, offset, and header data.
static ObjectContainerCreateMemoryInstance GetObjectContainerCreateMemoryCallbackAtIndex(uint32_t idx)
A class that represents a running process on the host machine.
Definition: SBAttachInfo.h:14
ObjectContainer *(* ObjectContainerCreateMemoryInstance)(const lldb::ModuleSP &module_sp, lldb::WritableDataBufferSP data_sp, const lldb::ProcessSP &process_sp, lldb::addr_t offset)
Definition: SBAddress.h:15
std::shared_ptr< lldb_private::ObjectContainer > ObjectContainerSP
Definition: lldb-forward.h:357
uint64_t offset_t
Definition: lldb-types.h:83
std::shared_ptr< lldb_private::Process > ProcessSP
Definition: lldb-forward.h:368
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
Definition: lldb-forward.h:318
std::shared_ptr< lldb_private::WritableDataBuffer > WritableDataBufferSP
Definition: lldb-forward.h:319
uint64_t addr_t
Definition: lldb-types.h:79
std::shared_ptr< lldb_private::Module > ModuleSP
Definition: lldb-forward.h:354