#include "ObjectFileWasm.h"
#include "lldb/Core/Module.h"
#include "lldb/Core/ModuleSpec.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/Section.h"
#include "lldb/Target/Process.h"
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
#include "lldb/Utility/DataBufferHeap.h"
#include "lldb/Utility/LLDBLog.h"
#include "lldb/Utility/Log.h"
#include "llvm/ADT/ArrayRef.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/BinaryFormat/Magic.h"
#include "llvm/BinaryFormat/Wasm.h"
#include "llvm/Support/Endian.h"
#include "llvm/Support/Format.h"
#include <optional>
usingnamespacelldb;
usingnamespacelldb_private;
usingnamespacelldb_private::wasm;
LLDB_PLUGIN_DEFINE(…)
static const uint32_t kWasmHeaderSize = …;
static bool ValidateModuleHeader(const DataBufferSP &data_sp) { … }
static std::optional<ConstString>
GetWasmString(llvm::DataExtractor &data, llvm::DataExtractor::Cursor &c) { … }
char ObjectFileWasm::ID;
void ObjectFileWasm::Initialize() { … }
void ObjectFileWasm::Terminate() { … }
ObjectFile *
ObjectFileWasm::CreateInstance(const ModuleSP &module_sp, DataBufferSP data_sp,
offset_t data_offset, const FileSpec *file,
offset_t file_offset, offset_t length) { … }
ObjectFile *ObjectFileWasm::CreateMemoryInstance(const ModuleSP &module_sp,
WritableDataBufferSP data_sp,
const ProcessSP &process_sp,
addr_t header_addr) { … }
bool ObjectFileWasm::DecodeNextSection(lldb::offset_t *offset_ptr) { … }
bool ObjectFileWasm::DecodeSections() { … }
size_t ObjectFileWasm::GetModuleSpecifications(
const FileSpec &file, DataBufferSP &data_sp, offset_t data_offset,
offset_t file_offset, offset_t length, ModuleSpecList &specs) { … }
ObjectFileWasm::ObjectFileWasm(const ModuleSP &module_sp, DataBufferSP data_sp,
offset_t data_offset, const FileSpec *file,
offset_t offset, offset_t length)
: … { … }
ObjectFileWasm::ObjectFileWasm(const lldb::ModuleSP &module_sp,
lldb::WritableDataBufferSP header_data_sp,
const lldb::ProcessSP &process_sp,
lldb::addr_t header_addr)
: … { … }
bool ObjectFileWasm::ParseHeader() { … }
void ObjectFileWasm::ParseSymtab(Symtab &symtab) { … }
static SectionType GetSectionTypeFromName(llvm::StringRef Name) { … }
void ObjectFileWasm::CreateSections(SectionList &unified_section_list) { … }
bool ObjectFileWasm::SetLoadAddress(Target &target, lldb::addr_t load_address,
bool value_is_offset) { … }
DataExtractor ObjectFileWasm::ReadImageData(offset_t offset, uint32_t size) { … }
std::optional<FileSpec> ObjectFileWasm::GetExternalDebugInfoFileSpec() { … }
void ObjectFileWasm::Dump(Stream *s) { … }
void ObjectFileWasm::DumpSectionHeader(llvm::raw_ostream &ostream,
const section_info_t &sh) { … }
void ObjectFileWasm::DumpSectionHeaders(llvm::raw_ostream &ostream) { … }