mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-03 17:59:46 +02:00
Merge remote-tracking branch
'origin/GP-1812_d-millar_windows_bpt_issues--SQUASHED' (Closes #4059)
This commit is contained in:
commit
b870139e50
7 changed files with 57 additions and 17 deletions
|
@ -50,11 +50,16 @@ public class DbgListMemoryRegionsCommand extends AbstractDbgCommand<List<DbgModu
|
|||
}
|
||||
manager.addMemory(region);
|
||||
}
|
||||
List<Long> toRemove = new ArrayList<>();
|
||||
for (Entry<Long, DbgModuleMemory> entry : memory.entrySet()) {
|
||||
if (memoryRegions.contains(entry.getValue())) {
|
||||
continue; // Do nothing, we're in sync
|
||||
}
|
||||
manager.removeMemory(entry.getKey());
|
||||
toRemove.add(entry.getKey());
|
||||
//manager.removeMemory(entry.getKey());
|
||||
}
|
||||
for (Long key : toRemove) {
|
||||
manager.removeMemory(key);
|
||||
}
|
||||
return memoryRegions;
|
||||
}
|
||||
|
|
|
@ -406,10 +406,12 @@ public class DbgManagerImpl implements DbgManager {
|
|||
//TODO: server.terminate();
|
||||
engThread.execute(100, dbgeng -> {
|
||||
Msg.debug(this, "Disconnecting DebugClient from session");
|
||||
dbgeng.endSession(DebugEndSessionFlags.DEBUG_END_DISCONNECT);
|
||||
dbgeng.endSession(DebugEndSessionFlags.DEBUG_END_PASSIVE);
|
||||
dbgeng.setOutputCallbacks(null);
|
||||
dbgeng.setEventCallbacks(null);
|
||||
dbgeng.setInputCallbacks(null);
|
||||
engThread.shutdown();
|
||||
});
|
||||
engThread.shutdown();
|
||||
try {
|
||||
engThread.awaitTermination(5000, TimeUnit.MILLISECONDS);
|
||||
}
|
||||
|
@ -942,7 +944,8 @@ public class DbgManagerImpl implements DbgManager {
|
|||
//System.err.println("RUNNING " + id);
|
||||
dbgState = DbgState.RUNNING;
|
||||
// NB: Needed by GADP variants, but not IN-VM
|
||||
getEventListeners().fire.memoryChanged(currentProcess, 0L, 0, evt.getCause());
|
||||
getEventListeners().fire.memoryChanged(currentProcess, 0L, 0,
|
||||
evt.getCause());
|
||||
processEvent(new DbgRunningEvent(eventThread.getId()));
|
||||
}
|
||||
if (!threads.containsValue(eventThread)) {
|
||||
|
@ -1483,11 +1486,13 @@ public class DbgManagerImpl implements DbgManager {
|
|||
|
||||
public CompletableFuture<Void> setActiveFrame(DbgThread thread, int index) {
|
||||
currentThread = thread;
|
||||
currentProcess = thread.getProcess();
|
||||
return execute(new DbgSetActiveThreadCommand(this, thread, index));
|
||||
}
|
||||
|
||||
public CompletableFuture<Void> setActiveThread(DbgThread thread) {
|
||||
currentThread = thread;
|
||||
currentProcess = thread.getProcess();
|
||||
return execute(new DbgSetActiveThreadCommand(this, thread, null));
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
import agent.dbgeng.dbgeng.DebugSystemObjects;
|
||||
import agent.dbgeng.dbgeng.DebugThreadId;
|
||||
import agent.dbgeng.manager.*;
|
||||
import agent.dbgeng.manager.cmd.DbgSetActiveThreadCommand;
|
||||
import agent.dbgeng.manager.impl.*;
|
||||
import agent.dbgeng.model.iface1.*;
|
||||
import agent.dbgeng.model.impl.DbgModelTargetStackImpl;
|
||||
|
@ -58,8 +57,9 @@ public interface DbgModelTargetThread extends //
|
|||
@Override
|
||||
public default CompletableFuture<Void> setActive() {
|
||||
DbgManagerImpl manager = getManager();
|
||||
DbgThread thread = getThread();
|
||||
return manager.execute(new DbgSetActiveThreadCommand(manager, thread, null));
|
||||
DbgProcessImpl process = (DbgProcessImpl) getParentProcess().getProcess();
|
||||
manager.setActiveProcess(process);
|
||||
return manager.setActiveThread(getThread());
|
||||
}
|
||||
|
||||
public DbgModelTargetStackImpl getStack();
|
||||
|
|
|
@ -21,6 +21,7 @@ import java.util.concurrent.CompletableFuture;
|
|||
import java.util.stream.Collectors;
|
||||
|
||||
import agent.dbgeng.manager.DbgCause;
|
||||
import agent.dbgeng.manager.DbgProcess;
|
||||
import agent.dbgeng.manager.breakpoint.DbgBreakpointInfo;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
import agent.dbgeng.model.iface2.*;
|
||||
|
@ -54,19 +55,34 @@ public class DbgModelTargetBreakpointContainerImpl extends DbgModelTargetObjectI
|
|||
), "Initialized");
|
||||
}
|
||||
|
||||
private boolean isMatch(DbgBreakpointInfo info) {
|
||||
DbgProcess bptProc = info.getProc();
|
||||
DbgModelTargetProcess parentProcess = getParentProcess();
|
||||
return parentProcess.getProcess().equals(bptProc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointCreated(DbgBreakpointInfo info, DbgCause cause) {
|
||||
if (!isMatch(info)) {
|
||||
return;
|
||||
}
|
||||
changeElements(List.of(), List.of(getTargetBreakpointSpec(info)), Map.of(), "Created");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointModified(DbgBreakpointInfo newInfo, DbgBreakpointInfo oldInfo,
|
||||
DbgCause cause) {
|
||||
if (!isMatch(newInfo)) {
|
||||
return;
|
||||
}
|
||||
getTargetBreakpointSpec(oldInfo).updateInfo(oldInfo, newInfo, "Modified");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointDeleted(DbgBreakpointInfo info, DbgCause cause) {
|
||||
if (!isMatch(info)) {
|
||||
return;
|
||||
}
|
||||
DbgModelImpl impl = (DbgModelImpl) model;
|
||||
impl.deleteModelObject(info.getDebugBreakpoint());
|
||||
changeElements(List.of( //
|
||||
|
|
|
@ -105,7 +105,7 @@ public class DbgModelTargetProcessContainerImpl extends DbgModelTargetObjectImpl
|
|||
}
|
||||
DbgModelTargetMemoryContainer memory = process.getMemory();
|
||||
if (memory != null) {
|
||||
memory.requestElements(false);
|
||||
memory.requestElements(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import java.util.concurrent.CompletableFuture;
|
|||
|
||||
import agent.dbgeng.dbgeng.DebugThreadId;
|
||||
import agent.dbgeng.manager.*;
|
||||
import agent.dbgeng.manager.cmd.DbgSetActiveThreadCommand;
|
||||
import agent.dbgeng.manager.impl.DbgManagerImpl;
|
||||
import agent.dbgeng.model.iface1.DbgModelTargetFocusScope;
|
||||
import agent.dbgeng.model.iface2.*;
|
||||
|
@ -30,10 +29,21 @@ import ghidra.dbg.target.TargetFocusScope;
|
|||
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),
|
||||
@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
|
||||
|
@ -146,7 +156,7 @@ public class DbgModelTargetThreadImpl extends DbgModelTargetObjectImpl
|
|||
@Override
|
||||
public CompletableFuture<Void> setActive() {
|
||||
DbgManagerImpl manager = getManager();
|
||||
return manager.execute(new DbgSetActiveThreadCommand(manager, thread, null));
|
||||
return manager.setActiveThread(thread);
|
||||
}
|
||||
|
||||
public DbgModelTargetRegisterContainerAndBank getRegisters() {
|
||||
|
|
|
@ -166,9 +166,13 @@ public class DefaultBreakpointRecorder implements ManagedBreakpointRecorder {
|
|||
else {
|
||||
traceBpt.setClearedSnap(snap - 1);
|
||||
}
|
||||
breakpointManager.placeBreakpoint(path, snap, range,
|
||||
traceBpt.getThreads(), traceBpt.getKinds(), traceBpt.isEnabled(snap),
|
||||
traceBpt.getComment());
|
||||
TraceBreakpoint newtraceBpt =
|
||||
breakpointManager.placeBreakpoint(path, snap, range,
|
||||
traceBpt.getThreads(), traceBpt.getKinds(), traceBpt.isEnabled(snap),
|
||||
traceBpt.getComment());
|
||||
// placeBreakpoint resets the name - maybe pass name in?
|
||||
newtraceBpt.setName(traceBpt.getName());
|
||||
|
||||
}
|
||||
catch (DuplicateNameException e) {
|
||||
// Split, and length matters not
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue