LLVM  6.0.0svn
Public Member Functions | List of all members
llvm::MCExternalSymbolizer Class Reference

Symbolize using user-provided, C API, callbacks. More...

#include "llvm/MC/MCDisassembler/MCExternalSymbolizer.h"

Inheritance diagram for llvm::MCExternalSymbolizer:
Inheritance graph
[legend]
Collaboration diagram for llvm::MCExternalSymbolizer:
Collaboration graph
[legend]

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 InstSize) override
 Try to add a symbolic operand instead of Value to the MCInst. More...
 
void tryAddingPcLoadReferenceComment (raw_ostream &CommentStream, int64_t Value, uint64_t Address) override
 Try to add a comment on the PC-relative load. More...
 
- Public Member Functions inherited from llvm::MCSymbolizer
 MCSymbolizer (MCContext &Ctx, std::unique_ptr< MCRelocationInfo > RelInfo)
 Construct an MCSymbolizer, taking ownership of RelInfo. More...
 
 MCSymbolizer (const MCSymbolizer &)=delete
 
MCSymbolizeroperator= (const MCSymbolizer &)=delete
 
virtual ~MCSymbolizer ()
 

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. More...
 
void * DisInfo
 The pointer to the block of symbolic information for above call back. More...
 
- Protected Attributes inherited from llvm::MCSymbolizer
MCContextCtx
 
std::unique_ptr< MCRelocationInfoRelInfo
 

Detailed Description

Symbolize using user-provided, C API, callbacks.

See llvm-c/Disassembler.h.

Definition at line 28 of file MCExternalSymbolizer.h.

Constructor & Destructor Documentation

◆ MCExternalSymbolizer()

llvm::MCExternalSymbolizer::MCExternalSymbolizer ( MCContext Ctx,
std::unique_ptr< MCRelocationInfo RelInfo,
LLVMOpInfoCallback  getOpInfo,
LLVMSymbolLookupCallback  symbolLookUp,
void *  disInfo 
)
inline

Member Function Documentation

◆ tryAddingPcLoadReferenceComment()

void MCExternalSymbolizer::tryAddingPcLoadReferenceComment ( raw_ostream cStream,
int64_t  Value,
uint64_t  Address 
)
overridevirtual

◆ tryAddingSymbolicOperand()

bool MCExternalSymbolizer::tryAddingSymbolicOperand ( MCInst Inst,
raw_ostream cStream,
int64_t  Value,
uint64_t  Address,
bool  IsBranch,
uint64_t  Offset,
uint64_t  InstSize 
)
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.

Parameters
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.
InstSize- Size of the instruction in bytes.
Returns
Whether a symbolic operand was added.

Implements llvm::MCSymbolizer.

Reimplemented in llvm::AArch64ExternalSymbolizer.

Definition at line 35 of file MCExternalSymbolizer.cpp.

References llvm::MCID::Add, llvm::MCInst::addOperand(), LLVMOpInfo1::AddSymbol, llvm::MCConstantExpr::create(), llvm::MCSymbolRefExpr::create(), llvm::MCBinaryExpr::createAdd(), llvm::MCOperand::createExpr(), llvm::MCUnaryExpr::createMinus(), llvm::MCBinaryExpr::createSub(), llvm::MCSymbolizer::Ctx, DisInfo, GetOpInfo, llvm::MCContext::getOrCreateSymbol(), LLVMDisassembler_ReferenceType_DeMangled_Name, LLVMDisassembler_ReferenceType_In_Branch, LLVMDisassembler_ReferenceType_InOut_None, LLVMDisassembler_ReferenceType_Out_Objc_Message, LLVMDisassembler_ReferenceType_Out_SymbolStub, LLVMOpInfoSymbol1::Name, LLVMOpInfoSymbol1::Present, llvm::MCSymbolizer::RelInfo, LLVMOpInfo1::SubtractSymbol, SymbolLookUp, LLVMOpInfoSymbol1::Value, LLVMOpInfo1::Value, and LLVMOpInfo1::VariantKind.

Referenced by MCExternalSymbolizer().

Member Data Documentation

◆ DisInfo

void* llvm::MCExternalSymbolizer::DisInfo
protected

The pointer to the block of symbolic information for above call back.

Definition at line 37 of file MCExternalSymbolizer.h.

Referenced by tryAddingPcLoadReferenceComment(), llvm::AArch64ExternalSymbolizer::tryAddingSymbolicOperand(), and tryAddingSymbolicOperand().

◆ GetOpInfo

LLVMOpInfoCallback llvm::MCExternalSymbolizer::GetOpInfo
protected

◆ SymbolLookUp

LLVMSymbolLookupCallback llvm::MCExternalSymbolizer::SymbolLookUp
protected

The documentation for this class was generated from the following files: