From fa05ba710e02461a15dce7abbed1bd662be79eea Mon Sep 17 00:00:00 2001 From: Dan <46821332+nsadeveloper789@users.noreply.github.com> Date: Fri, 20 Dec 2024 13:57:46 -0500 Subject: [PATCH] GP-5200: Ensure regs table refreshed on obj-restored. --- .../register/DebuggerRegistersProvider.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java index 65dda7f0a8..e99260e295 100644 --- a/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java +++ b/Ghidra/Debug/Debugger/src/main/java/ghidra/app/plugin/core/debug/gui/register/DebuggerRegistersProvider.java @@ -337,7 +337,18 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter } private void objectRestored(DomainObjectChangeRecord rec) { - coordinatesActivated(current.reFindThread()); + /** + * It's possible an "undo" or other transaction rollback will cause the current thread + * to be replaced by another object. If that's the case, we need to adjust our + * coordinates. + * + * If that adjustment does not otherwise cause the table to update, we have to fire that + * event, since the register values may have changed, esp., if this "restored" event is + * the result of many events being coalesced. + */ + if (!coordinatesActivated(current.reFindThread())) { + regsTableModel.fireTableDataChanged(); + } } private void registerValueChanged(TraceAddressSpace space, TraceAddressSnapRange range, @@ -803,10 +814,16 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter addNewTraceListener(); } - public void coordinatesActivated(DebuggerCoordinates coordinates) { + /** + * Notify this provider of new coordinates + * + * @param coordinates the new coordinates + * @return true if the new coordinates caused the table to update + */ + public boolean coordinatesActivated(DebuggerCoordinates coordinates) { if (sameCoordinates(current, coordinates)) { current = coordinates; - return; + return false; } previous = current; @@ -820,6 +837,7 @@ public class DebuggerRegistersProvider extends ComponentProviderAdapter recomputeViewKnown(); loadRegistersAndValues(); contextChanged(); + return true; } protected void traceClosed(Trace trace) {