1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Fix disassembly view when view is reset

The view can be reset in a couple of ways, by changing debug
context or manually refreshing. With this change in Platform
https://github.com/eclipse-platform/eclipse.platform.ui/pull/963
the CDT violation of the API aronud resetting state of the
document was exposed.

Therefore the solution is to instead of trying to reset the
state of the existing document, create a new one when the
view is reset.

Fixes #603
This commit is contained in:
Jonah Graham 2023-10-25 15:27:11 -04:00
parent 52926de56a
commit 4a87d7be70
2 changed files with 3 additions and 13 deletions

View file

@ -2126,8 +2126,10 @@ public abstract class DisassemblyPart extends WorkbenchPart
fPCHistory.clear();
fPendingPCUpdates.clear();
fFile2Storage.clear();
fDocument.clear();
var oldDocument = fDocument;
fDocument = createDocument();
fViewer.setDocument(fDocument, new AnnotationModel());
oldDocument.dispose();
if (fDebugSessionId != null) {
attachBreakpointsAnnotationModel();
attachExtendedPCAnnotationModel();

View file

@ -33,14 +33,12 @@ import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyDocument;
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.LabelPosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.SourcePosition;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.text.REDDocument;
import org.eclipse.cdt.dsf.debug.internal.ui.disassembly.text.REDTextStore;
import org.eclipse.core.resources.IStorage;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
import org.eclipse.jface.text.BadLocationException;
import org.eclipse.jface.text.BadPositionCategoryException;
import org.eclipse.jface.text.DefaultLineTracker;
import org.eclipse.jface.text.DocumentRewriteSession;
import org.eclipse.jface.text.DocumentRewriteSessionType;
import org.eclipse.jface.text.IDocument;
@ -129,16 +127,6 @@ public class DisassemblyDocument extends REDDocument implements IDisassemblyDocu
fInvalidSource.clear();
}
/**
* Clears all content and state.
*/
public void clear() {
dispose();
setTextStore(new REDTextStore());
setLineTracker(new DefaultLineTracker());
completeInitialization();
}
public AddressRangePosition[] getInvalidAddressRanges() {
assert isGuiThread();
return fInvalidAddressRanges.toArray(new AddressRangePosition[fInvalidAddressRanges.size()]);