aboutsummaryrefslogtreecommitdiffstats
path: root/bindings/python/llvm/disassembler.py
diff options
context:
space:
mode:
authorGregory Szorc <gregory.szorc@gmail.com>2012-12-01 21:57:30 +0000
committerGregory Szorc <gregory.szorc@gmail.com>2012-12-01 21:57:30 +0000
commitfdddf771716a48857a1044abc7917886bf0bf719 (patch)
treed25584980bbdcf41b96fbd5777dba7e542750a62 /bindings/python/llvm/disassembler.py
parent9756ca7ba0c7f6c3b1e76ee12ca27ddca04be9d7 (diff)
downloadexternal_llvm-fdddf771716a48857a1044abc7917886bf0bf719.zip
external_llvm-fdddf771716a48857a1044abc7917886bf0bf719.tar.gz
external_llvm-fdddf771716a48857a1044abc7917886bf0bf719.tar.bz2
[python] Add markup option to disassembler
Patch contributed by Wladimir J. van der Laan <laanwj@gmail.com> git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@169102 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'bindings/python/llvm/disassembler.py')
-rw-r--r--bindings/python/llvm/disassembler.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/bindings/python/llvm/disassembler.py b/bindings/python/llvm/disassembler.py
index 5030b98..dcef9ac 100644
--- a/bindings/python/llvm/disassembler.py
+++ b/bindings/python/llvm/disassembler.py
@@ -31,6 +31,9 @@ __all__ = [
lib = get_library()
callbacks = {}
+# Constants for set_options
+Option_UseMarkup = 1
+
class Disassembler(LLVMObject):
"""Represents a disassembler instance.
@@ -113,6 +116,10 @@ class Disassembler(LLVMObject):
address += result
offset += result
+ def set_options(self, options):
+ if not lib.LLVMSetDisasmOptions(self, options):
+ raise Exception('Unable to set all disassembler options in %i' % options)
+
def register_library(library):
library.LLVMCreateDisasm.argtypes = [c_char_p, c_void_p, c_int,
@@ -125,6 +132,10 @@ def register_library(library):
c_uint64, c_uint64, c_char_p, c_size_t]
library.LLVMDisasmInstruction.restype = c_size_t
+ library.LLVMSetDisasmOptions.argtypes = [Disassembler, c_uint64]
+ library.LLVMSetDisasmOptions.restype = c_int
+
+
callbacks['op_info'] = CFUNCTYPE(c_int, c_void_p, c_uint64, c_uint64, c_uint64,
c_int, c_void_p)
callbacks['symbol_lookup'] = CFUNCTYPE(c_char_p, c_void_p, c_uint64,