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 179737 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 avoiding API breakage
325277.patch (text/plain), 12.36 KB, created by
Anton Leherbauer
on 2010-09-28 09:02:22 EDT
(
hide
)
Description:
Patch avoiding API breakage
Filename:
MIME Type:
Creator:
Anton Leherbauer
Created:
2010-09-28 09:02:22 EDT
Size:
12.36 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: /cvsroot/tools/org.eclipse.cdt/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 3 Jun 2010 14:31:09 -0000 1.2 >+++ src/org/eclipse/cdt/debug/edc/disassembler/EDCInstruction.java 28 Sep 2010 12:55:23 -0000 >@@ -14,16 +14,16 @@ > import java.math.BigInteger; > import java.util.StringTokenizer; > >-import org.eclipse.cdt.dsf.debug.service.IInstruction; >+import org.eclipse.cdt.dsf.debug.service.AbstractInstruction; > >-public class EDCInstruction implements IInstruction { >+public class EDCInstruction extends AbstractInstruction { > > private final IDisassembledInstruction instruction; > > public EDCInstruction(IDisassembledInstruction instruction) { > this.instruction = instruction; > } >- >+ > /* > * (non-Javadoc) > * >@@ -96,6 +96,15 @@ > return null; > } > >+ /** >+ * @since 2.0 >+ */ >+ @Override >+ public Integer getSize() { >+ return instruction.getSize(); >+ } >+ >+ > @Override > public String toString() { > return instruction.toString(); >#P org.eclipse.cdt.dsf >Index: src/org/eclipse/cdt/dsf/debug/service/AbstractInstruction.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/debug/service/AbstractInstruction.java >diff -N src/org/eclipse/cdt/dsf/debug/service/AbstractInstruction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/debug/service/AbstractInstruction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,27 @@ >+/******************************************************************************* >+ * Copyright (c) 2010 Wind River Systems, 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: >+ * Wind River Systems - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.cdt.dsf.debug.service; >+ >+/** >+ * Implementers of {@link IInstruction} should extend this abstract class >+ * instead of implementing the interface directly. >+ * >+ * @since 2.2 >+ */ >+public abstract class AbstractInstruction implements IInstructionWithSize { >+ /* >+ * @see org.eclipse.cdt.dsf.debug.service.IInstructionWithSize#getSize() >+ */ >+ public Integer getSize() { >+ // unkown size >+ return null; >+ } >+} >Index: src/org/eclipse/cdt/dsf/debug/service/IInstruction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/service/IInstruction.java,v >retrieving revision 1.3 >diff -u -r1.3 IInstruction.java >--- src/org/eclipse/cdt/dsf/debug/service/IInstruction.java 3 Jun 2010 00:11:48 -0000 1.3 >+++ src/org/eclipse/cdt/dsf/debug/service/IInstruction.java 28 Sep 2010 12:55:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2008, 2009 Ericsson and others. >+ * Copyright (c) 2008, 2010 Ericsson 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 >@@ -14,9 +14,14 @@ > import java.math.BigInteger; > > /** >- * Represents an assembly instruction >+ * Represents an assembly instruction. >+ * <p> >+ * Implementers should extend {@link AbstractInstruction} instead of >+ * implementing this interface directly. >+ * </p> > * > * @since 1.0 >+ * @see IInstructionWithSize > */ > public interface IInstruction { > >Index: src/org/eclipse/cdt/dsf/debug/service/IInstructionWithSize.java >=================================================================== >RCS file: src/org/eclipse/cdt/dsf/debug/service/IInstructionWithSize.java >diff -N src/org/eclipse/cdt/dsf/debug/service/IInstructionWithSize.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/cdt/dsf/debug/service/IInstructionWithSize.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,33 @@ >+/******************************************************************************* >+ * 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.service; >+ >+import org.eclipse.cdt.dsf.debug.service.IInstruction; >+ >+/** >+ * Extension interface for instructions knowing their size. >+ * <p> >+ * Implementers must extend {@link AbstractInstruction} instead of >+ * implementing this interface directly. >+ * </p> >+ * @since 2.2 >+ * @noimplement This interface is not intended to be implemented by clients. >+ * @noextend This interface is not intended to be extended by clients. >+ */ >+public interface IInstructionWithSize extends IInstruction { >+ >+ /** >+ * @return size of the instruction in bytes or <code>null</code> if unknown >+ */ >+ Integer getSize(); >+ >+} >#P org.eclipse.cdt.dsf.gdb >Index: src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt/dsf-gdb/org.eclipse.cdt.dsf.gdb/src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java,v >retrieving revision 1.2 >diff -u -r1.2 MIInstruction.java >--- src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java 3 Jun 2010 00:09:36 -0000 1.2 >+++ src/org/eclipse/cdt/dsf/mi/service/command/output/MIInstruction.java 28 Sep 2010 12:55:25 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2009 QNX Software Systems and others. >+ * Copyright (c) 2000, 2010 QNX Software Systems 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 >@@ -14,9 +14,9 @@ > > import java.math.BigInteger; > >-import org.eclipse.cdt.dsf.debug.service.IInstruction; >+import org.eclipse.cdt.dsf.debug.service.AbstractInstruction; > >-public class MIInstruction implements IInstruction { >+public class MIInstruction extends AbstractInstruction { > > // The parsed information > BigInteger address; >#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.13 >diff -u -r1.13 DisassemblyBackendDsf.java >--- src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java 15 Sep 2010 11:05:51 -0000 1.13 >+++ src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java 28 Sep 2010 12:55:29 -0000 >@@ -40,6 +40,7 @@ > import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMContext; > import org.eclipse.cdt.dsf.debug.service.IFormattedValues.FormattedValueDMData; > import org.eclipse.cdt.dsf.debug.service.IInstruction; >+import org.eclipse.cdt.dsf.debug.service.IInstructionWithSize; > import org.eclipse.cdt.dsf.debug.service.IMixedInstruction; > import org.eclipse.cdt.dsf.debug.service.IRunControl; > import org.eclipse.cdt.dsf.debug.service.IRunControl.IExecutionDMContext; >@@ -613,12 +614,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 >@@ -667,7 +673,6 @@ > * @param showDisassembly > * @return whether [startAddress] was inserted > */ >- > private boolean insertDisassembly(BigInteger startAddress, BigInteger endAddress, IMixedInstruction[] mixedInstructions, boolean showSymbols, boolean showDisassembly) { > if (!fCallback.hasViewer() || fDsfSessionId == null) { > // return true to avoid a retry >@@ -730,26 +735,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) { >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.9 >diff -u -r1.9 DisassemblyDocument.java >--- src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java 20 Aug 2010 07:57:21 -0000 1.9 >+++ src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/model/DisassemblyDocument.java 28 Sep 2010 12:55:31 -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
Flags:
aleherb+eclipse
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 325277
:
178854
|
178900
|
178985
|
179171
| 179737