mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
GP-740: Removed TargetObjectRef and cleaned up.
This commit is contained in:
parent
b9f9c69be4
commit
6614b54248
328 changed files with 3177 additions and 4428 deletions
|
@ -23,7 +23,6 @@ import agent.dbgeng.dbgeng.DebugProcessId;
|
|||
import agent.dbgeng.dbgeng.DebugThreadId;
|
||||
import agent.dbgeng.manager.DbgManager.ExecSuffix;
|
||||
import agent.dbgeng.manager.impl.DbgSectionImpl;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.target.TargetAttachable;
|
||||
|
||||
public interface DbgProcess extends DbgMemoryOperations {
|
||||
|
@ -165,8 +164,7 @@ public interface DbgProcess extends DbgMemoryOperations {
|
|||
* @param ref the target process
|
||||
* @return a future that completes with a set of handles to all threads of the attached process
|
||||
*/
|
||||
CompletableFuture<Set<DbgThread>> reattach(
|
||||
TypedTargetObjectRef<? extends TargetAttachable<?>> ref);
|
||||
CompletableFuture<Set<DbgThread>> reattach(TargetAttachable attachable);
|
||||
|
||||
/**
|
||||
* Execute an arbitrary kd command, capturing its console output
|
||||
|
@ -187,8 +185,8 @@ public interface DbgProcess extends DbgMemoryOperations {
|
|||
* Step the process
|
||||
*
|
||||
* Note that the command can complete before the process has finished stepping. The command
|
||||
* completes as soon as the process is running. A separate stop event is emitted when the step is
|
||||
* completed.
|
||||
* completes as soon as the process is running. A separate stop event is emitted when the step
|
||||
* is completed.
|
||||
*
|
||||
* @param suffix specifies how far to step, or on what conditions stepping ends.
|
||||
*
|
||||
|
@ -200,8 +198,8 @@ public interface DbgProcess extends DbgMemoryOperations {
|
|||
* Step the process
|
||||
*
|
||||
* Note that the command can complete before the process has finished stepping. The command
|
||||
* completes as soon as the process is running. A separate stop event is emitted when the step is
|
||||
* completed.
|
||||
* completes as soon as the process is running. A separate stop event is emitted when the step
|
||||
* is completed.
|
||||
*
|
||||
* @param args specifies how far to step, or on what conditions stepping ends.
|
||||
*
|
||||
|
|
|
@ -17,29 +17,29 @@ package agent.dbgeng.manager.cmd;
|
|||
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
import agent.dbgeng.model.iface1.DbgModelTargetFocusScope;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
|
||||
public class DbgRequestFocusCommand extends AbstractDbgCommand<Void> {
|
||||
|
||||
private DbgModelTargetFocusScope<?> scope;
|
||||
private TargetObjectRef ref;
|
||||
private DbgModelTargetFocusScope scope;
|
||||
private TargetObject obj;
|
||||
|
||||
/**
|
||||
* Set focus for the current ref
|
||||
*
|
||||
* @param manager the manager to execute the command
|
||||
* @param scope in most cases the root object (must be an ancestor for the ref)
|
||||
* @param ref the desired focus
|
||||
* @param obj the desired focus
|
||||
*/
|
||||
public DbgRequestFocusCommand(DbgManagerImpl manager, DbgModelTargetFocusScope<?> scope,
|
||||
TargetObjectRef ref) {
|
||||
public DbgRequestFocusCommand(DbgManagerImpl manager, DbgModelTargetFocusScope scope,
|
||||
TargetObject obj) {
|
||||
super(manager);
|
||||
this.scope = scope;
|
||||
this.ref = ref;
|
||||
this.obj = obj;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke() {
|
||||
scope.doRequestFocus(ref);
|
||||
scope.doRequestFocus(obj);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package agent.dbgeng.manager.impl;
|
||||
|
||||
import static ghidra.async.AsyncUtils.*;
|
||||
import static ghidra.async.AsyncUtils.sequence;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
@ -44,7 +44,7 @@ import agent.dbgeng.model.iface1.DbgModelTargetFocusScope;
|
|||
import ghidra.async.*;
|
||||
import ghidra.async.seq.AsyncSequenceHandlerForRunner;
|
||||
import ghidra.comm.util.BitmaskSet;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.util.HandlerMap;
|
||||
import ghidra.lifecycle.Internal;
|
||||
import ghidra.util.Msg;
|
||||
|
@ -1400,9 +1400,9 @@ public class DbgManagerImpl implements DbgManager {
|
|||
return execute(new DbgSessionSelectCommand(this, session));
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> requestFocus(DbgModelTargetFocusScope<?> scope,
|
||||
TargetObjectRef ref) {
|
||||
return execute(new DbgRequestFocusCommand(this, scope, ref));
|
||||
public CompletableFuture<Void> requestFocus(DbgModelTargetFocusScope scope,
|
||||
TargetObject obj) {
|
||||
return execute(new DbgRequestFocusCommand(this, scope, obj));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
*/
|
||||
package agent.dbgeng.manager.impl;
|
||||
|
||||
import static ghidra.async.AsyncUtils.*;
|
||||
import static ghidra.async.AsyncUtils.sequence;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.util.*;
|
||||
|
@ -32,7 +32,6 @@ import agent.dbgeng.manager.DbgManager.ExecSuffix;
|
|||
import agent.dbgeng.manager.cmd.*;
|
||||
import ghidra.async.TypeSpec;
|
||||
import ghidra.comm.util.BitmaskSet;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.target.TargetAttachable;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
|
@ -267,8 +266,7 @@ public class DbgProcessImpl implements DbgProcess {
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Set<DbgThread>> reattach(
|
||||
TypedTargetObjectRef<? extends TargetAttachable<?>> ref) {
|
||||
public CompletableFuture<Set<DbgThread>> reattach(TargetAttachable attachable) {
|
||||
return sequence(TypeSpec.cls(DbgThread.class).set()).then((seq) -> {
|
||||
select().handle(seq::next);
|
||||
}).then((seq) -> {
|
||||
|
|
|
@ -21,7 +21,7 @@ import agent.dbgeng.manager.DbgProcess;
|
|||
import agent.dbgeng.manager.DbgThread;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
import agent.dbgeng.model.iface2.*;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
|
||||
public interface DbgModelSelectableObject extends DbgModelTargetObject {
|
||||
|
||||
|
@ -43,7 +43,7 @@ public interface DbgModelSelectableObject extends DbgModelTargetObject {
|
|||
}
|
||||
if (this instanceof DbgModelTargetStackFrame) {
|
||||
DbgModelTargetStackFrame tf = (DbgModelTargetStackFrame) this;
|
||||
TargetObjectRef ref = tf.getThread();
|
||||
TargetObject ref = tf.getThread();
|
||||
if (ref instanceof DbgModelTargetThread) {
|
||||
DbgModelTargetThread tt = (DbgModelTargetThread) ref;
|
||||
DbgThread thread = tt.getThread();
|
||||
|
|
|
@ -25,12 +25,12 @@ import ghidra.dbg.target.TargetAccessConditioned;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetAccessConditioned<T extends TargetAccessConditioned<T>>
|
||||
extends DbgModelTargetObject, TargetAccessConditioned<T> {
|
||||
public interface DbgModelTargetAccessConditioned
|
||||
extends DbgModelTargetObject, TargetAccessConditioned {
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility();
|
||||
public boolean isAccessible();
|
||||
|
||||
public void setAccessibility(TargetAccessibility accessibility);
|
||||
public void setAccessible(boolean accessible);
|
||||
|
||||
}
|
||||
|
|
|
@ -25,7 +25,6 @@ import ghidra.dbg.target.TargetAttachable;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetAttachable<T extends TargetAttachable<T>>
|
||||
extends DbgModelTargetObject, TargetAttachable<T> {
|
||||
public interface DbgModelTargetAttachable extends DbgModelTargetObject, TargetAttachable {
|
||||
|
||||
}
|
||||
|
|
|
@ -15,9 +15,7 @@
|
|||
*/
|
||||
package agent.dbgeng.model.iface1;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
import agent.dbgeng.manager.DbgProcess;
|
||||
import agent.dbgeng.manager.impl.DbgProcessImpl;
|
||||
|
@ -25,10 +23,8 @@ import agent.dbgeng.model.iface2.DbgModelTargetAvailable;
|
|||
import agent.dbgeng.model.iface2.DbgModelTargetObject;
|
||||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.async.TypeSpec;
|
||||
import ghidra.dbg.DebuggerObjectModel;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetAttachable;
|
||||
import ghidra.dbg.target.TargetAttacher;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
/**
|
||||
|
@ -38,25 +34,17 @@ import ghidra.util.Msg;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetAttacher<T extends TargetAttacher<T>>
|
||||
extends DbgModelTargetObject, TargetAttacher<T> {
|
||||
public interface DbgModelTargetAttacher extends DbgModelTargetObject, TargetAttacher {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> attach(
|
||||
TypedTargetObjectRef<? extends TargetAttachable<?>> ref) {
|
||||
getModel().assertMine(TargetObjectRef.class, ref);
|
||||
List<String> tPath = ref.getPath();
|
||||
AtomicReference<DbgProcess> process = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetAvailable> attachable = new AtomicReference<>();
|
||||
return AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
getModel().fetchModelObject(tPath).handle(seq::next);
|
||||
}, TypeSpec.cls(TargetObject.class)).then((obj, seq) -> {
|
||||
attachable.set((DbgModelTargetAvailable) DebuggerObjectModel.requireIface(
|
||||
TargetAttachable.class, obj, tPath));
|
||||
getManager().addProcess().handle(seq::next);
|
||||
}, process).then(seq -> {
|
||||
process.get().attach((int) attachable.get().getPid()).handle(seq::nextIgnore);
|
||||
}).finish().exceptionally((exc) -> {
|
||||
public default CompletableFuture<Void> attach(TargetAttachable attachable) {
|
||||
DbgModelTargetAvailable available =
|
||||
getModel().assertMine(DbgModelTargetAvailable.class, attachable);
|
||||
// TODO: This and the below new DbgProcessImpl seem to do the same thing
|
||||
// Both should be expressed the same way
|
||||
return getManager().addProcess().thenAccept(process -> {
|
||||
process.attach(available.getPid());
|
||||
}).exceptionally((exc) -> {
|
||||
Msg.error(this, "attach failed");
|
||||
return null;
|
||||
});
|
||||
|
@ -72,5 +60,4 @@ public interface DbgModelTargetAttacher<T extends TargetAttacher<T>>
|
|||
return null;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ import ghidra.dbg.target.TargetDeletable;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetDeletable<T extends TargetDeletable<T>>
|
||||
extends DbgModelTargetObject, TargetDeletable<T> {
|
||||
public interface DbgModelTargetDeletable extends DbgModelTargetObject, TargetDeletable {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> delete();
|
||||
|
|
|
@ -28,8 +28,7 @@ import ghidra.dbg.target.TargetDetachable;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetDetachable<T extends TargetDetachable<T>>
|
||||
extends DbgModelTargetObject, TargetDetachable<T> {
|
||||
public interface DbgModelTargetDetachable extends DbgModelTargetObject, TargetDetachable {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> detach() {
|
||||
|
|
|
@ -18,8 +18,7 @@ package agent.dbgeng.model.iface1;
|
|||
import agent.dbgeng.model.iface2.DbgModelTargetObject;
|
||||
import ghidra.dbg.target.TargetEnvironment;
|
||||
|
||||
public interface DbgModelTargetEnvironment<T extends TargetEnvironment<T>>
|
||||
extends DbgModelTargetObject, TargetEnvironment<T> {
|
||||
public interface DbgModelTargetEnvironment extends DbgModelTargetObject, TargetEnvironment {
|
||||
|
||||
public void refreshInternal();
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import ghidra.dbg.target.TargetEventScope;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetEventScope<T extends TargetEventScope<T>>
|
||||
extends DbgModelTargetObject, TargetEventScope<T> {
|
||||
public interface DbgModelTargetEventScope extends DbgModelTargetObject, TargetEventScope {
|
||||
|
||||
}
|
||||
|
|
|
@ -29,8 +29,8 @@ import ghidra.dbg.target.TargetExecutionStateful;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetExecutionStateful<T extends TargetExecutionStateful<T>>
|
||||
extends DbgModelTargetObject, TargetExecutionStateful<T> {
|
||||
public interface DbgModelTargetExecutionStateful
|
||||
extends DbgModelTargetObject, TargetExecutionStateful {
|
||||
|
||||
public default TargetExecutionState convertState(DbgState state) {
|
||||
switch (state) {
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
import agent.dbgeng.model.iface2.DbgModelTargetObject;
|
||||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.dbg.agent.AbstractTargetObject;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.error.DebuggerIllegalArgumentException;
|
||||
import ghidra.dbg.target.TargetFocusScope;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
|
@ -33,8 +32,7 @@ import ghidra.dbg.util.PathUtils;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetFocusScope<T extends TargetFocusScope<T>>
|
||||
extends DbgModelTargetObject, TargetFocusScope<T> {
|
||||
public interface DbgModelTargetFocusScope extends DbgModelTargetObject, TargetFocusScope {
|
||||
|
||||
@Override
|
||||
public DbgModelSelectableObject getFocus();
|
||||
|
@ -45,38 +43,36 @@ public interface DbgModelTargetFocusScope<T extends TargetFocusScope<T>>
|
|||
// NB: requestFocus request change in active object - propagates down to manager
|
||||
// (but, of course, may then cause change in state)
|
||||
@Override
|
||||
public default CompletableFuture<Void> requestFocus(TargetObjectRef ref) {
|
||||
return getManager().requestFocus(this, ref);
|
||||
public default CompletableFuture<Void> requestFocus(TargetObject obj) {
|
||||
return getManager().requestFocus(this, obj);
|
||||
}
|
||||
|
||||
public default CompletableFuture<Void> doRequestFocus(TargetObjectRef ref) {
|
||||
public default CompletableFuture<Void> doRequestFocus(TargetObject obj) {
|
||||
if (getManager().isWaiting()) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
getModel().assertMine(TargetObjectRef.class, ref);
|
||||
if (ref.equals(getFocus())) {
|
||||
getModel().assertMine(TargetObject.class, obj);
|
||||
if (obj.equals(getFocus())) {
|
||||
return CompletableFuture.completedFuture(null);
|
||||
}
|
||||
if (!PathUtils.isAncestor(this.getPath(), ref.getPath())) {
|
||||
if (!PathUtils.isAncestor(this.getPath(), obj.getPath())) {
|
||||
throw new DebuggerIllegalArgumentException("Can only focus a successor of the scope");
|
||||
}
|
||||
return ref.fetch().thenCompose(obj -> {
|
||||
TargetObject cur = obj;
|
||||
while (cur != null) {
|
||||
if (cur instanceof DbgModelSelectableObject) {
|
||||
DbgModelSelectableObject sel = (DbgModelSelectableObject) cur;
|
||||
setFocus(sel);
|
||||
return sel.select();
|
||||
}
|
||||
if (cur instanceof AbstractTargetObject) {
|
||||
AbstractTargetObject<?> def = (AbstractTargetObject<?>) cur;
|
||||
cur = def.getImplParent();
|
||||
continue;
|
||||
}
|
||||
throw new AssertionError();
|
||||
TargetObject cur = obj;
|
||||
while (cur != null) {
|
||||
if (cur instanceof DbgModelSelectableObject) {
|
||||
DbgModelSelectableObject sel = (DbgModelSelectableObject) cur;
|
||||
setFocus(sel);
|
||||
return sel.select();
|
||||
}
|
||||
return AsyncUtils.NIL;
|
||||
});
|
||||
if (cur instanceof AbstractTargetObject) {
|
||||
AbstractTargetObject<?> def = (AbstractTargetObject<?>) cur;
|
||||
cur = def.getParent();
|
||||
continue;
|
||||
}
|
||||
throw new AssertionError();
|
||||
}
|
||||
return AsyncUtils.NIL;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,8 +27,7 @@ import ghidra.dbg.target.TargetInterpreter;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetInterpreter<T extends TargetInterpreter<T>>
|
||||
extends DbgModelTargetObject, TargetInterpreter<T> {
|
||||
public interface DbgModelTargetInterpreter extends DbgModelTargetObject, TargetInterpreter {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> execute(String cmd) {
|
||||
|
|
|
@ -27,8 +27,7 @@ import ghidra.dbg.target.TargetInterruptible;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetInterruptible<T extends TargetInterruptible<T>>
|
||||
extends DbgModelTargetObject, TargetInterruptible<T> {
|
||||
public interface DbgModelTargetInterruptible extends DbgModelTargetObject, TargetInterruptible {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> interrupt() {
|
||||
|
|
|
@ -28,8 +28,7 @@ import ghidra.dbg.target.TargetKillable;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetKillable<T extends TargetKillable<T>>
|
||||
extends DbgModelTargetObject, TargetKillable<T> {
|
||||
public interface DbgModelTargetKillable extends DbgModelTargetObject, TargetKillable {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> kill() {
|
||||
|
|
|
@ -32,8 +32,7 @@ import ghidra.dbg.target.TargetLauncher.TargetCmdLineLauncher;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetLauncher<T extends TargetCmdLineLauncher<T>>
|
||||
extends DbgModelTargetObject, TargetCmdLineLauncher<T> {
|
||||
public interface DbgModelTargetLauncher extends DbgModelTargetObject, TargetCmdLineLauncher {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> launch(List<String> args) {
|
||||
|
|
|
@ -23,7 +23,6 @@ import ghidra.dbg.target.TargetMethod;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetMethod<T extends TargetMethod<T>>
|
||||
extends DbgModelTargetObject, TargetMethod<T> {
|
||||
public interface DbgModelTargetMethod extends DbgModelTargetObject, TargetMethod {
|
||||
|
||||
}
|
||||
|
|
|
@ -28,8 +28,7 @@ import ghidra.dbg.target.TargetResumable;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetResumable<T extends TargetResumable<T>>
|
||||
extends DbgModelTargetObject, TargetResumable<T> {
|
||||
public interface DbgModelTargetResumable extends DbgModelTargetObject, TargetResumable {
|
||||
|
||||
@Override
|
||||
public default CompletableFuture<Void> resume() {
|
||||
|
|
|
@ -30,8 +30,7 @@ import ghidra.dbg.target.TargetSteppable;
|
|||
*
|
||||
* @param <T> type for this
|
||||
*/
|
||||
public interface DbgModelTargetSteppable<T extends TargetSteppable<T>>
|
||||
extends DbgModelTargetObject, TargetSteppable<T> {
|
||||
public interface DbgModelTargetSteppable extends DbgModelTargetObject, TargetSteppable {
|
||||
|
||||
default ExecSuffix convertToDbg(TargetStepKind kind) {
|
||||
switch (kind) {
|
||||
|
@ -77,6 +76,7 @@ public interface DbgModelTargetSteppable<T extends TargetSteppable<T>>
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
default CompletableFuture<Void> step(Map<String, ?> args) {
|
||||
DbgThread thread = getManager().getCurrentThread();
|
||||
return thread.step(args);
|
||||
|
|
|
@ -17,8 +17,7 @@ package agent.dbgeng.model.iface2;
|
|||
|
||||
import ghidra.dbg.target.TargetAttachable;
|
||||
|
||||
public interface DbgModelTargetAvailable
|
||||
extends DbgModelTargetObject, TargetAttachable<DbgModelTargetAvailable> {
|
||||
public interface DbgModelTargetAvailable extends DbgModelTargetObject, TargetAttachable {
|
||||
|
||||
public long getPid();
|
||||
|
||||
|
|
|
@ -27,11 +27,15 @@ import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
|
|||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.program.model.address.AddressRange;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "BreakpointContainer", elements = {
|
||||
@TargetElementType(type = DbgModelTargetBreakpointSpec.class) }, attributes = {
|
||||
@TargetAttributeType(type = Void.class) }, canonicalContainer = true)
|
||||
public interface DbgModelTargetBreakpointContainer extends DbgModelTargetObject,
|
||||
TargetBreakpointContainer<DbgModelTargetBreakpointContainer>, DbgEventsListenerAdapter {
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "BreakpointContainer",
|
||||
elements = {
|
||||
@TargetElementType(type = DbgModelTargetBreakpointSpec.class) },
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class) },
|
||||
canonicalContainer = true)
|
||||
public interface DbgModelTargetBreakpointContainer
|
||||
extends DbgModelTargetObject, TargetBreakpointContainer, DbgEventsListenerAdapter {
|
||||
|
||||
/*
|
||||
@Override
|
||||
|
|
|
@ -15,17 +15,17 @@
|
|||
*/
|
||||
package agent.dbgeng.model.iface2;
|
||||
|
||||
import ghidra.dbg.attributes.TargetObjectRefList;
|
||||
import ghidra.dbg.attributes.TargetObjectList;
|
||||
import ghidra.dbg.target.TargetBreakpointLocation;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
public interface DbgModelTargetBreakpointLocation
|
||||
extends DbgModelTargetObject, TargetBreakpointLocation<DbgModelTargetBreakpointLocation> {
|
||||
extends DbgModelTargetObject, TargetBreakpointLocation {
|
||||
|
||||
@Override
|
||||
public Address getAddress();
|
||||
|
||||
@Override
|
||||
public TargetObjectRefList<?> getAffects();
|
||||
public TargetObjectList<?> getAffects();
|
||||
|
||||
}
|
||||
|
|
|
@ -21,16 +21,16 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
import agent.dbgeng.model.iface1.DbgModelTargetBptHelper;
|
||||
import ghidra.dbg.attributes.TargetObjectRefList;
|
||||
import ghidra.dbg.attributes.TargetObjectList;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetBreakpointContainer.TargetBreakpointKindSet;
|
||||
import ghidra.program.model.address.*;
|
||||
|
||||
public interface DbgModelTargetBreakpointSpec extends //
|
||||
DbgModelTargetObject, //
|
||||
TargetBreakpointSpec<DbgModelTargetBreakpointSpec>, //
|
||||
TargetBreakpointLocation<DbgModelTargetBreakpointSpec>, //
|
||||
TargetDeletable<DbgModelTargetBreakpointSpec>, //
|
||||
TargetBreakpointSpec, //
|
||||
TargetBreakpointLocation, //
|
||||
TargetDeletable, //
|
||||
DbgModelTargetBptHelper {
|
||||
|
||||
String BPT_ACCESS_ATTRIBUTE_NAME = "Access";
|
||||
|
@ -129,9 +129,9 @@ public interface DbgModelTargetBreakpointSpec extends //
|
|||
return getModel().getAddress("ram", info.addrAsLong());
|
||||
}
|
||||
|
||||
public default TargetObjectRefList<?> doGetAffects() {
|
||||
public default TargetObjectList<?> doGetAffects() {
|
||||
DbgModelTargetProcess process = getParentProcess();
|
||||
return TargetObjectRefList.of(process);
|
||||
return TargetObjectList.of(process);
|
||||
}
|
||||
|
||||
public default void updateInfo(DbgBreakpointInfo oldInfo, DbgBreakpointInfo newInfo,
|
||||
|
|
|
@ -23,7 +23,7 @@ import ghidra.dbg.target.TargetLauncher;
|
|||
import ghidra.dbg.target.TargetMethod.TargetParameterMap;
|
||||
|
||||
public interface DbgModelTargetConnector
|
||||
extends DbgModelSelectableObject, TargetLauncher<DbgModelTargetConnector> {
|
||||
extends DbgModelSelectableObject, TargetLauncher {
|
||||
|
||||
@Override
|
||||
public default String getDisplay() {
|
||||
|
|
|
@ -17,8 +17,7 @@ package agent.dbgeng.model.iface2;
|
|||
|
||||
import ghidra.dbg.target.TargetEnvironment;
|
||||
|
||||
public interface DbgModelTargetEnvironmentEx
|
||||
extends DbgModelTargetObject, TargetEnvironment<DbgModelTargetEnvironmentEx> {
|
||||
public interface DbgModelTargetEnvironmentEx extends DbgModelTargetObject, TargetEnvironment {
|
||||
|
||||
public void refreshInternal();
|
||||
|
||||
|
|
|
@ -21,8 +21,7 @@ import agent.dbgeng.manager.DbgModuleMemory;
|
|||
import ghidra.dbg.target.TargetMemory;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
public interface DbgModelTargetMemoryContainer
|
||||
extends DbgModelTargetObject, TargetMemory<DbgModelTargetMemoryContainer> {
|
||||
public interface DbgModelTargetMemoryContainer extends DbgModelTargetObject, TargetMemory {
|
||||
|
||||
public DbgModelTargetMemoryRegion getTargetMemory(DbgModuleMemory region);
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ package agent.dbgeng.model.iface2;
|
|||
import ghidra.dbg.target.TargetMemoryRegion;
|
||||
import ghidra.program.model.address.AddressRange;
|
||||
|
||||
public interface DbgModelTargetMemoryRegion
|
||||
extends DbgModelTargetObject, TargetMemoryRegion<DbgModelTargetMemoryRegion> {
|
||||
public interface DbgModelTargetMemoryRegion extends DbgModelTargetObject, TargetMemoryRegion {
|
||||
|
||||
@Override
|
||||
public AddressRange getRange();
|
||||
|
|
|
@ -23,9 +23,7 @@ import ghidra.dbg.target.TargetModule;
|
|||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.program.model.address.*;
|
||||
|
||||
public interface DbgModelTargetModule extends //
|
||||
DbgModelTargetObject, //
|
||||
TargetModule<DbgModelTargetModule> {
|
||||
public interface DbgModelTargetModule extends DbgModelTargetObject, TargetModule {
|
||||
|
||||
DbgModule getDbgModule();
|
||||
|
||||
|
|
|
@ -21,13 +21,11 @@ import agent.dbgeng.model.iface1.DbgModelTargetEventScope;
|
|||
import ghidra.dbg.target.TargetModule;
|
||||
import ghidra.dbg.target.TargetModuleContainer;
|
||||
|
||||
public interface DbgModelTargetModuleContainer extends //
|
||||
//DbgModelTargetObject,
|
||||
DbgModelTargetEventScope<DbgModelTargetModuleContainer>, //
|
||||
TargetModuleContainer<DbgModelTargetModuleContainer> {
|
||||
public interface DbgModelTargetModuleContainer
|
||||
extends /*DbgModelTargetObject,*/ DbgModelTargetEventScope, TargetModuleContainer {
|
||||
|
||||
@Override
|
||||
public CompletableFuture<? extends TargetModule<?>> addSyntheticModule(String name);
|
||||
public CompletableFuture<? extends TargetModule> addSyntheticModule(String name);
|
||||
|
||||
public CompletableFuture<DbgModelTargetModule> getTargetModule(String name);
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ package agent.dbgeng.model.iface2;
|
|||
import ghidra.dbg.target.TargetSection;
|
||||
import ghidra.program.model.address.AddressRange;
|
||||
|
||||
public interface DbgModelTargetModuleSection
|
||||
extends DbgModelTargetObject, TargetSection<DbgModelTargetModuleSection> {
|
||||
public interface DbgModelTargetModuleSection extends DbgModelTargetObject, TargetSection {
|
||||
|
||||
@Override
|
||||
public AddressRange getRange();
|
||||
|
|
|
@ -25,7 +25,6 @@ import agent.dbgeng.model.AbstractDbgModel;
|
|||
import ghidra.dbg.agent.InvalidatableTargetObjectIf;
|
||||
import ghidra.dbg.agent.SpiTargetObject;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.TargetObject.TargetObjectListener;
|
||||
import ghidra.dbg.util.CollectionUtils.Delta;
|
||||
import ghidra.util.datastruct.ListenerSet;
|
||||
|
||||
|
@ -61,8 +60,6 @@ public interface DbgModelTargetObject extends SpiTargetObject, InvalidatableTarg
|
|||
@Override
|
||||
public CompletableFuture<? extends Map<String, ?>> fetchAttributes();
|
||||
|
||||
public TargetObject getImplParent();
|
||||
|
||||
public Delta<?, ?> changeAttributes(List<String> remove, Map<String, ?> add, String reason);
|
||||
|
||||
public CompletableFuture<? extends Map<String, ?>> requestNativeAttributes();
|
||||
|
|
|
@ -29,18 +29,18 @@ import ghidra.dbg.util.PathUtils;
|
|||
|
||||
public interface DbgModelTargetProcess extends //
|
||||
TargetAggregate, //
|
||||
TargetProcess<DbgModelTargetProcess>, //
|
||||
DbgModelTargetExecutionStateful<DbgModelTargetProcess>, //
|
||||
DbgModelTargetAccessConditioned<DbgModelTargetProcess>, //
|
||||
DbgModelTargetAttacher<DbgModelTargetProcess>, //
|
||||
DbgModelTargetAttachable<DbgModelTargetProcess>, //
|
||||
DbgModelTargetLauncher<DbgModelTargetProcess>, //
|
||||
DbgModelTargetDeletable<DbgModelTargetProcess>, //
|
||||
DbgModelTargetDetachable<DbgModelTargetProcess>, //
|
||||
DbgModelTargetKillable<DbgModelTargetProcess>, //
|
||||
DbgModelTargetResumable<DbgModelTargetProcess>, //
|
||||
DbgModelTargetSteppable<DbgModelTargetProcess>, //
|
||||
DbgModelTargetInterruptible<DbgModelTargetProcess>, //
|
||||
TargetProcess, //
|
||||
DbgModelTargetExecutionStateful, //
|
||||
DbgModelTargetAccessConditioned, //
|
||||
DbgModelTargetAttacher, //
|
||||
DbgModelTargetAttachable, //
|
||||
DbgModelTargetLauncher, //
|
||||
DbgModelTargetDeletable, //
|
||||
DbgModelTargetDetachable, //
|
||||
DbgModelTargetKillable, //
|
||||
DbgModelTargetResumable, //
|
||||
DbgModelTargetSteppable, //
|
||||
DbgModelTargetInterruptible, //
|
||||
DbgEventsListenerAdapter, //
|
||||
DbgModelSelectableObject {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import agent.dbgeng.model.iface1.DbgModelTargetEventScope;
|
|||
|
||||
public interface DbgModelTargetProcessContainer extends //
|
||||
//DbgModelTargetObject,
|
||||
DbgModelTargetEventScope<DbgModelTargetProcessContainer>, //
|
||||
DbgModelTargetEventScope, //
|
||||
DbgEventsListenerAdapter {
|
||||
|
||||
public DbgModelTargetProcess getTargetProcess(DebugProcessId id);
|
||||
|
|
|
@ -18,8 +18,7 @@ package agent.dbgeng.model.iface2;
|
|||
import agent.dbgeng.manager.impl.DbgRegister;
|
||||
import ghidra.dbg.target.TargetRegister;
|
||||
|
||||
public interface DbgModelTargetRegister
|
||||
extends DbgModelTargetObject, TargetRegister<DbgModelTargetRegister> {
|
||||
public interface DbgModelTargetRegister extends DbgModelTargetObject, TargetRegister {
|
||||
|
||||
@Override
|
||||
public int getBitLength();
|
||||
|
|
|
@ -30,8 +30,7 @@ import ghidra.dbg.util.ConversionUtils;
|
|||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.ListenerSet;
|
||||
|
||||
public interface DbgModelTargetRegisterBank
|
||||
extends DbgModelTargetObject, TargetRegisterBank<DbgModelTargetRegisterBank> {
|
||||
public interface DbgModelTargetRegisterBank extends DbgModelTargetObject, TargetRegisterBank {
|
||||
|
||||
public DbgModelTargetRegister getTargetRegister(DbgRegister register);
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ import agent.dbgeng.manager.impl.DbgRegister;
|
|||
import ghidra.dbg.target.TargetRegisterContainer;
|
||||
|
||||
public interface DbgModelTargetRegisterContainer
|
||||
extends DbgModelTargetObject, TargetRegisterContainer<DbgModelTargetRegisterContainer> {
|
||||
extends DbgModelTargetObject, TargetRegisterContainer {
|
||||
|
||||
public DbgModelTargetRegister getTargetRegister(DbgRegister register);
|
||||
|
||||
|
|
|
@ -19,9 +19,8 @@ import agent.dbgeng.manager.impl.DbgRegister;
|
|||
import ghidra.dbg.target.TargetRegisterBank;
|
||||
import ghidra.dbg.target.TargetRegisterContainer;
|
||||
|
||||
public interface DbgModelTargetRegisterContainerAndBank extends DbgModelTargetObject, //
|
||||
TargetRegisterContainer<DbgModelTargetRegisterContainerAndBank>, //
|
||||
TargetRegisterBank<DbgModelTargetRegisterContainerAndBank> {
|
||||
public interface DbgModelTargetRegisterContainerAndBank
|
||||
extends DbgModelTargetObject, TargetRegisterContainer, TargetRegisterBank {
|
||||
|
||||
public DbgModelTargetRegister getTargetRegister(DbgRegister register);
|
||||
|
||||
|
|
|
@ -20,11 +20,11 @@ import agent.dbgeng.model.iface1.*;
|
|||
|
||||
public interface DbgModelTargetRoot extends //
|
||||
///DbgModelTargetObject,
|
||||
DbgModelTargetAccessConditioned<DbgModelTargetRoot>, //
|
||||
DbgModelTargetAttacher<DbgModelTargetRoot>, //
|
||||
DbgModelTargetEventScope<DbgModelTargetRoot>, //
|
||||
DbgModelTargetLauncher<DbgModelTargetRoot>, //
|
||||
DbgModelTargetFocusScope<DbgModelTargetRoot>, //
|
||||
DbgModelTargetAccessConditioned, //
|
||||
DbgModelTargetAttacher, //
|
||||
DbgModelTargetEventScope, //
|
||||
DbgModelTargetLauncher, //
|
||||
DbgModelTargetFocusScope, //
|
||||
DbgEventsListenerAdapter {
|
||||
|
||||
void setDefaultConnector(DbgModelTargetConnector defaultConnector);
|
||||
|
|
|
@ -30,12 +30,12 @@ import ghidra.dbg.target.TargetFocusScope.TargetFocusScopeListener;
|
|||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
public interface DbgModelTargetSession extends //
|
||||
DbgModelTargetAccessConditioned<DbgModelTargetSession>, //
|
||||
//DbgModelTargetFocusScope<DbgModelTargetSession>, //
|
||||
DbgModelTargetExecutionStateful<DbgModelTargetSession>, //
|
||||
DbgModelTargetInterpreter<DbgModelTargetSession>, //
|
||||
DbgModelTargetInterruptible<DbgModelTargetSession>, //
|
||||
DbgModelTargetResumable<DbgModelTargetSession>, //
|
||||
DbgModelTargetAccessConditioned, //
|
||||
//DbgModelTargetFocusScope, //
|
||||
DbgModelTargetExecutionStateful, //
|
||||
DbgModelTargetInterpreter, //
|
||||
DbgModelTargetInterruptible, //
|
||||
DbgModelTargetResumable, //
|
||||
DbgEventsListenerAdapter, //
|
||||
DbgModelSelectableObject, //
|
||||
TargetFocusScopeListener, //
|
||||
|
|
|
@ -20,7 +20,7 @@ import agent.dbgeng.model.iface1.DbgModelTargetEnvironment;
|
|||
|
||||
public interface DbgModelTargetSessionAttributes extends
|
||||
//DbgModelTargetObject,
|
||||
DbgModelTargetEnvironment<DbgModelTargetSessionAttributes>, //
|
||||
DbgModelTargetEnvironment, //
|
||||
DbgEventsListenerAdapter {
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,7 @@ import agent.dbgeng.manager.DbgStackFrame;
|
|||
import ghidra.dbg.target.TargetStack;
|
||||
|
||||
public interface DbgModelTargetStack
|
||||
extends DbgModelTargetObject, TargetStack<DbgModelTargetStack> {
|
||||
extends DbgModelTargetObject, TargetStack {
|
||||
|
||||
public DbgModelTargetStackFrame getTargetFrame(DbgStackFrame frame);
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import agent.dbgeng.manager.DbgStackFrame;
|
|||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
import agent.dbgeng.manager.impl.DbgThreadImpl;
|
||||
import agent.dbgeng.model.iface1.DbgModelSelectableObject;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.TargetStackFrame;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
@ -31,7 +30,7 @@ import ghidra.program.model.address.AddressSpace;
|
|||
|
||||
public interface DbgModelTargetStackFrame extends //
|
||||
//DbgModelTargetObject,
|
||||
TargetStackFrame<DbgModelTargetStackFrame>, //
|
||||
TargetStackFrame, //
|
||||
DbgEventsListenerAdapter, //
|
||||
DbgModelSelectableObject {
|
||||
|
||||
|
@ -90,7 +89,7 @@ public interface DbgModelTargetStackFrame extends //
|
|||
|
||||
public void setFrame(DbgStackFrame frame);
|
||||
|
||||
public TargetObjectRef getThread();
|
||||
public TargetObject getThread();
|
||||
|
||||
public Address getPC();
|
||||
|
||||
|
|
|
@ -18,8 +18,7 @@ package agent.dbgeng.model.iface2;
|
|||
import ghidra.dbg.target.TargetSymbol;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
public interface DbgModelTargetSymbol
|
||||
extends DbgModelTargetObject, TargetSymbol<DbgModelTargetSymbol> {
|
||||
public interface DbgModelTargetSymbol extends DbgModelTargetObject, TargetSymbol {
|
||||
|
||||
@Override
|
||||
public boolean isConstant();
|
||||
|
|
|
@ -19,8 +19,7 @@ import agent.dbgeng.manager.impl.DbgMinimalSymbol;
|
|||
import agent.dbgeng.model.impl.DbgModelTargetSymbolImpl;
|
||||
import ghidra.dbg.target.TargetSymbolNamespace;
|
||||
|
||||
public interface DbgModelTargetSymbolContainer
|
||||
extends DbgModelTargetObject, TargetSymbolNamespace<DbgModelTargetSymbolContainer> {
|
||||
public interface DbgModelTargetSymbolContainer extends DbgModelTargetObject, TargetSymbolNamespace {
|
||||
|
||||
public DbgModelTargetSymbolImpl getTargetSymbol(DbgMinimalSymbol symbol);
|
||||
|
||||
|
|
|
@ -28,10 +28,10 @@ import ghidra.dbg.target.TargetThread;
|
|||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
public interface DbgModelTargetThread extends //
|
||||
TargetThread<DbgModelTargetThread>, //
|
||||
DbgModelTargetAccessConditioned<DbgModelTargetThread>, //
|
||||
DbgModelTargetExecutionStateful<DbgModelTargetThread>, //
|
||||
DbgModelTargetSteppable<DbgModelTargetThread>, //
|
||||
TargetThread, //
|
||||
DbgModelTargetAccessConditioned, //
|
||||
DbgModelTargetExecutionStateful, //
|
||||
DbgModelTargetSteppable, //
|
||||
DbgEventsListenerAdapter, //
|
||||
DbgModelSelectableObject {
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ import agent.dbgeng.model.iface1.DbgModelTargetEventScope;
|
|||
|
||||
public interface DbgModelTargetThreadContainer extends //
|
||||
//DbgModelTargetObject,
|
||||
DbgModelTargetEventScope<DbgModelTargetThreadContainer>, //
|
||||
DbgModelTargetEventScope, //
|
||||
DbgEventsListenerAdapter {
|
||||
|
||||
public void threadCreated(DbgThread thread);
|
||||
|
|
|
@ -29,17 +29,20 @@ import agent.dbgeng.manager.impl.DbgManagerImpl;
|
|||
import agent.dbgeng.model.iface2.*;
|
||||
import ghidra.dbg.error.DebuggerMemoryAccessException;
|
||||
import ghidra.dbg.error.DebuggerModelAccessException;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.program.model.address.Address;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Memory", elements = { //
|
||||
@TargetElementType(type = DbgModelTargetMemoryRegionImpl.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Memory",
|
||||
elements = {
|
||||
@TargetElementType(type = DbgModelTargetMemoryRegionImpl.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class DbgModelTargetMemoryContainerImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetMemoryContainer {
|
||||
|
||||
|
@ -256,12 +259,11 @@ public class DbgModelTargetMemoryContainerImpl extends DbgModelTargetObjectImpl
|
|||
@Override
|
||||
public void onRunning() {
|
||||
invalidateMemoryCaches();
|
||||
setAccessibility(TargetAccessibility.INACCESSIBLE);
|
||||
setAccessible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void update() {
|
||||
requestElements(true);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -30,11 +30,15 @@ import ghidra.dbg.target.schema.*;
|
|||
import ghidra.lifecycle.Internal;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "ModuleContainer", elements = { //
|
||||
@TargetElementType(type = DbgModelTargetModuleImpl.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "ModuleContainer",
|
||||
elements = { //
|
||||
@TargetElementType(type = DbgModelTargetModuleImpl.class) //
|
||||
},
|
||||
attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class DbgModelTargetModuleContainerImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetModuleContainer {
|
||||
// NOTE: -file-list-shared-libraries omits the main module and system-supplied DSO.
|
||||
|
@ -97,7 +101,7 @@ public class DbgModelTargetModuleContainerImpl extends DbgModelTargetObjectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<? extends TargetModule<?>> addSyntheticModule(String name) {
|
||||
public CompletableFuture<? extends TargetModule> addSyntheticModule(String name) {
|
||||
throw new UnsupportedOperationException("Dbgeng Does not support synthetic modules");
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,14 @@ import agent.dbgeng.model.iface2.DbgModelTargetModuleSection;
|
|||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.program.model.address.*;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Section", elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Section",
|
||||
elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
},
|
||||
attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
public class DbgModelTargetModuleSectionImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetModuleSection {
|
||||
protected static final String OBJFILE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "objfile";
|
||||
|
@ -45,7 +48,7 @@ public class DbgModelTargetModuleSectionImpl extends DbgModelTargetObjectImpl
|
|||
range = new AddressRangeImpl(min, max);
|
||||
|
||||
changeAttributes(List.of(), List.of(), Map.of( //
|
||||
MODULE_ATTRIBUTE_NAME, sections.getImplParent(), //
|
||||
MODULE_ATTRIBUTE_NAME, sections.getParent(), //
|
||||
RANGE_ATTRIBUTE_NAME, range, //
|
||||
DISPLAY_ATTRIBUTE_NAME, section.getName(), //
|
||||
UPDATE_MODE_ATTRIBUTE_NAME, TargetUpdateMode.FIXED //
|
||||
|
|
|
@ -26,7 +26,6 @@ import agent.dbgeng.model.iface1.DbgModelTargetExecutionStateful;
|
|||
import agent.dbgeng.model.iface2.*;
|
||||
import ghidra.dbg.agent.DefaultTargetObject;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibilityListener;
|
||||
import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;
|
||||
import ghidra.dbg.target.schema.TargetObjectSchema;
|
||||
|
@ -34,7 +33,7 @@ import ghidra.dbg.target.schema.TargetObjectSchema;
|
|||
public class DbgModelTargetObjectImpl extends DefaultTargetObject<TargetObject, TargetObject>
|
||||
implements DbgModelTargetObject {
|
||||
|
||||
protected TargetAccessibility accessibility = TargetAccessibility.ACCESSIBLE;
|
||||
protected boolean accessible = true;
|
||||
protected final DbgStateListener accessListener = this::checkExited;
|
||||
private boolean modified;
|
||||
|
||||
|
@ -61,22 +60,21 @@ public class DbgModelTargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
getManager().removeStateListener(accessListener);
|
||||
}
|
||||
|
||||
public void setAccessibility(TargetAccessibility accessibility) {
|
||||
public void setAccessible(boolean accessible) {
|
||||
synchronized (attributes) {
|
||||
if (this.accessibility == accessibility) {
|
||||
if (this.accessible == accessible) {
|
||||
return;
|
||||
}
|
||||
this.accessibility = accessibility;
|
||||
this.accessible = accessible;
|
||||
}
|
||||
if (this instanceof DbgModelTargetAccessConditioned<?>) {
|
||||
if (this instanceof DbgModelTargetAccessConditioned) {
|
||||
changeAttributes(List.of(), List.of(), Map.of( //
|
||||
TargetAccessConditioned.ACCESSIBLE_ATTRIBUTE_NAME,
|
||||
accessibility == TargetAccessibility.ACCESSIBLE //
|
||||
TargetAccessConditioned.ACCESSIBLE_ATTRIBUTE_NAME, accessible //
|
||||
), "Accessibility changed");
|
||||
DbgModelTargetAccessConditioned<?> accessConditioned =
|
||||
(DbgModelTargetAccessConditioned<?>) this;
|
||||
DbgModelTargetAccessConditioned accessConditioned =
|
||||
(DbgModelTargetAccessConditioned) this;
|
||||
listeners.fire(TargetAccessibilityListener.class)
|
||||
.accessibilityChanged(accessConditioned, accessibility);
|
||||
.accessibilityChanged(accessConditioned, accessible);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,16 +84,16 @@ public class DbgModelTargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
}
|
||||
|
||||
public void onRunning() {
|
||||
setAccessibility(TargetAccessibility.INACCESSIBLE);
|
||||
setAccessible(false);
|
||||
}
|
||||
|
||||
public void onStopped() {
|
||||
setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
setAccessible(true);
|
||||
update();
|
||||
}
|
||||
|
||||
public void onExit() {
|
||||
setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
setAccessible(true);
|
||||
}
|
||||
|
||||
protected void update() {
|
||||
|
@ -139,7 +137,7 @@ public class DbgModelTargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
}
|
||||
}
|
||||
if (this instanceof DbgModelTargetExecutionStateful) {
|
||||
DbgModelTargetExecutionStateful<?> stateful = (DbgModelTargetExecutionStateful<?>) this;
|
||||
DbgModelTargetExecutionStateful stateful = (DbgModelTargetExecutionStateful) this;
|
||||
stateful.setExecutionState(exec, "Refreshed");
|
||||
}
|
||||
}
|
||||
|
@ -153,7 +151,7 @@ public class DbgModelTargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
public DbgModelTargetSession getParentSession() {
|
||||
DbgModelTargetObject test = (DbgModelTargetObject) parent;
|
||||
while (test != null && !(test instanceof DbgModelTargetSession)) {
|
||||
test = (DbgModelTargetObject) test.getImplParent();
|
||||
test = (DbgModelTargetObject) test.getParent();
|
||||
}
|
||||
return test == null ? null : (DbgModelTargetSession) test;
|
||||
}
|
||||
|
@ -162,7 +160,7 @@ public class DbgModelTargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
public DbgModelTargetProcess getParentProcess() {
|
||||
DbgModelTargetObject test = (DbgModelTargetObject) parent;
|
||||
while (test != null && !(test instanceof TargetProcess)) {
|
||||
test = (DbgModelTargetObject) test.getImplParent();
|
||||
test = (DbgModelTargetObject) test.getParent();
|
||||
}
|
||||
return test == null ? null : (DbgModelTargetProcess) test;
|
||||
}
|
||||
|
@ -171,7 +169,7 @@ public class DbgModelTargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
public DbgModelTargetThread getParentThread() {
|
||||
DbgModelTargetObject test = (DbgModelTargetObject) parent;
|
||||
while (test != null && !(test instanceof TargetThread)) {
|
||||
test = (DbgModelTargetObject) test.getImplParent();
|
||||
test = (DbgModelTargetObject) test.getParent();
|
||||
}
|
||||
return test == null ? null : (DbgModelTargetThread) test;
|
||||
}
|
||||
|
|
|
@ -23,16 +23,19 @@ import java.util.stream.Collectors;
|
|||
import agent.dbgeng.dbgeng.*;
|
||||
import agent.dbgeng.manager.*;
|
||||
import agent.dbgeng.model.iface2.*;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "ProcessContainer", elements = { //
|
||||
@TargetElementType(type = DbgModelTargetProcessImpl.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "ProcessContainer",
|
||||
elements = { //
|
||||
@TargetElementType(type = DbgModelTargetProcessImpl.class) //
|
||||
},
|
||||
attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class DbgModelTargetProcessContainerImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetProcessContainer {
|
||||
|
||||
|
@ -47,8 +50,8 @@ public class DbgModelTargetProcessContainerImpl extends DbgModelTargetObjectImpl
|
|||
|
||||
@Override
|
||||
public void processAdded(DbgProcess proc, DbgCause cause) {
|
||||
DbgModelTargetSession session = (DbgModelTargetSession) getImplParent();
|
||||
session.setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
DbgModelTargetSession session = (DbgModelTargetSession) getParent();
|
||||
session.setAccessible(true);
|
||||
DbgModelTargetProcess process = getTargetProcess(proc);
|
||||
changeElements(List.of(), List.of(process), Map.of(), "Added");
|
||||
process.processStarted(proc.getPid());
|
||||
|
|
|
@ -28,22 +28,38 @@ import agent.dbgeng.model.iface2.*;
|
|||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.async.TypeSpec;
|
||||
import ghidra.dbg.DebugModelConventions;
|
||||
import ghidra.dbg.DebuggerObjectModel;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Process", elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(name = "Debug", type = DbgModelTargetDebugContainerImpl.class, required = true, fixed = true), //
|
||||
@TargetAttributeType(name = "Memory", type = DbgModelTargetMemoryContainerImpl.class, required = true, fixed = true), //
|
||||
@TargetAttributeType(name = "Modules", type = DbgModelTargetModuleContainerImpl.class, required = true, fixed = true), //
|
||||
@TargetAttributeType(name = "Threads", type = DbgModelTargetThreadContainerImpl.class, required = true, fixed = true), //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Process",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(
|
||||
name = "Debug",
|
||||
type = DbgModelTargetDebugContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Memory",
|
||||
type = DbgModelTargetMemoryContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Modules",
|
||||
type = DbgModelTargetModuleContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Threads",
|
||||
type = DbgModelTargetThreadContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class DbgModelTargetProcessImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetProcess {
|
||||
|
||||
|
@ -113,7 +129,7 @@ public class DbgModelTargetProcessImpl extends DbgModelTargetObjectImpl
|
|||
@Override
|
||||
public void processSelected(DbgProcess eventProcess, DbgCause cause) {
|
||||
if (eventProcess.equals(process)) {
|
||||
AtomicReference<DbgModelTargetFocusScope<?>> scope = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetFocusScope> scope = new AtomicReference<>();
|
||||
AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
DebugModelConventions.findSuitable(DbgModelTargetFocusScope.class, this)
|
||||
.handle(seq::next);
|
||||
|
@ -146,25 +162,16 @@ public class DbgModelTargetProcessImpl extends DbgModelTargetObjectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> attach(TypedTargetObjectRef<? extends TargetAttachable<?>> ref) {
|
||||
getModel().assertMine(TargetObjectRef.class, ref);
|
||||
public CompletableFuture<Void> attach(TargetAttachable attachable) {
|
||||
getModel().assertMine(TargetObject.class, attachable);
|
||||
// NOTE: Get the object and type check it myself.
|
||||
// The typed ref could have been unsafely cast
|
||||
List<String> tPath = ref.getPath();
|
||||
return AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
getModel().fetchModelObject(tPath).handle(seq::next);
|
||||
}, TypeSpec.cls(TargetObject.class)).then((obj, seq) -> {
|
||||
TargetAttachable<?> attachable =
|
||||
DebuggerObjectModel.requireIface(TargetAttachable.class, obj, tPath);
|
||||
process.reattach(attachable);
|
||||
}).finish();
|
||||
return process.reattach(attachable).thenApply(set -> null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> attach(long pid) {
|
||||
return AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
process.attach(pid).handle(seq::nextIgnore);
|
||||
}).finish();
|
||||
return process.attach(pid).thenApply(set -> null);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -218,7 +225,7 @@ public class DbgModelTargetProcessImpl extends DbgModelTargetObjectImpl
|
|||
@Override
|
||||
public void onExit() {
|
||||
super.onExit();
|
||||
DbgModelTargetProcessContainer processes = (DbgModelTargetProcessContainer) getImplParent();
|
||||
DbgModelTargetProcessContainer processes = (DbgModelTargetProcessContainer) getParent();
|
||||
processes.processRemoved(process.getId(), DbgCause.Causes.UNCLAIMED);
|
||||
}
|
||||
|
||||
|
@ -244,8 +251,7 @@ public class DbgModelTargetProcessImpl extends DbgModelTargetObjectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility() {
|
||||
return accessibility;
|
||||
public boolean isAccessible() {
|
||||
return accessible;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -26,22 +26,24 @@ import agent.dbgeng.manager.impl.DbgRegisterSet;
|
|||
import agent.dbgeng.model.iface2.*;
|
||||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.async.TypeSpec;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.error.DebuggerRegisterAccessException;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.TargetRegisterBank;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.ConversionUtils;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "RegisterContainer", elements = { //
|
||||
@TargetElementType(type = DbgModelTargetRegisterImpl.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType( //
|
||||
name = TargetRegisterBank.DESCRIPTIONS_ATTRIBUTE_NAME, //
|
||||
type=DbgModelTargetRegisterContainerImpl.class),
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "RegisterContainer",
|
||||
elements = {
|
||||
@TargetElementType(type = DbgModelTargetRegisterImpl.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(
|
||||
name = TargetRegisterBank.DESCRIPTIONS_ATTRIBUTE_NAME,
|
||||
type = DbgModelTargetRegisterContainerImpl.class),
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class DbgModelTargetRegisterContainerImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetRegisterContainerAndBank {
|
||||
|
||||
|
@ -139,7 +141,7 @@ public class DbgModelTargetRegisterContainerImpl extends DbgModelTargetObjectImp
|
|||
}, TypeSpec.cls(DbgRegisterSet.class)).then((regs, seq) -> {
|
||||
fetchElements().handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Map<String, ? extends TargetObjectRef> regs = getCachedElements();
|
||||
Map<String, ? extends TargetObject> regs = getCachedElements();
|
||||
Map<DbgRegister, BigInteger> toWrite = new LinkedHashMap<>();
|
||||
for (Map.Entry<String, byte[]> ent : values.entrySet()) {
|
||||
String regname = ent.getKey();
|
||||
|
@ -168,12 +170,12 @@ public class DbgModelTargetRegisterContainerImpl extends DbgModelTargetObjectImp
|
|||
public void onRunning() {
|
||||
// NB: We don't want to do this apparently
|
||||
//invalidateRegisterCaches();
|
||||
setAccessibility(TargetAccessibility.INACCESSIBLE);
|
||||
setAccessible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopped() {
|
||||
setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
setAccessible(true);
|
||||
if (thread.equals(getManager().getEventThread())) {
|
||||
readRegistersNamed(getCachedElements().keySet());
|
||||
}
|
||||
|
|
|
@ -32,26 +32,26 @@ import ghidra.dbg.util.PathUtils;
|
|||
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Debugger",
|
||||
elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = { //
|
||||
attributes = {
|
||||
@TargetAttributeType(
|
||||
name = "Available",
|
||||
type = DbgModelTargetAvailableContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true), //
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Connectors",
|
||||
type = DbgModelTargetConnectorContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true), //
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Sessions",
|
||||
type = DbgModelTargetSessionContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true), //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
fixed = true),
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class DbgModelTargetRootImpl extends DbgModelDefaultTargetModelRoot
|
||||
implements DbgModelTargetRoot {
|
||||
|
@ -152,8 +152,8 @@ public class DbgModelTargetRootImpl extends DbgModelDefaultTargetModelRoot
|
|||
}
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility() {
|
||||
return accessibility;
|
||||
public boolean isAccessible() {
|
||||
return accessible;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -27,13 +27,23 @@ import agent.dbgeng.model.iface2.DbgModelTargetSession;
|
|||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Session", elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(name = "Attributes", type = DbgModelTargetSessionAttributesImpl.class, fixed = true), //
|
||||
@TargetAttributeType(name = "Processes", type = DbgModelTargetProcessContainerImpl.class, required = true, fixed = true), //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Session",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(
|
||||
name = "Attributes",
|
||||
type = DbgModelTargetSessionAttributesImpl.class,
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Processes",
|
||||
type = DbgModelTargetProcessContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class DbgModelTargetSessionImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetSession {
|
||||
|
||||
|
@ -87,8 +97,8 @@ public class DbgModelTargetSessionImpl extends DbgModelTargetObjectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility() {
|
||||
return accessibility;
|
||||
public boolean isAccessible() {
|
||||
return accessible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -28,27 +28,52 @@ import agent.dbgeng.model.iface2.*;
|
|||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.async.TypeSpec;
|
||||
import ghidra.dbg.DebugModelConventions;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "StackFrame", elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.FUNC_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.FUNC_TABLE_ENTRY_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.INST_OFFSET_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.FRAME_OFFSET_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.RETURN_OFFSET_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.STACK_OFFSET_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.VIRTUAL_ATTRIBUTE_NAME, type = Boolean.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.PARAM0_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.PARAM1_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.PARAM2_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(name = DbgModelTargetStackFrame.PARAM3_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "StackFrame",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.FUNC_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.FUNC_TABLE_ENTRY_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.INST_OFFSET_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.FRAME_OFFSET_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.RETURN_OFFSET_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.STACK_OFFSET_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.VIRTUAL_ATTRIBUTE_NAME,
|
||||
type = Boolean.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.PARAM0_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.PARAM1_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.PARAM2_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(
|
||||
name = DbgModelTargetStackFrame.PARAM3_ATTRIBUTE_NAME,
|
||||
type = String.class),
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class DbgModelTargetStackFrameImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetStackFrame {
|
||||
|
||||
|
@ -100,7 +125,7 @@ public class DbgModelTargetStackFrameImpl extends DbgModelTargetObjectImpl
|
|||
@Override
|
||||
public void threadSelected(DbgThread eventThread, DbgStackFrame eventFrame, DbgCause cause) {
|
||||
if (eventFrame != null && eventFrame.equals(frame)) {
|
||||
AtomicReference<DbgModelTargetFocusScope<?>> scope = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetFocusScope> scope = new AtomicReference<>();
|
||||
AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
DebugModelConventions.findSuitable(DbgModelTargetFocusScope.class, this)
|
||||
.handle(seq::next);
|
||||
|
@ -154,7 +179,7 @@ public class DbgModelTargetStackFrameImpl extends DbgModelTargetObjectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public TargetObjectRef getThread() {
|
||||
public TargetObject getThread() {
|
||||
return thread.getParent();
|
||||
}
|
||||
|
||||
|
|
|
@ -22,17 +22,20 @@ import java.util.stream.Collectors;
|
|||
|
||||
import agent.dbgeng.manager.DbgStackFrame;
|
||||
import agent.dbgeng.model.iface2.*;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Stack", elements = { //
|
||||
@TargetElementType(type = DbgModelTargetStackFrameImpl.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Stack",
|
||||
elements = {
|
||||
@TargetElementType(type = DbgModelTargetStackFrameImpl.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class DbgModelTargetStackImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetStack {
|
||||
|
||||
|
@ -84,12 +87,12 @@ public class DbgModelTargetStackImpl extends DbgModelTargetObjectImpl
|
|||
public void onRunning() {
|
||||
// NB: We don't want to do this apparently
|
||||
//invalidateRegisterCaches();
|
||||
setAccessibility(TargetAccessibility.INACCESSIBLE);
|
||||
setAccessible(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopped() {
|
||||
setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
setAccessible(true);
|
||||
if (thread.getThread().getId().equals(getManager().getEventThread().getId())) {
|
||||
update();
|
||||
}
|
||||
|
@ -101,6 +104,7 @@ public class DbgModelTargetStackImpl extends DbgModelTargetObjectImpl
|
|||
* GDB doesn't produce stack change events, but they should only ever happen by running a
|
||||
* target. Thus, every time we're STOPPED, this method should be called.
|
||||
*/
|
||||
@Override
|
||||
public void update() {
|
||||
requestElements(true).exceptionally(e -> {
|
||||
Msg.error(this, "Could not update stack " + this + " on STOPPED");
|
||||
|
|
|
@ -33,14 +33,25 @@ import ghidra.dbg.target.TargetEnvironment;
|
|||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Thread", elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(name = "Registers", type = DbgModelTargetRegisterContainerImpl.class, required = true, fixed = true), //
|
||||
@TargetAttributeType(name = "Stack", type = DbgModelTargetStackImpl.class, required = true, fixed = true), //
|
||||
@TargetAttributeType(name = TargetEnvironment.ARCH_ATTRIBUTE_NAME, type = String.class), //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Thread",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(
|
||||
name = "Registers",
|
||||
type = DbgModelTargetRegisterContainerImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(
|
||||
name = "Stack",
|
||||
type = DbgModelTargetStackImpl.class,
|
||||
required = true,
|
||||
fixed = true),
|
||||
@TargetAttributeType(name = TargetEnvironment.ARCH_ATTRIBUTE_NAME, type = String.class),
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class DbgModelTargetThreadImpl extends DbgModelTargetObjectImpl
|
||||
implements DbgModelTargetThread {
|
||||
|
||||
|
@ -107,7 +118,7 @@ public class DbgModelTargetThreadImpl extends DbgModelTargetObjectImpl
|
|||
@Override
|
||||
public void threadSelected(DbgThread eventThread, DbgStackFrame frame, DbgCause cause) {
|
||||
if (eventThread.equals(thread)) {
|
||||
AtomicReference<DbgModelTargetFocusScope<?>> scope = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetFocusScope> scope = new AtomicReference<>();
|
||||
AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
DebugModelConventions.findSuitable(DbgModelTargetFocusScope.class, this)
|
||||
.handle(seq::next);
|
||||
|
@ -170,8 +181,8 @@ public class DbgModelTargetThreadImpl extends DbgModelTargetObjectImpl
|
|||
}
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility() {
|
||||
return accessibility;
|
||||
public boolean isAccessible() {
|
||||
return accessible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
package agent.dbgeng.model;
|
||||
|
||||
import static agent.dbgeng.testutil.DummyProc.runProc;
|
||||
import static ghidra.lifecycle.Unfinished.TODO;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -33,12 +34,10 @@ import ghidra.async.*;
|
|||
import ghidra.dbg.DebugModelConventions;
|
||||
import ghidra.dbg.DebugModelConventions.AllRequiredAccess;
|
||||
import ghidra.dbg.DebuggerObjectModel;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TargetObjectRefList;
|
||||
import ghidra.dbg.attributes.TargetObjectList;
|
||||
import ghidra.dbg.error.DebuggerModelNoSuchPathException;
|
||||
import ghidra.dbg.error.DebuggerModelTypeException;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetBreakpointContainer.TargetBreakpointKindSet;
|
||||
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
|
||||
import ghidra.dbg.target.TargetConsole.Channel;
|
||||
|
@ -139,7 +138,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
model.fetchModelObject("Doesn't exist").handle(seq::next);
|
||||
}, TypeSpec.cls(TargetObject.class)).then((obj, seq) -> {
|
||||
|
@ -156,7 +155,7 @@ public abstract class AbstractModelForDbgTest
|
|||
|
||||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> access = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher<?>> launcher = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher> launcher = new AtomicReference<>();
|
||||
TypeSpec<Map<String, ? extends TargetObject>> t = TypeSpec.auto();
|
||||
|
||||
waitOn(AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
|
@ -169,7 +168,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(DbgModelTargetLauncher.class, root.get())
|
||||
|
@ -179,11 +178,10 @@ public abstract class AbstractModelForDbgTest
|
|||
launcher.get().launch("notepad", "junk.txt").handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Processes (after launch)...");
|
||||
model.fetchObjectElements(List.of("Sessions", "[0]"))
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
}, t).then((children, seq) -> {
|
||||
Msg.debug(this, "Processes after: " + children);
|
||||
|
@ -201,7 +199,7 @@ public abstract class AbstractModelForDbgTest
|
|||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<TargetObject> session = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> rootAccess = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher<?>> launcher = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher> launcher = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> launcherAccess = new AtomicReference<>();
|
||||
TypeSpec<Map<String, ? extends TargetObject>> t = TypeSpec.auto();
|
||||
|
||||
|
@ -215,7 +213,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, rootAccess).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
rootAccess.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
rootAccess.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
model.fetchModelObject(List.of("Sessions", "[0]")).handle(seq::next);
|
||||
}, session).then(seq -> {
|
||||
|
@ -224,22 +222,21 @@ public abstract class AbstractModelForDbgTest
|
|||
session.get()).handle(seq::next);
|
||||
}, TypeSpec.cls(TargetObject.class)).then((obj, seq) -> {
|
||||
assertTrue(obj.getInterfaceNames().contains("Launcher"));
|
||||
launcher.set((DbgModelTargetLauncher<?>) obj);
|
||||
launcher.set((DbgModelTargetLauncher) obj);
|
||||
Msg.debug(this, "Tracking process access...");
|
||||
DebugModelConventions.trackAccessibility(obj).handle(seq::next);
|
||||
}, launcherAccess).then(seq -> {
|
||||
Msg.debug(this, "Waiting for process access...");
|
||||
launcherAccess.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
launcherAccess.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Launching...");
|
||||
launcher.get().launch("notepad", "junk.txt").handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
rootAccess.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
rootAccess.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Processes (after launch)...");
|
||||
model.fetchObjectElements(List.of("Sessions", "[0]", "Processes"))
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
}, t).then((elements, seq) -> {
|
||||
Msg.debug(this, "Processes after: " + elements);
|
||||
|
@ -267,10 +264,9 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
model.fetchObjectElements(List.of("Sessions", "[0]", "Available"))
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
}, DebuggerObjectModel.ELEMENT_MAP_TYPE).then((available, seq) -> {
|
||||
assertTrue(available.containsKey(Long.toString(np.pid)));
|
||||
|
@ -298,7 +294,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(TargetAttacher.class, root.get())
|
||||
|
@ -306,16 +302,11 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, proc).then(seq -> {
|
||||
Msg.debug(this, "Attaching to bogus path...");
|
||||
TargetAttacher<?> attacher = proc.get().as(TargetAttacher.tclass);
|
||||
attacher.attach(
|
||||
model.createRef("Sessions", "[0]", "Available", "[" + np.pid + "]")
|
||||
.as(
|
||||
TargetAttachable.tclass))
|
||||
.handle(
|
||||
seq::nextIgnore);
|
||||
TargetAttacher attacher = proc.get().as(TargetAttacher.class);
|
||||
TODO();
|
||||
seq.next(null, null);
|
||||
}).then(seq -> {
|
||||
model.fetchObjectElements(List.of("Sessions", "[0]", "Processes"))
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
// NB: listProcesses will fail if no process is being debugged
|
||||
}, DebuggerObjectModel.ELEMENT_MAP_TYPE).then((processes, seq) -> {
|
||||
|
@ -332,8 +323,8 @@ public abstract class AbstractModelForDbgTest
|
|||
|
||||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> access = new AtomicReference<>();
|
||||
AtomicReference<TargetAttacher<?>> attacher = new AtomicReference<>();
|
||||
AtomicReference<TargetAttachable<?>> attachable = new AtomicReference<>();
|
||||
AtomicReference<TargetAttacher> attacher = new AtomicReference<>();
|
||||
AtomicReference<TargetAttachable> attachable = new AtomicReference<>();
|
||||
TypeSpec<Map<String, ? extends TargetObject>> t = TypeSpec.auto();
|
||||
|
||||
waitOn(AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
|
@ -346,7 +337,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
// Msg.debug(this, "Getting Processes (before attach)...");
|
||||
// model.getObjectElements(List.of("Sessions", "[0]", "Processes")).handle(seq::next);
|
||||
|
@ -366,7 +357,7 @@ public abstract class AbstractModelForDbgTest
|
|||
.thenAccept(o -> {
|
||||
Msg.debug(this, " Got Attachable: " + o);
|
||||
assertTrue(o.getInterfaceNames().contains("Attachable"));
|
||||
attachable.set((TargetAttachable<?>) o);
|
||||
attachable.set((TargetAttachable) o);
|
||||
}));
|
||||
fence.ready().handle(seq::next);
|
||||
}).then(seq -> {
|
||||
|
@ -374,11 +365,10 @@ public abstract class AbstractModelForDbgTest
|
|||
attacher.get().attach(attachable.get()).handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Processes (after attach)...");
|
||||
model.fetchObjectElements(List.of("Sessions", "[0]", "Processes"))
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
}, t).then((elements, seq) -> {
|
||||
Msg.debug(this, "Processes after: " + elements);
|
||||
|
@ -386,7 +376,7 @@ public abstract class AbstractModelForDbgTest
|
|||
Msg.debug(this, "Killing...");
|
||||
TargetObject attached = elements.get("0");
|
||||
assertTrue(attached.getInterfaceNames().contains("Killable"));
|
||||
TargetKillable<?> killable = (TargetKillable<?>) attached;
|
||||
TargetKillable killable = (TargetKillable) attached;
|
||||
killable.kill().handle(seq::next);
|
||||
}).finish());
|
||||
}
|
||||
|
@ -412,7 +402,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(TargetAttacher.class, root.get())
|
||||
|
@ -420,17 +410,15 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, obj).then(seq -> {
|
||||
Msg.debug(this, "Attaching...");
|
||||
TargetAttacher<?> attacher = obj.get().as(TargetAttacher.tclass);
|
||||
attacher.attach(model.createRef("Sessions", "[0]", "Available", "[" + np.pid + "]")
|
||||
.as(TargetAttachable.tclass))
|
||||
TargetAttacher attacher = obj.get().as(TargetAttacher.class);
|
||||
attacher.attach(np.pid)
|
||||
.handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again, again)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Processes (after attach)...");
|
||||
model.fetchObjectElements(List.of("Sessions", "[0]", "Processes"))
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
}, t).then((elements, seq) -> {
|
||||
Msg.debug(this, "Processes after: " + elements);
|
||||
|
@ -438,7 +426,7 @@ public abstract class AbstractModelForDbgTest
|
|||
Msg.debug(this, "Killing...");
|
||||
TargetObject attached = elements.get("0");
|
||||
assertTrue(attached.getInterfaceNames().contains("Killable"));
|
||||
TargetKillable<?> killable = (TargetKillable<?>) attached;
|
||||
TargetKillable killable = (TargetKillable) attached;
|
||||
killable.kill().handle(seq::next);
|
||||
}).finish());
|
||||
}
|
||||
|
@ -464,7 +452,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(TargetAttacher.class, root.get())
|
||||
|
@ -472,29 +460,25 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, obj).then(seq -> {
|
||||
Msg.debug(this, "Attaching...");
|
||||
TargetAttacher<?> attacher = obj.get().as(TargetAttacher.tclass);
|
||||
attacher.attach(
|
||||
model.createRef("Sessions", "[0]", "Available", "[" + np.pid + "]")
|
||||
.as(
|
||||
TargetAttachable.tclass))
|
||||
TargetAttacher attacher = obj.get().as(TargetAttacher.class);
|
||||
attacher.attach(np.pid)
|
||||
.handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again, again)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Process 1...");
|
||||
model.fetchModelObject("Sessions", "[0]", "Processes", "[0]").handle(seq::next);
|
||||
}, obj).then(seq -> {
|
||||
Msg.debug(this, "Resuming...");
|
||||
TargetResumable<?> resumable = obj.get().as(TargetResumable.tclass);
|
||||
TargetResumable resumable = obj.get().as(TargetResumable.class);
|
||||
resumable.resume().handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (after resume)...");
|
||||
access.get().waitValue(TargetAccessibility.INACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Processes (after attach)...");
|
||||
model.fetchObjectElements(List.of("Sessions", "[0]", "Processes"))
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
}, t).then((elements, seq) -> {
|
||||
Msg.debug(this, "Processes after: " + elements);
|
||||
|
@ -502,7 +486,7 @@ public abstract class AbstractModelForDbgTest
|
|||
Msg.debug(this, "Killing...");
|
||||
TargetObject attached = elements.get("0");
|
||||
assertTrue(attached.getInterfaceNames().contains("Killable"));
|
||||
TargetKillable<?> killable = (TargetKillable<?>) attached;
|
||||
TargetKillable killable = (TargetKillable) attached;
|
||||
killable.kill().handle(seq::nextIgnore);
|
||||
}).finish());
|
||||
}
|
||||
|
@ -526,29 +510,29 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(DbgModelTargetLauncher.class, root.get())
|
||||
.handle(seq::next);
|
||||
}, obj).then(seq -> {
|
||||
Msg.debug(this, "Launching...");
|
||||
TargetLauncher<?> launcher = obj.get().as(TargetLauncher.tclass);
|
||||
TargetLauncher launcher = obj.get().as(TargetLauncher.class);
|
||||
launcher.launch(Map.of(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, "notepad junk.txt"))
|
||||
.handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Process 1...");
|
||||
model.fetchModelObject("Sessions", "[0]", "Processes", "[0]").handle(seq::next);
|
||||
}, obj).then(seq -> {
|
||||
Msg.debug(this, "Resuming...");
|
||||
TargetResumable<?> resumable = obj.get().as(TargetResumable.tclass);
|
||||
TargetResumable resumable = obj.get().as(TargetResumable.class);
|
||||
resumable.resume().handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (after resume)...");
|
||||
access.get().waitValue(TargetAccessibility.INACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).finish());
|
||||
}
|
||||
}
|
||||
|
@ -572,7 +556,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(TargetAttacher.class, root.get())
|
||||
|
@ -580,10 +564,9 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, proc).then(seq -> {
|
||||
Msg.debug(this, "Attaching to bogus path...");
|
||||
TargetAttacher<?> attacher = proc.get().as(TargetAttacher.tclass);
|
||||
attacher.attach(model.createRef("Sessions", "[0]", "Available", "Process -1")
|
||||
.as(TargetAttachable.tclass))
|
||||
.handle(seq::nextIgnore);
|
||||
TargetAttacher attacher = proc.get().as(TargetAttacher.class);
|
||||
TODO();
|
||||
seq.next(null, null);
|
||||
}).finish());
|
||||
}
|
||||
}
|
||||
|
@ -607,7 +590,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(TargetAttacher.class, root.get())
|
||||
|
@ -615,11 +598,9 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, proc).then(seq -> {
|
||||
Msg.debug(this, "Attaching to bogus path...");
|
||||
TargetAttacher<?> attacher = proc.get().as(TargetAttacher.tclass);
|
||||
attacher.attach(model.createRef("Sessions", "[0]", "Available")
|
||||
.as(
|
||||
TargetAttachable.tclass))
|
||||
.handle(seq::nextIgnore);
|
||||
TargetAttacher attacher = proc.get().as(TargetAttacher.class);
|
||||
TODO();
|
||||
seq.next(null, null);
|
||||
}).finish());
|
||||
fail("Exception expected");
|
||||
}
|
||||
|
@ -662,10 +643,10 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Running command...");
|
||||
TargetInterpreter<?> interpreter = root.get().as(TargetInterpreter.tclass);
|
||||
TargetInterpreter interpreter = root.get().as(TargetInterpreter.class);
|
||||
interpreter.execute(".echo xyzzy").handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for expected output...");
|
||||
|
@ -705,10 +686,10 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Running command with capture...");
|
||||
TargetInterpreter<?> interpreter = root.get().as(TargetInterpreter.tclass);
|
||||
TargetInterpreter interpreter = root.get().as(TargetInterpreter.class);
|
||||
interpreter.executeCapture(".echo xyzzy").handle(seq::next);
|
||||
}, TypeSpec.STRING).then((out, seq) -> {
|
||||
Msg.debug(this, "Captured: " + out);
|
||||
|
@ -725,7 +706,7 @@ public abstract class AbstractModelForDbgTest
|
|||
|
||||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> access = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointContainer<?>> breaks = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointContainer> breaks = new AtomicReference<>();
|
||||
|
||||
waitOn(AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
m.init().handle(seq::next);
|
||||
|
@ -737,7 +718,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding breakpoint container...");
|
||||
DebugModelConventions.findSuitable(TargetBreakpointContainer.class, root.get())
|
||||
|
@ -752,7 +733,7 @@ public abstract class AbstractModelForDbgTest
|
|||
}
|
||||
}
|
||||
|
||||
public static final TypeSpec<Collection<? extends TargetBreakpointLocation<?>>> BL_COL_SPEC =
|
||||
public static final TypeSpec<Collection<? extends TargetBreakpointLocation>> BL_COL_SPEC =
|
||||
null;
|
||||
|
||||
@Test
|
||||
|
@ -762,9 +743,9 @@ public abstract class AbstractModelForDbgTest
|
|||
|
||||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> access = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher<?>> launcher = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointContainer<?>> breaks = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointLocation<?>> eff = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher> launcher = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointContainer> breaks = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointLocation> loc = new AtomicReference<>();
|
||||
|
||||
waitOn(AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
m.init().handle(seq::next);
|
||||
|
@ -776,7 +757,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(DbgModelTargetLauncher.class, root.get())
|
||||
|
@ -801,20 +782,19 @@ public abstract class AbstractModelForDbgTest
|
|||
Msg.debug(this, "Getting breakpoint specs...");
|
||||
breaks.get()
|
||||
.fetchElements()
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
}, DebuggerObjectModel.ELEMENT_MAP_TYPE).then((specs, seq) -> {
|
||||
Msg.debug(this, "Got specs: " + specs);
|
||||
assertEquals(1, specs.size());
|
||||
TargetBreakpointSpec<?> spec = specs.get("0").as(TargetBreakpointSpec.tclass);
|
||||
TargetBreakpointSpec spec = specs.get("0").as(TargetBreakpointSpec.class);
|
||||
spec.getLocations().handle(seq::next);
|
||||
}, BL_COL_SPEC).then((es, seq) -> {
|
||||
Msg.debug(this, "Got effectives: " + es);
|
||||
assertEquals(1, es.size());
|
||||
eff.set(es.iterator().next());
|
||||
Address addr = eff.get().getAddress();
|
||||
loc.set(es.iterator().next());
|
||||
Address addr = loc.get().getAddress();
|
||||
Msg.debug(this, "Got address: " + addr);
|
||||
TargetObjectRefList<?> list = eff.get().getAffects();
|
||||
TargetObjectList<?> list = loc.get().getAffects();
|
||||
Msg.debug(this, "Got affects: " + list);
|
||||
assertEquals(1, list.size());
|
||||
seq.exit();
|
||||
|
@ -829,8 +809,8 @@ public abstract class AbstractModelForDbgTest
|
|||
|
||||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> access = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointContainer<?>> breaks = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher<?>> launcher = new AtomicReference<>();
|
||||
AtomicReference<TargetBreakpointContainer> breaks = new AtomicReference<>();
|
||||
AtomicReference<TargetLauncher> launcher = new AtomicReference<>();
|
||||
AtomicReference<TargetObject> obj = new AtomicReference<>();
|
||||
waitOn(AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
m.init().handle(seq::next);
|
||||
|
@ -842,18 +822,20 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(DbgModelTargetLauncher.class, root.get())
|
||||
DebugModelConventions.findSuitable(TargetLauncher.class, root.get())
|
||||
.handle(
|
||||
seq::next);
|
||||
}, launcher).then(seq -> {
|
||||
Msg.debug(this, "Launching...");
|
||||
launcher.get().launch("notepad", "junk.txt").handle(seq::nextIgnore);
|
||||
launcher.get()
|
||||
.launch(Map.of("args", List.of("notepad", "junk.txt")))
|
||||
.handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding breakpoint container...");
|
||||
DebugModelConventions.findSuitable(TargetBreakpointContainer.class, root.get())
|
||||
|
@ -869,20 +851,17 @@ public abstract class AbstractModelForDbgTest
|
|||
model.fetchModelObject("Sessions", "[0]", "Processes", "[0]").handle(seq::next);
|
||||
}, obj).then(seq -> {
|
||||
Msg.debug(this, "Resuming...");
|
||||
TargetResumable<?> resumable = obj.get().as(TargetResumable.tclass);
|
||||
TargetResumable resumable = obj.get().as(TargetResumable.class);
|
||||
resumable.resume().handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (after resume)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
obj.get()
|
||||
.fetchSubElements("Threads", "[0]", "Stack")
|
||||
.thenCompose(DebugModelConventions::fetchAll)
|
||||
.handle(seq::next);
|
||||
obj.get().fetchSubElements("Threads", "[0]", "Stack").handle(seq::next);
|
||||
}, DebuggerObjectModel.ELEMENT_MAP_TYPE).then((frames, seq) -> {
|
||||
Msg.debug(this, "Got stack:");
|
||||
for (Map.Entry<String, ? extends TargetObject> ent : frames.entrySet()) {
|
||||
TargetStackFrame<?> frame = ent.getValue().as(TargetStackFrame.tclass);
|
||||
TargetStackFrame frame = ent.getValue().as(TargetStackFrame.class);
|
||||
Msg.debug(this, ent.getKey() + ": " + frame.getProgramCounter());
|
||||
}
|
||||
long offset = frames.get("0")
|
||||
|
@ -904,10 +883,10 @@ public abstract class AbstractModelForDbgTest
|
|||
|
||||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> access = new AtomicReference<>();
|
||||
AtomicReference<DbgModelTargetLauncher<?>> launcher = new AtomicReference<>();
|
||||
AtomicReference<TargetLauncher> launcher = new AtomicReference<>();
|
||||
AtomicReference<TargetObject> proc = new AtomicReference<>();
|
||||
AtomicReference<TargetRegisterBank<?>> bank = new AtomicReference<>();
|
||||
Set<TargetRegister<?>> descs = new LinkedHashSet<>();
|
||||
AtomicReference<TargetRegisterBank> bank = new AtomicReference<>();
|
||||
Set<TargetRegister> descs = new LinkedHashSet<>();
|
||||
|
||||
waitOn(AsyncUtils.sequence(TypeSpec.VOID).then(seq -> {
|
||||
m.init().handle(seq::next);
|
||||
|
@ -919,7 +898,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(DbgModelTargetLauncher.class, root.get())
|
||||
|
@ -927,10 +906,12 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, launcher).then(seq -> {
|
||||
Msg.debug(this, "Launching...");
|
||||
launcher.get().launch("notepad", "junk.txt").handle(seq::nextIgnore);
|
||||
launcher.get()
|
||||
.launch(Map.of("args", List.of("notepad", "junk.txt")))
|
||||
.handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting Process 1...");
|
||||
model.fetchModelObject(List.of("Sessions", "[0]", "Processes", "[0]"))
|
||||
|
@ -938,18 +919,17 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, proc).then(seq -> {
|
||||
proc.get().fetchSuccessor("Threads", "[0]", "Stack", "[0]").thenAccept(top -> {
|
||||
bank.set(top.as(TargetRegisterBank.tclass));
|
||||
bank.set(top.as(TargetRegisterBank.class));
|
||||
}).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Got bank: " + bank.get());
|
||||
Msg.debug(this, "Descriptions ref: " + bank.get().getDescriptions());
|
||||
bank.get().getDescriptions().fetch().handle(seq::next);
|
||||
}, TypeSpec.cls(TargetRegisterContainer.wclass)).then((cont, seq) -> {
|
||||
TargetRegisterContainer cont = bank.get().getDescriptions();
|
||||
Msg.debug(this, "Register descriptions: " + cont);
|
||||
cont.getRegisters().thenAccept(descs::addAll).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Elements: ");
|
||||
for (TargetRegister<?> reg : descs) {
|
||||
for (TargetRegister reg : descs) {
|
||||
Msg.debug(this, " " + reg.getIndex() + ": " + reg.getBitLength());
|
||||
}
|
||||
bank.get().readRegisters(descs).handle(seq::next);
|
||||
|
@ -982,7 +962,7 @@ public abstract class AbstractModelForDbgTest
|
|||
DebuggerObjectModel model = m.getModel();
|
||||
|
||||
AtomicReference<TargetObject> root = new AtomicReference<>();
|
||||
AtomicReference<TargetFocusScope<?>> scope = new AtomicReference<>();
|
||||
AtomicReference<TargetFocusScope> scope = new AtomicReference<>();
|
||||
AtomicReference<AllRequiredAccess> access = new AtomicReference<>();
|
||||
AtomicReference<TargetObject> processes = new AtomicReference<>();
|
||||
AtomicReference<TargetObject> obj1 = new AtomicReference<>();
|
||||
|
@ -993,13 +973,13 @@ public abstract class AbstractModelForDbgTest
|
|||
TargetObjectListener procListener = new TargetObjectListener() {
|
||||
@Override
|
||||
public void elementsChanged(TargetObject parent, Collection<String> removed,
|
||||
Map<String, ? extends TargetObjectRef> added) {
|
||||
Map<String, ? extends TargetObject> added) {
|
||||
processCount.set(processes.get().getCachedElements().size(), null);
|
||||
}
|
||||
};
|
||||
TargetFocusScopeListener focusListener = new TargetFocusScopeListener() {
|
||||
@Override
|
||||
public void focusChanged(TargetFocusScope<?> object, TargetObjectRef focused) {
|
||||
public void focusChanged(TargetFocusScope object, TargetObject focused) {
|
||||
// Truncate the path to the parent process
|
||||
focusProcPath.set(focused.getPath().subList(0, 2), null);
|
||||
}
|
||||
|
@ -1011,13 +991,13 @@ public abstract class AbstractModelForDbgTest
|
|||
Msg.debug(this, "Getting session root object");
|
||||
model.fetchModelObject("Sessions", "[0]").handle(seq::next);
|
||||
}, root).then(seq -> {
|
||||
scope.set(root.get().as(TargetFocusScope.tclass));
|
||||
scope.set(root.get().as(TargetFocusScope.class));
|
||||
scope.get().addListener(focusListener);
|
||||
Msg.debug(this, "Tracking session access...");
|
||||
DebugModelConventions.trackAccessibility(root.get()).handle(seq::next);
|
||||
}, access).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
DebugModelConventions.findSuitable(DbgModelTargetLauncher.class, root.get())
|
||||
|
@ -1025,12 +1005,8 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, obj1).then(seq -> {
|
||||
Msg.debug(this, "Attaching...");
|
||||
TargetAttacher<?> attacher = obj1.get().as(TargetAttacher.tclass);
|
||||
attacher.attach(
|
||||
model.createRef("Sessions", "[0]", "Available", "[" + np.pid + "]")
|
||||
.as(
|
||||
TargetAttachable.tclass))
|
||||
.handle(seq::nextIgnore);
|
||||
TargetAttacher attacher = obj1.get().as(TargetAttacher.class);
|
||||
attacher.attach(np.pid).handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Getting processes container");
|
||||
model.fetchModelObject("Sessions", "[0]", "Processes").handle(seq::next);
|
||||
|
@ -1042,12 +1018,12 @@ public abstract class AbstractModelForDbgTest
|
|||
seq::next);
|
||||
}, obj2).then(seq -> {
|
||||
Msg.debug(this, "Creating another process");
|
||||
TargetLauncher<?> launcher = obj2.get().as(TargetLauncher.tclass);
|
||||
TargetLauncher launcher = obj2.get().as(TargetLauncher.class);
|
||||
launcher.launch(Map.of(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, "notepad junk.txt"))
|
||||
.handle(seq::nextIgnore);
|
||||
}).then(seq -> {
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
access.get().waitValue(TargetAccessibility.ACCESSIBLE).handle(seq::next);
|
||||
access.get().waitValue(true).handle(seq::next);
|
||||
}).then(seq -> {
|
||||
assertTrue(PathUtils.isAncestor(List.of("Sessions", "[0]", "Processes", "[1]"),
|
||||
scope.get().getFocus().getPath()));
|
||||
|
@ -1056,9 +1032,9 @@ public abstract class AbstractModelForDbgTest
|
|||
|
||||
Msg.debug(this, "Requesting focus on process 0");
|
||||
AsyncFence fence = new AsyncFence();
|
||||
TargetObjectRef i2 = model.createRef("Sessions", "[0]", "Processes", "[0]");
|
||||
fence.include(focusProcPath.waitValue(i2.getPath()));
|
||||
fence.include(scope.get().requestFocus(i2));
|
||||
TargetObject p2 = model.getModelObject("Sessions", "[0]", "Processes", "[0]");
|
||||
fence.include(focusProcPath.waitValue(p2.getPath()));
|
||||
fence.include(scope.get().requestFocus(p2));
|
||||
fence.ready().handle(seq::next);
|
||||
}).then(seq -> {
|
||||
assertTrue(PathUtils.isAncestor(List.of("Sessions", "[0]", "Processes", "[0]"),
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/* ###
|
||||
* IP: GHIDRA
|
||||
*
|
||||
|
@ -162,13 +161,13 @@ public class PopulateTraceRemote extends GhidraScript {
|
|||
|
||||
Set<DebuggerObjectModel> models = targets.getModels();
|
||||
DebuggerObjectModel model = (DebuggerObjectModel) models.toArray()[0];
|
||||
TargetInterpreter<?> interpreter =
|
||||
DebugModelConventions.findSuitable(TargetInterpreter.tclass, model.createRef()).get();
|
||||
TargetInterpreter interpreter =
|
||||
DebugModelConventions.findSuitable(TargetInterpreter.class, model.getModelRoot()).get();
|
||||
interpreter.execute(".opendump " + f.getAbsolutePath()).get();
|
||||
interpreter.execute("g");
|
||||
TargetAttacher<?> attacher =
|
||||
DebugModelConventions.findSuitable(TargetAttacher.tclass, model.createRef()).get();
|
||||
TargetAttacher attacher =
|
||||
DebugModelConventions.findSuitable(TargetAttacher.class, model.getModelRoot()).get();
|
||||
// TODO: Is "Available" the correct path?
|
||||
attacher.attach(model.createRef("Available", "[0]").as(TargetAttachable.tclass)).get();
|
||||
attacher.attach(model.getModelObject("Available", "[0]").as(TargetAttachable.class)).get();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,7 +23,6 @@ import agent.dbgmodel.dbgmodel.main.ModelObject;
|
|||
import agent.dbgmodel.gadp.impl.WrappedDbgModel;
|
||||
import agent.dbgmodel.manager.DbgManager2Impl;
|
||||
import agent.dbgmodel.model.impl.*;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
|
@ -53,7 +52,7 @@ public class DbgListElementsCommand extends AbstractDbgCommand<List<TargetObject
|
|||
synchronized (access) {
|
||||
updatedElements = new ArrayList<>();
|
||||
List<ModelObject> list = access.getElements(path);
|
||||
Map<String, ? extends TargetObjectRef> existingElements =
|
||||
Map<String, ? extends TargetObject> existingElements =
|
||||
targetObject.getCachedElements();
|
||||
|
||||
for (ModelObject obj : list) {
|
||||
|
|
|
@ -32,7 +32,6 @@ import agent.dbgmodel.jna.dbgmodel.DbgModelNative.TypeKind;
|
|||
import agent.dbgmodel.manager.DbgManager2Impl;
|
||||
import ghidra.dbg.agent.DefaultTargetObject;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetBreakpointContainer.TargetBreakpointKindSet;
|
||||
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
|
||||
import ghidra.dbg.target.TargetExecutionStateful.TargetExecutionState;
|
||||
|
@ -49,7 +48,7 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
protected final Map<String, TargetObject> elementsByKey = new WeakValueHashMap<>();
|
||||
|
||||
protected DbgModelSelectableObject focus;
|
||||
public TargetAccessibility accessibility = TargetAccessibility.ACCESSIBLE;
|
||||
public boolean accessible = true;
|
||||
|
||||
private ModelObject modelObject = null;
|
||||
protected Map<String, Object> intrinsics = new TreeMap<>(TargetObjectKeyComparator.ATTRIBUTE);
|
||||
|
@ -214,11 +213,10 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
DelegateDbgModel2TargetObject delegate = (DelegateDbgModel2TargetObject) this;
|
||||
TargetObject proxy = delegate.getProxy();
|
||||
if (proxy instanceof TargetAccessConditioned) {
|
||||
attrs.put(TargetAccessConditioned.ACCESSIBLE_ATTRIBUTE_NAME,
|
||||
accessibility == TargetAccessibility.ACCESSIBLE);
|
||||
attrs.put(TargetAccessConditioned.ACCESSIBLE_ATTRIBUTE_NAME, accessible);
|
||||
}
|
||||
if (proxy instanceof TargetExecutionStateful) {
|
||||
TargetExecutionStateful<?> stateful = (TargetExecutionStateful<?>) proxy;
|
||||
TargetExecutionStateful stateful = (TargetExecutionStateful) proxy;
|
||||
TargetExecutionState state = stateful.getExecutionState();
|
||||
attrs.put(TargetExecutionStateful.STATE_ATTRIBUTE_NAME, state);
|
||||
}
|
||||
|
@ -269,12 +267,12 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
attrs.put(TargetEnvironment.ARCH_ATTRIBUTE_NAME, executionType);
|
||||
}
|
||||
if (proxy instanceof TargetRegister) {
|
||||
DbgModelTargetObject bank = (DbgModelTargetObject) getImplParent();
|
||||
TargetObject container = bank.getImplParent();
|
||||
DbgModelTargetObject bank = (DbgModelTargetObject) getParent();
|
||||
TargetObject container = bank.getParent();
|
||||
attrs.put(TargetRegister.CONTAINER_ATTRIBUTE_NAME, container);
|
||||
}
|
||||
if (proxy instanceof TargetRegisterBank) {
|
||||
attrs.put(TargetRegisterBank.DESCRIPTIONS_ATTRIBUTE_NAME, getImplParent());
|
||||
attrs.put(TargetRegisterBank.DESCRIPTIONS_ATTRIBUTE_NAME, getParent());
|
||||
}
|
||||
if (proxy instanceof TargetStackFrame) {
|
||||
DbgModelTargetStackFrame frame = (DbgModelTargetStackFrame) proxy;
|
||||
|
@ -358,7 +356,7 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
}
|
||||
DbgModelTargetObject test = (DbgModelTargetObject) parent;
|
||||
while (test != null && !(test.getProxy() instanceof DbgModelTargetSession)) {
|
||||
test = (DbgModelTargetObject) test.getImplParent();
|
||||
test = (DbgModelTargetObject) test.getParent();
|
||||
}
|
||||
return test == null ? null : (DbgModelTargetSession) test.getProxy();
|
||||
}
|
||||
|
@ -367,7 +365,7 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
public DbgModelTargetProcess getParentProcess() {
|
||||
DbgModelTargetObject test = (DbgModelTargetObject) parent;
|
||||
while (test != null && !(test.getProxy() instanceof TargetProcess)) {
|
||||
test = (DbgModelTargetObject) test.getImplParent();
|
||||
test = (DbgModelTargetObject) test.getParent();
|
||||
}
|
||||
return test == null ? null : (DbgModelTargetProcess) test.getProxy();
|
||||
}
|
||||
|
@ -376,7 +374,7 @@ public class DbgModel2TargetObjectImpl extends DefaultTargetObject<TargetObject,
|
|||
public DbgModelTargetThread getParentThread() {
|
||||
DbgModelTargetObject test = (DbgModelTargetObject) parent;
|
||||
while (test != null && !(test.getProxy() instanceof TargetThread)) {
|
||||
test = (DbgModelTargetObject) test.getImplParent();
|
||||
test = (DbgModelTargetObject) test.getParent();
|
||||
}
|
||||
return test == null ? null : (DbgModelTargetThread) test.getProxy();
|
||||
}
|
||||
|
|
|
@ -336,8 +336,8 @@ public class DbgModel2TargetRootImpl extends DbgModel2DefaultTargetModelRoot
|
|||
getModel().fetchModelValue(objPath).handle(seq::next);
|
||||
}, TypeSpec.cls(Object.class)).then((obj, seq) -> {
|
||||
if (obj instanceof DbgModelTargetExecutionStateful) {
|
||||
DbgModelTargetExecutionStateful<?> stateful =
|
||||
(DbgModelTargetExecutionStateful<?>) obj;
|
||||
DbgModelTargetExecutionStateful stateful =
|
||||
(DbgModelTargetExecutionStateful) obj;
|
||||
TargetExecutionState execState = stateful.convertState(state);
|
||||
stateful.setExecutionState(execState, reason);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ public class DbgModel2TargetRootImpl extends DbgModel2DefaultTargetModelRoot
|
|||
}
|
||||
|
||||
listeners.fire(TargetBreakpointListener.class)
|
||||
.breakpointHit((TargetBreakpointContainer<?>) bpt.getParent(),
|
||||
.breakpointHit((TargetBreakpointContainer) bpt.getParent(),
|
||||
getParentProcess(), null, bpt, bpt);
|
||||
bpt.breakpointHit();
|
||||
});
|
||||
|
@ -492,13 +492,12 @@ public class DbgModel2TargetRootImpl extends DbgModel2DefaultTargetModelRoot
|
|||
}
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility() {
|
||||
return accessibility;
|
||||
public boolean isAccessible() {
|
||||
return accessible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccessibility(TargetAccessibility accessibility) {
|
||||
this.accessibility = accessibility;
|
||||
public void setAccessible(boolean accessible) {
|
||||
this.accessible = accessible;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import agent.dbgeng.model.iface1.DbgModelTargetInterruptible;
|
|||
import agent.dbgeng.model.iface2.DbgModelTargetObject;
|
||||
|
||||
public class DbgModel2TargetSystemMarkerImpl extends DbgModel2TargetObjectImpl
|
||||
implements DbgModelTargetInterruptible<DbgModel2TargetSystemMarkerImpl> {
|
||||
implements DbgModelTargetInterruptible {
|
||||
|
||||
// NB: this is an invisible marker whose only purpose if to enable an
|
||||
// interrupt when connecting in kernel-mode to a running target
|
||||
|
|
|
@ -19,7 +19,6 @@ import java.lang.invoke.MethodHandles;
|
|||
import java.lang.ref.Cleaner;
|
||||
import java.lang.ref.Cleaner.Cleanable;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import agent.dbgeng.manager.*;
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
|
@ -27,16 +26,14 @@ import agent.dbgeng.model.iface1.*;
|
|||
import agent.dbgeng.model.iface2.*;
|
||||
import agent.dbgmodel.dbgmodel.main.ModelObject;
|
||||
import agent.dbgmodel.jna.dbgmodel.DbgModelNative.ModelObjectKind;
|
||||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointAction;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.util.datastruct.ListenerSet;
|
||||
|
||||
public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl implements //
|
||||
DbgModelTargetAccessConditioned<DelegateDbgModel2TargetObject>, //
|
||||
DbgModelTargetExecutionStateful<DelegateDbgModel2TargetObject>, //
|
||||
DbgModelTargetAccessConditioned, //
|
||||
DbgModelTargetExecutionStateful, //
|
||||
DbgModel2TargetProxy, DbgModelTargetBptHelper {
|
||||
// Probably don-t need any of the handler-map or annotation stuff
|
||||
|
||||
|
@ -198,7 +195,7 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
|
|||
}
|
||||
|
||||
public DelegateDbgModel2TargetObject clone(String key, ModelObject modelObject) {
|
||||
DbgModelTargetObject p = (DbgModelTargetObject) getImplParent();
|
||||
DbgModelTargetObject p = (DbgModelTargetObject) getParent();
|
||||
List<Class<? extends TargetObject>> mixins = new ArrayList<>();
|
||||
Class<? extends DbgModelTargetObject> mixin = lookupWrapperType(key, p.getName());
|
||||
if (mixin != null) {
|
||||
|
@ -209,27 +206,11 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
|
|||
return delegate;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompletableFuture<? extends DelegateDbgModel2TargetObject> fetch() {
|
||||
return (CompletableFuture) CompletableFuture.completedFuture(proxy);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DbgModelTargetObject getProxy() {
|
||||
return (DbgModelTargetObject) proxy;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public CompletableFuture<? extends DelegateDbgModel2TargetObject> fetchParent() {
|
||||
TargetObjectRef p = getParent();
|
||||
if (p == null) {
|
||||
return AsyncUtils.nil();
|
||||
}
|
||||
return (CompletableFuture<? extends DelegateDbgModel2TargetObject>) p.fetch();
|
||||
}
|
||||
|
||||
protected static String getHintForObject(ModelObject obj) {
|
||||
ModelObjectKind kind = obj.getKind();
|
||||
String ret = kind == null ? "" : kind.name();
|
||||
|
@ -309,35 +290,34 @@ public class DelegateDbgModel2TargetObject extends DbgModel2TargetObjectImpl imp
|
|||
|
||||
public void onRunning() {
|
||||
invalidate();
|
||||
setAccessibility(TargetAccessibility.INACCESSIBLE);
|
||||
setAccessible(false);
|
||||
}
|
||||
|
||||
public void onStopped() {
|
||||
setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
setAccessible(true);
|
||||
update();
|
||||
}
|
||||
|
||||
public void onExit() {
|
||||
setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
setAccessible(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility() {
|
||||
return accessibility;
|
||||
public boolean isAccessible() {
|
||||
return accessible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAccessibility(TargetAccessibility accessibility) {
|
||||
public void setAccessible(boolean accessible) {
|
||||
synchronized (attributes) {
|
||||
if (this.accessibility == accessibility) {
|
||||
if (this.accessible == accessible) {
|
||||
return;
|
||||
}
|
||||
this.accessibility = accessibility;
|
||||
this.accessible = accessible;
|
||||
}
|
||||
if (proxy instanceof TargetAccessConditioned) {
|
||||
changeAttributes(List.of(), List.of(), Map.of( //
|
||||
TargetAccessConditioned.ACCESSIBLE_ATTRIBUTE_NAME,
|
||||
accessibility == TargetAccessibility.ACCESSIBLE //
|
||||
TargetAccessConditioned.ACCESSIBLE_ATTRIBUTE_NAME, accessible //
|
||||
), "Accessibility changed");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,7 +26,6 @@ import ghidra.async.AsyncUtils;
|
|||
import ghidra.dbg.DebuggerModelClosedReason;
|
||||
import ghidra.dbg.agent.AbstractDebuggerObjectModel;
|
||||
import ghidra.dbg.error.DebuggerUserException;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.schema.AnnotatedSchemaContext;
|
||||
import ghidra.dbg.target.schema.TargetObjectSchema;
|
||||
|
@ -102,11 +101,11 @@ public class GdbModelImpl extends AbstractDebuggerObjectModel {
|
|||
}
|
||||
case RUNNING: {
|
||||
session.invalidateMemoryAndRegisterCaches();
|
||||
session.setAccessibility(TargetAccessibility.INACCESSIBLE);
|
||||
session.setAccessible(false);
|
||||
break;
|
||||
}
|
||||
case STOPPED: {
|
||||
session.setAccessibility(TargetAccessibility.ACCESSIBLE);
|
||||
session.setAccessible(true);
|
||||
break;
|
||||
}
|
||||
case EXIT: {
|
||||
|
|
|
@ -17,8 +17,8 @@ package agent.gdb.model.impl;
|
|||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
|
||||
interface GdbModelSelectableObject extends TargetObjectRef {
|
||||
interface GdbModelSelectableObject extends TargetObject {
|
||||
CompletableFuture<Void> select();
|
||||
}
|
||||
|
|
|
@ -25,14 +25,17 @@ import ghidra.dbg.target.TargetObject;
|
|||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Attachable", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Attachable",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetAttachable
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetAvailableContainer>
|
||||
implements TargetAttachable<GdbModelTargetAttachable> {
|
||||
implements TargetAttachable {
|
||||
protected static final String PID_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "pid";
|
||||
// TODO: DESCRIPTION, TYPE, USER?
|
||||
|
||||
|
|
|
@ -26,9 +26,12 @@ import ghidra.dbg.target.schema.TargetAttributeType;
|
|||
import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "AvailableContainer", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "AvailableContainer",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetAvailableContainer
|
||||
extends DefaultTargetObject<GdbModelTargetAttachable, GdbModelTargetSession> {
|
||||
public static final String NAME = "Available";
|
||||
|
|
|
@ -34,13 +34,15 @@ import ghidra.program.model.address.AddressRange;
|
|||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "BreakpointContainer", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "BreakpointContainer",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetBreakpointContainer
|
||||
extends DefaultTargetObject<GdbModelTargetBreakpointSpec, GdbModelTargetSession>
|
||||
implements TargetBreakpointContainer<GdbModelTargetBreakpointContainer>,
|
||||
GdbEventsListenerAdapter {
|
||||
implements TargetBreakpointContainer, GdbEventsListenerAdapter {
|
||||
public static final String NAME = "Breakpoints";
|
||||
|
||||
protected static final TargetBreakpointKindSet SUPPORTED_KINDS =
|
||||
|
|
|
@ -25,22 +25,25 @@ import agent.gdb.manager.parsing.GdbCValueParser;
|
|||
import agent.gdb.manager.parsing.GdbParsingUtils.GdbParseError;
|
||||
import generic.Unique;
|
||||
import ghidra.dbg.agent.DefaultTargetObject;
|
||||
import ghidra.dbg.attributes.TargetObjectRefList;
|
||||
import ghidra.dbg.attributes.TargetObjectRefList.DefaultTargetObjectRefList;
|
||||
import ghidra.dbg.attributes.TargetObjectList;
|
||||
import ghidra.dbg.attributes.TargetObjectList.DefaultTargetObjectList;
|
||||
import ghidra.dbg.target.TargetBreakpointLocation;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "BreakpointLocation", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "BreakpointLocation",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetBreakpointLocation
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetBreakpointSpec>
|
||||
implements TargetBreakpointLocation<GdbModelTargetBreakpointLocation> {
|
||||
implements TargetBreakpointLocation {
|
||||
protected static String indexLocation(GdbBreakpointLocation loc) {
|
||||
return PathUtils.makeIndex(loc.getSub());
|
||||
}
|
||||
|
@ -54,7 +57,7 @@ public class GdbModelTargetBreakpointLocation
|
|||
|
||||
protected Address address;
|
||||
protected Integer length;
|
||||
protected final TargetObjectRefList<GdbModelTargetInferior> affects;
|
||||
protected final TargetObjectList<GdbModelTargetInferior> affects;
|
||||
protected String display;
|
||||
|
||||
public GdbModelTargetBreakpointLocation(GdbModelTargetBreakpointSpec spec,
|
||||
|
@ -133,15 +136,15 @@ public class GdbModelTargetBreakpointLocation
|
|||
return length;
|
||||
}
|
||||
|
||||
protected TargetObjectRefList<GdbModelTargetInferior> doGetAffects() {
|
||||
protected TargetObjectList<GdbModelTargetInferior> doGetAffects() {
|
||||
return loc.getInferiorIds()
|
||||
.stream()
|
||||
.map(impl.session.inferiors::getTargetInferior)
|
||||
.collect(Collectors.toCollection(DefaultTargetObjectRefList::new));
|
||||
.collect(Collectors.toCollection(DefaultTargetObjectList::new));
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetObjectRefList<GdbModelTargetInferior> getAffects() {
|
||||
public TargetObjectList<GdbModelTargetInferior> getAffects() {
|
||||
return affects;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,13 +34,15 @@ import ghidra.util.Msg;
|
|||
import ghidra.util.datastruct.ListenerSet;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "BreakpointSpec", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "BreakpointSpec",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetBreakpointSpec extends
|
||||
DefaultTargetObject<GdbModelTargetBreakpointLocation, GdbModelTargetBreakpointContainer>
|
||||
implements TargetBreakpointSpec<GdbModelTargetBreakpointSpec>,
|
||||
TargetDeletable<GdbModelTargetBreakpointSpec> {
|
||||
implements TargetBreakpointSpec, TargetDeletable {
|
||||
|
||||
protected static String indexBreakpoint(GdbBreakpointInfo info) {
|
||||
return PathUtils.makeIndex(info.getNumber());
|
||||
|
|
|
@ -25,14 +25,17 @@ import ghidra.dbg.target.TargetEnvironment;
|
|||
import ghidra.dbg.target.TargetObject;
|
||||
import ghidra.dbg.target.schema.*;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Environment", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Environment",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetEnvironment
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetInferior>
|
||||
implements TargetEnvironment<GdbModelTargetEnvironment> {
|
||||
implements TargetEnvironment {
|
||||
public static final String NAME = "Environment";
|
||||
|
||||
public static final String VISIBLE_ARCH_ATTRIBUTE_NAME = "arch";
|
||||
|
|
|
@ -22,8 +22,6 @@ import agent.gdb.manager.GdbInferior;
|
|||
import agent.gdb.manager.GdbManager.ExecSuffix;
|
||||
import ghidra.async.AsyncFence;
|
||||
import ghidra.dbg.agent.DefaultTargetObject;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.error.DebuggerModelNoSuchPathException;
|
||||
import ghidra.dbg.error.DebuggerModelTypeException;
|
||||
import ghidra.dbg.target.*;
|
||||
|
@ -40,18 +38,10 @@ import ghidra.util.Msg;
|
|||
attributes = {
|
||||
@TargetAttributeType(type = Void.class) })
|
||||
public class GdbModelTargetInferior
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetInferiorContainer> implements //
|
||||
TargetProcess<GdbModelTargetInferior>, //
|
||||
TargetAggregate, //
|
||||
TargetExecutionStateful<GdbModelTargetInferior>, //
|
||||
TargetAttacher<GdbModelTargetInferior>, //
|
||||
TargetDeletable<GdbModelTargetInferior>, //
|
||||
TargetDetachable<GdbModelTargetInferior>, //
|
||||
TargetKillable<GdbModelTargetInferior>, //
|
||||
TargetCmdLineLauncher<GdbModelTargetInferior>, //
|
||||
TargetResumable<GdbModelTargetInferior>, //
|
||||
TargetSteppable<GdbModelTargetInferior>, //
|
||||
GdbModelSelectableObject {
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetInferiorContainer>
|
||||
implements TargetProcess, TargetAggregate, TargetExecutionStateful, TargetAttacher,
|
||||
TargetDeletable, TargetDetachable, TargetKillable, TargetCmdLineLauncher, TargetResumable,
|
||||
TargetSteppable, GdbModelSelectableObject {
|
||||
|
||||
public static final String EXIT_CODE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "exit_code";
|
||||
|
||||
|
@ -186,16 +176,17 @@ public class GdbModelTargetInferior
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> attach(TypedTargetObjectRef<? extends TargetAttachable<?>> ref) {
|
||||
impl.assertMine(TargetObjectRef.class, ref);
|
||||
public CompletableFuture<Void> attach(TargetAttachable attachable) {
|
||||
impl.assertMine(TargetObject.class, attachable);
|
||||
// NOTE: These can change at any time. Just use the path to derive the target PID
|
||||
if (!Objects.equals(PathUtils.parent(ref.getPath()), impl.session.available.getPath())) {
|
||||
if (!Objects.equals(PathUtils.parent(attachable.getPath()),
|
||||
impl.session.available.getPath())) {
|
||||
throw new DebuggerModelTypeException(
|
||||
"Target of attach must be a child of " + impl.session.available.getPath());
|
||||
}
|
||||
long pid;
|
||||
try {
|
||||
pid = Long.parseLong(ref.getIndex());
|
||||
pid = Long.parseLong(attachable.getIndex());
|
||||
}
|
||||
catch (IllegalArgumentException e) {
|
||||
throw new DebuggerModelNoSuchPathException("Badly-formatted PID", e);
|
||||
|
|
|
@ -26,14 +26,17 @@ import ghidra.dbg.target.schema.*;
|
|||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.program.model.address.*;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "MemoryRegion", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "MemoryRegion",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetMemoryRegion
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetProcessMemory>
|
||||
implements TargetMemoryRegion<GdbModelTargetMemoryRegion> {
|
||||
implements TargetMemoryRegion {
|
||||
protected static final String OBJFILE_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "objfile";
|
||||
protected static final String OFFSET_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "offset";
|
||||
|
||||
|
@ -121,7 +124,11 @@ public class GdbModelTargetMemoryRegion
|
|||
return true; // TODO
|
||||
}
|
||||
|
||||
@TargetAttributeType(name = OBJFILE_ATTRIBUTE_NAME, required = true, fixed = true, hidden = true)
|
||||
@TargetAttributeType(
|
||||
name = OBJFILE_ATTRIBUTE_NAME,
|
||||
required = true,
|
||||
fixed = true,
|
||||
hidden = true)
|
||||
public String getObjfile() {
|
||||
return objfile;
|
||||
}
|
||||
|
|
|
@ -29,14 +29,17 @@ import ghidra.dbg.util.PathUtils;
|
|||
import ghidra.program.model.address.*;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Module", elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
}, attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Module",
|
||||
elements = { //
|
||||
@TargetElementType(type = Void.class) //
|
||||
},
|
||||
attributes = { //
|
||||
@TargetAttributeType(type = Void.class) //
|
||||
})
|
||||
public class GdbModelTargetModule
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetModuleContainer>
|
||||
implements TargetModule<GdbModelTargetModule> {
|
||||
implements TargetModule {
|
||||
|
||||
public static final String VISIBLE_RANGE_ATTRIBUTE_NAME = "range";
|
||||
public static final String VISIBLE_MODULE_NAME_ATTRIBUTE_NAME = "module name";
|
||||
|
|
|
@ -40,7 +40,7 @@ import ghidra.util.Msg;
|
|||
canonicalContainer = true)
|
||||
public class GdbModelTargetModuleContainer
|
||||
extends DefaultTargetObject<GdbModelTargetModule, GdbModelTargetInferior>
|
||||
implements TargetModuleContainer<GdbModelTargetModuleContainer> {
|
||||
implements TargetModuleContainer {
|
||||
// NOTE: -file-list-shared-libraries omits the main module and system-supplied DSO.
|
||||
public static final String NAME = "Modules";
|
||||
|
||||
|
@ -78,7 +78,7 @@ public class GdbModelTargetModuleContainer
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<? extends TargetModule<?>> addSyntheticModule(String name) {
|
||||
public CompletableFuture<? extends TargetModule> addSyntheticModule(String name) {
|
||||
throw new DebuggerUserException("GDB Does not support synthetic modules");
|
||||
}
|
||||
|
||||
|
|
|
@ -38,12 +38,15 @@ import ghidra.program.model.address.*;
|
|||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Memory", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Memory",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetProcessMemory
|
||||
extends DefaultTargetObject<GdbModelTargetMemoryRegion, GdbModelTargetInferior>
|
||||
implements TargetMemory<GdbModelTargetProcessMemory> {
|
||||
implements TargetMemory {
|
||||
public static final String NAME = "Memory";
|
||||
|
||||
protected final GdbModelImpl impl;
|
||||
|
|
|
@ -25,14 +25,17 @@ import ghidra.dbg.target.TargetRegister;
|
|||
import ghidra.dbg.target.schema.*;
|
||||
import ghidra.dbg.util.PathUtils;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "RegisterDescriptor", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "RegisterDescriptor",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetRegister
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetRegisterContainer>
|
||||
implements TargetRegister<GdbModelTargetRegister> {
|
||||
implements TargetRegister {
|
||||
|
||||
protected static String indexRegister(GdbRegister register) {
|
||||
String name = register.getName();
|
||||
|
|
|
@ -29,12 +29,15 @@ import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
|||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "RegisterContainer", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "RegisterContainer",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetRegisterContainer
|
||||
extends DefaultTargetObject<GdbModelTargetRegister, GdbModelTargetInferior>
|
||||
implements TargetRegisterContainer<GdbModelTargetRegisterContainer> {
|
||||
implements TargetRegisterContainer {
|
||||
public static final String NAME = "Registers";
|
||||
|
||||
protected final GdbModelImpl impl;
|
||||
|
|
|
@ -26,14 +26,17 @@ import ghidra.dbg.target.schema.*;
|
|||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.program.model.address.*;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Section", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Section",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetSection
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetSectionContainer>
|
||||
implements TargetSection<GdbModelTargetSection> {
|
||||
implements TargetSection {
|
||||
|
||||
public static final String VISIBLE_RANGE_ATTRIBUTE_NAME = "range";
|
||||
|
||||
|
|
|
@ -26,9 +26,12 @@ import ghidra.dbg.target.schema.TargetAttributeType;
|
|||
import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "SectionContainer", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "SectionContainer",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetSectionContainer
|
||||
extends DefaultTargetObject<GdbModelTargetSection, GdbModelTargetModule> {
|
||||
public static final String NAME = "Sections";
|
||||
|
|
|
@ -21,11 +21,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
import agent.gdb.manager.*;
|
||||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.dbg.DebuggerObjectModel;
|
||||
import ghidra.dbg.agent.AbstractTargetObject;
|
||||
import ghidra.dbg.agent.DefaultTargetModelRoot;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.error.DebuggerIllegalArgumentException;
|
||||
import ghidra.dbg.target.*;
|
||||
import ghidra.dbg.target.TargetLauncher.TargetCmdLineLauncher;
|
||||
|
@ -41,16 +37,10 @@ import ghidra.util.Msg;
|
|||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetSession extends DefaultTargetModelRoot implements //
|
||||
TargetAccessConditioned<GdbModelTargetSession>,
|
||||
TargetAttacher<GdbModelTargetSession>,
|
||||
TargetFocusScope<GdbModelTargetSession>,
|
||||
TargetInterpreter<GdbModelTargetSession>,
|
||||
TargetInterruptible<GdbModelTargetSession>,
|
||||
TargetCmdLineLauncher<GdbModelTargetSession>,
|
||||
TargetEventScope<GdbModelTargetSession>,
|
||||
GdbConsoleOutputListener,
|
||||
GdbEventsListenerAdapter {
|
||||
public class GdbModelTargetSession extends DefaultTargetModelRoot implements
|
||||
TargetAccessConditioned, TargetAttacher, TargetFocusScope, TargetInterpreter,
|
||||
TargetInterruptible, TargetCmdLineLauncher, TargetEventScope,
|
||||
GdbConsoleOutputListener, GdbEventsListenerAdapter {
|
||||
protected static final String GDB_PROMPT = "(gdb)";
|
||||
|
||||
protected final GdbModelImpl impl;
|
||||
|
@ -60,7 +50,7 @@ public class GdbModelTargetSession extends DefaultTargetModelRoot implements //
|
|||
protected final GdbModelTargetAvailableContainer available;
|
||||
protected final GdbModelTargetBreakpointContainer breakpoints;
|
||||
|
||||
private TargetAccessibility accessibility = TargetAccessibility.ACCESSIBLE;
|
||||
private boolean accessible = true;
|
||||
protected GdbModelSelectableObject focus;
|
||||
|
||||
protected String debugger = "gdb"; // Used by GdbModelTargetEnvironment
|
||||
|
@ -77,7 +67,7 @@ public class GdbModelTargetSession extends DefaultTargetModelRoot implements //
|
|||
inferiors.getName(), inferiors, //
|
||||
available.getName(), available, //
|
||||
breakpoints.getName(), breakpoints, //
|
||||
ACCESSIBLE_ATTRIBUTE_NAME, accessibility == TargetAccessibility.ACCESSIBLE, //
|
||||
ACCESSIBLE_ATTRIBUTE_NAME, accessible, //
|
||||
PROMPT_ATTRIBUTE_NAME, GDB_PROMPT, //
|
||||
DISPLAY_ATTRIBUTE_NAME, display, //
|
||||
TargetMethod.PARAMETERS_ATTRIBUTE_NAME, TargetCmdLineLauncher.PARAMETERS, //
|
||||
|
@ -167,22 +157,22 @@ public class GdbModelTargetSession extends DefaultTargetModelRoot implements //
|
|||
setFocus(f);
|
||||
}
|
||||
|
||||
public void setAccessibility(TargetAccessibility accessibility) {
|
||||
public void setAccessible(boolean accessible) {
|
||||
synchronized (attributes) {
|
||||
if (this.accessibility == accessibility) {
|
||||
if (this.accessible == accessible) {
|
||||
return;
|
||||
}
|
||||
this.accessibility = accessibility;
|
||||
this.accessible = accessible;
|
||||
changeAttributes(List.of(), Map.of( //
|
||||
ACCESSIBLE_ATTRIBUTE_NAME, accessibility == TargetAccessibility.ACCESSIBLE //
|
||||
ACCESSIBLE_ATTRIBUTE_NAME, accessible //
|
||||
), "Accessibility changed");
|
||||
}
|
||||
listeners.fire(TargetAccessibilityListener.class).accessibilityChanged(this, accessibility);
|
||||
listeners.fire(TargetAccessibilityListener.class).accessibilityChanged(this, accessible);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetAccessibility getAccessibility() {
|
||||
return accessibility;
|
||||
public boolean isAccessible() {
|
||||
return accessible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -194,17 +184,10 @@ public class GdbModelTargetSession extends DefaultTargetModelRoot implements //
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> attach(TypedTargetObjectRef<? extends TargetAttachable<?>> ref) {
|
||||
getModel().assertMine(TargetObjectRef.class, ref);
|
||||
List<String> tPath = ref.getPath();
|
||||
return impl.fetchModelObject(tPath).thenCompose(obj -> {
|
||||
GdbModelTargetAttachable attachable = (GdbModelTargetAttachable) DebuggerObjectModel
|
||||
.requireIface(TargetAttachable.class, obj, tPath);
|
||||
// TODO: Find first unused inferior?
|
||||
return impl.gdb.addInferior().thenCompose(inf -> {
|
||||
return inf.attach(attachable.pid).thenApply(__ -> null);
|
||||
});
|
||||
});
|
||||
public CompletableFuture<Void> attach(TargetAttachable attachable) {
|
||||
GdbModelTargetAttachable mine =
|
||||
getModel().assertMine(GdbModelTargetAttachable.class, attachable);
|
||||
return attach(mine.pid);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -237,31 +220,24 @@ public class GdbModelTargetSession extends DefaultTargetModelRoot implements //
|
|||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> requestFocus(TargetObjectRef ref) {
|
||||
impl.assertMine(TargetObjectRef.class, ref);
|
||||
public CompletableFuture<Void> requestFocus(TargetObject obj) {
|
||||
impl.assertMine(TargetObject.class, obj);
|
||||
/**
|
||||
* Yes, this is pointless, since I'm the root, but do it right (TM), since this may change
|
||||
* or be used as an example for other implementations.
|
||||
*/
|
||||
if (!PathUtils.isAncestor(this.getPath(), ref.getPath())) {
|
||||
if (!PathUtils.isAncestor(this.getPath(), obj.getPath())) {
|
||||
throw new DebuggerIllegalArgumentException("Can only focus a successor of the scope");
|
||||
}
|
||||
return ref.fetch().thenCompose(obj -> {
|
||||
TargetObject cur = obj;
|
||||
while (cur != null) {
|
||||
if (cur instanceof GdbModelSelectableObject) {
|
||||
GdbModelSelectableObject sel = (GdbModelSelectableObject) cur;
|
||||
return sel.select();
|
||||
}
|
||||
if (cur instanceof AbstractTargetObject) {
|
||||
AbstractTargetObject<?> def = (AbstractTargetObject<?>) cur;
|
||||
cur = def.getImplParent();
|
||||
continue;
|
||||
}
|
||||
throw new AssertionError();
|
||||
TargetObject cur = obj;
|
||||
while (cur != null) {
|
||||
if (cur instanceof GdbModelSelectableObject) {
|
||||
GdbModelSelectableObject sel = (GdbModelSelectableObject) cur;
|
||||
return sel.select();
|
||||
}
|
||||
return AsyncUtils.NIL;
|
||||
});
|
||||
cur = cur.getParent();
|
||||
}
|
||||
return AsyncUtils.NIL;
|
||||
}
|
||||
|
||||
protected void invalidateMemoryAndRegisterCaches() {
|
||||
|
|
|
@ -30,12 +30,15 @@ import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
|||
import ghidra.util.Msg;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Stack", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Stack",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetStack
|
||||
extends DefaultTargetObject<GdbModelTargetStackFrame, GdbModelTargetThread>
|
||||
implements TargetStack<GdbModelTargetStack> {
|
||||
implements TargetStack {
|
||||
public static final String NAME = "Stack";
|
||||
|
||||
protected final GdbModelImpl impl;
|
||||
|
|
|
@ -31,14 +31,16 @@ import ghidra.lifecycle.Internal;
|
|||
import ghidra.program.model.address.Address;
|
||||
import ghidra.util.Msg;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "StackFrame", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "StackFrame",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetStackFrame extends DefaultTargetObject<TargetObject, GdbModelTargetStack>
|
||||
implements TargetStackFrame<GdbModelTargetStackFrame>,
|
||||
TargetRegisterBank<GdbModelTargetStackFrame>, GdbModelSelectableObject {
|
||||
implements TargetStackFrame, TargetRegisterBank, GdbModelSelectableObject {
|
||||
public static final String FUNC_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "function";
|
||||
public static final String FROM_ATTRIBUTE_NAME = PREFIX_INVISIBLE + "from"; // TODO
|
||||
|
||||
|
@ -87,7 +89,10 @@ public class GdbModelTargetStackFrame extends DefaultTargetObject<TargetObject,
|
|||
setFrame(frame);
|
||||
}
|
||||
|
||||
@TargetAttributeType(name = GdbModelTargetStackFrameRegisterContainer.NAME, required = true, fixed = true)
|
||||
@TargetAttributeType(
|
||||
name = GdbModelTargetStackFrameRegisterContainer.NAME,
|
||||
required = true,
|
||||
fixed = true)
|
||||
public GdbModelTargetStackFrameRegisterContainer getRegisters() {
|
||||
return registers;
|
||||
}
|
||||
|
|
|
@ -25,9 +25,12 @@ import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
|||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
// NB. The canonical container, but of no recognized interface
|
||||
@TargetObjectSchemaInfo(name = "RegisterValueContainer", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "RegisterValueContainer",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetStackFrameRegisterContainer
|
||||
extends DefaultTargetObject<GdbModelTargetStackFrameRegister, GdbModelTargetStackFrame> {
|
||||
public static final String NAME = "Registers";
|
||||
|
|
|
@ -26,14 +26,17 @@ import ghidra.dbg.target.schema.*;
|
|||
import ghidra.dbg.util.PathUtils;
|
||||
import ghidra.program.model.address.Address;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "Symbol", elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
}, attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "Symbol",
|
||||
elements = {
|
||||
@TargetElementType(type = Void.class)
|
||||
},
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
})
|
||||
public class GdbModelTargetSymbol
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetSymbolContainer>
|
||||
implements TargetSymbol<GdbModelTargetSymbol> {
|
||||
implements TargetSymbol {
|
||||
protected static String indexSymbol(GdbMinimalSymbol symbol) {
|
||||
return symbol.getName();
|
||||
}
|
||||
|
|
|
@ -27,12 +27,15 @@ import ghidra.dbg.target.schema.TargetAttributeType;
|
|||
import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "SymbolContainer", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "SymbolContainer",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetSymbolContainer
|
||||
extends DefaultTargetObject<GdbModelTargetSymbol, GdbModelTargetModule>
|
||||
implements TargetSymbolNamespace<GdbModelTargetSymbolContainer> {
|
||||
implements TargetSymbolNamespace {
|
||||
public static final String NAME = "Symbols";
|
||||
|
||||
protected final GdbModelImpl impl;
|
||||
|
|
|
@ -40,8 +40,7 @@ import ghidra.util.Msg;
|
|||
@TargetAttributeType(type = Void.class) })
|
||||
public class GdbModelTargetThread
|
||||
extends DefaultTargetObject<TargetObject, GdbModelTargetThreadContainer> implements
|
||||
TargetThread<GdbModelTargetThread>, TargetExecutionStateful<GdbModelTargetThread>,
|
||||
TargetSteppable<GdbModelTargetThread>, GdbModelSelectableObject {
|
||||
TargetThread, TargetExecutionStateful, TargetSteppable, GdbModelSelectableObject {
|
||||
protected static final TargetStepKindSet SUPPORTED_KINDS = TargetStepKindSet.of( //
|
||||
TargetStepKind.ADVANCE, //
|
||||
TargetStepKind.FINISH, //
|
||||
|
|
|
@ -27,9 +27,12 @@ import ghidra.dbg.target.schema.TargetAttributeType;
|
|||
import ghidra.dbg.target.schema.TargetObjectSchemaInfo;
|
||||
import ghidra.util.datastruct.WeakValueHashMap;
|
||||
|
||||
@TargetObjectSchemaInfo(name = "ThreadContainer", attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
}, canonicalContainer = true)
|
||||
@TargetObjectSchemaInfo(
|
||||
name = "ThreadContainer",
|
||||
attributes = {
|
||||
@TargetAttributeType(type = Void.class)
|
||||
},
|
||||
canonicalContainer = true)
|
||||
public class GdbModelTargetThreadContainer
|
||||
extends DefaultTargetObject<GdbModelTargetThread, GdbModelTargetInferior> {
|
||||
public static final String NAME = "Threads";
|
||||
|
|
|
@ -17,6 +17,7 @@ package agent.gdb.model;
|
|||
|
||||
import static ghidra.dbg.testutil.DummyProc.run;
|
||||
import static ghidra.dbg.testutil.DummyProc.which;
|
||||
import static ghidra.lifecycle.Unfinished.TODO;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.*;
|
||||
|
@ -33,11 +34,9 @@ import agent.gdb.model.impl.GdbModelTargetInferior;
|
|||
import agent.gdb.model.impl.GdbModelTargetStackFrame;
|
||||
import ghidra.async.AsyncReference;
|
||||
import ghidra.async.AsyncUtils;
|
||||
import ghidra.dbg.DebugModelConventions;
|
||||
import ghidra.dbg.DebugModelConventions.AllRequiredAccess;
|
||||
import ghidra.dbg.DebuggerObjectModel;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TargetObjectRefList;
|
||||
import ghidra.dbg.attributes.TargetObjectList;
|
||||
import ghidra.dbg.error.DebuggerModelNoSuchPathException;
|
||||
import ghidra.dbg.error.DebuggerModelTypeException;
|
||||
import ghidra.dbg.target.*;
|
||||
|
@ -185,12 +184,12 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access...");
|
||||
waitAcc(access);
|
||||
Msg.debug(this, "Getting Inferiors (before launch)...");
|
||||
Map<String, ? extends TargetObjectRef> inferiors =
|
||||
Map<String, ? extends TargetObject> inferiors =
|
||||
waitOn(model.fetchObjectElements(List.of("Inferiors")));
|
||||
Msg.debug(this, "Inferiors before: " + inferiors);
|
||||
assertEquals(1, inferiors.size());
|
||||
Msg.debug(this, "Finding TargetLauncher...");
|
||||
TargetLauncher<?> launcher = suitable(TargetLauncher.tclass, root);
|
||||
TargetLauncher launcher = suitable(TargetLauncher.class, root);
|
||||
Msg.debug(this, "Launching...");
|
||||
waitOn(launcher.launch(
|
||||
Map.of(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, "/bin/echo Hello, World!")));
|
||||
|
@ -221,8 +220,8 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for inferior access...");
|
||||
waitAcc(infAccess);
|
||||
Msg.debug(this, "Reflecting parameters");
|
||||
TargetLauncher<?> launcher = inferior.as(TargetLauncher.tclass);
|
||||
for (ParameterDescription<?> param : launcher.getParameters().values()) {
|
||||
TargetLauncher launcher = inferior.as(TargetLauncher.class);
|
||||
for (ParameterDescription param : launcher.getParameters().values()) {
|
||||
Msg.info(this, " Parameter: " + param);
|
||||
}
|
||||
waitOn(launcher.launch(Map.of("args", "/bin/echo Hello, World!")));
|
||||
|
@ -230,7 +229,7 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
waitAcc(rootAccess);
|
||||
Msg.debug(this, "Getting Inferiors (after launch)...");
|
||||
Map<String, ? extends TargetObjectRef> inferiors =
|
||||
Map<String, ? extends TargetObject> inferiors =
|
||||
waitOn(model.fetchObjectElements(List.of("Inferiors")));
|
||||
Msg.debug(this, "Inferiors after: " + inferiors);
|
||||
assertEquals(1, inferiors.size());
|
||||
|
@ -260,7 +259,7 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
waitAcc(rootAccess);
|
||||
Msg.debug(this, "Getting Inferiors (after launch)...");
|
||||
Map<String, ? extends TargetObjectRef> inferiors =
|
||||
Map<String, ? extends TargetObject> inferiors =
|
||||
waitOn(model.fetchObjectElements(List.of("Inferiors")));
|
||||
Msg.debug(this, "Inferiors after: " + inferiors);
|
||||
assertEquals(1, inferiors.size());
|
||||
|
@ -278,7 +277,7 @@ public abstract class AbstractModelForGdbTest
|
|||
AllRequiredAccess access = access(root);
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
waitAcc(access);
|
||||
Map<String, ? extends TargetObjectRef> available =
|
||||
Map<String, ? extends TargetObject> available =
|
||||
waitOn(model.fetchObjectElements(List.of("Available")));
|
||||
assertTrue(available.containsKey(Long.toString(dd.pid)));
|
||||
}
|
||||
|
@ -296,16 +295,16 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access...");
|
||||
waitAcc(access);
|
||||
Msg.debug(this, "Getting Inferiors (before attach)...");
|
||||
Map<String, ? extends TargetObjectRef> inferiors =
|
||||
Map<String, ? extends TargetObject> inferiors =
|
||||
waitOn(model.fetchObjectElements(List.of("Inferiors")));
|
||||
Msg.debug(this, "Inferiors before: " + inferiors);
|
||||
assertEquals(1, inferiors.size());
|
||||
Msg.debug(this, "Finding TargetAttacher...");
|
||||
TargetAttacher<?> attacher = suitable(TargetAttacher.tclass, root);
|
||||
TargetAttacher attacher = suitable(TargetAttacher.class, root);
|
||||
Msg.debug(this, " Got TargetAttacher: " + attacher);
|
||||
TargetAttachable<?> attachable =
|
||||
TargetAttachable attachable =
|
||||
waitOn(model.fetchModelObject("Available", "[" + dd.pid + "]"))
|
||||
.as(TargetAttachable.tclass);
|
||||
.as(TargetAttachable.class);
|
||||
Msg.debug(this, " Got Attachable: " + attachable);
|
||||
Msg.debug(this, "Attaching...");
|
||||
waitOn(attacher.attach(attachable));
|
||||
|
@ -316,8 +315,7 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Inferiors after: " + inferiors);
|
||||
assertEquals(2, inferiors.size());
|
||||
Msg.debug(this, "Killing...");
|
||||
TargetKillable<?> killable =
|
||||
waitOn(inferiors.get("2").as(TargetKillable.tclass).fetch());
|
||||
TargetKillable killable = inferiors.get("2").as(TargetKillable.class);
|
||||
waitOn(killable.kill());
|
||||
}
|
||||
}
|
||||
|
@ -335,7 +333,7 @@ public abstract class AbstractModelForGdbTest
|
|||
waitAcc(access);
|
||||
Msg.debug(this, "Getting Inferior 1...");
|
||||
TargetObject inferior = waitOn(model.fetchModelObject(List.of("Inferiors", "[1]")));
|
||||
TargetAttacher<?> attacher = inferior.as(TargetAttacher.tclass);
|
||||
TargetAttacher attacher = inferior.as(TargetAttacher.class);
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
waitAcc(access);
|
||||
Msg.debug(this, "Attaching...");
|
||||
|
@ -343,13 +341,13 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access (again, again)...");
|
||||
waitAcc(access);
|
||||
Msg.debug(this, "Getting Inferiors (after attach)...");
|
||||
Map<String, ? extends TargetObjectRef> inferiors =
|
||||
Map<String, ? extends TargetObject> inferiors =
|
||||
waitOn(model.fetchObjectElements(List.of("Inferiors")));
|
||||
Msg.debug(this, "Inferiors after: " + inferiors);
|
||||
assertEquals(1, inferiors.size());
|
||||
Msg.debug(this, "Killing...");
|
||||
TargetObject attached = waitOn(inferiors.get("1").fetch());
|
||||
TargetKillable<?> killable = attached.as(TargetKillable.tclass);
|
||||
TargetObject attached = inferiors.get("1");
|
||||
TargetKillable killable = attached.as(TargetKillable.class);
|
||||
waitOn(killable.kill());
|
||||
}
|
||||
}
|
||||
|
@ -392,9 +390,8 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Getting Inferior 1...");
|
||||
TargetObject inferior = waitOn(model.fetchModelObject("Inferiors", "[1]"));
|
||||
Msg.debug(this, "Attaching to bogus path...");
|
||||
TargetAttacher<?> attacher = inferior.as(TargetAttacher.tclass);
|
||||
waitOn(attacher.attach(model.createRef("Available", "Process -1")
|
||||
.as(TargetAttachable.tclass)));
|
||||
TargetAttacher attacher = inferior.as(TargetAttacher.class);
|
||||
TODO();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -412,8 +409,9 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Getting Inferior 1...");
|
||||
TargetObject inferior = waitOn(model.fetchModelObject("Inferiors", "[1]"));
|
||||
Msg.debug(this, "Attaching to bogus path...");
|
||||
TargetAttacher<?> attacher = inferior.as(TargetAttacher.tclass);
|
||||
waitOn(attacher.attach(model.createRef("Available").as(TargetAttachable.tclass)));
|
||||
TargetAttacher attacher = inferior.as(TargetAttacher.class);
|
||||
// NOTE: Technically, the "as" call is causing it here.
|
||||
waitOn(attacher.attach(model.getModelObject("Available").as(TargetAttachable.class)));
|
||||
fail("Exception expected");
|
||||
}
|
||||
}
|
||||
|
@ -524,7 +522,7 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access...");
|
||||
waitAcc(access);
|
||||
Msg.debug(this, "Finding breakpoint container...");
|
||||
TargetBreakpointContainer<?> breaks = suitable(TargetBreakpointContainer.tclass, root);
|
||||
TargetBreakpointContainer breaks = suitable(TargetBreakpointContainer.class, root);
|
||||
Msg.debug(this, "Got: " + breaks);
|
||||
TargetBreakpointKindSet kinds = breaks.getSupportedBreakpointKinds();
|
||||
Msg.debug(this, "Supports: " + kinds);
|
||||
|
@ -547,22 +545,21 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Setting file to " + specimen + "...");
|
||||
cli(root, "file " + specimen);
|
||||
Msg.debug(this, "Finding breakpoint container...");
|
||||
TargetBreakpointContainer<?> breaks = suitable(TargetBreakpointContainer.tclass, root);
|
||||
TargetBreakpointContainer breaks = suitable(TargetBreakpointContainer.class, root);
|
||||
Msg.debug(this, "Placing breakpoint...");
|
||||
waitOn(breaks.placeBreakpoint("func", Set.of(TargetBreakpointKind.SOFTWARE)));
|
||||
Msg.debug(this, "Getting breakpoint specs...");
|
||||
Map<String, ? extends TargetObjectRef> specs = waitOn(breaks.fetchElements());
|
||||
Map<String, ? extends TargetObject> specs = waitOn(breaks.fetchElements());
|
||||
Msg.debug(this, "Got specs: " + specs);
|
||||
assertEquals(1, specs.size());
|
||||
TargetBreakpointSpec<?> spec =
|
||||
waitOn(specs.get("1").as(TargetBreakpointSpec.tclass).fetch());
|
||||
Collection<? extends TargetBreakpointLocation<?>> ls = waitOn(spec.getLocations());
|
||||
TargetBreakpointSpec spec = specs.get("1").as(TargetBreakpointSpec.class);
|
||||
Collection<? extends TargetBreakpointLocation> ls = waitOn(spec.getLocations());
|
||||
Msg.debug(this, "Got locations: " + ls);
|
||||
assertEquals(1, ls.size());
|
||||
TargetBreakpointLocation<?> loc = ls.iterator().next();
|
||||
TargetBreakpointLocation loc = ls.iterator().next();
|
||||
Address addr = loc.getAddress();
|
||||
Msg.debug(this, "Got address: " + addr);
|
||||
TargetObjectRefList<?> list = loc.getAffects();
|
||||
TargetObjectList<?> list = loc.getAffects();
|
||||
Msg.debug(this, "Got affects: " + list);
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
@ -583,24 +580,23 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Setting file to " + specimen + "...");
|
||||
cli(root, "file " + specimen);
|
||||
Msg.debug(this, "Finding breakpoint container...");
|
||||
TargetBreakpointContainer<?> breaks = suitable(TargetBreakpointContainer.tclass, root);
|
||||
TargetBreakpointContainer breaks = suitable(TargetBreakpointContainer.class, root);
|
||||
Msg.debug(this, "Placing breakpoint...");
|
||||
waitOn(breaks.placeBreakpoint("int_var",
|
||||
Set.of(TargetBreakpointKind.READ, TargetBreakpointKind.WRITE)));
|
||||
Msg.debug(this, "Getting breakpoint specs...");
|
||||
Map<String, ? extends TargetObjectRef> specs = waitOn(breaks.fetchElements());
|
||||
Map<String, ? extends TargetObject> specs = waitOn(breaks.fetchElements());
|
||||
Msg.debug(this, "Got specs: " + specs);
|
||||
assertEquals(1, specs.size());
|
||||
TargetBreakpointSpec<?> spec =
|
||||
waitOn(specs.get("1").as(TargetBreakpointSpec.tclass).fetch());
|
||||
Collection<? extends TargetBreakpointLocation<?>> ls = waitOn(spec.getLocations());
|
||||
TargetBreakpointSpec spec = specs.get("1").as(TargetBreakpointSpec.class);
|
||||
Collection<? extends TargetBreakpointLocation> ls = waitOn(spec.getLocations());
|
||||
Msg.debug(this, "Got locations: " + ls);
|
||||
assertEquals(1, ls.size());
|
||||
TargetBreakpointLocation<?> loc = ls.iterator().next();
|
||||
TargetBreakpointLocation loc = ls.iterator().next();
|
||||
Address addr = loc.getAddress();
|
||||
Msg.debug(this, "Got address: " + addr);
|
||||
assertNotNull(addr);
|
||||
TargetObjectRefList<?> list = loc.getAffects();
|
||||
TargetObjectList<?> list = loc.getAffects();
|
||||
Msg.debug(this, "Got affects: " + list);
|
||||
assertEquals(1, list.size());
|
||||
}
|
||||
|
@ -611,7 +607,7 @@ public abstract class AbstractModelForGdbTest
|
|||
try (ModelHost m = modelHost()) {
|
||||
DebuggerObjectModel model = m.getModel();
|
||||
Set<Address> locAddresses = new HashSet<>();
|
||||
Set<TargetObjectRef> locAffecteds = new HashSet<>();
|
||||
Set<TargetObject> locAffecteds = new HashSet<>();
|
||||
|
||||
init(m);
|
||||
Msg.debug(this, "Getting root object");
|
||||
|
@ -628,33 +624,32 @@ public abstract class AbstractModelForGdbTest
|
|||
waitAcc(access);
|
||||
Msg.debug(this, "Setting to stay attached to forks");
|
||||
cli(root, "set detach-on-fork off");
|
||||
TargetBreakpointContainer<?> breaks =
|
||||
suitable(TargetBreakpointContainer.tclass, inferior);
|
||||
TargetBreakpointContainer breaks =
|
||||
suitable(TargetBreakpointContainer.class, inferior);
|
||||
Msg.debug(this, "Setting break on func");
|
||||
waitOn(breaks.placeBreakpoint("func", Set.of(TargetBreakpointKind.SOFTWARE)));
|
||||
Msg.debug(this, "Resuming execution (first time)");
|
||||
resume(inferior);
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
waitAcc(access);
|
||||
Map<String, ? extends TargetObjectRef> inferiors =
|
||||
Map<String, ? extends TargetObject> inferiors =
|
||||
waitOn(model.fetchObjectElements("Inferiors"));
|
||||
Msg.debug(this, "After first break, inferiors are: " + inferiors);
|
||||
assertEquals(2, inferiors.size());
|
||||
// NOTE: Breakpoint 1 was the temporary one on 'main'
|
||||
Map<String, ? extends TargetObjectRef> ls =
|
||||
Map<String, ? extends TargetObject> ls =
|
||||
waitOn(model.fetchObjectElements("Breakpoints", "[2]"));
|
||||
Msg.debug(this, "Locations: " + ls);
|
||||
assertEquals(2, ls.size());
|
||||
for (TargetObjectRef ref : ls.values()) {
|
||||
TargetBreakpointLocation<?> loc =
|
||||
waitOn(ref.as(TargetBreakpointLocation.tclass).fetch());
|
||||
for (TargetObject obj : ls.values()) {
|
||||
TargetBreakpointLocation loc = obj.as(TargetBreakpointLocation.class);
|
||||
locAddresses.add(loc.getAddress());
|
||||
locAffecteds.addAll(loc.getAffects());
|
||||
}
|
||||
Msg.debug(this, "Addresses: " + locAddresses + ", affected: " + locAffecteds);
|
||||
assertEquals(1, locAddresses.size());
|
||||
assertEquals(Set.of(List.of("Inferiors", "[1]"), List.of("Inferiors", "[2]")),
|
||||
locAffecteds.stream().map(TargetObjectRef::getPath).collect(Collectors.toSet()));
|
||||
locAffecteds.stream().map(TargetObject::getPath).collect(Collectors.toSet()));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -663,16 +658,16 @@ public abstract class AbstractModelForGdbTest
|
|||
public void testExpForkWithListeners() throws Throwable {
|
||||
ElementTrackingListener<TargetObject> infListener =
|
||||
new ElementTrackingListener<>(TargetObject.class);
|
||||
ElementTrackingListener<? extends TargetBreakpointSpec<?>> bkListener =
|
||||
new ElementTrackingListener<>(TargetBreakpointSpec.tclass);
|
||||
ElementTrackingListener<? extends TargetBreakpointLocation<?>> blListener =
|
||||
new ElementTrackingListener<>(TargetBreakpointLocation.tclass);
|
||||
ElementTrackingListener<? extends TargetBreakpointSpec> bkListener =
|
||||
new ElementTrackingListener<>(TargetBreakpointSpec.class);
|
||||
ElementTrackingListener<? extends TargetBreakpointLocation> blListener =
|
||||
new ElementTrackingListener<>(TargetBreakpointLocation.class);
|
||||
EventSequenceListener evtListener = new EventSequenceListener();
|
||||
|
||||
try (ModelHost m = modelHost()) {
|
||||
DebuggerObjectModel model = m.getModel();
|
||||
Set<Address> ebAddresses = new HashSet<>();
|
||||
Set<TargetObjectRef> ebAffecteds = new HashSet<>();
|
||||
Set<TargetObject> ebAffecteds = new HashSet<>();
|
||||
|
||||
init(m);
|
||||
Msg.debug(this, "Getting root object");
|
||||
|
@ -687,8 +682,7 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Installing listener for inferiors");
|
||||
infCont.addListener(infListener);
|
||||
Msg.debug(this, "Getting inferiors");
|
||||
Map<String, ? extends TargetObject> inferiors = waitOn(infCont.fetchElements()
|
||||
.thenCompose(DebugModelConventions::fetchAll));
|
||||
Map<String, ? extends TargetObject> inferiors = waitOn(infCont.fetchElements());
|
||||
infListener.putAll(inferiors);
|
||||
Msg.debug(this, "Launching...");
|
||||
launch(infListener.elements.get("1"),
|
||||
|
@ -697,24 +691,22 @@ public abstract class AbstractModelForGdbTest
|
|||
waitAcc(access);
|
||||
Msg.debug(this, "Setting to stay attached to forks");
|
||||
cli(root, "set detach-on-fork off");
|
||||
TargetBreakpointContainer<?> bkCont =
|
||||
suitable(TargetBreakpointContainer.tclass, infCont);
|
||||
TargetBreakpointContainer bkCont =
|
||||
suitable(TargetBreakpointContainer.class, infCont);
|
||||
Msg.debug(this, "Installing listener for breakpoints");
|
||||
bkCont.addListener(bkListener);
|
||||
Msg.debug(this, "Getting breakpoints");
|
||||
Map<String, ? extends TargetObject> bkElems = waitOn(bkCont.fetchElements()
|
||||
.thenCompose(DebugModelConventions::fetchAll));
|
||||
Map<String, ? extends TargetObject> bkElems = waitOn(bkCont.fetchElements());
|
||||
bkListener.putAll(bkElems);
|
||||
Msg.debug(this, "Setting break on func");
|
||||
waitOn(bkCont.placeBreakpoint("func", Set.of(TargetBreakpointKind.SOFTWARE)));
|
||||
Msg.debug(this, "Breakpoint elements: " + bkListener.elements);
|
||||
TargetBreakpointSpec<?> bk2 =
|
||||
TargetBreakpointSpec bk2 =
|
||||
waitOn(bkListener.refElement("2").waitUntil(t -> t != null));
|
||||
Msg.debug(this, "Installing listener on Breakpoint 2");
|
||||
bk2.addListener(blListener);
|
||||
Msg.debug(this, "Getting locations for 2");
|
||||
Map<String, ? extends TargetObject> bk2ls = waitOn(bk2.fetchElements()
|
||||
.thenCompose(DebugModelConventions::fetchAll));
|
||||
Map<String, ? extends TargetObject> bk2ls = waitOn(bk2.fetchElements());
|
||||
blListener.putAll(bk2ls);
|
||||
Msg.debug(this, "Resuming execution (first time)");
|
||||
resume(infListener.elements.get("1"));
|
||||
|
@ -727,14 +719,14 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Locations: " + blListener.elements);
|
||||
assertEquals(2, blListener.elements.size());
|
||||
for (TargetObject obj : blListener.elements.values()) {
|
||||
TargetBreakpointLocation<?> eb = obj.as(TargetBreakpointLocation.tclass);
|
||||
TargetBreakpointLocation eb = obj.as(TargetBreakpointLocation.class);
|
||||
ebAddresses.add(eb.getAddress());
|
||||
ebAffecteds.addAll(eb.getAffects());
|
||||
}
|
||||
Msg.debug(this, "Addresses: " + ebAddresses + ", affected: " + ebAffecteds);
|
||||
assertEquals(1, ebAddresses.size());
|
||||
assertEquals(Set.of(List.of("Inferiors", "[1]"), List.of("Inferiors", "[2]")),
|
||||
ebAffecteds.stream().map(TargetObjectRef::getPath).collect(Collectors.toSet()));
|
||||
ebAffecteds.stream().map(TargetObject::getPath).collect(Collectors.toSet()));
|
||||
|
||||
// Getting more precise than this could become fragile, as library paths vary
|
||||
TargetEventType lastType = null;
|
||||
|
@ -779,7 +771,7 @@ public abstract class AbstractModelForGdbTest
|
|||
Map.of(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, which("expCloneExit")));
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
waitAcc(access);
|
||||
TargetBreakpointContainer<?> breaks =
|
||||
TargetBreakpointContainer breaks =
|
||||
suitable(TargetBreakpointContainer.class, inferior);
|
||||
Msg.debug(this, "Setting break on work");
|
||||
waitOn(breaks.placeBreakpoint("work", Set.of(TargetBreakpointKind.SOFTWARE)));
|
||||
|
@ -787,7 +779,7 @@ public abstract class AbstractModelForGdbTest
|
|||
resume(inferior);
|
||||
Msg.debug(this, "Waiting for session access...");
|
||||
waitAcc(access);
|
||||
Map<String, ? extends TargetObjectRef> threads =
|
||||
Map<String, ? extends TargetObject> threads =
|
||||
waitOn(model.fetchObjectElements("Inferiors", "[1]", "Threads"));
|
||||
Msg.debug(this, "After first break, threads are: " + threads);
|
||||
assertEquals(2, threads.size());
|
||||
|
@ -816,11 +808,11 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
waitAcc(access);
|
||||
Msg.debug(this, "Getting symbol to overwrite");
|
||||
TargetSymbol<?> overwrite = waitOn(inferior.fetchSuccessor(
|
||||
"Modules", "[" + expPrint + "]", "Symbols", "[overwrite]")).as(TargetSymbol.tclass);
|
||||
TargetSymbol overwrite = waitOn(inferior.fetchSuccessor(
|
||||
"Modules", "[" + expPrint + "]", "Symbols", "[overwrite]")).as(TargetSymbol.class);
|
||||
Msg.debug(this, "Symbol 'overwrite' is at addr: " + overwrite.getValue());
|
||||
Msg.debug(this, "Getting Memory");
|
||||
TargetMemory<?> memory = (TargetMemory<?>) waitOn(inferior.fetchSuccessor("Memory"));
|
||||
TargetMemory memory = (TargetMemory) waitOn(inferior.fetchSuccessor("Memory"));
|
||||
Msg.debug(this, "Writing");
|
||||
waitOn(memory.writeMemory(overwrite.getValue(), toWrite.getBytes()));
|
||||
Msg.debug(this, "Getting thread (for stepping)");
|
||||
|
@ -864,7 +856,7 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
waitAcc(access);
|
||||
Msg.debug(this, "Finding breakpoint container...");
|
||||
TargetBreakpointContainer<?> breaks = suitable(TargetBreakpointContainer.tclass, root);
|
||||
TargetBreakpointContainer breaks = suitable(TargetBreakpointContainer.class, root);
|
||||
Msg.debug(this, "Placing breakpoint...");
|
||||
waitOn(breaks.placeBreakpoint("write", Set.of(TargetBreakpointKind.SOFTWARE)));
|
||||
Msg.debug(this, "Resuming...");
|
||||
|
@ -872,11 +864,10 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Waiting for session access (after resume)...");
|
||||
waitAcc(access);
|
||||
Map<String, ? extends TargetObject> frames =
|
||||
waitOn(inferior.fetchSubElements("Threads", "[1]", "Stack")
|
||||
.thenCompose(DebugModelConventions::fetchAll));
|
||||
waitOn(inferior.fetchSubElements("Threads", "[1]", "Stack"));
|
||||
Msg.debug(this, "Got stack:");
|
||||
for (Map.Entry<String, ? extends TargetObject> ent : frames.entrySet()) {
|
||||
TargetStackFrame<?> frame = ent.getValue().as(TargetStackFrame.tclass);
|
||||
TargetStackFrame frame = ent.getValue().as(TargetStackFrame.class);
|
||||
Msg.debug(this, ent.getKey() + ": " + frame.getProgramCounter());
|
||||
}
|
||||
assertEquals("write", frames.get("0")
|
||||
|
@ -892,7 +883,7 @@ public abstract class AbstractModelForGdbTest
|
|||
public void testRegisters() throws Throwable {
|
||||
try (ModelHost m = modelHost()) {
|
||||
DebuggerObjectModel model = m.getModel();
|
||||
Set<TargetRegister<?>> descs = new LinkedHashSet<>();
|
||||
Set<TargetRegister> descs = new LinkedHashSet<>();
|
||||
|
||||
init(m);
|
||||
Msg.debug(this, "Getting root object");
|
||||
|
@ -906,16 +897,15 @@ public abstract class AbstractModelForGdbTest
|
|||
launch(inferior, Map.of(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, "echo Hello, World!"));
|
||||
Msg.debug(this, "Waiting for session access (again)...");
|
||||
waitAcc(access);
|
||||
TargetRegisterBank<?> bank =
|
||||
TargetRegisterBank bank =
|
||||
waitOn(inferior.fetchSuccessor("Threads", "[1]", "Stack", "[0]"))
|
||||
.as(TargetRegisterBank.tclass);
|
||||
.as(TargetRegisterBank.class);
|
||||
Msg.debug(this, "Got bank: " + bank);
|
||||
Msg.debug(this, "Descriptions ref: " + bank.getDescriptions());
|
||||
TargetRegisterContainer<?> cont = waitOn(bank.getDescriptions().fetch());
|
||||
TargetRegisterContainer cont = bank.getDescriptions();
|
||||
Msg.debug(this, "Register descriptions: " + cont);
|
||||
descs.addAll(waitOn(cont.getRegisters()));
|
||||
Msg.debug(this, "Elements: ");
|
||||
for (TargetRegister<?> reg : descs) {
|
||||
for (TargetRegister reg : descs) {
|
||||
Msg.debug(this, " " + reg.getIndex() + ": " + reg.getBitLength());
|
||||
}
|
||||
Map<String, byte[]> data = waitOn(bank.readRegisters(descs));
|
||||
|
@ -941,12 +931,12 @@ public abstract class AbstractModelForGdbTest
|
|||
try (ModelHost m = modelHost()) {
|
||||
DebuggerObjectModel model = m.getModel();
|
||||
|
||||
AsyncReference<TargetObjectRef, Void> focus = new AsyncReference<>();
|
||||
AsyncReference<TargetObject, Void> focus = new AsyncReference<>();
|
||||
AsyncReference<Integer, Void> inferiorCount = new AsyncReference<>();
|
||||
|
||||
TargetFocusScopeListener focusListener = new TargetFocusScopeListener() {
|
||||
@Override
|
||||
public void focusChanged(TargetFocusScope<?> object, TargetObjectRef focused) {
|
||||
public void focusChanged(TargetFocusScope object, TargetObject focused) {
|
||||
focus.set(focused, null);
|
||||
}
|
||||
};
|
||||
|
@ -965,7 +955,7 @@ public abstract class AbstractModelForGdbTest
|
|||
TargetObjectListener infListener = new TargetObjectListener() {
|
||||
@Override
|
||||
public void elementsChanged(TargetObject parent, Collection<String> removed,
|
||||
Map<String, ? extends TargetObjectRef> added) {
|
||||
Map<String, ? extends TargetObject> added) {
|
||||
inferiorCount.set(infCont.getCachedElements().size(), null);
|
||||
}
|
||||
};
|
||||
|
@ -974,9 +964,9 @@ public abstract class AbstractModelForGdbTest
|
|||
Msg.debug(this, "Creating another inferior");
|
||||
cli(root, "add-inferior");
|
||||
waitOn(inferiorCount.waitValue(2));
|
||||
assertEquals(model.createRef("Inferiors", "[1]"), getFocus(root));
|
||||
focus(root, model.createRef("Inferiors", "[2]"));
|
||||
assertEquals(model.createRef("Inferiors", "[2]"), getFocus(root));
|
||||
assertSame(model.getModelObject("Inferiors", "[1]"), getFocus(root));
|
||||
focus(root, model.getModelObject("Inferiors", "[2]"));
|
||||
assertSame(model.getModelObject("Inferiors", "[2]"), getFocus(root));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -985,12 +975,12 @@ public abstract class AbstractModelForGdbTest
|
|||
try (ModelHost m = modelHost()) {
|
||||
DebuggerObjectModel model = m.getModel();
|
||||
|
||||
Deque<TargetObjectRef> focusSeq = new LinkedList<>();
|
||||
Deque<TargetObject> focusSeq = new LinkedList<>();
|
||||
AsyncReference<Integer, Void> focusSeqSize = new AsyncReference<>();
|
||||
|
||||
TargetFocusScopeListener focusListener = new TargetFocusScopeListener() {
|
||||
@Override
|
||||
public void focusChanged(TargetFocusScope<?> object, TargetObjectRef focused) {
|
||||
public void focusChanged(TargetFocusScope object, TargetObject focused) {
|
||||
Msg.debug(this, "Focused: " + focused);
|
||||
if (focused instanceof TargetProcess) {
|
||||
return;
|
||||
|
@ -1016,7 +1006,7 @@ public abstract class AbstractModelForGdbTest
|
|||
launch(inferior,
|
||||
Map.of(TargetCmdLineLauncher.CMDLINE_ARGS_NAME, "/bin/echo Hello, World!"));
|
||||
waitOn(focusSeqSize.waitValue(1));
|
||||
assertEquals(model.createRef(PathUtils.parse("Inferiors[1].Threads[1].Stack[0]")),
|
||||
assertEquals(model.getModelObject(PathUtils.parse("Inferiors[1].Threads[1].Stack[0]")),
|
||||
focusSeq.peekLast());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ package agent.gdb.model;
|
|||
|
||||
import java.util.*;
|
||||
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.target.TargetEventScope;
|
||||
import ghidra.dbg.target.TargetEventScope.TargetEventScopeListener;
|
||||
import ghidra.dbg.target.TargetEventScope.TargetEventType;
|
||||
|
@ -25,14 +24,13 @@ import ghidra.dbg.target.TargetThread;
|
|||
|
||||
public class EventSequenceListener implements TargetEventScopeListener {
|
||||
public static class EventRecord {
|
||||
public final TargetEventScope<?> object;
|
||||
public final TypedTargetObjectRef<? extends TargetThread<?>> eventThread;
|
||||
public final TargetEventScope object;
|
||||
public final TargetThread eventThread;
|
||||
public final TargetEventType type;
|
||||
public final String description;
|
||||
public final List<Object> parameters;
|
||||
|
||||
public EventRecord(TargetEventScope<?> object,
|
||||
TypedTargetObjectRef<? extends TargetThread<?>> eventThread, TargetEventType type,
|
||||
public EventRecord(TargetEventScope object, TargetThread eventThread, TargetEventType type,
|
||||
String description, List<Object> parameters) {
|
||||
this.object = object;
|
||||
this.eventThread = eventThread;
|
||||
|
@ -80,8 +78,7 @@ public class EventSequenceListener implements TargetEventScopeListener {
|
|||
public final List<EventRecord> events = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void event(TargetEventScope<?> object,
|
||||
TypedTargetObjectRef<? extends TargetThread<?>> eventThread, TargetEventType type,
|
||||
public void event(TargetEventScope object, TargetThread eventThread, TargetEventType type,
|
||||
String description, List<Object> parameters) {
|
||||
events.add(new EventRecord(object, eventThread, type, description, parameters));
|
||||
}
|
||||
|
|
|
@ -30,7 +30,6 @@ import ghidra.dbg.gadp.protocol.Gadp;
|
|||
import ghidra.dbg.gadp.protocol.Gadp.EventNotification.EvtCase;
|
||||
import ghidra.dbg.memory.CachedMemory;
|
||||
import ghidra.dbg.target.TargetAccessConditioned;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibility;
|
||||
import ghidra.dbg.target.TargetAccessConditioned.TargetAccessibilityListener;
|
||||
import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointAction;
|
||||
import ghidra.dbg.target.TargetObject;
|
||||
|
@ -211,11 +210,6 @@ public class DelegateGadpClientTargetObject
|
|||
return ifaces;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<? extends TargetObject> fetch() {
|
||||
return CompletableFuture.completedFuture(getProxy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Void> resync(boolean attributes, boolean elements) {
|
||||
return client.sendChecked(Gadp.ResyncRequest.newBuilder()
|
||||
|
|
|
@ -34,7 +34,6 @@ import ghidra.async.*;
|
|||
import ghidra.dbg.DebuggerModelClosedReason;
|
||||
import ghidra.dbg.agent.*;
|
||||
import ghidra.dbg.agent.AbstractTargetObject.ProxyFactory;
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.error.*;
|
||||
import ghidra.dbg.gadp.GadpVersion;
|
||||
import ghidra.dbg.gadp.error.*;
|
||||
|
@ -575,17 +574,6 @@ public class GadpClient extends AbstractDebuggerObjectModel
|
|||
return factory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetObjectRef createRef(List<String> path) {
|
||||
synchronized (lock) {
|
||||
GadpClientTargetObject proxy = modelProxies.get(path);
|
||||
if (proxy != null) {
|
||||
return proxy;
|
||||
}
|
||||
}
|
||||
return super.createRef(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TargetObject getModelObject(List<String> path) {
|
||||
return getProxy(path, false);
|
||||
|
|
|
@ -19,12 +19,12 @@ import ghidra.dbg.gadp.client.annot.GadpAttributeChangeCallback;
|
|||
import ghidra.dbg.target.TargetAccessConditioned;
|
||||
|
||||
public interface GadpClientTargetAccessConditioned
|
||||
extends GadpClientTargetObject, TargetAccessConditioned<GadpClientTargetAccessConditioned> {
|
||||
extends GadpClientTargetObject, TargetAccessConditioned {
|
||||
|
||||
@GadpAttributeChangeCallback(ACCESSIBLE_ATTRIBUTE_NAME)
|
||||
default void handleAccessibleChanged(Object accessible) {
|
||||
getDelegate().getListeners()
|
||||
.fire(TargetAccessibilityListener.class)
|
||||
.accessibilityChanged(this, fromObj(accessible));
|
||||
.accessibilityChanged(this, (Boolean) accessible);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,6 @@ package ghidra.dbg.gadp.client;
|
|||
|
||||
import ghidra.dbg.target.TargetAttachable;
|
||||
|
||||
public interface GadpClientTargetAttachable
|
||||
extends GadpClientTargetObject, TargetAttachable<GadpClientTargetAttachable> {
|
||||
public interface GadpClientTargetAttachable extends GadpClientTargetObject, TargetAttachable {
|
||||
// Nothing to add
|
||||
}
|
||||
|
|
|
@ -17,31 +17,26 @@ package ghidra.dbg.gadp.client;
|
|||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.gadp.protocol.Gadp;
|
||||
import ghidra.dbg.target.TargetAttachable;
|
||||
import ghidra.dbg.target.TargetAttacher;
|
||||
import ghidra.dbg.target.*;
|
||||
|
||||
public interface GadpClientTargetAttacher
|
||||
extends GadpClientTargetObject, TargetAttacher<GadpClientTargetAttacher> {
|
||||
public interface GadpClientTargetAttacher extends GadpClientTargetObject, TargetAttacher {
|
||||
@Override
|
||||
default CompletableFuture<Void> attach(
|
||||
TypedTargetObjectRef<? extends TargetAttachable<?>> ref) {
|
||||
default CompletableFuture<Void> attach(TargetAttachable attachable) {
|
||||
getDelegate().assertValid();
|
||||
getModel().assertMine(TargetObjectRef.class, ref);
|
||||
getModel().assertMine(TargetObject.class, attachable);
|
||||
return getModel().sendChecked(Gadp.AttachRequest.newBuilder()
|
||||
.setPath(GadpValueUtils.makePath(getPath()))
|
||||
.setTarget(GadpValueUtils.makePath(ref.getPath())),
|
||||
.setTarget(GadpValueUtils.makePath(attachable.getPath())),
|
||||
Gadp.AttachReply.getDefaultInstance()).thenApply(rep -> null);
|
||||
}
|
||||
|
||||
@Override
|
||||
default CompletableFuture<Void> attach(long id) {
|
||||
default CompletableFuture<Void> attach(long pid) {
|
||||
getDelegate().assertValid();
|
||||
return getModel().sendChecked(Gadp.AttachRequest.newBuilder()
|
||||
.setPath(GadpValueUtils.makePath(getPath()))
|
||||
.setPid(id),
|
||||
.setPid(pid),
|
||||
Gadp.AttachReply.getDefaultInstance()).thenApply(rep -> null);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,8 +18,6 @@ package ghidra.dbg.gadp.client;
|
|||
import java.util.Set;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import ghidra.dbg.attributes.TargetObjectRef;
|
||||
import ghidra.dbg.attributes.TypedTargetObjectRef;
|
||||
import ghidra.dbg.gadp.client.annot.GadpEventHandler;
|
||||
import ghidra.dbg.gadp.protocol.Gadp;
|
||||
import ghidra.dbg.gadp.protocol.Gadp.Path;
|
||||
|
@ -29,8 +27,8 @@ import ghidra.dbg.target.TargetBreakpointSpec.TargetBreakpointKind;
|
|||
import ghidra.program.model.address.AddressRange;
|
||||
import ghidra.util.datastruct.ListenerSet;
|
||||
|
||||
public interface GadpClientTargetBreakpointContainer extends GadpClientTargetObject,
|
||||
TargetBreakpointContainer<GadpClientTargetBreakpointContainer> {
|
||||
public interface GadpClientTargetBreakpointContainer
|
||||
extends GadpClientTargetObject, TargetBreakpointContainer {
|
||||
|
||||
@Override
|
||||
default CompletableFuture<Void> placeBreakpoint(AddressRange range,
|
||||
|
@ -63,18 +61,16 @@ public interface GadpClientTargetBreakpointContainer extends GadpClientTargetObj
|
|||
@GadpEventHandler(Gadp.EventNotification.EvtCase.BREAK_HIT_EVENT)
|
||||
default void handleBreakHitEvent(Gadp.EventNotification notification) {
|
||||
Gadp.BreakHitEvent evt = notification.getBreakHitEvent();
|
||||
TargetObjectRef trapped = getModel().getProxy(evt.getTrapped().getEList(), true);
|
||||
TargetObject trapped = getModel().getProxy(evt.getTrapped().getEList(), true);
|
||||
Path framePath = evt.getFrame();
|
||||
TypedTargetObjectRef<? extends TargetStackFrame<?>> frame =
|
||||
framePath == null || framePath.getECount() == 0 ? null
|
||||
: getModel().getProxy(framePath.getEList(), true).as(TargetStackFrame.tclass);
|
||||
TargetStackFrame frame = framePath == null || framePath.getECount() == 0 ? null
|
||||
: getModel().getProxy(framePath.getEList(), true).as(TargetStackFrame.class);
|
||||
Path specPath = evt.getSpec();
|
||||
TypedTargetObjectRef<? extends TargetBreakpointSpec<?>> spec = specPath == null ? null
|
||||
: getModel().getProxy(specPath.getEList(), true).as(TargetBreakpointSpec.tclass);
|
||||
TargetBreakpointSpec spec = specPath == null ? null
|
||||
: getModel().getProxy(specPath.getEList(), true).as(TargetBreakpointSpec.class);
|
||||
Path bptPath = evt.getEffective();
|
||||
TypedTargetObjectRef<? extends TargetBreakpointLocation<?>> breakpoint = bptPath == null
|
||||
? null
|
||||
: getModel().getProxy(bptPath.getEList(), true).as(TargetBreakpointLocation.tclass);
|
||||
TargetBreakpointLocation breakpoint = bptPath == null ? null
|
||||
: getModel().getProxy(bptPath.getEList(), true).as(TargetBreakpointLocation.class);
|
||||
getDelegate().getListeners()
|
||||
.fire(TargetBreakpointListener.class)
|
||||
.breakpointHit(this, trapped, frame, spec, breakpoint);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue