-
Notifications
You must be signed in to change notification settings - Fork 3
/
TestMarkup.java
38 lines (34 loc) · 1.23 KB
/
TestMarkup.java
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
32
33
34
35
36
37
38
//Test markup
//@author saruman9
//@category Examples
//@keybinding
//@menupath
//@toolbar
import ghidra.app.script.GhidraScript;
import ghidra.app.util.template.TemplateSimplifier;
import ghidra.program.model.listing.CodeUnitFormat;
import ghidra.program.model.listing.CodeUnitFormatOptions;
import ghidra.program.model.listing.Instruction;
public class TestMarkup extends GhidraScript {
@Override
protected void run() throws Exception {
Instruction instruction = currentProgram.getListing().getInstructionAt(currentAddress);
TemplateSimplifier simplifier = new TemplateSimplifier();
simplifier.setEnabled(false);
var options = new CodeUnitFormatOptions(CodeUnitFormatOptions.ShowBlockName.ALWAYS,
CodeUnitFormatOptions.ShowNamespace.ALWAYS,
"",
true,
true,
true,
true,
true,
true,
true,
simplifier);
CodeUnitFormat codeUnitFormat = new CodeUnitFormat(options);
for (int i = 0; i < instruction.getNumOperands(); i++) {
printf("op #%d: \"%s\"\n", i, codeUnitFormat.getOperandRepresentationString(instruction, i));
}
}
}