mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue