LLVM API Documentation

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
MCExternalSymbolizer.h
Go to the documentation of this file.
1 //===-- llvm/MC/MCExternalSymbolizer.h - ------------------------*- C++ -*-===//
2 //
3 // The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains the declaration of the MCExternalSymbolizer class, which
11 // enables library users to provide callbacks (through the C API) to do the
12 // symbolization externally.
13 //
14 //===----------------------------------------------------------------------===//
15 
16 #ifndef LLVM_MC_MCEXTERNALSYMBOLIZER_H
17 #define LLVM_MC_MCEXTERNALSYMBOLIZER_H
18 
19 #include "llvm-c/Disassembler.h"
20 #include "llvm/MC/MCSymbolizer.h"
21 
22 namespace llvm {
23 
24 /// \brief Symbolize using user-provided, C API, callbacks.
25 ///
26 /// See llvm-c/Disassembler.h.
28 
29  /// \name Hooks for symbolic disassembly via the public 'C' interface.
30  /// @{
31  /// The function to get the symbolic information for operands.
32  LLVMOpInfoCallback GetOpInfo;
33  /// The function to lookup a symbol name.
34  LLVMSymbolLookupCallback SymbolLookUp;
35  /// The pointer to the block of symbolic information for above call back.
36  void *DisInfo;
37  /// @}
38 
39 public:
42  LLVMOpInfoCallback getOpInfo,
43  LLVMSymbolLookupCallback symbolLookUp,
44  void *disInfo)
45  : MCSymbolizer(Ctx, RelInfo),
46  GetOpInfo(getOpInfo), SymbolLookUp(symbolLookUp), DisInfo(disInfo) {}
47 
48  bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &CommentStream,
49  int64_t Value,
50  uint64_t Address, bool IsBranch,
51  uint64_t Offset, uint64_t InstSize);
52  void tryAddingPcLoadReferenceComment(raw_ostream &CommentStream,
53  int64_t Value, uint64_t Address);
54 };
55 
56 }
57 
58 #endif
MCExternalSymbolizer(MCContext &Ctx, OwningPtr< MCRelocationInfo > &RelInfo, LLVMOpInfoCallback getOpInfo, LLVMSymbolLookupCallback symbolLookUp, void *disInfo)
const char *(* LLVMSymbolLookupCallback)(void *DisInfo, uint64_t ReferenceValue, uint64_t *ReferenceType, uint64_t ReferencePC, const char **ReferenceName)
Symbolize using user-provided, C API, callbacks.
MCContext & Ctx
Definition: MCSymbolizer.h:44
bool tryAddingSymbolicOperand(MCInst &MI, raw_ostream &CommentStream, int64_t Value, uint64_t Address, bool IsBranch, uint64_t Offset, uint64_t InstSize)
Try to add a symbolic operand instead of Value to the MCInst.
Symbolize and annotate disassembled instructions.
Definition: MCSymbolizer.h:39
OwningPtr< MCRelocationInfo > RelInfo
Definition: MCSymbolizer.h:45
void tryAddingPcLoadReferenceComment(raw_ostream &CommentStream, int64_t Value, uint64_t Address)
Try to add a comment on the PC-relative load. For instance, in Mach-O, this is used to add annotation...
LLVM Value Representation.
Definition: Value.h:66
int(* LLVMOpInfoCallback)(void *DisInfo, uint64_t PC, uint64_t Offset, uint64_t Size, int TagType, void *TagBuf)