support disassembling bytes from memoryview#1773
support disassembling bytes from memoryview#1773kabeor merged 3 commits intocapstone-engine:nextfrom
Conversation
|
could you provide a testcase for this? |
|
@huettenhain I tried to verify this PR with following script (a part of test_basic.py) md = Cs(arch, mode)
code = memoryview(code) # added this to check if memoryview work
if syntax is not None:
md.syntax = syntax
for insn in md.disasm(code, 0x1000):
print("0x%x:\t%s\t%s" % (insn.address, insn.mnemonic, insn.op_str))but get this issue I think you should fix the compatibility of memoryview and ctypes |
|
Hey! Sorry for the delay. Indeed I was not aware that ctypes would require the buffer to be writable. I think it might be best to simply include this as a check, I'll update the PR soon. |
|
Hey @kabeor I didn't manage to build this locally, otherwise I would have tested it myself. I updated the PR so that it should work on any writable buffer type, including |
|
@huettenhain I tried to write a test case to verify your PR, but it didn't work. Can you write a test case function in bindings/python/test_basic.py? |
|
I added a test and fixed one remaining bug in the code. |
|
Test confirmed. Thanks for your contribution. |
Recreation of #1758 relative to the
nextbranch.