mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-28 18:10:24 +08:00
GP-0 corrected Lab5Script example for Advanced Development Class
This commit is contained in:
@@ -910,7 +910,7 @@
|
|||||||
|
|
||||||
<annot>@Override</annot>
|
<annot>@Override</annot>
|
||||||
<kw>public</kw> <kw>void</kw> run() <kw>throws</kw> Exception {
|
<kw>public</kw> <kw>void</kw> run() <kw>throws</kw> Exception {
|
||||||
<kw>for</kw> (<if>Instruction</if> <loc>instruction</loc> = getFirstInstruction(); <loc>instruction</loc> != <kw>null</kw>; <loc>instruction</loc> = getNextInstruction()) {
|
<kw>for</kw> (<if>Instruction</if> <loc>instruction</loc> = getFirstInstruction(); <loc>instruction</loc> != <kw>null</kw>; <loc>instruction</loc> = getInstructionAfter(<loc>instruction</loc>)) {
|
||||||
<kw>if</kw> ( <fld>monitor</fld>.isCancelled() ) {
|
<kw>if</kw> ( <fld>monitor</fld>.isCancelled() ) {
|
||||||
<kw>break</kw>;
|
<kw>break</kw>;
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-3
@@ -27,8 +27,9 @@ public class Lab5Script extends GhidraScript {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() throws Exception {
|
public void run() throws Exception {
|
||||||
Instruction instruction = getFirstInstruction();
|
|
||||||
while (instruction != null) {
|
for (Instruction instruction = getFirstInstruction(); instruction != null; instruction =
|
||||||
|
getInstructionAfter(instruction)) {
|
||||||
if (monitor.isCancelled()) {
|
if (monitor.isCancelled()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -51,7 +52,6 @@ public class Lab5Script extends GhidraScript {
|
|||||||
String comment =
|
String comment =
|
||||||
"[" + register.getName() + "]=[" + scalar.toString(16, false, false, "", "") + "]";
|
"[" + register.getName() + "]=[" + scalar.toString(16, false, false, "", "") + "]";
|
||||||
setEOLComment(instruction.getMinAddress(), comment);
|
setEOLComment(instruction.getMinAddress(), comment);
|
||||||
instruction = getInstructionAfter(instruction);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user