Merge remote-tracking branch

'origin/GP-1595_Dan_globalControlActions--SQUASHED' (Closes #3742)
This commit is contained in:
Ryan Kurtz 2022-10-19 13:03:25 -04:00
commit c17fd389df
66 changed files with 3335 additions and 763 deletions

View file

@ -37,22 +37,7 @@ public interface TargetExecutionStateful extends TargetObject {
* This may apply, e.g., to a GDB "Inferior," which has no yet been used to launch or attach
* to a process.
*/
INACTIVE {
@Override
public boolean isAlive() {
return false;
}
@Override
public boolean isRunning() {
return false;
}
@Override
public boolean isStopped() {
return false;
}
},
INACTIVE(false, false, false),
/**
* The object is alive, but its execution state is unspecified
@ -64,42 +49,12 @@ public interface TargetExecutionStateful extends TargetObject {
* when <em>all</em> of its threads are stopped. For the clients' sakes, all models should
* implement these conventions internally.
*/
ALIVE {
@Override
public boolean isAlive() {
return true;
}
@Override
public boolean isRunning() {
return false;
}
@Override
public boolean isStopped() {
return false;
}
},
ALIVE(true, false, false),
/**
* The object is alive, but not executing
*/
STOPPED {
@Override
public boolean isAlive() {
return true;
}
@Override
public boolean isRunning() {
return false;
}
@Override
public boolean isStopped() {
return true;
}
},
STOPPED(true, false, true),
/**
* The object is alive and executing
@ -109,22 +64,7 @@ public interface TargetExecutionStateful extends TargetObject {
* thread is currently executing, waiting on an event, or scheduled for execution. It does
* not necessarily mean it is executing on a CPU at this exact moment.
*/
RUNNING {
@Override
public boolean isAlive() {
return true;
}
@Override
public boolean isRunning() {
return true;
}
@Override
public boolean isStopped() {
return false;
}
},
RUNNING(true, true, false),
/**
* The object is no longer alive
@ -134,43 +74,44 @@ public interface TargetExecutionStateful extends TargetObject {
* stale handles to objects which may still be queried (e.g., for a process exit code), or
* e.g., a GDB "Inferior," which could be re-used to launch or attach to another process.
*/
TERMINATED {
@Override
public boolean isAlive() {
return false;
}
TERMINATED(false, false, false);
@Override
public boolean isRunning() {
return false;
}
private final boolean alive;
private final boolean running;
private final boolean stopped;
@Override
public boolean isStopped() {
return false;
}
};
private TargetExecutionState(boolean alive, boolean running, boolean stopped) {
this.alive = alive;
this.running = running;
this.stopped = stopped;
}
/**
* Check if this state implies the object is alive
*
* @return true if alive
*/
public abstract boolean isAlive();
public boolean isAlive() {
return alive;
}
/**
* Check if this state implies the object is running
*
* @return true if running
*/
public abstract boolean isRunning();
public boolean isRunning() {
return running;
}
/**
* Check if this state implies the object is stopped
*
* @return true if stopped
*/
public abstract boolean isStopped();
public boolean isStopped() {
return stopped;
}
}
/**

View file

@ -1050,6 +1050,22 @@ public interface TargetObject extends Comparable<TargetObject> {
return ValueUtils.expectType(obj, cls, this, name, fallback, required);
}
/**
* Search the model for a suitable-related object of the given interface
*
* @see TargetObjectSchema#searchForSuitable(Class, List)
* @param <T> the expected type of the interface
* @param cls the class giving the expected type
* @return the found object, or null
*/
public default <T extends TargetObject> T getCachedSuitable(Class<T> cls) {
List<String> found = getModel().getRootSchema().searchForSuitable(cls, getPath());
if (found == null) {
return null;
}
return cls.cast(getModel().getModelValue(found));
}
/**
* Invalidate caches associated with this object, other than those for cached children
*