diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-07-26 19:36:28 +0000 |
commit | cfca06d7963fa0909f90483b42a6d7d194d01e08 (patch) | |
tree | 209fb2a2d68f8f277793fc8df46c753d31bc853b /lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h | |
parent | 706b4fc47bbc608932d3b491ae19a3b9cde9497b (diff) |
Notes
Diffstat (limited to 'lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h')
-rw-r--r-- | lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h new file mode 100644 index 000000000000..9b3741bdd18f --- /dev/null +++ b/lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h @@ -0,0 +1,85 @@ +//===-- DisassemblerLLVMC.h -------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_SOURCE_PLUGINS_DISASSEMBLER_LLVMC_DISASSEMBLERLLVMC_H +#define LLDB_SOURCE_PLUGINS_DISASSEMBLER_LLVMC_DISASSEMBLERLLVMC_H + +#include <memory> +#include <mutex> +#include <string> + +#include "lldb/Core/Address.h" +#include "lldb/Core/Disassembler.h" +#include "lldb/Core/PluginManager.h" + +class InstructionLLVMC; + +class DisassemblerLLVMC : public lldb_private::Disassembler { +public: + DisassemblerLLVMC(const lldb_private::ArchSpec &arch, + const char *flavor /* = NULL */); + + ~DisassemblerLLVMC() override; + + // Static Functions + static void Initialize(); + + static void Terminate(); + + static lldb_private::ConstString GetPluginNameStatic(); + + static lldb_private::Disassembler * + CreateInstance(const lldb_private::ArchSpec &arch, const char *flavor); + + size_t DecodeInstructions(const lldb_private::Address &base_addr, + const lldb_private::DataExtractor &data, + lldb::offset_t data_offset, size_t num_instructions, + bool append, bool data_from_file) override; + + // PluginInterface protocol + lldb_private::ConstString GetPluginName() override; + + uint32_t GetPluginVersion() override; + +protected: + friend class InstructionLLVMC; + + bool FlavorValidForArchSpec(const lldb_private::ArchSpec &arch, + const char *flavor) override; + + bool IsValid() const; + + int OpInfo(uint64_t PC, uint64_t Offset, uint64_t Size, int TagType, + void *TagBug); + + const char *SymbolLookup(uint64_t ReferenceValue, uint64_t *ReferenceType, + uint64_t ReferencePC, const char **ReferenceName); + + static int OpInfoCallback(void *DisInfo, uint64_t PC, uint64_t Offset, + uint64_t Size, int TagType, void *TagBug); + + static const char *SymbolLookupCallback(void *DisInfo, + uint64_t ReferenceValue, + uint64_t *ReferenceType, + uint64_t ReferencePC, + const char **ReferenceName); + + const lldb_private::ExecutionContext *m_exe_ctx; + InstructionLLVMC *m_inst; + std::mutex m_mutex; + bool m_data_from_file; + + // Since we need to make two actual MC Disassemblers for ARM (ARM & THUMB), + // and there's a bit of goo to set up and own in the MC disassembler world, + // this class was added to manage the actual disassemblers. + class MCDisasmInstance; + std::unique_ptr<MCDisasmInstance> m_disasm_up; + std::unique_ptr<MCDisasmInstance> m_alternate_disasm_up; +}; + +#endif // LLDB_SOURCE_PLUGINS_DISASSEMBLER_LLVMC_DISASSEMBLERLLVMC_H |