mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Bug 330646 - Disassembly view causes AssertionError
This commit is contained in:
parent
818d361c4f
commit
7cdb3eeeb1
2 changed files with 95 additions and 54 deletions
|
@ -596,7 +596,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions, boolean showSymbols, boolean showDisassembly) {
|
private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IInstruction[] instructions, boolean showSymbols, boolean showDisassembly) {
|
||||||
if (!fCallback.hasViewer() || fDsfSessionId == null) {
|
if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
|
||||||
// return true to avoid a retry
|
// return true to avoid a retry
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -709,7 +709,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
* @return whether [startAddress] was inserted
|
* @return whether [startAddress] was inserted
|
||||||
*/
|
*/
|
||||||
private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IMixedInstruction[] mixedInstructions, boolean showSymbols, boolean showDisassembly) {
|
private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IMixedInstruction[] mixedInstructions, boolean showSymbols, boolean showDisassembly) {
|
||||||
if (!fCallback.hasViewer() || fDsfSessionId == null) {
|
if (!fCallback.hasViewer() || fDsfSessionId == null || fTargetContext == null) {
|
||||||
// return true to avoid a retry
|
// return true to avoid a retry
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,6 +66,7 @@ import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.ListenerList;
|
import org.eclipse.core.runtime.ListenerList;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
import org.eclipse.core.runtime.SafeRunner;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.debug.core.DebugPlugin;
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.IBreakpointManager;
|
import org.eclipse.debug.core.IBreakpointManager;
|
||||||
|
@ -118,6 +119,7 @@ import org.eclipse.jface.text.source.OverviewRuler;
|
||||||
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
import org.eclipse.jface.text.source.SourceViewerConfiguration;
|
||||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||||
|
import org.eclipse.jface.util.SafeRunnable;
|
||||||
import org.eclipse.jface.viewers.ISelection;
|
import org.eclipse.jface.viewers.ISelection;
|
||||||
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
import org.eclipse.jface.viewers.ISelectionChangedListener;
|
||||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||||
|
@ -251,6 +253,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
private int fAddressSize= 32;
|
private int fAddressSize= 32;
|
||||||
|
|
||||||
private volatile boolean fUpdatePending;
|
private volatile boolean fUpdatePending;
|
||||||
|
private volatile int fUpdateCount;
|
||||||
private BigInteger fPCAddress;
|
private BigInteger fPCAddress;
|
||||||
private BigInteger fGotoAddressPending= PC_UNKNOWN;
|
private BigInteger fGotoAddressPending= PC_UNKNOWN;
|
||||||
private BigInteger fFocusAddress= PC_UNKNOWN;
|
private BigInteger fFocusAddress= PC_UNKNOWN;
|
||||||
|
@ -1481,13 +1484,15 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
public void viewportChanged(int verticalOffset) {
|
public void viewportChanged(int verticalOffset) {
|
||||||
if (fDebugSessionId != null && fGotoAddressPending == PC_UNKNOWN && fScrollPos == null && !fUpdatePending && !fRefreshViewPending) {
|
if (fDebugSessionId != null && fGotoAddressPending == PC_UNKNOWN && fScrollPos == null && !fUpdatePending && !fRefreshViewPending) {
|
||||||
fUpdatePending = true;
|
fUpdatePending = true;
|
||||||
|
final int updateCount = fUpdateCount;
|
||||||
invokeLater(new Runnable() {
|
invokeLater(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (updateCount == fUpdateCount) {
|
||||||
assert fUpdatePending;
|
assert fUpdatePending;
|
||||||
if (fUpdatePending) {
|
if (fUpdatePending) {
|
||||||
fUpdatePending = false;
|
fUpdatePending = false;
|
||||||
updateVisibleArea();
|
updateVisibleArea();
|
||||||
fPCLastAddress = getTopAddress();
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1677,16 +1682,13 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
if (fDebugSessionId == null) {
|
if (fDebugSessionId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fUpdatePending) {
|
startUpdate(new Runnable() {
|
||||||
invokeLater(new Runnable() {
|
|
||||||
public void run() {
|
public void run() {
|
||||||
retrieveDisassembly(file, lines, mixed);
|
|
||||||
}});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (DEBUG) System.out.println("retrieveDisassembly "+file); //$NON-NLS-1$
|
if (DEBUG) System.out.println("retrieveDisassembly "+file); //$NON-NLS-1$
|
||||||
fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
|
fBackend.retrieveDisassembly(file, lines, fEndAddress, mixed, fShowSymbols, fShowDisassembly);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void retrieveDisassembly(BigInteger startAddress, BigInteger endAddress, int lines) {
|
private void retrieveDisassembly(BigInteger startAddress, BigInteger endAddress, int lines) {
|
||||||
if (fDebugSessionId == null) {
|
if (fDebugSessionId == null) {
|
||||||
|
@ -1872,7 +1874,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
if (result != null) {
|
if (result != null) {
|
||||||
fDebugSessionId = result.sessionId;
|
fDebugSessionId = result.sessionId;
|
||||||
if (result.contextChanged && fViewer != null) {
|
if (result.contextChanged && fViewer != null) {
|
||||||
|
startUpdate(new Runnable() {
|
||||||
|
public void run() {
|
||||||
debugContextChanged();
|
debugContextChanged();
|
||||||
|
}
|
||||||
|
});
|
||||||
if (prevBackend != null && fBackend != prevBackend) {
|
if (prevBackend != null && fBackend != prevBackend) {
|
||||||
prevBackend.clearDebugContext();
|
prevBackend.clearDebugContext();
|
||||||
}
|
}
|
||||||
|
@ -1884,8 +1890,35 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void startUpdate(final Runnable update) {
|
||||||
|
final int updateCount = fUpdateCount;
|
||||||
|
final SafeRunnable safeUpdate = new SafeRunnable() {
|
||||||
|
public void run() {
|
||||||
|
if (updateCount == fUpdateCount) {
|
||||||
|
update.run();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public void handleException(Throwable e) {
|
||||||
|
internalError(e);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if (fUpdatePending) {
|
||||||
|
invokeLater(new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
if (updateCount == fUpdateCount) {
|
||||||
|
SafeRunner.run(safeUpdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
SafeRunner.run(safeUpdate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void debugContextChanged() {
|
private void debugContextChanged() {
|
||||||
if (DEBUG) System.out.println("DisassemblyPart.debugContextChanged()"); //$NON-NLS-1$
|
if (DEBUG) System.out.println("DisassemblyPart.debugContextChanged()"); //$NON-NLS-1$
|
||||||
|
fUpdateCount++;
|
||||||
fRunnableQueue.clear();
|
fRunnableQueue.clear();
|
||||||
fUpdatePending = false;
|
fUpdatePending = false;
|
||||||
resetViewer();
|
resetViewer();
|
||||||
|
@ -1921,8 +1954,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
firePropertyChange(PROP_SUSPENDED);
|
firePropertyChange(PROP_SUSPENDED);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void attachBreakpointsAnnotationModel() {
|
private void attachBreakpointsAnnotationModel() {
|
||||||
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
|
IAnnotationModel annotationModel = fViewer.getAnnotationModel();
|
||||||
if (annotationModel instanceof IAnnotationModelExtension) {
|
if (annotationModel instanceof IAnnotationModelExtension) {
|
||||||
|
@ -2478,11 +2509,14 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
if (doit != null) {
|
if (doit != null) {
|
||||||
fRunnableQueue.add(doit);
|
fRunnableQueue.add(doit);
|
||||||
}
|
}
|
||||||
|
final int updateCount = fUpdateCount;
|
||||||
if (fUpdatePending) {
|
if (fUpdatePending) {
|
||||||
if (fRunnableQueue.size() == 1) {
|
if (fRunnableQueue.size() == 1) {
|
||||||
Runnable doitlater = new Runnable() {
|
Runnable doitlater = new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
|
if (updateCount == fUpdateCount) {
|
||||||
doScrollLocked(null);
|
doScrollLocked(null);
|
||||||
|
}
|
||||||
}};
|
}};
|
||||||
invokeLater(doitlater);
|
invokeLater(doitlater);
|
||||||
}
|
}
|
||||||
|
@ -2493,6 +2527,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
ArrayList<Runnable> copy = new ArrayList<Runnable>(fRunnableQueue);
|
ArrayList<Runnable> copy = new ArrayList<Runnable>(fRunnableQueue);
|
||||||
fRunnableQueue.clear();
|
fRunnableQueue.clear();
|
||||||
for (Iterator<Runnable> iter = copy.iterator(); iter.hasNext();) {
|
for (Iterator<Runnable> iter = copy.iterator(); iter.hasNext();) {
|
||||||
|
if (updateCount != fUpdateCount) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
Runnable doitnow = iter.next();
|
Runnable doitnow = iter.next();
|
||||||
try {
|
try {
|
||||||
doitnow.run();
|
doitnow.run();
|
||||||
|
@ -2920,10 +2957,14 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
asyncExec(new Runnable() {
|
asyncExec(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
fDebugSessionId = null;
|
fDebugSessionId = null;
|
||||||
|
startUpdate(new Runnable() {
|
||||||
|
public void run() {
|
||||||
debugContextChanged();
|
debugContextChanged();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#setUpdatePending(boolean)
|
* @see org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyPartCallback#setUpdatePending(boolean)
|
||||||
|
|
Loading…
Add table
Reference in a new issue