Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 178985 Details for
Bug 325277
[disassembly] add IInstruction#getSize() to fill single-instruction gaps, allow large pseudo-mnemonics
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch for CDT_7_0 only: add IInstructionWithSize (extends IInstruction)
ecl.bz.325277.CDT_7_0.patch (text/plain), 12.46 KB, created by
Kirk Beitz
on 2010-09-15 17:47:17 EDT
(
hide
)
Description:
patch for CDT_7_0 only: add IInstructionWithSize (extends IInstruction)
Filename:
MIME Type:
Creator:
Kirk Beitz
Created:
2010-09-15 17:47:17 EDT
Size:
12.46 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.debug.edc >Index: src/org/eclipse/cdt/debug/edc/disassembler/EDCInstruction.java >=================================================================== >RCS file: /n/edc/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/disassembler/EDCInstruction.java,v >retrieving revision 1.2 >diff -u -r1.2 EDCInstruction.java >--- src/org/eclipse/cdt/debug/edc/disassembler/EDCInstruction.java 21 Jun 2010 21:30:40 -0000 1.2 >+++ src/org/eclipse/cdt/debug/edc/disassembler/EDCInstruction.java 15 Sep 2010 21:03:26 -0000 >@@ -14,9 +14,10 @@ > import java.math.BigInteger; > import java.util.StringTokenizer; > >+import org.eclipse.cdt.dsf.debug.internal.provisional.service.IInstructionWithSize; > import org.eclipse.cdt.dsf.debug.service.IInstruction; > >-public class EDCInstruction implements IInstruction { >+public class EDCInstruction implements IInstruction, IInstructionWithSize { > > private final IDisassembledInstruction instruction; > >@@ -96,6 +97,16 @@ > return null; > } > >+ /* >+ * (non-Javadoc) >+ * >+ * @see org.eclipse.cdt.dsf.debug.internal.provisional.service.IInstructionWithSize#getSize() >+ */ >+ public Integer getSize() { >+ return (Integer)instruction.getSize(); >+ } >+ >+ > @Override > public String toString() { > return instruction.toString(); >#P org.eclipse.cdt.dsf >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf/META-INF/MANIFEST.MF,v >retrieving revision 1.6 >diff -u -r1.6 MANIFEST.MF >--- META-INF/MANIFEST.MF 1 Mar 2010 17:15:20 -0000 1.6 >+++ META-INF/MANIFEST.MF 15 Sep 2010 21:03:31 -0000 >@@ -3,7 +3,7 @@ > Bundle-Name: %pluginName > Bundle-Vendor: %providerName > Bundle-SymbolicName: org.eclipse.cdt.dsf;singleton:=true >-Bundle-Version: 2.1.0.qualifier >+Bundle-Version: 2.2.0.qualifier > Bundle-Activator: org.eclipse.cdt.dsf.internal.DsfPlugin > Bundle-Localization: plugin > Require-Bundle: org.eclipse.core.runtime, >@@ -14,6 +14,7 @@ > Export-Package: org.eclipse.cdt.dsf.concurrent, > org.eclipse.cdt.dsf.datamodel, > org.eclipse.cdt.dsf.debug.internal.provisional.model;x-friends:="org.eclipse.cdt.dsf.ui", >+ org.eclipse.cdt.dsf.debug.internal.provisional.service, > org.eclipse.cdt.dsf.debug.model, > org.eclipse.cdt.dsf.debug.service, > org.eclipse.cdt.dsf.debug.service.command, >Index: src/org/eclipse/cdt/dsf/debug/internal/provisional/service/IInstructionWithSize.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/debug/internal/provisional/service/IInstructionWithSize.java >diff -N src/org/eclipse/cdt/dsf/debug/internal/provisional/service/IInstructionWithSize.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/debug/internal/provisional/service/IInstructionWithSize.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,30 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Nokia, Inc. and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * Nokia >+ * Wind River Systems >+ *******************************************************************************/ >+package org.eclipse.cdt.dsf.debug.internal.provisional.service; >+ >+import org.eclipse.cdt.dsf.debug.service.IInstruction; >+ >+/** >+ * a provisional API to provide access to size for use in CDT 7.0.x releases >+ * to be replaced in CDT 8.x by moving getSize() to IInstruction >+ * @author kirk.beitz@nokia.com >+ * @since 2.2 >+ */ >+public interface IInstructionWithSize extends IInstruction { >+ >+ /** >+ * @return size of the instruction >+ * @since 2.2 >+ */ >+ Integer getSize(); >+ >+} >#P org.eclipse.cdt.dsf.ui >Index: src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java,v >retrieving revision 1.8.2.3 >diff -u -r1.8.2.3 DisassemblyBackendDsf.java >--- src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java 26 Aug 2010 09:25:53 -0000 1.8.2.3 >+++ src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java 15 Sep 2010 21:04:10 -0000 >@@ -31,6 +31,7 @@ > import org.eclipse.cdt.dsf.concurrent.Query; > import org.eclipse.cdt.dsf.datamodel.DMContexts; > import org.eclipse.cdt.dsf.datamodel.IDMContext; >+import org.eclipse.cdt.dsf.debug.internal.provisional.service.IInstructionWithSize; > import org.eclipse.cdt.dsf.debug.service.IDisassembly; > import org.eclipse.cdt.dsf.debug.service.IExpressions; > import org.eclipse.cdt.dsf.debug.service.IFormattedValues; >@@ -568,8 +569,8 @@ > // return true to avoid a retry > return true; > } >- // indicates whether [startAddress] was inserted >- boolean insertedStartAddress = startAddress == null; >+ >+ boolean insertedAnyAddress = false; > > try { > fCallback.lockScroller(); >@@ -590,7 +591,7 @@ > fCallback.getDocument().addInvalidAddressRange(p); > } else if (p == null || address.compareTo(endAddress) > 0) { > if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ >- return insertedStartAddress; >+ return insertedAnyAddress; > } else if (p.fValid) { > if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ > if (!p.fAddressOffset.equals(address)) { >@@ -598,7 +599,7 @@ > p.fValid = false; > fCallback.getDocument().addInvalidAddressRange(p); > } else { >- return insertedStartAddress; >+ continue; > } > } > boolean hasSource= false; >@@ -610,12 +611,17 @@ > } > // determine instruction byte length > BigInteger instrLength= null; >- if (j < instructions.length - 1) { >- instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); >- } >- if (instrLength == null) { >- // cannot determine length of last instruction >- break; >+ if (instruction instanceof IInstructionWithSize >+ && ((IInstructionWithSize)instruction).getSize() != null) { >+ instrLength= new BigInteger(((IInstructionWithSize)instruction).getSize().toString()); >+ } else { >+ if (j < instructions.length - 1) { >+ instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); >+ } >+ if (instrLength == null) { >+ // cannot determine length of last instruction >+ break; >+ } > } > final String opCode; > // insert function name+offset instead of opcode bytes >@@ -624,18 +630,19 @@ > } else { > opCode= ""; //$NON-NLS-1$ > } >- insertedStartAddress= insertedStartAddress || address.compareTo(startAddress) == 0; >+ > p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstruction(), compilationPath, -1); >- if (p == null && insertedStartAddress) { >+ if (p == null) { > break; > } >+ insertedAnyAddress = true; > } > } catch (BadLocationException e) { > // should not happen > DisassemblyUtils.internalError(e); > } finally { > fCallback.setUpdatePending(false); >- if (insertedStartAddress) { >+ if (insertedAnyAddress) { > fCallback.updateInvalidSource(); > fCallback.unlockScroller(); > fCallback.doPending(); >@@ -644,7 +651,7 @@ > fCallback.unlockScroller(); > } > } >- return insertedStartAddress; >+ return insertedAnyAddress; > } > > /** >@@ -676,8 +683,8 @@ > // return true to avoid a retry > return true; > } >- // indicates whether [startAddress] was inserted >- boolean insertedStartAddress = startAddress == null; >+ >+ boolean insertedAnyAddress = false; > try { > fCallback.lockScroller(); > >@@ -702,7 +709,7 @@ > fCallback.getDocument().addInvalidAddressRange(p); > } else if (p == null || address.compareTo(endAddress) > 0) { > if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ >- return insertedStartAddress; >+ return insertedAnyAddress; > } else if (p.fValid) { > if (DEBUG) System.out.println("Excess disassembly lines at " + DisassemblyUtils.getAddressText(address)); //$NON-NLS-1$ > if (!p.fAddressOffset.equals(address)) { >@@ -725,26 +732,31 @@ > } > // determine instruction byte length > BigInteger instrLength= null; >- if (j < instructions.length - 1) { >- instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); >- } else if (i < mixedInstructions.length - 1) { >- int nextSrcLineIdx= i+1; >- while (nextSrcLineIdx < mixedInstructions.length) { >- IInstruction[] nextInstrs= mixedInstructions[nextSrcLineIdx].getInstructions(); >- if (nextInstrs.length > 0) { >- instrLength= nextInstrs[0].getAdress().subtract(instruction.getAdress()).abs(); >+ if (instruction instanceof IInstructionWithSize >+ && ((IInstructionWithSize)instruction).getSize() != null) { >+ instrLength= new BigInteger(((IInstructionWithSize)instruction).getSize().toString()); >+ } else { >+ if (j < instructions.length - 1) { >+ instrLength= instructions[j+1].getAdress().subtract(instruction.getAdress()).abs(); >+ } else if (i < mixedInstructions.length - 1) { >+ int nextSrcLineIdx= i+1; >+ while (nextSrcLineIdx < mixedInstructions.length) { >+ IInstruction[] nextInstrs= mixedInstructions[nextSrcLineIdx].getInstructions(); >+ if (nextInstrs.length > 0) { >+ instrLength= nextInstrs[0].getAdress().subtract(instruction.getAdress()).abs(); >+ break; >+ } >+ ++nextSrcLineIdx; >+ } >+ if (nextSrcLineIdx >= mixedInstructions.length) { > break; > } >- ++nextSrcLineIdx; > } >- if (nextSrcLineIdx >= mixedInstructions.length) { >+ if (instrLength == null) { >+ // cannot determine length of last instruction > break; > } > } >- if (instrLength == null) { >- // cannot determine length of last instruction >- break; >- } > final String opCode; > // insert function name+offset instead of opcode bytes > if (functionName != null && functionName.length() > 0) { >@@ -752,11 +764,11 @@ > } else { > opCode= ""; //$NON-NLS-1$ > } >- insertedStartAddress= insertedStartAddress || address.compareTo(startAddress) == 0; > p = fCallback.getDocument().insertDisassemblyLine(p, address, instrLength.intValue(), opCode, instruction.getInstruction(), file, lineNumber); >- if (p == null && insertedStartAddress) { >+ if (p == null) { > break; > } >+ insertedAnyAddress = true; > } > } > >@@ -765,7 +777,7 @@ > DisassemblyUtils.internalError(e); > } finally { > fCallback.setUpdatePending(false); >- if (insertedStartAddress) { >+ if (insertedAnyAddress) { > fCallback.updateInvalidSource(); > fCallback.unlockScroller(); > fCallback.doPending(); >@@ -774,7 +786,7 @@ > fCallback.unlockScroller(); > } > } >- return insertedStartAddress; >+ return insertedAnyAddress; > } > > /* (non-Javadoc) >Index: src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java,v >retrieving revision 1.8.2.1 >diff -u -r1.8.2.1 DisassemblyDocument.java >--- src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java 20 Aug 2010 07:54:37 -0000 1.8.2.1 >+++ src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java 15 Sep 2010 21:04:11 -0000 >@@ -697,7 +697,7 @@ > if (functionLength > fMaxFunctionLength) { > fMaxFunctionLength = functionLength; > } >- if (fNumberOfInstructions < 100) { >+ if (fNumberOfInstructions < 100 && fMeanSizeOfInstructions < 16.0) { > fMeanSizeOfInstructions = (fMeanSizeOfInstructions * fNumberOfInstructions + pos.fAddressLength.floatValue()) / (++fNumberOfInstructions); > } > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 325277
:
178854
|
178900
|
178985
|
179171
|
179737