diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java index 6a2219d44a..9d17df1b79 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/breakpoint/LogicalBreakpointInternal.java @@ -35,6 +35,7 @@ import ghidra.util.Msg; import ghidra.util.database.UndoableTransaction; import ghidra.util.exception.CancelledException; import ghidra.util.task.TaskMonitor; +import utilities.util.IDHashed; interface LogicalBreakpointInternal extends LogicalBreakpoint { public static class ProgramBreakpoint { @@ -248,33 +249,6 @@ interface LogicalBreakpointInternal extends LogicalBreakpoint { } static class TraceBreakpointSet { - private static class IDHashed { - final T obj; - - public IDHashed(T obj) { - this.obj = obj; - } - - @Override - public String toString() { - return obj.toString(); - } - - @Override - public int hashCode() { - return System.identityHashCode(obj); - } - - @Override - public boolean equals(Object o) { - if (!(o instanceof IDHashed)) { - return false; - } - IDHashed that = (IDHashed) o; - return this.obj.equals(that.obj); - } - } - private final TraceRecorder recorder; private final Trace trace; private final Address address; diff --git a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceAddressSnapSpace.java b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceAddressSnapSpace.java index 36e1e474ea..8f4f3da38e 100644 --- a/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceAddressSnapSpace.java +++ b/Ghidra/Debug/Framework-TraceModeling/src/main/java/ghidra/trace/model/TraceAddressSnapSpace.java @@ -22,9 +22,11 @@ import ghidra.program.model.address.Address; import ghidra.program.model.address.AddressSpace; import ghidra.trace.model.map.UnsignedUtils; import ghidra.util.database.spatial.rect.EuclideanSpace2D; +import utilities.util.IDHashed; public class TraceAddressSnapSpace implements EuclideanSpace2D { - private static final Map SPACES = new HashMap<>(); + private static final Map, TraceAddressSnapSpace> SPACES = + new HashMap<>(); /** * Get the trace-address-snap space for a given address space @@ -38,7 +40,8 @@ public class TraceAddressSnapSpace implements EuclideanSpace2D { */ public static TraceAddressSnapSpace forAddressSpace(AddressSpace space) { synchronized (SPACES) { - return SPACES.computeIfAbsent(space, TraceAddressSnapSpace::new); + return SPACES.computeIfAbsent(new IDHashed<>(space), + s -> new TraceAddressSnapSpace(space)); } } diff --git a/Ghidra/Debug/ProposedUtils/src/main/java/utilities/util/IDHashed.java b/Ghidra/Debug/ProposedUtils/src/main/java/utilities/util/IDHashed.java new file mode 100644 index 0000000000..3b500d98ba --- /dev/null +++ b/Ghidra/Debug/ProposedUtils/src/main/java/utilities/util/IDHashed.java @@ -0,0 +1,43 @@ +/* ### + * IP: GHIDRA + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package utilities.util; + +public class IDHashed { + public final T obj; + + public IDHashed(T obj) { + this.obj = obj; + } + + @Override + public String toString() { + return obj.toString(); + } + + @Override + public int hashCode() { + return System.identityHashCode(obj); + } + + @Override + public boolean equals(Object o) { + if (!(o instanceof IDHashed)) { + return false; + } + IDHashed that = (IDHashed) o; + return this.obj.equals(that.obj); + } +}