LLDB mainline
ObjectContainerClangOffloadBundle.h
Go to the documentation of this file.
1//===-- ObjectContainerClangOffloadBundle.h ----------------------*- C++
2//-*-===//
3//
4// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5// See https://llvm.org/LICENSE.txt for license information.
6// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7//
8//===----------------------------------------------------------------------===//
9
10#ifndef LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_CLANG_OFFLOAD_BUNDLE_OBJECTCONTAINERCLANGOFFLOADBUNDLE_H
11#define LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_CLANG_OFFLOAD_BUNDLE_OBJECTCONTAINERCLANGOFFLOADBUNDLE_H
12
16#include <vector>
17
19public:
21 lldb::DataBufferSP &data_sp,
22 lldb::offset_t data_offset,
23 const lldb_private::FileSpec *file,
24 lldb::offset_t file_offset,
25 lldb::offset_t length);
26
28
29 static void Initialize();
30 static void Terminate();
31
32 static llvm::StringRef GetPluginNameStatic() {
33 return "clang-offload-bundle";
34 }
35
36 static llvm::StringRef GetPluginDescriptionStatic() {
37 return "Clang offload bundle object container reader.";
38 }
39
41 CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp,
42 lldb::offset_t data_offset, const lldb_private::FileSpec *file,
43 lldb::offset_t file_offset, lldb::offset_t length);
44
47 lldb::DataExtractorSP &extractor_sp,
48 lldb::offset_t file_offset, lldb::offset_t file_size);
49
50 static bool MagicBytesMatch(const lldb_private::DataExtractor &data);
51
52 bool ParseHeader() override;
53
54 size_t GetNumArchitectures() const override;
55
56 bool GetArchitectureAtIndex(uint32_t idx,
57 lldb_private::ArchSpec &arch) const override;
58
60
61 llvm::StringRef GetPluginName() override { return GetPluginNameStatic(); }
62
63protected:
70 std::vector<Entry> m_entries;
71
72 static bool FindBundleEntries(const lldb_private::FileSpec &file,
73 std::vector<Entry> &entries);
74};
75
76#endif // LLDB_SOURCE_PLUGINS_OBJECTCONTAINER_CLANG_OFFLOAD_BUNDLE_OBJECTCONTAINERCLANGOFFLOADBUNDLE_H
ObjectContainerClangOffloadBundle(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
static bool MagicBytesMatch(const lldb_private::DataExtractor &data)
lldb::ObjectFileSP GetObjectFile(const lldb_private::FileSpec *file) override
Selects an architecture in an object file.
static bool FindBundleEntries(const lldb_private::FileSpec &file, std::vector< Entry > &entries)
bool ParseHeader() override
Attempts to parse the object header.
static lldb_private::ObjectContainer * CreateInstance(const lldb::ModuleSP &module_sp, lldb::DataBufferSP &data_sp, lldb::offset_t data_offset, const lldb_private::FileSpec *file, lldb::offset_t file_offset, lldb::offset_t length)
size_t GetNumArchitectures() const override
Get the number of architectures in this object file.
static lldb_private::ModuleSpecList GetModuleSpecifications(const lldb_private::FileSpec &file, lldb::DataExtractorSP &extractor_sp, lldb::offset_t file_offset, lldb::offset_t file_size)
bool GetArchitectureAtIndex(uint32_t idx, lldb_private::ArchSpec &arch) const override
Gets the architecture given an index.
An architecture specification class.
Definition ArchSpec.h:32
An data extractor class.
A file utility class.
Definition FileSpec.h:56
A plug-in interface definition class for object containers.
uint64_t offset_t
Definition lldb-types.h:86
std::shared_ptr< lldb_private::ObjectFile > ObjectFileSP
std::shared_ptr< lldb_private::DataBuffer > DataBufferSP
std::shared_ptr< lldb_private::DataExtractor > DataExtractorSP
std::shared_ptr< lldb_private::Module > ModuleSP