mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-883: Fixed 0-address breakoint bug.
This commit is contained in:
@@ -151,14 +151,14 @@ public class DefaultBreakpointRecorder implements ManagedBreakpointRecorder {
|
||||
}, path);
|
||||
}
|
||||
|
||||
protected void doBreakpointLengthChanged(long snap, int length, Address traceAddr,
|
||||
protected void doBreakpointLocationChanged(long snap, int length, Address traceAddr,
|
||||
String path) {
|
||||
for (TraceBreakpoint traceBpt : breakpointManager.getBreakpointsByPath(path)) {
|
||||
if (traceBpt.getLength() == length) {
|
||||
AddressRange range = range(traceAddr, length);
|
||||
if (traceBpt.getRange().equals(range)) {
|
||||
continue; // Nothing to change
|
||||
}
|
||||
// TODO: Verify all other attributes match?
|
||||
// TODO: Should this be allowed to happen?
|
||||
try {
|
||||
if (traceBpt.getPlacedSnap() == snap) {
|
||||
traceBpt.delete();
|
||||
@@ -166,7 +166,7 @@ public class DefaultBreakpointRecorder implements ManagedBreakpointRecorder {
|
||||
else {
|
||||
traceBpt.setClearedSnap(snap - 1);
|
||||
}
|
||||
breakpointManager.placeBreakpoint(path, snap, range(traceAddr, length),
|
||||
breakpointManager.placeBreakpoint(path, snap, range,
|
||||
traceBpt.getThreads(), traceBpt.getKinds(), traceBpt.isEnabled(),
|
||||
traceBpt.getComment());
|
||||
}
|
||||
@@ -178,11 +178,11 @@ public class DefaultBreakpointRecorder implements ManagedBreakpointRecorder {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakpointLengthChanged(int length, Address traceAddr, String path)
|
||||
public void breakpointLocationChanged(int length, Address traceAddr, String path)
|
||||
throws AssertionError {
|
||||
long snap = recorder.getSnap();
|
||||
recorder.parTx.execute("Breakpoint length changed", () -> {
|
||||
doBreakpointLengthChanged(snap, length, traceAddr, path);
|
||||
doBreakpointLocationChanged(snap, length, traceAddr, path);
|
||||
}, path);
|
||||
}
|
||||
|
||||
|
||||
@@ -478,13 +478,14 @@ public class TraceObjectManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void attributesChangedBreakpointLocation(TargetObject bpt, Map<String, ?> added) {
|
||||
if (added.containsKey(TargetBreakpointLocation.LENGTH_ATTRIBUTE_NAME)) {
|
||||
Address traceAddr = recorder.getMemoryMapper()
|
||||
.targetToTrace(((TargetBreakpointLocation) bpt).getAddress());
|
||||
String path = bpt.getJoinedPath(".");
|
||||
Integer length = (Integer) added.get(TargetBreakpointLocation.LENGTH_ATTRIBUTE_NAME);
|
||||
recorder.breakpointRecorder.breakpointLengthChanged(length, traceAddr, path);
|
||||
public void attributesChangedBreakpointLocation(TargetObject obj, Map<String, ?> added) {
|
||||
TargetBreakpointLocation loc = (TargetBreakpointLocation) obj;
|
||||
if (added.containsKey(TargetBreakpointLocation.LENGTH_ATTRIBUTE_NAME) ||
|
||||
added.containsKey(TargetBreakpointLocation.ADDRESS_ATTRIBUTE_NAME)) {
|
||||
Address traceAddr = recorder.getMemoryMapper().targetToTrace(loc.getAddress());
|
||||
String path = loc.getJoinedPath(".");
|
||||
int length = loc.getLengthOrDefault(1);
|
||||
recorder.breakpointRecorder.breakpointLocationChanged(length, traceAddr, path);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ public interface ManagedBreakpointRecorder {
|
||||
* @param traceAddr the address of the location in the trace
|
||||
* @param path the dot-separated path of the breakpoint location in the model
|
||||
*/
|
||||
void breakpointLengthChanged(int length, Address traceAddr, String path);
|
||||
void breakpointLocationChanged(int length, Address traceAddr, String path);
|
||||
|
||||
void breakpointToggled(TargetBreakpointSpec spec, boolean enabled);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user