-
Notifications
You must be signed in to change notification settings - Fork 82
Expand file tree
/
Copy pathDisassemble instruction.py
More file actions
executable file
·31 lines (25 loc) · 978 Bytes
/
Disassemble instruction.py
File metadata and controls
executable file
·31 lines (25 loc) · 978 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
doc = Document.getCurrentDocument()
seg = doc.getCurrentSegment()
adr = doc.getCurrentAddress()
doc.log("-----------")
doc.log("Disassemble instruction at " + hex(adr))
instr = seg.getInstructionAtAddress(adr)
doc.log("Architecture: %s" % Instruction.stringForArchitecture(instr.getArchitecture()))
doc.log("instruction: " + instr.getInstructionString())
doc.log("instruction length: %d" % instr.getInstructionLength())
argCount = instr.getArgumentCount()
if argCount > 0:
plural = "s"
if argCount == 1:
plural = ""
doc.log("%d argument%s" % (argCount, plural))
doc.log("Raw arguments")
for idx in range(instr.getArgumentCount()):
doc.log((" %d: " % idx) + " " + instr.getRawArgument(idx))
doc.log("Formatted arguments")
for idx in range(instr.getArgumentCount()):
doc.log((" %d: " % idx) + " " + instr.getFormattedArgument(idx))
if instr.isAConditionalJump():
doc.log("conditional jump")
if instr.isAnInconditionalJump():
doc.log("inconditional jump")