1//===-- ObjectFilePlaceholder.h ---------------------------------*- C++ -*-===//
2//
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
6//
7//===----------------------------------------------------------------------===//
8
9#ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_PLACEHOLDER_OBJECTFILEPLACEHOLDER_H
10#define LLDB_SOURCE_PLUGINS_OBJECTFILE_PLACEHOLDER_OBJECTFILEPLACEHOLDER_H
11
12#include "lldb/Symbol/ObjectFile.h"
13
14#include "lldb/Target/Target.h"
15#include "lldb/Utility/ArchSpec.h"
16#include "lldb/Utility/FileSpec.h"
17#include "lldb/Utility/UUID.h"
18#include "lldb/lldb-private.h"
19
20/// A minimal ObjectFile implementation providing a dummy object file for the
21/// cases when the real module binary is not available. This allows the module
22/// to show up in "image list" and symbols to be added to it.
23class ObjectFilePlaceholder : public lldb_private::ObjectFile {
24public:
25 // Static Functions
26 static void Initialize() {}
27
28 static void Terminate() {}
29
30 static llvm::StringRef GetPluginNameStatic() { return "placeholder"; }
31
32 ObjectFilePlaceholder(const lldb::ModuleSP &module_sp,
33 const lldb_private::ModuleSpec &module_spec,
34 lldb::addr_t base, lldb::addr_t size);
35
36 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
37 bool ParseHeader() override { return true; }
38 Type CalculateType() override { return eTypeUnknown; }
39 Strata CalculateStrata() override { return eStrataUnknown; }
40 uint32_t GetDependentModules(lldb_private::FileSpecList &file_list) override {
41 return 0;
42 }
43 bool IsExecutable() const override { return false; }
44 lldb_private::ArchSpec GetArchitecture() override { return m_arch; }
45 lldb_private::UUID GetUUID() override { return m_uuid; }
46 void ParseSymtab(lldb_private::Symtab &symtab) override {}
47 bool IsStripped() override { return true; }
48 lldb::ByteOrder GetByteOrder() const override {
49 return m_arch.GetByteOrder();
50 }
51
52 uint32_t GetAddressByteSize() const override {
53 return m_arch.GetAddressByteSize();
54 }
55
56 lldb_private::Address GetBaseAddress() override;
57
58 void CreateSections(lldb_private::SectionList &unified_section_list) override;
59
60 bool SetLoadAddress(lldb_private::Target &target, lldb::addr_t value,
61 bool value_is_offset) override;
62
63 void Dump(lldb_private::Stream *s) override;
64
65 lldb::addr_t GetBaseImageAddress() const { return m_base; }
66
67private:
68 lldb_private::ArchSpec m_arch;
69 lldb_private::UUID m_uuid;
70 lldb::addr_t m_base;
71 lldb::addr_t m_size;
72};
73
74#endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_PLACEHOLDER_OBJECTFILEPLACEHOLDER_H
75

source code of lldb/source/Plugins/ObjectFile/Placeholder/ObjectFilePlaceholder.h