GP-4293: Implemented default actions in Model tables and trees.

This commit is contained in:
Dan 2024-04-03 11:06:13 -04:00
parent 2a7897c366
commit 1d6cd070f5
30 changed files with 470 additions and 144 deletions

View file

@ -0,0 +1,43 @@
/* ###
* IP: GHIDRA
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ghidra.dbg.target;
import ghidra.dbg.DebuggerTargetObjectIface;
/**
* An object which can be activated
*
* <p>
* Activation generally means to become the active, selected or focused object. Subsequent commands
* to the debugger implicitly apply to this object. For example, if a user activates a thread, then
* subsequent register read/write commands ought to affect the active thread's context.
*
* <p>
* This interface is only used by RMI targets. The back end must register a suitable method so that
* the front end can notify it when the user has activated this object. Generally, a user activates
* the object by double-clicking it in the appropriate table or tree. If it is <em>not</em> marked
* with this interface, the UI will ignore the action. If it is, the UI will mark it the active
* object and invoke the appropriate target method. If this interface is present, but a suitable
* method is not, an error is logged upon attempted activation.
*
* <p>
* We cannot just use the presence or absence of a suitable activation method as a proxy for this
* interface, because the registry is only available when the back end is alive.
*/
@DebuggerTargetObjectIface("Activatable")
public interface TargetActivatable extends TargetObject {
// No methods
}

View file

@ -105,8 +105,7 @@ import ghidra.lifecycle.Internal;
* <ul>
* <li>"Threads" : {@link TargetObject}</li>
* <ul>
* <li>"Thread 1" : {@link TargetExecutionStateful}, {@link TargetSingleSteppable},
* {@link TargetMultiSteppable}</li>
* <li>"Thread 1" : {@link TargetExecutionStateful}, {@link TargetSteppable}</li>
* <ul>
* <li>"Registers" : {@link TargetRegisterBank}</li>
* <ul>
@ -167,15 +166,16 @@ import ghidra.lifecycle.Internal;
public interface TargetObject extends Comparable<TargetObject> {
Set<Class<? extends TargetObject>> ALL_INTERFACES =
Set.of(TargetAccessConditioned.class, TargetActiveScope.class, TargetAggregate.class,
TargetAttachable.class, TargetAttacher.class, TargetBreakpointLocation.class,
TargetBreakpointLocationContainer.class, TargetBreakpointSpec.class,
TargetBreakpointSpecContainer.class, TargetConfigurable.class, TargetConsole.class,
TargetDataTypeMember.class, TargetDataTypeNamespace.class, TargetDeletable.class,
TargetDetachable.class, TargetEnvironment.class, TargetEventScope.class,
TargetExecutionStateful.class, TargetFocusScope.class, TargetInterpreter.class,
TargetInterruptible.class, TargetKillable.class, TargetLauncher.class,
TargetMemory.class, TargetMemoryRegion.class, TargetMethod.class, TargetModule.class,
Set.of(TargetAccessConditioned.class, TargetActivatable.class, TargetActiveScope.class,
TargetAggregate.class, TargetAttachable.class, TargetAttacher.class,
TargetBreakpointLocation.class, TargetBreakpointLocationContainer.class,
TargetBreakpointSpec.class, TargetBreakpointSpecContainer.class,
TargetConfigurable.class, TargetConsole.class, TargetDataTypeMember.class,
TargetDataTypeNamespace.class, TargetDeletable.class, TargetDetachable.class,
TargetEnvironment.class, TargetEventScope.class, TargetExecutionStateful.class,
TargetFocusScope.class, TargetInterpreter.class, TargetInterruptible.class,
TargetKillable.class, TargetLauncher.class, TargetMemory.class,
TargetMemoryRegion.class, TargetMethod.class, TargetModule.class,
TargetModuleContainer.class, TargetNamedDataType.class, TargetProcess.class,
TargetRegister.class, TargetRegisterBank.class, TargetRegisterContainer.class,
TargetResumable.class, TargetSection.class, TargetSectionContainer.class,
@ -472,7 +472,7 @@ public interface TargetObject extends Comparable<TargetObject> {
* <p>
* This is an informal notion of type and may only be used for visual styling, logging, or other
* informational purposes. Scripts should not rely on this to predict behavior, but instead on
* {@link #getAs(Class)}, {@link #getInterfaces()}, or {@link #getSchema()}.
* {@link #as(Class)}, {@link #getInterfaces()}, or {@link #getSchema()}.
*
* @return an informal name of this object's type
*/
@ -516,10 +516,11 @@ public interface TargetObject extends Comparable<TargetObject> {
*
* <p>
* In general, an invalid object should be disposed by the user immediately on discovering it is
* invalid. See {@link DebuggerModelListener#invalidated(TargetObject)} for a means of reacting
* to object invalidation. Nevertheless, it is acceptable to access stale attributes and element
* keys, for informational purposes only. Implementors must reject all commands, including
* fetches, on an invalid object by throwing an {@link IllegalStateException}.
* invalid. See {@link DebuggerModelListener#invalidated(TargetObject, TargetObject, String)}
* for a means of reacting to object invalidation. Nevertheless, it is acceptable to access
* stale attributes and element keys, for informational purposes only. Implementors must reject
* all commands, including fetches, on an invalid object by throwing an
* {@link IllegalStateException}.
*
* @return true if valid, false if invalid
*/