GP-740: minor bug fixes - mismatched paths, bad cast

This commit is contained in:
d-millar 2021-03-04 20:12:45 +00:00
parent 6614b54248
commit c1d5a86b39
2 changed files with 37 additions and 47 deletions

View file

@ -19,7 +19,6 @@ import java.util.concurrent.CompletableFuture;
import agent.dbgeng.model.iface2.DbgModelTargetObject; import agent.dbgeng.model.iface2.DbgModelTargetObject;
import ghidra.async.AsyncUtils; import ghidra.async.AsyncUtils;
import ghidra.dbg.agent.AbstractTargetObject;
import ghidra.dbg.error.DebuggerIllegalArgumentException; import ghidra.dbg.error.DebuggerIllegalArgumentException;
import ghidra.dbg.target.TargetFocusScope; import ghidra.dbg.target.TargetFocusScope;
import ghidra.dbg.target.TargetObject; import ghidra.dbg.target.TargetObject;
@ -65,8 +64,8 @@ public interface DbgModelTargetFocusScope extends DbgModelTargetObject, TargetFo
setFocus(sel); setFocus(sel);
return sel.select(); return sel.select();
} }
if (cur instanceof AbstractTargetObject) { if (cur instanceof DbgModelTargetObject) {
AbstractTargetObject<?> def = (AbstractTargetObject<?>) cur; DbgModelTargetObject def = (DbgModelTargetObject) cur;
cur = def.getParent(); cur = def.getParent();
continue; continue;
} }

View file

@ -111,70 +111,70 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter implements
public static final String OPTION_NAME_DEFAULT_BACKGROUND_COLOR = "Object Colors.Background"; public static final String OPTION_NAME_DEFAULT_BACKGROUND_COLOR = "Object Colors.Background";
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_DEFAULT_FOREGROUND_COLOR, // name = OPTION_NAME_DEFAULT_FOREGROUND_COLOR, //
description = "The default foreground color of items in the objects tree", // description = "The default foreground color of items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color defaultForegroundColor = Color.BLACK; Color defaultForegroundColor = Color.BLACK;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_DEFAULT_BACKGROUND_COLOR, // name = OPTION_NAME_DEFAULT_BACKGROUND_COLOR, //
description = "The default background color of items in the objects tree", // description = "The default background color of items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color defaultBackgroundColor = Color.WHITE; Color defaultBackgroundColor = Color.WHITE;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_INVISIBLE_FOREGROUND_COLOR, // name = OPTION_NAME_INVISIBLE_FOREGROUND_COLOR, //
description = "The foreground color for items normally not visible (toggleable)", // description = "The foreground color for items normally not visible (toggleable)", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color invisibleForegroundColor = Color.LIGHT_GRAY; Color invisibleForegroundColor = Color.LIGHT_GRAY;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_MODIFIED_FOREGROUND_COLOR, // name = OPTION_NAME_MODIFIED_FOREGROUND_COLOR, //
description = "The foreground color for modified items in the objects tree", // description = "The foreground color for modified items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color modifiedForegroundColor = Color.RED; Color modifiedForegroundColor = Color.RED;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_SUBSCRIBED_FOREGROUND_COLOR, // name = OPTION_NAME_SUBSCRIBED_FOREGROUND_COLOR, //
description = "The foreground color for subscribed items in the objects tree", // description = "The foreground color for subscribed items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color subscribedForegroundColor = Color.BLACK; Color subscribedForegroundColor = Color.BLACK;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_ERROR_FOREGROUND_COLOR, // name = OPTION_NAME_ERROR_FOREGROUND_COLOR, //
description = "The foreground color for items in error", // description = "The foreground color for items in error", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color errorForegroundColor = Color.RED; Color errorForegroundColor = Color.RED;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_INTRINSIC_FOREGROUND_COLOR, // name = OPTION_NAME_INTRINSIC_FOREGROUND_COLOR, //
description = "The foreground color for intrinsic items in the objects tree", // description = "The foreground color for intrinsic items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color intrinsicForegroundColor = Color.BLUE; Color intrinsicForegroundColor = Color.BLUE;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_TARGET_FOREGROUND_COLOR, // name = OPTION_NAME_TARGET_FOREGROUND_COLOR, //
description = "The foreground color for target object items in the objects tree", // description = "The foreground color for target object items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color targetForegroundColor = Color.MAGENTA; Color targetForegroundColor = Color.MAGENTA;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_ACCESSOR_FOREGROUND_COLOR, // name = OPTION_NAME_ACCESSOR_FOREGROUND_COLOR, //
description = "The foreground color for property accessor items in the objects tree", // description = "The foreground color for property accessor items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color accessorForegroundColor = Color.LIGHT_GRAY; Color accessorForegroundColor = Color.LIGHT_GRAY;
@AutoOptionDefined( // @AutoOptionDefined( //
name = OPTION_NAME_LINK_FOREGROUND_COLOR, // name = OPTION_NAME_LINK_FOREGROUND_COLOR, //
description = "The foreground color for links to items in the objects tree", // description = "The foreground color for links to items in the objects tree", //
help = @HelpInfo(anchor = "colors") // help = @HelpInfo(anchor = "colors") //
) )
Color linkForegroundColor = Color.GREEN; Color linkForegroundColor = Color.GREEN;
@AutoOptionDefined( // @AutoOptionDefined( //
name = "Default Extended Step", // name = "Default Extended Step", //
description = "The default string for the extended step command" // description = "The default string for the extended step command" //
//help = @HelpInfo(anchor = "colors") // //help = @HelpInfo(anchor = "colors") //
) )
String extendedStep = ""; String extendedStep = "";
@ -681,14 +681,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter implements
} }
public ObjectContainer getContainerByPath(List<String> path) { public ObjectContainer getContainerByPath(List<String> path) {
String joinedPath = ""; return targetMap.get(PathUtils.toString(path));
for (String segment : path) {
joinedPath += segment + PATH_JOIN_CHAR;
}
if (joinedPath.length() > 1) {
joinedPath = joinedPath.substring(0, joinedPath.length() - 1);
}
return targetMap.get(joinedPath);
} }
static List<ObjectContainer> getContainersFromObjects(Map<String, ?> objectMap, static List<ObjectContainer> getContainersFromObjects(Map<String, ?> objectMap,
@ -1592,8 +1585,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter implements
} }
@Override @Override
public void accessibilityChanged(TargetAccessConditioned object, public void accessibilityChanged(TargetAccessConditioned object, boolean accessible) {
boolean accessible) {
//this.access = accessibility.equals(TargetAccessibility.ACCESSIBLE); //this.access = accessibility.equals(TargetAccessibility.ACCESSIBLE);
plugin.getTool().contextChanged(this); plugin.getTool().contextChanged(this);
} }
@ -1613,8 +1605,7 @@ public class DebuggerObjectsProvider extends ComponentProviderAdapter implements
} }
@Override @Override
public void executionStateChanged(TargetExecutionStateful object, public void executionStateChanged(TargetExecutionStateful object, TargetExecutionState state) {
TargetExecutionState state) {
//this.state = state; //this.state = state;
plugin.getTool().contextChanged(this); plugin.getTool().contextChanged(this);
} }