LLVM 20.0.0git
|
Symbolize using user-provided, C API, callbacks. More...
#include "llvm/MC/MCDisassembler/MCExternalSymbolizer.h"
Public Member Functions | |
MCExternalSymbolizer (MCContext &Ctx, std::unique_ptr< MCRelocationInfo > RelInfo, LLVMOpInfoCallback getOpInfo, LLVMSymbolLookupCallback symbolLookUp, void *disInfo) | |
bool | tryAddingSymbolicOperand (MCInst &MI, raw_ostream &CommentStream, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t OpSize, uint64_t InstSize) override |
Try to add a symbolic operand instead of Value to the MCInst. | |
void | tryAddingPcLoadReferenceComment (raw_ostream &CommentStream, int64_t Value, uint64_t Address) override |
Try to add a comment on the PC-relative load. | |
Public Member Functions inherited from llvm::MCSymbolizer | |
MCSymbolizer (MCContext &Ctx, std::unique_ptr< MCRelocationInfo > RelInfo) | |
Construct an MCSymbolizer, taking ownership of RelInfo . | |
MCSymbolizer (const MCSymbolizer &)=delete | |
MCSymbolizer & | operator= (const MCSymbolizer &)=delete |
virtual | ~MCSymbolizer () |
virtual bool | tryAddingSymbolicOperand (MCInst &Inst, raw_ostream &cStream, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t OpSize, uint64_t InstSize)=0 |
Try to add a symbolic operand instead of Value to the MCInst. | |
virtual void | tryAddingPcLoadReferenceComment (raw_ostream &cStream, int64_t Value, uint64_t Address)=0 |
Try to add a comment on the PC-relative load. | |
virtual ArrayRef< uint64_t > | getReferencedAddresses () const |
Get the MCSymbolizer's list of addresses that were referenced by symbolizable operands but not resolved to a symbol. | |
Protected Attributes | |
Hooks for symbolic disassembly via the public 'C' interface. | |
The function to get the symbolic information for operands. | |
LLVMOpInfoCallback | GetOpInfo |
LLVMSymbolLookupCallback | SymbolLookUp |
The function to lookup a symbol name. | |
void * | DisInfo |
The pointer to the block of symbolic information for above call back. | |
Protected Attributes inherited from llvm::MCSymbolizer | |
MCContext & | Ctx |
std::unique_ptr< MCRelocationInfo > | RelInfo |
Symbolize using user-provided, C API, callbacks.
Definition at line 27 of file MCExternalSymbolizer.h.
|
inline |
Definition at line 40 of file MCExternalSymbolizer.h.
|
overridevirtual |
Try to add a comment on the PC-relative load.
For instance, in Mach-O, this is used to add annotations to instructions that use C string literals, as found in __cstring.
Implements llvm::MCSymbolizer.
Definition at line 153 of file MCExternalSymbolizer.cpp.
References llvm::Address, DisInfo, LLVMDisassembler_ReferenceType_In_PCrel_Load, LLVMDisassembler_ReferenceType_Out_LitPool_CstrAddr, LLVMDisassembler_ReferenceType_Out_LitPool_SymAddr, LLVMDisassembler_ReferenceType_Out_Objc_CFString_Ref, LLVMDisassembler_ReferenceType_Out_Objc_Class_Ref, LLVMDisassembler_ReferenceType_Out_Objc_Message, LLVMDisassembler_ReferenceType_Out_Objc_Message_Ref, LLVMDisassembler_ReferenceType_Out_Objc_Selector_Ref, SymbolLookUp, and llvm::raw_ostream::write_escaped().
|
overridevirtual |
Try to add a symbolic operand instead of Value
to the MCInst.
Instead of having a difficult to read immediate, a symbolic operand would represent this immediate in a more understandable way, for instance as a symbol or an offset from a symbol. Relocations can also be used to enrich the symbolic expression.
Inst | - The MCInst where to insert the symbolic operand. |
cStream | - Stream to print comments and annotations on. |
Value | - Operand value, pc-adjusted by the caller if necessary. |
Address | - Load address of the instruction. |
IsBranch | - Is the instruction a branch? |
Offset | - Byte offset of the operand inside the inst. |
OpSize | - Size of the operand in bytes. |
InstSize | - Size of the instruction in bytes. |
Implements llvm::MCSymbolizer.
Reimplemented in llvm::AArch64ExternalSymbolizer.
Definition at line 35 of file MCExternalSymbolizer.cpp.
References llvm::Add, llvm::Address, LLVMOpInfo1::AddSymbol, llvm::MCSymbolRefExpr::create(), llvm::MCConstantExpr::create(), llvm::MCBinaryExpr::createAdd(), llvm::MCOperand::createExpr(), llvm::MCUnaryExpr::createMinus(), llvm::MCBinaryExpr::createSub(), llvm::MCSymbolizer::Ctx, DisInfo, GetOpInfo, llvm::MCContext::getOrCreateSymbol(), LHS, LLVMDisassembler_ReferenceType_DeMangled_Name, LLVMDisassembler_ReferenceType_In_Branch, LLVMDisassembler_ReferenceType_InOut_None, LLVMDisassembler_ReferenceType_Out_Objc_Message, LLVMDisassembler_ReferenceType_Out_SymbolStub, MI, LLVMOpInfoSymbol1::Name, Name, llvm::Offset, LLVMOpInfoSymbol1::Present, llvm::MCSymbolizer::RelInfo, LLVMOpInfo1::SubtractSymbol, Sym, SymbolLookUp, LLVMOpInfoSymbol1::Value, LLVMOpInfo1::Value, and LLVMOpInfo1::VariantKind.
|
protected |
The pointer to the block of symbolic information for above call back.
Definition at line 36 of file MCExternalSymbolizer.h.
Referenced by tryAddingPcLoadReferenceComment(), tryAddingSymbolicOperand(), and llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand().
|
protected |
Definition at line 32 of file MCExternalSymbolizer.h.
Referenced by tryAddingSymbolicOperand(), and llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand().
|
protected |
The function to lookup a symbol name.
Definition at line 34 of file MCExternalSymbolizer.h.
Referenced by tryAddingPcLoadReferenceComment(), tryAddingSymbolicOperand(), and llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand().