Bug 456958 Disassembly view sometimes doesn't update after stepping
authorTeodor Madan <teodor.madan@freescale.com>
Tue, 30 Jun 2015 15:51:11 +0000 (18:51 +0300)
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>
Wed, 1 Jul 2015 13:14:42 +0000 (09:14 -0400)
instructions

- set update pending to false when received a late disasm result and no
context is available.
- add some trace messages helping trace the issue

Change-Id: Ia0a98ef283e871d12de4f50bad89a8d2f4e4c887
Signed-off-by: Teodor Madan <teodor.madan@freescale.com>
dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java

index 8d5fc6b..9315de6 100644 (file)
@@ -21,6 +21,7 @@ import static org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils
 import static org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyUtils.internalError;
 
 import java.math.BigInteger;
+import java.text.MessageFormat;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.RejectedExecutionException;
 import java.util.concurrent.TimeUnit;
@@ -175,7 +176,10 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
                
                if (!dsfSessionId.equals(fDsfSessionId)) {
                        // switch to different session or initiate session
-                       if (DEBUG) System.out.println("DisassemblyBackendDsf() " + dsfSessionId); //$NON-NLS-1$
+                       if (DEBUG) {
+                               System.out.println(MessageFormat.format("DisassemblyBackendDsf: switch session [{0}<<{1}]. Input context={2}", dsfSessionId, //$NON-NLS-1$
+                                       fDsfSessionId, dmContext));
+                       }
                        fTargetContext= null;
                        fTargetFrameContext = null;
                        result.contextChanged = true;
@@ -257,7 +261,11 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
                        fTargetFrameContext = null;
                        result.contextChanged = true;
                }
-               
+               if (DEBUG) {
+                       System.out.println(MessageFormat.format(
+                               "DisassemblyBackendDsf: switch session done [id={0};context={1};\n\t\t\tframe={2}].\n\t\t\tInput context={3}", //$NON-NLS-1$
+                               fDsfSessionId, fTargetContext, fTargetFrameContext, dmContext));
+               }
                return result;
        }
 
@@ -669,6 +677,14 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
 
        private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions, boolean showSymbols, boolean showDisassembly) {
         if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
+               if (DEBUG) {
+                       System.out.println(MessageFormat.format(
+                                               "insertDisassembly ignored at {0} due to missing context: [fDsfSessionId={1};fTargetContext={2}]", //$NON-NLS-1$
+                                               DisassemblyUtils.getAddressText(startAddress), fDsfSessionId, fTargetContext));
+               }
+               if (fTargetContext == null) {
+                       fCallback.setUpdatePending(false);
+               }
                        // return true to avoid a retry
                        return true;
                }
@@ -788,6 +804,14 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
         */
        private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IMixedInstruction[] mixedInstructions, boolean showSymbols, boolean showDisassembly) {
         if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
+               if (DEBUG) {
+                       System.out.println(MessageFormat.format(
+                                               "insertDisassembly ignored at {0} : missing context: [fDsfSessionId={1};fTargetContext={2}]", //$NON-NLS-1$
+                                               DisassemblyUtils.getAddressText(startAddress), fDsfSessionId, fTargetContext));
+               }
+               if (fTargetContext == null) {
+                       fCallback.setUpdatePending(false);
+               }
                        // return true to avoid a retry
                        return true;
                }