Skip to content

Commit fa05ba7

Browse files
GP-5200: Ensure regs table refreshed on obj-restored.
1 parent 66a43cd commit fa05ba7

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java

+21-3
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,18 @@ private void refreshRange(AddressRange range) {
337337
}
338338

339339
private void objectRestored(DomainObjectChangeRecord rec) {
340-
coordinatesActivated(current.reFindThread());
340+
/**
341+
* It's possible an "undo" or other transaction rollback will cause the current thread
342+
* to be replaced by another object. If that's the case, we need to adjust our
343+
* coordinates.
344+
*
345+
* If that adjustment does not otherwise cause the table to update, we have to fire that
346+
* event, since the register values may have changed, esp., if this "restored" event is
347+
* the result of many events being coalesced.
348+
*/
349+
if (!coordinatesActivated(current.reFindThread())) {
350+
regsTableModel.fireTableDataChanged();
351+
}
341352
}
342353

343354
private void registerValueChanged(TraceAddressSpace space, TraceAddressSnapRange range,
@@ -803,10 +814,16 @@ private void doSetTrace(Trace trace) {
803814
addNewTraceListener();
804815
}
805816

806-
public void coordinatesActivated(DebuggerCoordinates coordinates) {
817+
/**
818+
* Notify this provider of new coordinates
819+
*
820+
* @param coordinates the new coordinates
821+
* @return true if the new coordinates caused the table to update
822+
*/
823+
public boolean coordinatesActivated(DebuggerCoordinates coordinates) {
807824
if (sameCoordinates(current, coordinates)) {
808825
current = coordinates;
809-
return;
826+
return false;
810827
}
811828

812829
previous = current;
@@ -820,6 +837,7 @@ public void coordinatesActivated(DebuggerCoordinates coordinates) {
820837
recomputeViewKnown();
821838
loadRegistersAndValues();
822839
contextChanged();
840+
return true;
823841
}
824842

825843
protected void traceClosed(Trace trace) {

0 commit comments

Comments
 (0)