diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java index 6e0888d852..304a4c9d0c 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/listing/DebuggerListingProvider.java @@ -295,6 +295,8 @@ public class DebuggerListingProvider extends CodeViewerProvider { protected final boolean isMainListing; + private long countAddressesInIndex; + public DebuggerListingProvider(DebuggerListingPlugin plugin, FormatManager formatManager, boolean isConnected) { super(plugin, formatManager, isConnected); @@ -722,6 +724,19 @@ public class DebuggerListingProvider extends CodeViewerProvider { @Override public void stateChanged(ChangeEvent e) { super.stateChanged(e); + /* + * It seems this method gets called a bit spuriously. A change in bytes, which does not + * imply a change in layout, will also land us here. Thus, we do some simple test here to + * verify that the layout has actually changed. A good proxy is if the number of addresses + * in the listing has changed. To detect that, we have to record what we've seen each + * change. + */ + long newCountAddressesInIndex = + getListingPanel().getAddressIndexMap().getIndexedAddressSet().getNumAddresses(); + if (this.countAddressesInIndex == newCountAddressesInIndex) { + return; + } + this.countAddressesInIndex = newCountAddressesInIndex; ProgramLocation trackedLocation = trackingTrait.getTrackedLocation(); if (trackedLocation != null && !isEffectivelyDifferent(getLocation(), trackedLocation)) { cbGoTo.invoke(() -> getListingPanel().goTo(trackedLocation, true));