mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Bug 310443 - DSF Disassembly part cannot locate external source files
Bug 310171 - DSF disassembly view doesn't display mixed instructions from multiple files
This commit is contained in:
parent
f6da41c466
commit
2f123dcce2
2 changed files with 22 additions and 4 deletions
|
@ -14,6 +14,7 @@ package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
|
|||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression;
|
||||
import org.eclipse.cdt.debug.core.model.IAsmInstruction;
|
||||
|
@ -33,6 +34,7 @@ import org.eclipse.cdt.debug.internal.ui.CDebugUIMessages;
|
|||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.runtime.IAdaptable;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.debug.core.DebugEvent;
|
||||
|
@ -500,6 +502,15 @@ public class DisassemblyBackendCdi implements IDisassemblyBackend, IDebugEventSe
|
|||
else if (srcElement instanceof IFile) {
|
||||
compilationPath = ((IFile)srcElement).getLocation().toString();
|
||||
}
|
||||
else if (srcElement instanceof java.io.File) {
|
||||
compilationPath = ((java.io.File)srcElement).getAbsolutePath();
|
||||
}
|
||||
else if (srcElement instanceof ITranslationUnit) {
|
||||
IPath location = ((ITranslationUnit) srcElement).getLocation();
|
||||
if (location != null) {
|
||||
compilationPath = location.toString();
|
||||
}
|
||||
}
|
||||
else {
|
||||
assert false : "missing support for source element of type " + srcElement.getClass().toString(); //$NON-NLS-1$
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import java.util.ListIterator;
|
|||
import java.util.Map;
|
||||
|
||||
import org.eclipse.cdt.core.IAddress;
|
||||
import org.eclipse.cdt.core.model.ITranslationUnit;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.AddressRangePosition;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.DisassemblyPosition;
|
||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.ErrorPosition;
|
||||
|
@ -1625,7 +1626,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
return;
|
||||
}
|
||||
if (DEBUG) System.out.println("retrieveDisassembly "+getAddressText(startAddress)+" "+lines+" lines"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
retrieveDisassembly(startAddress, endAddress, lines, fShowSource, false);
|
||||
retrieveDisassembly(startAddress, endAddress, lines, fShowSource, true);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
@ -1730,7 +1731,6 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
}
|
||||
AddressRangePosition pos = fDocument.getPositionOfAddress(address);
|
||||
assert !(pos instanceof SourcePosition);
|
||||
assert pos != null || address.compareTo(fStartAddress) < 0|| address.compareTo(fEndAddress) >= 0;
|
||||
return pos;
|
||||
}
|
||||
|
||||
|
@ -2712,6 +2712,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
}
|
||||
if (sourceElement instanceof File) {
|
||||
sourceElement = new LocalFileStorage((File)sourceElement);
|
||||
} else if (sourceElement instanceof ITranslationUnit) {
|
||||
IPath location = ((ITranslationUnit) sourceElement).getLocation();
|
||||
if (location != null) {
|
||||
sourceElement = new LocalFileStorage(location.toFile());
|
||||
}
|
||||
}
|
||||
if (sourceElement instanceof IStorage) {
|
||||
if (!(sourceElement instanceof IFile)) {
|
||||
|
@ -2725,9 +2730,11 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
}
|
||||
}
|
||||
fFile2Storage.put(file, sourceElement);
|
||||
} else {
|
||||
fFile2Storage.put(file, null);
|
||||
} else if (sourceElement == null) {
|
||||
logWarning(DisassemblyMessages.Disassembly_log_error_locateFile+file, null);
|
||||
} else {
|
||||
fFile2Storage.put(file, null);
|
||||
assert false : "missing support for source element of type " + sourceElement.getClass().toString(); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
if (sourceElement instanceof IStorage) {
|
||||
|
|
Loading…
Add table
Reference in a new issue