From fea82991c3a96e506f460570f6ce1623c4deba7b Mon Sep 17 00:00:00 2001 From: anthony cantor Date: Tue, 27 Aug 2013 16:05:29 -0600 Subject: [PATCH] convert str input to bytes StringRefMemoryObject constructor binding specifies bytes as its input parameter, so we have to convert it. --- llvm/mc/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/llvm/mc/__init__.py b/llvm/mc/__init__.py index 0ec8211..46d9276 100644 --- a/llvm/mc/__init__.py +++ b/llvm/mc/__init__.py @@ -129,6 +129,9 @@ class Disassembler(object): @bs) ''' + if isinstance(bs, str): + bs = bytes(map(lambda c: ord(c), bs)) + code = api.llvm.StringRefMemoryObject.new(bs, base_addr) idx = 0 align = self.mai.getMinInstAlignment()