aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Tepavich2012-09-04 11:32:31 (EDT)
committerPawel Piech2012-09-04 16:10:06 (EDT)
commit3e9fde6d2f51211801286a632021bd96e107ad35 (patch)
tree09509bdeb63bee35daf911332003928e2b122bae
parentbddd46b1d09272d46682a3e7eba6799605fba918 (diff)
downloadorg.eclipse.tcf-3e9fde6d2f51211801286a632021bd96e107ad35.zip
org.eclipse.tcf-3e9fde6d2f51211801286a632021bd96e107ad35.tar.gz
org.eclipse.tcf-3e9fde6d2f51211801286a632021bd96e107ad35.tar.bz2
Bug [388356] Disassembly view attempts to disassemble beyond address space
-rw-r--r--plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/disassembly/TCFDisassemblyBackend.java23
1 files changed, 21 insertions, 2 deletions
diff --git a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/disassembly/TCFDisassemblyBackend.java b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/disassembly/TCFDisassemblyBackend.java
index 4e446c1..9ad29c0 100644
--- a/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/disassembly/TCFDisassemblyBackend.java
+++ b/plugins/org.eclipse.tcf.cdt.ui/src/org/eclipse/tcf/internal/cdt/ui/disassembly/TCFDisassemblyBackend.java
@@ -510,9 +510,29 @@ public class TCFDisassemblyBackend extends AbstractDisassemblyBackend {
fCallback.setUpdatePending(false);
return;
}
+ final int addr_bits = mem.getAddressSize() * 8;
+ int accessSize = 0;
+ BigInteger bit = new BigInteger("1");
+ BigInteger mem_end = bit.shiftLeft(addr_bits);
+ mem_end = mem_end.subtract(bit);
+
+ if (startAddress.compareTo(mem_end) > 0) {
+ fCallback.setUpdatePending(false);
+ return;
+ }
+
+ BigInteger requestedLineEndAddr = startAddress.add(BigInteger.valueOf(linesHint * mem.getAddressSize()));
+
+ if (requestedLineEndAddr.compareTo(mem_end) > 0) {
+ accessSize = mem_end.subtract(startAddress).intValue() + 1;
+ }
+ else {
+ accessSize = linesHint * mem.getAddressSize();
+ }
+
final String contextId = mem.getID();
Map<String, Object> params = new HashMap<String, Object>();
- disass.disassemble(contextId, startAddress, linesHint * 4, params, new DoneDisassemble() {
+ disass.disassemble(contextId, startAddress, accessSize, params, new DoneDisassemble() {
public void doneDisassemble(IToken token, final Throwable error, IDisassemblyLine[] disassembly) {
if (execContext != fExecContext) return;
if (error != null) {
@@ -522,7 +542,6 @@ public class TCFDisassemblyBackend extends AbstractDisassemblyBackend {
if (modCount == getModCount()) {
fCallback.insertError(startAddress, TCFModel.getErrorMessage(error, false));
fCallback.setUpdatePending(false);
- int addr_bits = mem.getAddressSize() * 8;
if (fCallback.getAddressSize() < addr_bits) fCallback.addressSizeChanged(addr_bits);
}
}