GP-5737: Fixing bug that caused some test failures

This commit is contained in:
Ryan Kurtz 2025-06-10 10:10:05 -04:00
parent 569519fb6c
commit 4257433253
4 changed files with 11 additions and 17 deletions

View file

@ -274,19 +274,6 @@ public abstract class GhidraScript extends FlatProgramAPI {
execute(runState, new ScriptControls(runWriter, runWriter, runMonitor));
}
/**
* Execute/run script with the given {@link GhidraState state} and current
* {@link ScriptControls controls} and {@link #doCleanup} afterwards.
* <p>
* NOTE: This method is not intended to be called by script writers.
*
* @param runState state object
* @throws Exception if the script excepts
*/
public final void execute(GhidraState runState) throws Exception {
execute(runState, new ScriptControls(writer, errorWriter, decorateOutput, monitor));
}
/**
* Execute/run script with the given {@link GhidraState state} and
* {@link ScriptControls controls} and {@link #doCleanup} afterwards.
@ -587,6 +574,13 @@ public abstract class GhidraScript extends FlatProgramAPI {
return state;
}
/**
* {@return the current script controls}
*/
public final ScriptControls getControls() {
return new ScriptControls(writer, errorWriter, decorateOutput, monitor);
}
/**
* Set the script {@link #currentAddress}, {@link #currentLocation}, and update state object.
*
@ -924,7 +918,7 @@ public abstract class GhidraScript extends FlatProgramAPI {
updateStateFromVariables();
}
script.execute(scriptState);
script.execute(scriptState, getControls());
if (scriptState == state) {
loadVariablesFromState();

View file

@ -423,7 +423,7 @@ public abstract class HeadlessScript extends GhidraScript {
script.setScriptArgs(scriptArguments);
script.execute(scriptState);
script.execute(scriptState, getControls());
if (scriptState == state) {
loadVariablesFromState();

View file

@ -330,7 +330,7 @@ public class ShowConstantUse extends GhidraScript {
if (scriptSource != null) {
GhidraScriptProvider provider = GhidraScriptUtil.getProvider(scriptSource);
GhidraScript script = provider.getScriptInstance(scriptSource, errorWriter);
script.execute(scriptState);
script.execute(scriptState, getControls());
return;
}
}

View file

@ -77,7 +77,7 @@ public class JythonScript extends GhidraScript {
interpreter.execFile(jythonScript.getSourceFile(), jythonScript);
}
else {
ghidraScript.execute(scriptState);
ghidraScript.execute(scriptState, getControls());
}
if (scriptState == state) {