diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-08-20 20:51:52 +0000 |
commit | 5f29bb8a675e8f96452b632e7129113f7dec850e (patch) | |
tree | 3d3f2a0d3ad10872a4dcaba8ec8d1d20c87ab147 /include/lldb/Core/Disassembler.h | |
parent | 88c643b6fec27eec436c8d138fee6346e92337d6 (diff) |
Notes
Diffstat (limited to 'include/lldb/Core/Disassembler.h')
-rw-r--r-- | include/lldb/Core/Disassembler.h | 89 |
1 files changed, 42 insertions, 47 deletions
diff --git a/include/lldb/Core/Disassembler.h b/include/lldb/Core/Disassembler.h index 7cec837e71f8..ba9ca87832f6 100644 --- a/include/lldb/Core/Disassembler.h +++ b/include/lldb/Core/Disassembler.h @@ -1,9 +1,8 @@ //===-- Disassembler.h ------------------------------------------*- C++ -*-===// // -// The LLVM Compiler Infrastructure -// -// This file is distributed under the University of Illinois Open Source -// License. See LICENSE.TXT for details. +// 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 // //===----------------------------------------------------------------------===// @@ -39,41 +38,21 @@ #include <stdint.h> #include <stdio.h> -namespace lldb_private { -class AddressRange; +namespace llvm { +template <typename T> class SmallVectorImpl; } + namespace lldb_private { +class AddressRange; class DataExtractor; -} -namespace lldb_private { class Debugger; -} -namespace lldb_private { class Disassembler; -} -namespace lldb_private { class Module; -} -namespace lldb_private { class Stream; -} -namespace lldb_private { class SymbolContext; -} -namespace lldb_private { class SymbolContextList; -} -namespace lldb_private { class Target; -} -namespace lldb_private { struct RegisterInfo; -} -namespace llvm { -template <typename T> class SmallVectorImpl; -} - -namespace lldb_private { class Instruction { public: @@ -110,38 +89,37 @@ public: m_address = addr; } - //------------------------------------------------------------------ /// Dump the text representation of this Instruction to a Stream /// /// Print the (optional) address, (optional) bytes, opcode, /// operands, and instruction comments to a stream. /// - /// @param[in] s + /// \param[in] s /// The Stream to add the text to. /// - /// @param[in] show_address + /// \param[in] show_address /// Whether the address (using disassembly_addr_format_spec formatting) /// should be printed. /// - /// @param[in] show_bytes + /// \param[in] show_bytes /// Whether the bytes of the assembly instruction should be printed. /// - /// @param[in] max_opcode_byte_size + /// \param[in] max_opcode_byte_size /// The size (in bytes) of the largest instruction in the list that /// we are printing (for text justification/alignment purposes) /// Only needed if show_bytes is true. /// - /// @param[in] exe_ctx + /// \param[in] exe_ctx /// The current execution context, if available. May be used in /// the assembling of the operands+comments for this instruction. /// Pass NULL if not applicable. /// - /// @param[in] sym_ctx + /// \param[in] sym_ctx /// The SymbolContext for this instruction. /// Pass NULL if not available/computed. /// Only needed if show_address is true. /// - /// @param[in] prev_sym_ctx + /// \param[in] prev_sym_ctx /// The SymbolContext for the previous instruction. Depending on /// the disassembly address format specification, a change in /// Symbol / Function may mean that a line is printed with the new @@ -150,17 +128,16 @@ public: /// the InstructionList. /// Only needed if show_address is true. /// - /// @param[in] disassembly_addr_format + /// \param[in] disassembly_addr_format /// The format specification for how addresses are printed. /// Only needed if show_address is true. /// - /// @param[in] max_address_text_size + /// \param[in] max_address_text_size /// The length of the longest address string at the start of the /// disassembly line that will be printed (the /// Debugger::FormatDisassemblerAddress() string) /// so this method can properly align the instruction opcodes. /// May be 0 to indicate no indentation/alignment of the opcodes. - //------------------------------------------------------------------ virtual void Dump(Stream *s, uint32_t max_opcode_byte_size, bool show_address, bool show_bytes, const ExecutionContext *exe_ctx, const SymbolContext *sym_ctx, @@ -293,8 +270,32 @@ public: lldb::InstructionSP GetInstructionAtIndex(size_t idx) const; + //------------------------------------------------------------------ + /// Get the index of the next branch instruction. + /// + /// Given a list of instructions, find the next branch instruction + /// in the list by returning an index. + /// + /// @param[in] start + /// The instruction index of the first instruction to check. + /// + /// @param[in] target + /// A LLDB target object that is used to resolve addresses. + /// + /// @param[in] ignore_calls + /// It true, then fine the first branch instruction that isn't + /// a function call (a branch that calls and returns to the next + /// instruction). If false, find the instruction index of any + /// branch in the list. + /// + /// @return + /// The instruction index of the first branch that is at or past + /// \a start. Returns UINT32_MAX if no matching branches are + /// found. + //------------------------------------------------------------------ uint32_t GetIndexOfNextBranchInstruction(uint32_t start, - Target &target) const; + Target &target, + bool ignore_calls) const; uint32_t GetIndexOfInstructionAtLoadAddress(lldb::addr_t load_addr, Target &target); @@ -414,7 +415,7 @@ public: static bool Disassemble(Debugger &debugger, const ArchSpec &arch, const char *plugin_name, const char *flavor, const ExecutionContext &exe_ctx, - const ConstString &name, Module *module, + ConstString name, Module *module, uint32_t num_instructions, bool mixed_source_and_assembly, uint32_t num_mixed_context_lines, uint32_t options, Stream &strm); @@ -424,9 +425,7 @@ public: uint32_t num_instructions, bool mixed_source_and_assembly, uint32_t num_mixed_context_lines, uint32_t options, Stream &strm); - //------------------------------------------------------------------ // Constructors and Destructors - //------------------------------------------------------------------ Disassembler(const ArchSpec &arch, const char *flavor); ~Disassembler() override; @@ -536,18 +535,14 @@ protected: return ElideMixedSourceAndDisassemblyLine(exe_ctx, sc, sl); }; - //------------------------------------------------------------------ // Classes that inherit from Disassembler can see and modify these - //------------------------------------------------------------------ ArchSpec m_arch; InstructionList m_instruction_list; lldb::addr_t m_base_addr; std::string m_flavor; private: - //------------------------------------------------------------------ // For Disassembler only - //------------------------------------------------------------------ DISALLOW_COPY_AND_ASSIGN(Disassembler); }; |