GP-1288: config options done

This commit is contained in:
d-millar
2021-09-23 15:56:24 +00:00
parent 885bdd36b3
commit 23f50fdf10
6 changed files with 30 additions and 10 deletions

View File

@@ -21,7 +21,7 @@ import ghidra.dbg.target.TargetTogglable;
public interface DbgModelTargetEventOption extends DbgModelTargetObject, TargetTogglable {
int getOption();
Integer getOption();
CompletableFuture<Void> setOption(int ordinal);

View File

@@ -66,7 +66,7 @@ public class DbgModelTargetContinuationOptionImpl extends DbgModelTargetObjectIm
}
@Override
public int getOption() {
public Integer getOption() {
return optionCont.ordinal();
}

View File

@@ -138,6 +138,15 @@ public class DbgModelTargetEventImpl extends DbgModelTargetObjectImpl
ParameterDescription.create(String.class, ARGUMENT_ATTRIBUTE_NAME, false, "",
ARGUMENT_ATTRIBUTE_NAME, "filter argument");
map.put(ARGUMENT_ATTRIBUTE_NAME, argDesc);
ParameterDescription<Integer> execDesc =
ParameterDescription.create(Integer.class, EXECUTE_OPTION_ATTRIBUTE_NAME, false,
execOption.getOption(), EXECUTE_OPTION_ATTRIBUTE_NAME, "filter execution option");
map.put(EXECUTE_OPTION_ATTRIBUTE_NAME, execDesc);
ParameterDescription<Integer> contDesc =
ParameterDescription.create(Integer.class, CONTINUE_OPTION_ATTRIBUTE_NAME, false,
contOption.getOption(), CONTINUE_OPTION_ATTRIBUTE_NAME,
"filter continuation option");
map.put(CONTINUE_OPTION_ATTRIBUTE_NAME, contDesc);
return map;
}
@@ -165,12 +174,12 @@ public class DbgModelTargetEventImpl extends DbgModelTargetObjectImpl
throw new DebuggerIllegalArgumentException("Argument should be a string");
case EXECUTE_OPTION_ATTRIBUTE_NAME:
if (value instanceof Integer) {
execOption.setOption((Integer) value);
return execOption.setOption((Integer) value);
}
throw new DebuggerIllegalArgumentException("Option should be numeric");
case CONTINUE_OPTION_ATTRIBUTE_NAME:
if (value instanceof Integer) {
contOption.setOption((Integer) value);
return contOption.setOption((Integer) value);
}
throw new DebuggerIllegalArgumentException("Option should be numeric");
default:

View File

@@ -125,6 +125,15 @@ public class DbgModelTargetExceptionImpl extends DbgModelTargetObjectImpl
ParameterDescription.create(String.class, COMMAND2_ATTRIBUTE_NAME, false, "",
COMMAND2_ATTRIBUTE_NAME, "filter 2nd-chance command");
map.put(COMMAND2_ATTRIBUTE_NAME, cmdDesc2);
ParameterDescription<Integer> execDesc =
ParameterDescription.create(Integer.class, EXECUTE_OPTION_ATTRIBUTE_NAME, false,
execOption.getOption(), EXECUTE_OPTION_ATTRIBUTE_NAME, "filter execution option");
map.put(EXECUTE_OPTION_ATTRIBUTE_NAME, execDesc);
ParameterDescription<Integer> contDesc =
ParameterDescription.create(Integer.class, CONTINUE_OPTION_ATTRIBUTE_NAME, false,
contOption.getOption(), CONTINUE_OPTION_ATTRIBUTE_NAME,
"filter continuation option");
map.put(CONTINUE_OPTION_ATTRIBUTE_NAME, contDesc);
return map;
}
@@ -152,12 +161,12 @@ public class DbgModelTargetExceptionImpl extends DbgModelTargetObjectImpl
throw new DebuggerIllegalArgumentException("Command should be a string");
case EXECUTE_OPTION_ATTRIBUTE_NAME:
if (value instanceof Integer) {
execOption.setOption((Integer) value);
return execOption.setOption((Integer) value);
}
throw new DebuggerIllegalArgumentException("Option should be numeric");
case CONTINUE_OPTION_ATTRIBUTE_NAME:
if (value instanceof Integer) {
contOption.setOption((Integer) value);
return contOption.setOption((Integer) value);
}
throw new DebuggerIllegalArgumentException("Option should be numeric");
default:

View File

@@ -67,7 +67,7 @@ public class DbgModelTargetExecutionOptionImpl extends DbgModelTargetObjectImpl
}
@Override
public int getOption() {
public Integer getOption() {
return optionExc.ordinal();
}

View File

@@ -338,7 +338,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter
//attachDialogOld = new DebuggerAttachDialog(this);
attachDialog = new DebuggerAttachDialog(this);
breakpointDialog = new DebuggerBreakpointDialog(this);
configDialog = new DebuggerMethodInvocationDialog(tool, "Config", "Config",
configDialog = new DebuggerMethodInvocationDialog(tool, "Configuration", "Configure",
DebuggerResources.ICON_LAUNCH);
}
@@ -1527,8 +1527,10 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter
public void performConfigure(ActionContext context) {
performAction(context, false, TargetConfigurable.class, configurable -> {
Map<String, ?> args = configDialog.promptArguments(configurable.getConfigParameters());
for (Entry<String, ?> entry : args.entrySet()) {
configurable.writeConfigurationOption(entry.getKey(), entry.getValue());
if (args != null) {
for (Entry<String, ?> entry : args.entrySet()) {
configurable.writeConfigurationOption(entry.getKey(), entry.getValue());
}
}
return AsyncUtils.NIL;
}, "Couldn't configure");