mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[295895] DSF Disassembly view attempts to insert source even when 'Show Source' option is off
This commit is contained in:
parent
c753fd5b74
commit
214ac8648b
2 changed files with 72 additions and 57 deletions
|
@ -1752,7 +1752,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (DEBUG) System.out.println("retrieveDisassembly "+getAddressText(startAddress)+" "+lines+" lines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
if (DEBUG) System.out.println("retrieveDisassembly "+getAddressText(startAddress)+" "+lines+" lines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
retrieveDisassembly(startAddress, endAddress, lines, true, false);
|
retrieveDisassembly(startAddress, endAddress, lines, fShowSource, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void retrieveDisassembly(final BigInteger startAddress, BigInteger endAddress, final int linesHint, boolean mixed, boolean ignoreFile) {
|
private void retrieveDisassembly(final BigInteger startAddress, BigInteger endAddress, final int linesHint, boolean mixed, boolean ignoreFile) {
|
||||||
|
@ -3346,6 +3346,14 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
} else {
|
} else {
|
||||||
fPCAnnotationUpdatePending = true;
|
fPCAnnotationUpdatePending = true;
|
||||||
updateInvalidSource();
|
updateInvalidSource();
|
||||||
|
if (fShowSource) {
|
||||||
|
Runnable doit = new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
fDocument.invalidateAddressRange(fStartAddress, fEndAddress, true);
|
||||||
|
fGotoFramePending = true;
|
||||||
|
}};
|
||||||
|
doScrollLocked(doit);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,6 +25,8 @@ import org.eclipse.debug.core.sourcelookup.containers.LocalFileStorage;
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.BadPositionCategoryException;
|
import org.eclipse.jface.text.BadPositionCategoryException;
|
||||||
import org.eclipse.jface.text.DefaultLineTracker;
|
import org.eclipse.jface.text.DefaultLineTracker;
|
||||||
|
import org.eclipse.jface.text.DocumentRewriteSession;
|
||||||
|
import org.eclipse.jface.text.DocumentRewriteSessionType;
|
||||||
import org.eclipse.jface.text.IDocument;
|
import org.eclipse.jface.text.IDocument;
|
||||||
import org.eclipse.jface.text.IRegion;
|
import org.eclipse.jface.text.IRegion;
|
||||||
import org.eclipse.jface.text.Position;
|
import org.eclipse.jface.text.Position;
|
||||||
|
@ -1228,71 +1230,76 @@ public class DisassemblyDocument extends REDDocument {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void deleteDisassemblyRange(BigInteger startAddress, BigInteger endAddress, boolean invalidate, boolean collapse) {
|
public void deleteDisassemblyRange(BigInteger startAddress, BigInteger endAddress, boolean invalidate, boolean collapse) {
|
||||||
String replacement = invalidate ? "...\n" : null; //$NON-NLS-1$
|
DocumentRewriteSession session = startRewriteSession(DocumentRewriteSessionType.STRICTLY_SEQUENTIAL);
|
||||||
int replaceLen = replacement != null ? replacement.length() : 0;
|
try {
|
||||||
AddressRangePosition lastPos = null;
|
String replacement = invalidate ? "...\n" : null; //$NON-NLS-1$
|
||||||
ArrayList<AddressRangePosition> toRemove = new ArrayList<AddressRangePosition>();
|
int replaceLen = replacement != null ? replacement.length() : 0;
|
||||||
Iterator<AddressRangePosition> it = getModelPositionIterator(startAddress);
|
AddressRangePosition lastPos = null;
|
||||||
while (it.hasNext()) {
|
ArrayList<AddressRangePosition> toRemove = new ArrayList<AddressRangePosition>();
|
||||||
AddressRangePosition pos = it.next();
|
Iterator<AddressRangePosition> it = getModelPositionIterator(startAddress);
|
||||||
BigInteger posEndAddress = pos.fAddressOffset.add(pos.fAddressLength);
|
while (it.hasNext()) {
|
||||||
if (pos instanceof LabelPosition) {
|
AddressRangePosition pos = it.next();
|
||||||
if (!invalidate && pos.length > 0 && posEndAddress.compareTo(endAddress) > 0) {
|
BigInteger posEndAddress = pos.fAddressOffset.add(pos.fAddressLength);
|
||||||
|
if (pos instanceof LabelPosition) {
|
||||||
|
if (!invalidate && pos.length > 0 && posEndAddress.compareTo(endAddress) > 0) {
|
||||||
|
try {
|
||||||
|
int oldLength = pos.length;
|
||||||
|
pos.length = 0;
|
||||||
|
replace(pos, oldLength, null);
|
||||||
|
} catch (BadLocationException e) {
|
||||||
|
internalError(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pos = null;
|
||||||
|
} else if (pos instanceof SourcePosition) {
|
||||||
|
pos = null;
|
||||||
|
} else if (pos instanceof ErrorPosition) {
|
||||||
|
pos = null;
|
||||||
|
} else if (pos instanceof DisassemblyPosition) {
|
||||||
|
// optimization: join adjacent positions
|
||||||
|
if (collapse && lastPos != null
|
||||||
|
&& (invalidate || lastPos.fValid == pos.fValid)
|
||||||
|
&& lastPos.offset+lastPos.length == pos.offset) {
|
||||||
|
assert lastPos.fAddressOffset.add(lastPos.fAddressLength).compareTo(pos.fAddressOffset) == 0;
|
||||||
|
lastPos.length += pos.length;
|
||||||
|
lastPos.fAddressLength = lastPos.fAddressLength.add(pos.fAddressLength);
|
||||||
|
toRemove.add(pos);
|
||||||
|
if (!pos.fValid) {
|
||||||
|
fInvalidAddressRanges.remove(pos);
|
||||||
|
}
|
||||||
|
pos = null;
|
||||||
|
if (posEndAddress.compareTo(endAddress) < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (lastPos != null) {
|
||||||
try {
|
try {
|
||||||
int oldLength = pos.length;
|
if (lastPos.length > 0 || replaceLen > 0) {
|
||||||
pos.length = 0;
|
int oldLength = lastPos.length;
|
||||||
replace(pos, oldLength, null);
|
lastPos.length = replaceLen;
|
||||||
|
replace(lastPos, oldLength, replacement);
|
||||||
|
}
|
||||||
} catch (BadLocationException e) {
|
} catch (BadLocationException e) {
|
||||||
internalError(e);
|
internalError(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pos = null;
|
if (pos == null && posEndAddress.compareTo(endAddress) >= 0) {
|
||||||
} else if (pos instanceof SourcePosition) {
|
break;
|
||||||
pos = null;
|
}
|
||||||
} else if (pos instanceof ErrorPosition) {
|
lastPos = null;
|
||||||
pos = null;
|
if (pos != null) {
|
||||||
} else if (pos instanceof DisassemblyPosition) {
|
if (pos.fValid && invalidate) {
|
||||||
// optimization: join adjacent positions
|
pos.fValid = false;
|
||||||
if (collapse && lastPos != null
|
fInvalidAddressRanges.add(pos);
|
||||||
&& (invalidate || lastPos.fValid == pos.fValid)
|
|
||||||
&& lastPos.offset+lastPos.length == pos.offset) {
|
|
||||||
assert lastPos.fAddressOffset.add(lastPos.fAddressLength).compareTo(pos.fAddressOffset) == 0;
|
|
||||||
lastPos.length += pos.length;
|
|
||||||
lastPos.fAddressLength = lastPos.fAddressLength.add(pos.fAddressLength);
|
|
||||||
toRemove.add(pos);
|
|
||||||
if (!pos.fValid) {
|
|
||||||
fInvalidAddressRanges.remove(pos);
|
|
||||||
}
|
|
||||||
pos = null;
|
|
||||||
if (posEndAddress.compareTo(endAddress) < 0) {
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
lastPos = pos;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lastPos != null) {
|
removePositions(CATEGORY_DISASSEMBLY, toRemove);
|
||||||
try {
|
} finally {
|
||||||
if (lastPos.length > 0 || replaceLen > 0) {
|
stopRewriteSession(session);
|
||||||
int oldLength = lastPos.length;
|
|
||||||
lastPos.length = replaceLen;
|
|
||||||
replace(lastPos, oldLength, replacement);
|
|
||||||
}
|
|
||||||
} catch (BadLocationException e) {
|
|
||||||
internalError(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (pos == null && posEndAddress.compareTo(endAddress) >= 0) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
lastPos = null;
|
|
||||||
if (pos != null) {
|
|
||||||
if (pos.fValid && invalidate) {
|
|
||||||
pos.fValid = false;
|
|
||||||
fInvalidAddressRanges.add(pos);
|
|
||||||
}
|
|
||||||
lastPos = pos;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
removePositions(CATEGORY_DISASSEMBLY, toRemove);
|
|
||||||
if (DEBUG) checkConsistency();
|
if (DEBUG) checkConsistency();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue