From 3ca6229159e520cf122831e5bad40c75c9ff02e8 Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Wed, 21 Aug 2024 09:45:43 -0400 Subject: [PATCH] GP-0: Invoke change callback on correcting inconsistency. --- .../DebuggerStaticMappingServicePlugin.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.java index 1680bc1ede..149cc31cd7 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/service/modules/DebuggerStaticMappingServicePlugin.java @@ -377,6 +377,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin result.add(me.program); } outbound.values().removeAll(toClean); + mappingsAffected(toClean); return result; } @@ -393,11 +394,13 @@ public class DebuggerStaticMappingServicePlugin extends Plugin } if (me.isStaticProgramOpen()) { outbound.values().removeAll(toClean); + mappingsAffected(toClean); return me.mapTraceAddressToProgramLocation(address); } } } outbound.values().removeAll(toClean); + mappingsAffected(toClean); return null; } @@ -424,6 +427,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin .add(new MappedAddressRange(srcRng, dstRng)); } outbound.values().removeAll(toClean); + mappingsAffected(toClean); } public Map> getOpenMappedViews(AddressSetView set, @@ -452,6 +456,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin result.add(me.getStaticProgramURL()); } outbound.values().removeAll(toClean); + mappingsAffected(toClean); } public Set getMappedProgramURLsInView(AddressSetView set, Lifespan span) { @@ -506,10 +511,12 @@ public class DebuggerStaticMappingServicePlugin extends Plugin } if (Objects.equals(trace, me.getTrace())) { inbound.keySet().removeAll(toClean); + mappingsAffected(toClean); return true; } } inbound.keySet().removeAll(toClean); + mappingsAffected(toClean); return false; } @@ -545,6 +552,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin result.add(me.mapProgramAddressToTraceLocation(address)); } inbound.keySet().removeAll(toClean); + mappingsAffected(toClean); return result; } @@ -573,9 +581,11 @@ public class DebuggerStaticMappingServicePlugin extends Plugin continue; } inbound.keySet().removeAll(toClean); + mappingsAffected(toClean); return me.mapProgramAddressToTraceLocation(address); } inbound.keySet().removeAll(toClean); + mappingsAffected(toClean); return null; } @@ -605,6 +615,7 @@ public class DebuggerStaticMappingServicePlugin extends Plugin .add(new MappedAddressRange(srcRange, dstRange)); } inbound.keySet().removeAll(toClean); + mappingsAffected(toClean); } public Map> getOpenMappedViews( @@ -688,6 +699,16 @@ public class DebuggerStaticMappingServicePlugin extends Plugin } } + private void mappingsAffected(Collection entries) { + Set traces = entries.stream().map(e -> e.getTrace()).collect(Collectors.toSet()); + Set programs = entries.stream().map(e -> e.program).collect(Collectors.toSet()); + synchronized (affectedTraces) { + affectedTraces.addAll(traces); + affectedPrograms.addAll(programs); + changeDebouncer.contact(null); + } + } + @Override public void addChangeListener(DebuggerStaticMappingChangeListener l) { changeListeners.add(l);