From ca9852bf78a2a5f366449bb49f1510baedd896e4 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Sat, 18 Sep 2004 03:46:42 +0000 Subject: [PATCH] Work to support bigger then 32 bits application --- .../cdt/debug/core/cdi/ICDILocation.java | 5 +- .../cdt/debug/core/cdi/ICDIMemoryManager.java | 5 +- .../cdt/debug/core/cdi/ICDISourceManager.java | 9 ++-- .../cdt/debug/core/cdi/ICDITraceManager.java | 5 +- .../cdi/event/ICDIMemoryChangedEvent.java | 4 +- .../debug/core/cdi/model/ICDIInstruction.java | 5 +- .../debug/core/cdi/model/ICDIMemoryBlock.java | 5 +- .../core/cdi/model/ICDISharedLibrary.java | 7 +-- .../cdt/debug/core/cdi/model/ICDITarget.java | 5 +- .../cdi/model/type/ICDIIntegralValue.java | 4 ++ .../core/cdi/model/type/ICDIPointerValue.java | 5 +- .../cdi/model/type/ICDIReferenceValue.java | 5 +- .../internal/core/CBreakpointManager.java | 18 ++++--- .../internal/core/model/AsmInstruction.java | 13 +++-- .../internal/core/model/AsmSourceLine.java | 5 +- .../internal/core/model/CDebugTarget.java | 5 +- .../core/model/CFormattedMemoryBlock.java | 14 ++++-- .../internal/core/model/CSharedLibrary.java | 11 +++-- .../internal/core/model/CStackFrame.java | 4 +- .../cdt/debug/internal/core/model/CValue.java | 17 ++++--- .../internal/core/model/Disassembly.java | 3 +- .../internal/core/model/DisassemblyBlock.java | 16 +++--- .../debug/mi/core/cdi/BreakpointManager.java | 4 +- .../cdt/debug/mi/core/cdi/EventManager.java | 4 +- .../cdt/debug/mi/core/cdi/Location.java | 13 ++--- .../cdt/debug/mi/core/cdi/MemoryManager.java | 15 +++--- .../cdt/debug/mi/core/cdi/Session.java | 9 ++-- .../mi/core/cdi/SharedLibraryManager.java | 8 +-- .../cdt/debug/mi/core/cdi/SourceManager.java | 43 +++++++++------- .../mi/core/cdi/event/MemoryChangedEvent.java | 8 +-- .../debug/mi/core/cdi/model/Breakpoint.java | 5 +- .../debug/mi/core/cdi/model/Instruction.java | 8 +-- .../debug/mi/core/cdi/model/MemoryBlock.java | 15 +++--- .../mi/core/cdi/model/SharedLibrary.java | 12 +++-- .../debug/mi/core/cdi/model/StackFrame.java | 13 +++-- .../cdt/debug/mi/core/cdi/model/Target.java | 49 ++----------------- .../mi/core/cdi/model/VariableObject.java | 5 +- .../mi/core/cdi/model/type/IntegralValue.java | 29 +++++++++-- .../mi/core/cdi/model/type/PointerValue.java | 16 +++--- .../core/cdi/model/type/ReferenceValue.java | 20 ++++---- .../mi/core/command/MIGDBShowAddressSize.java | 2 +- .../mi/core/event/MIMemoryChangedEvent.java | 12 ++--- .../mi/core/event/MIMemoryCreatedEvent.java | 11 +++-- .../core/output/MIInfoSharedLibraryInfo.java | 15 ++---- .../cdt/debug/mi/core/GDBDebugger.java | 6 +-- .../cdt/debug/mi/core/GDBServerDebugger.java | 4 +- .../eclipse/cdt/debug/mi/core/MIFormat.java | 38 ++++++++++++++ .../eclipse/cdt/debug/mi/core/MIPlugin.java | 38 +++++--------- 48 files changed, 322 insertions(+), 250 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java index 39b05878ec3..3a7fb868e41 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java @@ -10,8 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.debug.core.cdi; -import org.eclipse.cdt.core.IAddress; - +import java.math.BigInteger; /** * @@ -26,7 +25,7 @@ public interface ICDILocation { * * @return the address of this location */ - IAddress getAddress(); + BigInteger getAddress(); /** * Returns the source file of this location or null diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIMemoryManager.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIMemoryManager.java index b1adfdd5ffa..8e00cc883c1 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIMemoryManager.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIMemoryManager.java @@ -11,7 +11,8 @@ package org.eclipse.cdt.debug.core.cdi; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; /** @@ -42,7 +43,7 @@ public interface ICDIMemoryManager extends ICDIManager { * @return a memory block with the specified identifier * @throws CDIException on failure. Reasons include: */ - ICDIMemoryBlock createMemoryBlock(IAddress address, int length) + ICDIMemoryBlock createMemoryBlock(BigInteger address, int length) throws CDIException; /** diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISourceManager.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISourceManager.java index c37263e5c90..fed61113697 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISourceManager.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDISourceManager.java @@ -11,7 +11,8 @@ package org.eclipse.cdt.debug.core.cdi; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; @@ -41,7 +42,7 @@ public interface ICDISourceManager extends ICDIManager { * @param endAddress is the end address * @throws CDIException on failure. */ - ICDIInstruction[] getInstructions(IAddress startAddress, IAddress endAddress) + ICDIInstruction[] getInstructions(BigInteger startAddress, BigInteger endAddress) throws CDIException; /** @@ -67,8 +68,8 @@ public interface ICDISourceManager extends ICDIManager { * @throws CDIException on failure. */ ICDIMixedInstruction[] getMixedInstructions( - IAddress startAddress, - IAddress endAddress) + BigInteger startAddress, + BigInteger endAddress) throws CDIException; /** diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java index 9553bae4951..46691eccfd7 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDITraceManager.java @@ -11,7 +11,8 @@ package org.eclipse.cdt.debug.core.cdi; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint; /** @@ -156,5 +157,5 @@ public interface ICDITraceManager extends ICDISessionObject { * @param address - an address * @return an ICDILocation object */ - ICDILocation createLocation( IAddress address ); + ICDILocation createLocation( BigInteger address ); } diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.java index 5e49f807f45..fb26b342626 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/event/ICDIMemoryChangedEvent.java @@ -10,7 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.debug.core.cdi.event; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; /** * @@ -21,5 +21,5 @@ public interface ICDIMemoryChangedEvent extends ICDIChangedEvent { /** * @return the modified addresses. */ - IAddress[] getAddresses(); + BigInteger[] getAddresses(); } diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.java index 6b8665726a1..577e5704009 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIInstruction.java @@ -11,7 +11,8 @@ package org.eclipse.cdt.debug.core.cdi.model; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + /** * @@ -24,7 +25,7 @@ public interface ICDIInstruction extends ICDIObject { * Returns the Address. * @return the address. */ - IAddress getAdress(); + BigInteger getAdress(); /** * @return the function name. diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java index 0317aefd936..a82179a49eb 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIMemoryBlock.java @@ -11,7 +11,8 @@ package org.eclipse.cdt.debug.core.cdi.model; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; /** @@ -27,7 +28,7 @@ public interface ICDIMemoryBlock extends ICDIObject { * * @return the start address of this memory block */ - IAddress getStartAddress(); + BigInteger getStartAddress(); /** * Returns the length of this memory block in bytes. diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java index 1857b1152ea..b129e41653d 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDISharedLibrary.java @@ -10,7 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.debug.core.cdi.model; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; /** @@ -33,14 +34,14 @@ public interface ICDISharedLibrary extends ICDIObject { * * @return the start address of this library */ - IAddress getStartAddress(); + BigInteger getStartAddress(); /** * Returns the end address of this library. * * @return the end address of this library */ - IAddress getEndAddress(); + BigInteger getEndAddress(); /** * Returns whether the symbols of this library are read. diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java index 515dddc0c72..af0cb6486d6 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java @@ -11,7 +11,8 @@ package org.eclipse.cdt.debug.core.cdi.model; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDILocation; @@ -183,6 +184,6 @@ public interface ICDITarget extends ICDIThreadGroup, ICDISessionObject { /** * Returns a ICDILocation */ - ICDILocation createLocation(IAddress address); + ICDILocation createLocation(BigInteger address); } diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralValue.java index 3f3319c571f..f59821a046e 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralValue.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIIntegralValue.java @@ -11,6 +11,8 @@ package org.eclipse.cdt.debug.core.cdi.model.type; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; @@ -23,6 +25,8 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; */ public interface ICDIIntegralValue extends ICDIValue { + public BigInteger bigIntegerValue() throws CDIException; + public long longValue() throws CDIException; public int intValue() throws CDIException; diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.java index 77a5edb86b8..f9a5560f26a 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIPointerValue.java @@ -11,7 +11,8 @@ package org.eclipse.cdt.debug.core.cdi.model.type; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; @@ -23,5 +24,5 @@ import org.eclipse.cdt.debug.core.cdi.CDIException; */ public interface ICDIPointerValue extends ICDIDerivedValue { - IAddress pointerValue() throws CDIException; + BigInteger pointerValue() throws CDIException; } diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.java index 826e61a36aa..3ed9c1c8fe0 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/type/ICDIReferenceValue.java @@ -10,12 +10,13 @@ *******************************************************************************/ package org.eclipse.cdt.debug.core.cdi.model.type; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; /** */ public interface ICDIReferenceValue extends ICDIDerivedValue { - IAddress referenceValue() throws CDIException; + BigInteger referenceValue() throws CDIException; } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java index 56a94b1c725..82af6fb8411 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java @@ -10,6 +10,7 @@ ***********************************************************************/ package org.eclipse.cdt.debug.internal.core; +import java.math.BigInteger; import java.text.MessageFormat; import java.util.Arrays; import java.util.HashMap; @@ -17,6 +18,7 @@ import java.util.Map; import java.util.Set; import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; @@ -264,8 +266,11 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) { try { ICDILocation location = ((ICDILocationBreakpoint)cdiBreakpoint).getLocation(); - if ( location != null ) - return location.getAddress(); + if ( location != null ) + { + IAddressFactory factory = getDebugTarget().getAddressFactory(); + return factory.createAddress( location.getAddress().toString() ); + } } catch( CDIException e ) { } @@ -495,7 +500,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException { ICDITarget cdiTarget = getCDITarget(); - ICDILocation location = cdiTarget.createLocation( getDebugTarget().getAddressFactory().createAddress(breakpoint.getAddress())); + ICDILocation location = cdiTarget.createLocation( new BigInteger ( breakpoint.getAddress() ) ); ICDIBreakpoint cdiBreakpoint = null; synchronized ( getBreakpointMap() ) { cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true ); @@ -565,7 +570,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) { breakpoint = createFunctionBreakpoint( cdiBreakpoint ); } - else if ( ! cdiBreakpoint.getLocation().getAddress().isZero() ) { + else if ( ! cdiBreakpoint.getLocation().getAddress().equals( BigInteger.ZERO ) ) { breakpoint = createAddressBreakpoint( cdiBreakpoint ); } } @@ -573,7 +578,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) { breakpoint = createFunctionBreakpoint( cdiBreakpoint ); } - else if ( ! cdiBreakpoint.getLocation().getAddress().isZero()) { + else if ( ! cdiBreakpoint.getLocation().getAddress().equals( BigInteger.ZERO ) ) { breakpoint = createAddressBreakpoint( cdiBreakpoint ); } } @@ -618,9 +623,10 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent private ICAddressBreakpoint createAddressBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { IFile execFile = getExecFile(); String sourceHandle = execFile.getFullPath().toOSString(); + IAddress address = getDebugTarget().getAddressFactory().createAddress( cdiBreakpoint.getLocation().getAddress().toString() ); ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( sourceHandle, execFile, - cdiBreakpoint.getLocation().getAddress(), + address, cdiBreakpoint.isEnabled(), cdiBreakpoint.getCondition().getIgnoreCount(), cdiBreakpoint.getCondition().getExpression(), diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java index 7a52aabf51c..43e48ce1f37 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmInstruction.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.debug.internal.core.model; import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.model.IAsmInstruction; @@ -20,19 +21,25 @@ import org.eclipse.cdt.debug.core.model.IAsmInstruction; public class AsmInstruction implements IAsmInstruction { private ICDIInstruction fCDIInstruction; - + private IAddressFactory fAddressFactory; /** * Constructor for AsmInstruction. */ - public AsmInstruction( ICDIInstruction cdiInstruction ) { + public AsmInstruction( IAddressFactory factory, ICDIInstruction cdiInstruction ) { fCDIInstruction = cdiInstruction; + fAddressFactory = factory; + } + + public IAddressFactory getAddressFactory() { + return fAddressFactory; } /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress() */ public IAddress getAdress() { - return fCDIInstruction.getAdress(); + IAddressFactory factory = getAddressFactory(); + return factory.createAddress( fCDIInstruction.getAdress().toString() ); } /* (non-Javadoc) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java index 59df3e81c6f..0cb076d8d7d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/AsmSourceLine.java @@ -10,6 +10,7 @@ ***********************************************************************/ package org.eclipse.cdt.debug.internal.core.model; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.model.IAsmInstruction; import org.eclipse.cdt.debug.core.model.IAsmSourceLine; @@ -26,11 +27,11 @@ public class AsmSourceLine implements IAsmSourceLine { /** * Constructor for AsmSourceLine. */ - public AsmSourceLine( String text, ICDIInstruction[] cdiInstructions ) { + public AsmSourceLine( IAddressFactory factory, String text, ICDIInstruction[] cdiInstructions ) { fText = text; fInstructions = new IAsmInstruction[cdiInstructions.length]; for ( int i = 0; i < fInstructions.length; ++i ) { - fInstructions[i] = new AsmInstruction( cdiInstructions[i] ); + fInstructions[i] = new AsmInstruction( factory, cdiInstructions[i] ); } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index 9c00a1b0b48..d5bfc57f930 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -10,6 +10,7 @@ *******************************************************************************/ package org.eclipse.cdt.debug.internal.core.model; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; @@ -1518,7 +1519,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv if ( skipBreakpoints ) { getBreakpointManager().skipBreakpoints( true ); } - ICDILocation location = getCDITarget().createLocation( address ); + ICDILocation location = getCDITarget().createLocation( new BigInteger( address.toString() ) ); try { getCDITarget().stepUntil( location ); } @@ -1619,7 +1620,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv public void jumpToAddress( IAddress address ) throws DebugException { if ( !canJumpToAddress( address ) ) return; - ICDILocation location = getCDITarget().createLocation( address ); + ICDILocation location = getCDITarget().createLocation( new BigInteger( address.toString() ) ); try { getCDITarget().resume( location ); } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java index 0054764738e..12ee8aa8761 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CFormattedMemoryBlock.java @@ -15,6 +15,7 @@ import java.util.ArrayList; import java.util.List; import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.cdi.CDIException; @@ -293,11 +294,12 @@ public class CFormattedMemoryBlock extends CDebugElement public IAddress getRealStartAddress() { + IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); if ( fCDIMemoryBlock != null ) { - return fCDIMemoryBlock.getStartAddress(); + return factory.createAddress( fCDIMemoryBlock.getStartAddress().toString() ); } - return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero(); + return factory.getZero(); } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IMemoryBlock#getLength() @@ -500,7 +502,13 @@ public class CFormattedMemoryBlock extends CDebugElement { resetBytes(); resetRows(); - setChangedAddresses( event.getAddresses() ); + IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); + BigInteger[] bigs = event.getAddresses(); + IAddress[] addresses = new IAddress[bigs.length]; + for (int i = 0; i < addresses.length; ++i) { + addresses[i] = factory.createAddress( bigs[i].toString() ); + } + setChangedAddresses( addresses ); fireChangeEvent( DebugEvent.CONTENT ); } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSharedLibrary.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSharedLibrary.java index e3ec2ad8a99..39dc09ae523 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSharedLibrary.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSharedLibrary.java @@ -11,6 +11,7 @@ package org.eclipse.cdt.debug.internal.core.model; import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; @@ -55,9 +56,10 @@ public class CSharedLibrary extends CDebugElement */ public IAddress getStartAddress() { + IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); if ( getCDISharedLibrary() != null ) - return getCDISharedLibrary().getStartAddress(); - return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero(); + return factory.createAddress(getCDISharedLibrary().getStartAddress().toString()); + return factory.getZero(); } /* (non-Javadoc) @@ -65,9 +67,10 @@ public class CSharedLibrary extends CDebugElement */ public IAddress getEndAddress() { + IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); if ( getCDISharedLibrary() != null ) - return getCDISharedLibrary().getEndAddress(); - return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero(); + return factory.createAddress(getCDISharedLibrary().getEndAddress().toString()); + return factory.getZero(); } /* (non-Javadoc) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java index f60169be0ca..63112ed25b6 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java @@ -18,6 +18,7 @@ import java.util.Iterator; import java.util.List; import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; @@ -532,7 +533,8 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress() */ public IAddress getAddress() { - return getCDIStackFrame().getLocation().getAddress(); + IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); + return factory.createAddress( getCDIStackFrame().getLocation().getAddress().toString() ); } /* (non-Javadoc) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java index 7a480d8817d..b88acd2784a 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CValue.java @@ -18,6 +18,7 @@ import java.util.Iterator; import java.util.List; import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; @@ -363,9 +364,11 @@ public class CValue extends AbstractCValue { private String getPointerValueString( ICDIPointerValue value ) throws CDIException { - //IPF_TODO Workaround to solve incoorect handling of structures referenced by pointers or references - IAddress address = value.pointerValue(); - if(address == null) return ""; + //TODO:IPF_TODO Workaround to solve incorrect handling of structures referenced by pointers or references + IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); + IAddress address = factory.createAddress(value.pointerValue().toString()); + if ( address == null ) + return ""; //$NON-NLS-1$ CVariableFormat format = getParentVariable().getFormat(); if( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) @@ -378,9 +381,11 @@ public class CValue extends AbstractCValue { private String getReferenceValueString( ICDIReferenceValue value ) throws CDIException { //NOTE: Reference should be displayed identically to address - //IPF_TODO Workaround to solve incoorect handling of structures referenced by pointers or references - IAddress address = value.referenceValue(); - if(address == null) return ""; + //TODO:IPF_TODO Workaround to solve incoorect handling of structures referenced by pointers or references + IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); + IAddress address = factory.createAddress( value.referenceValue().toString() ); + if (address == null) + return ""; //$NON-NLS-1$ CVariableFormat format = getParentVariable().getFormat(); if( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java index d9735959066..04327c6236d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/Disassembly.java @@ -79,7 +79,8 @@ public class Disassembly extends CDebugElement implements IDisassembly { if ( mixedInstrs.length == 0 || !containsAddress( mixedInstrs, address ) ) { try { - ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( address, address.add(BigInteger.valueOf(DISASSEMBLY_BLOCK_SIZE)) ) ); + BigInteger addr = new BigInteger( address.toString() ); + ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( addr, addr.add(BigInteger.valueOf(DISASSEMBLY_BLOCK_SIZE)) ) ); return DisassemblyBlock.create( this, instructions ); } catch( CDIException e ) { diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java index 46f2fa87f3e..23df3bca9b9 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/DisassemblyBlock.java @@ -17,6 +17,7 @@ import java.io.IOException; import java.io.LineNumberReader; import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; import org.eclipse.cdt.debug.core.model.IAsmInstruction; @@ -61,15 +62,17 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable { if ( adapter instanceof IAdaptable ) { locator = (ICSourceLocator)((IAdaptable)adapter).getAdapter( ICSourceLocator.class ); } - block.setSourceLines( createSourceLines( locator, instructions ) ); + IAddressFactory factory = ((CDebugTarget)disassembly.getDebugTarget()).getAddressFactory(); + block.setSourceLines( createSourceLines( factory, locator, instructions ) ); block.initializeAddresses(); return block; } public static DisassemblyBlock create( IDisassembly disassembly, ICDIInstruction[] instructions ) { DisassemblyBlock block = new DisassemblyBlock( disassembly ); + IAddressFactory factory = ((CDebugTarget)disassembly.getDebugTarget()).getAddressFactory(); block.setMixedMode( false ); - block.setSourceLines( createSourceLines( instructions ) ); + block.setSourceLines( createSourceLines( factory, instructions ) ); block.initializeAddresses(); return block; } @@ -130,7 +133,7 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable { public void dispose() { } - private static IAsmSourceLine[] createSourceLines( ICSourceLocator locator, ICDIMixedInstruction[] mi ) { + private static IAsmSourceLine[] createSourceLines( IAddressFactory factory, ICSourceLocator locator, ICDIMixedInstruction[] mi ) { IAsmSourceLine[] result = new IAsmSourceLine[mi.length]; LineNumberReader reader = null; if ( result.length > 0 && locator != null ) { @@ -170,13 +173,14 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable { } } } - result[i] = new AsmSourceLine( text, mi[i].getInstructions() ); + result[i] = new AsmSourceLine( factory, text, mi[i].getInstructions() ); } return result; } - private static IAsmSourceLine[] createSourceLines( ICDIInstruction[] instructions ) { - return new IAsmSourceLine[] { new AsmSourceLine( "", instructions ) }; //$NON-NLS-1$ + private static IAsmSourceLine[] createSourceLines( IAddressFactory factory, ICDIInstruction[] instructions ) { + + return new IAsmSourceLine[] { new AsmSourceLine( factory, "", instructions ) }; //$NON-NLS-1$ } private void initializeAddresses() { diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java index d7100c856e8..bf6ac520962 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/BreakpointManager.java @@ -10,13 +10,13 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDILocation; @@ -650,7 +650,7 @@ public class BreakpointManager extends Manager { /** * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(long) */ - public ICDILocation createLocation(IAddress address) { + public ICDILocation createLocation(BigInteger address) { return new Location(address); } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java index b3934319254..6b5605dfa1f 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/EventManager.java @@ -10,13 +10,13 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Observable; import java.util.Observer; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager; @@ -120,7 +120,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs MemoryManager mgr = (MemoryManager)session.getMemoryManager(); MemoryBlock[] blocks = mgr.getMemoryBlocks(miEvent.getMISession()); MIMemoryChangedEvent miMem = (MIMemoryChangedEvent)miEvent; - IAddress[] addresses = miMem.getAddresses(); + BigInteger[] addresses = miMem.getAddresses(); for (int i = 0; i < blocks.length; i++) { if (blocks[i].contains(addresses) && (! blocks[i].isFrozen() || blocks[i].isDirty())) { diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java index 8617ac188c4..535fbd24015 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Location.java @@ -10,14 +10,15 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.ICDILocation; /** */ public class Location implements ICDILocation { - IAddress addr; + BigInteger addr; String file = ""; //$NON-NLS-1$ String function = ""; //$NON-NLS-1$ int line; @@ -26,7 +27,7 @@ public class Location implements ICDILocation { this(f, fnct, l, null); } - public Location(String f, String fnct, int l, IAddress a) { + public Location(String f, String fnct, int l, BigInteger a) { if (f != null) file = f; if (fnct != null) @@ -35,14 +36,14 @@ public class Location implements ICDILocation { addr = a; } - public Location(IAddress address) { + public Location(BigInteger address) { addr = address; } /** * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress() */ - public IAddress getAddress() { + public BigInteger getAddress() { return addr; } @@ -87,7 +88,7 @@ public class Location implements ICDILocation { } } } - IAddress oaddr = location.getAddress(); + BigInteger oaddr = location.getAddress(); if (addr != null && oaddr != null) { //IPF_TODO: check ZERO addresses if (addr.equals(oaddr)) { return true; diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java index c6f31c0b4b6..a79a53faf48 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/MemoryManager.java @@ -18,7 +18,6 @@ import java.util.Hashtable; import java.util.List; import java.util.Map; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; @@ -102,12 +101,12 @@ public class MemoryManager extends Manager implements ICDIMemoryManager { /** * update one Block. */ - public IAddress[] update(MemoryBlock block, List aList) throws CDIException { + public BigInteger[] update(MemoryBlock block, List aList) throws CDIException { Target target = (Target)block.getTarget(); MISession miSession = target.getMISession(); MemoryBlock newBlock = cloneBlock(block); boolean newAddress = ! newBlock.getStartAddress().equals(block.getStartAddress()); - IAddress[] array = compareBlocks(block, newBlock); + BigInteger[] array = compareBlocks(block, newBlock); // Update the block MIDataReadMemoryInfo. block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo()); if (array.length > 0 || newAddress) { @@ -128,11 +127,11 @@ public class MemoryManager extends Manager implements ICDIMemoryManager { * oldBlock.getLength() == newBlock.getLength(); * @return Long[] array of modified addresses. */ - IAddress[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException { + BigInteger[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException { byte[] oldBytes = oldBlock.getBytes(); byte[] newBytes = newBlock.getBytes(); List aList = new ArrayList(newBytes.length); - BigInteger distance = newBlock.getStartAddress().distance(oldBlock.getStartAddress()); + BigInteger distance = newBlock.getStartAddress().subtract(oldBlock.getStartAddress()); //IPF_TODO enshure it is OK here int diff = distance.intValue(); if ( Math.abs(diff) < newBytes.length) { @@ -144,7 +143,7 @@ public class MemoryManager extends Manager implements ICDIMemoryManager { } } } - return (IAddress[])aList.toArray(new IAddress[0]); + return (BigInteger[]) aList.toArray(new BigInteger[aList.size()]); } /** @@ -180,9 +179,9 @@ public class MemoryManager extends Manager implements ICDIMemoryManager { /** * @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(long, int) */ - public ICDIMemoryBlock createMemoryBlock(IAddress address, int length) + public ICDIMemoryBlock createMemoryBlock(BigInteger address, int length) throws CDIException { - return createMemoryBlock(address.toHexAddressString(), length); + return createMemoryBlock(address.toString(16), length); } /** diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java index b0d67cd2c09..c295ec461f7 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/Session.java @@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.mi.core.cdi; import java.util.Properties; -import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; @@ -55,19 +54,19 @@ public class Session implements ICDISession, ICDISessionObject { SourceManager sourceManager; ICDIConfiguration configuration; - public Session(MISession miSession, IAddressFactory addrFactory, boolean attach) { + public Session(MISession miSession, boolean attach) { commonSetup(); setConfiguration(new Configuration(miSession, attach)); - Target target = new Target(this, miSession, addrFactory); + Target target = new Target(this, miSession); addTargets(new Target[] { target }, target); } - public Session(MISession miSession, IAddressFactory addrFactory) { + public Session(MISession miSession) { commonSetup(); setConfiguration(new CoreFileConfiguration()); - Target target = new Target(this, miSession, addrFactory); + Target target = new Target(this, miSession); addTargets(new Target[] { target }, target); } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java index 8df65049e1a..c0cf8640e8f 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SharedLibraryManager.java @@ -11,18 +11,19 @@ package org.eclipse.cdt.debug.mi.core.cdi; +import java.math.BigInteger; import java.util.ArrayList; import java.util.Collections; import java.util.Hashtable; import java.util.List; import java.util.Map; -import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager; import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; import org.eclipse.cdt.debug.mi.core.MIException; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.cdi.model.SharedLibrary; import org.eclipse.cdt.debug.mi.core.cdi.model.Target; @@ -146,10 +147,9 @@ public class SharedLibraryManager extends Manager implements ICDISharedLibraryMa } public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) { - IAddressFactory af = ((Target)getSession().getCurrentTarget()).getAddressFactory(); return !miLib.getName().equals(lib.getFileName()) || - !af.createAddress(miLib.getFrom()).equals(lib.getStartAddress()) || - !af.createAddress(miLib.getTo()).equals(lib.getEndAddress()) || + !MIFormat.getBigInteger(miLib.getFrom()).equals(lib.getStartAddress()) || + !MIFormat.getBigInteger(miLib.getTo()).equals(lib.getEndAddress()) || miLib.isRead() != lib.areSymbolsLoaded(); } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java index 1c14e671699..d329a6ee7d1 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/SourceManager.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi; +import java.math.BigInteger; import java.util.StringTokenizer; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDISourceManager; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; @@ -146,16 +146,16 @@ public class SourceManager extends Manager implements ICDISourceManager { /** * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long) */ - public ICDIInstruction[] getInstructions(IAddress start, IAddress end) throws CDIException { + public ICDIInstruction[] getInstructions(BigInteger start, BigInteger end) throws CDIException { Target target = (Target)getSession().getCurrentTarget(); return getInstructions(target, start, end); } - public ICDIInstruction[] getInstructions(Target target, IAddress start, IAddress end) throws CDIException { + public ICDIInstruction[] getInstructions(Target target, BigInteger start, BigInteger end) throws CDIException { MISession mi = target.getMISession(); CommandFactory factory = mi.getCommandFactory(); String hex = "0x"; //$NON-NLS-1$ - String sa = start.toHexAddressString(); - String ea = end.toHexAddressString(); + String sa = hex + start.toString(16); + String ea = hex + end.toString(16); MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, false); try { mi.postCommand(dis); @@ -206,15 +206,16 @@ public class SourceManager extends Manager implements ICDISourceManager { /** * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long) */ - public ICDIMixedInstruction[] getMixedInstructions(IAddress start, IAddress end) throws CDIException { + public ICDIMixedInstruction[] getMixedInstructions(BigInteger start, BigInteger end) throws CDIException { Target target = (Target)getSession().getCurrentTarget(); return getMixedInstructions(target, start, end); } - public ICDIMixedInstruction[] getMixedInstructions(Target target, IAddress start, IAddress end) throws CDIException { + public ICDIMixedInstruction[] getMixedInstructions(Target target, BigInteger start, BigInteger end) throws CDIException { MISession mi = target.getMISession(); CommandFactory factory = mi.getCommandFactory(); - String sa = start.toHexAddressString(); - String ea = end.toHexAddressString(); + String hex = "0x"; //$NON-NLS-1$ + String sa = hex + start.toString(16); + String ea = hex + end.toString(16); MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, true); try { mi.postCommand(dis); @@ -340,7 +341,7 @@ public class SourceManager extends Manager implements ICDISourceManager { } else if (typename.equals("int32_t")) { //$NON-NLS-1$ return new LongType(vo, typename); } else if (typename.equals("int64_t")) { //$NON-NLS-1$ - return new IntType(vo, typename); + return new LongLongType(vo, typename); } else if (typename.equals("int128_t")) { //$NON-NLS-1$ return new IntType(vo, typename); } @@ -480,12 +481,16 @@ public class SourceManager extends Manager implements ICDISourceManager { } public String getTypeName(VariableObject vo, String variable) throws CDIException { + Target target = (Target)vo.getTarget(); ICDIStackFrame frame = vo.getStackFrame(); - Target target = (Target)frame.getTarget(); - ICDIThread currentThread = target.getCurrentThread(); - ICDIStackFrame currentFrame = currentThread.getCurrentStackFrame(); - target.setCurrentThread(frame.getThread(), false); - frame.getThread().setCurrentStackFrame(frame, false); + ICDIThread currentThread = null; + ICDIStackFrame currentFrame = null; + if (frame != null) { + currentThread = target.getCurrentThread(); + currentFrame = currentThread.getCurrentStackFrame(); + target.setCurrentThread(frame.getThread(), false); + frame.getThread().setCurrentStackFrame(frame, false); + } try { MISession mi = target.getMISession(); CommandFactory factory = mi.getCommandFactory(); @@ -499,8 +504,12 @@ public class SourceManager extends Manager implements ICDISourceManager { } catch (MIException e) { throw new MI2CDIException(e); } finally { - target.setCurrentThread(currentThread, false); - currentThread.setCurrentStackFrame(currentFrame, false); + if (currentThread != null) { + target.setCurrentThread(currentThread, false); + } + if (currentFrame != null) { + currentThread.setCurrentStackFrame(currentFrame, false); + } } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java index b342acded85..f396e93837d 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/event/MemoryChangedEvent.java @@ -10,10 +10,10 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi.event; +import java.math.BigInteger; import java.util.ArrayList; import java.util.List; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent; import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.mi.core.cdi.Session; @@ -37,16 +37,16 @@ public class MemoryChangedEvent implements ICDIMemoryChangedEvent { /** * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getAddresses() */ - public IAddress[] getAddresses() { + public BigInteger[] getAddresses() { /* But only returns the address that are in the block. */ - IAddress[] mi_addresses = miMem.getAddresses(); + BigInteger[] mi_addresses = miMem.getAddresses(); List aList = new ArrayList(mi_addresses.length); for (int i = 0; i < mi_addresses.length; i++) { if (source.contains(mi_addresses[i])) { aList.add(mi_addresses[i]); } } - return (IAddress[])aList.toArray(new IAddress[0]); + return (BigInteger[]) aList.toArray(new BigInteger[aList.size()]); } /** diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java index cd1baca1aa0..b9fddfd7430 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Breakpoint.java @@ -10,11 +10,14 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi.model; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.model.ICDIBreakpoint; import org.eclipse.cdt.debug.core.cdi.model.ICDILocationBreakpoint; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; import org.eclipse.cdt.debug.mi.core.cdi.Condition; import org.eclipse.cdt.debug.mi.core.cdi.Location; @@ -153,7 +156,7 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint { fLocation = new Location (miBreakpoint.getFile(), miBreakpoint.getFunction(), miBreakpoint.getLine(), - ((Target)getTarget()).getAddressFactory().createAddress(miBreakpoint.getAddress())); + MIFormat.getBigInteger(miBreakpoint.getAddress())); } } return fLocation; diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java index d7f291836c8..ff2a8e63645 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Instruction.java @@ -10,8 +10,10 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi.model; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.output.MIAsm; /** @@ -27,8 +29,8 @@ public class Instruction extends CObject implements ICDIInstruction { /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getAdress() */ - public IAddress getAdress() { - return ((Target)getTarget()).getAddressFactory().createAddress(asm.getAddress()); + public BigInteger getAdress() { + return MIFormat.getBigInteger(asm.getAddress()); } /** diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java index 7f6eeb73420..2bbc91b4002 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/MemoryBlock.java @@ -15,7 +15,6 @@ import java.math.BigInteger; import java.util.ArrayList; import java.util.List; -import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; import org.eclipse.cdt.debug.mi.core.MIException; @@ -39,7 +38,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock { boolean dirty; private MIDataReadMemoryInfo mem; - private IAddress cStartAddress; //cashed start address + private BigInteger cStartAddress; //cashed start address private byte[] cBytes; //cashed bytes public MemoryBlock(Target target, String exp, MIDataReadMemoryInfo info) { @@ -61,7 +60,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock { * using this method */ public void setMIDataReadMemoryInfo(MIDataReadMemoryInfo m) { - cStartAddress = ((Target)getTarget()).getAddressFactory().createAddress(m.getAddress()); + cStartAddress = MIFormat.getBigInteger(m.getAddress()); cBytes = getBytes(m); mem = m; } @@ -76,7 +75,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock { /** * @return true if any address in the array is within the block. */ - public boolean contains(IAddress[] adds) { + public boolean contains(BigInteger[] adds) { for (int i = 0; i < adds.length; i++) { if (contains(adds[i])) { return true; @@ -88,8 +87,8 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock { /** * @return true if the address is within the block. */ - public boolean contains(IAddress addr) { - IAddress start = getStartAddress(); + public boolean contains(BigInteger addr) { + BigInteger start = getStartAddress(); long length = getLength(); if ( start.compareTo(addr) <= 0 && addr.compareTo(start.add(BigInteger.valueOf(length))) <= 0 ) @@ -144,7 +143,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock { Target target = (Target)getTarget(); MemoryManager mgr = (MemoryManager)target.getSession().getMemoryManager(); setDirty(true); - IAddress[] addresses = mgr.update(this, null); + BigInteger[] addresses = mgr.update(this, null); // Check if this affects other blocks. if (addresses.length > 0) { MemoryBlock[] blocks = mgr.getMemoryBlocks(target.getMISession()); @@ -168,7 +167,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock { /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getStartAddress() */ - public IAddress getStartAddress() { + public BigInteger getStartAddress() { return cStartAddress; } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java index 55e31e602ad..f7baf5ed449 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/SharedLibrary.java @@ -11,9 +11,11 @@ package org.eclipse.cdt.debug.mi.core.cdi.model; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.SharedLibraryManager; import org.eclipse.cdt.debug.mi.core.output.MIShared; @@ -48,15 +50,15 @@ public class SharedLibrary extends CObject implements ICDISharedLibrary { /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getStartAddress() */ - public IAddress getStartAddress() { - return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getFrom()); + public BigInteger getStartAddress() { + return MIFormat.getBigInteger(miShared.getFrom()); } /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress() */ - public IAddress getEndAddress() { - return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getTo()); + public BigInteger getEndAddress() { + return MIFormat.getBigInteger(miShared.getTo()); } /** diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java index bc5ec330cee..49ec6caa5cd 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/StackFrame.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi.model; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; @@ -20,6 +22,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject; import org.eclipse.cdt.debug.mi.core.MIException; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.cdi.CdiResources; import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; @@ -41,6 +44,7 @@ public class StackFrame extends CObject implements ICDIStackFrame { int level; ICDIArgument[] args; ICDIVariable[] locals; + Location fLocation; /* * @@ -130,12 +134,15 @@ public class StackFrame extends CObject implements ICDIStackFrame { */ public ICDILocation getLocation() { if (frame != null) { - return new Location(frame.getFile(), + if (fLocation == null) { + fLocation = new Location(frame.getFile(), frame.getFunction(), frame.getLine(), - ((Target)getTarget()).getAddressFactory().createAddress(frame.getAddress())); + MIFormat.getBigInteger(frame.getAddress())); + } + return fLocation; } - return new Location("", "", 0, ((Target)getTarget()).getAddressFactory().getZero()); //$NON-NLS-1$ //$NON-NLS-2$ + return new Location("", "", 0, BigInteger.ZERO); //$NON-NLS-1$ //$NON-NLS-2$ } /** diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java index 1ee8c70f3de..46a48bfcf50 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java @@ -10,11 +10,10 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.cdi.model; +import java.math.BigInteger; import java.util.ArrayList; import java.util.List; -import org.eclipse.cdt.core.IAddress; -import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDILocation; @@ -65,13 +64,11 @@ public class Target implements ICDITarget { Thread[] noThreads = new Thread[0]; Thread[] currentThreads; int currentThreadId; - IAddressFactory addressFactory; - public Target(Session s, MISession mi, IAddressFactory addrFactory) { + public Target(Session s, MISession mi) { session = s; miSession = mi; currentThreads = noThreads; - addressFactory = addrFactory; } public MISession getMISession() { @@ -468,7 +465,7 @@ public class Target implements ICDITarget { loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ } else if (location.getFunction() != null && location.getFunction().length() > 0) { loc = location.getFunction(); - } else if ( ! location.getAddress().isZero() ) { + } else if ( ! location.getAddress().equals(BigInteger.ZERO) ) { loc = "*" + location.getAddress().toString(); //$NON-NLS-1$ } MIExecUntil until = factory.createMIExecUntil(loc); @@ -579,7 +576,7 @@ public class Target implements ICDITarget { loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ } else if (location.getFunction() != null && location.getFunction().length() > 0) { loc = location.getFunction(); - } else if (! location.getAddress().isZero()) { + } else if (! location.getAddress().equals(BigInteger.ZERO)) { loc = "*" + location.getAddress().toString(); //$NON-NLS-1$ } MIJump jump = factory.createMIJump(loc); @@ -746,44 +743,8 @@ public class Target implements ICDITarget { /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLocation(long) */ - public ICDILocation createLocation(IAddress address) { + public ICDILocation createLocation(BigInteger address) { BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); return bMgr.createLocation(address); } -/* - private IAddressFactory createAddressFactory() throws CDIException - { - MISession mi = ((Session)getSession()).getMISession(); - CommandFactory cf = mi.getCommandFactory(); - MIGDBShowAddressSize as = cf.createMIGDBShowAddressSize(); - try - { - mi.postCommand(as ); - MIGDBShowAddressSizeInfo info = (MIGDBShowAddressSizeInfo)as.getMIInfo(); - if (info == null) - { - throw new CDIException("Target is not responding"); - } - switch ( info.getAddressSize() ) - { - case 32: - return new Addr32Factory(); - case 64: - return new Addr64Factory(); - default: - throw new CDIException("Undefined address size"); - } - } - catch (MIException e) - { - throw new MI2CDIException(e); - } - } -*/ - public IAddressFactory getAddressFactory() - { - return addressFactory; - } - - } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java index 3a3b2dd4035..49a103c0f71 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableObject.java @@ -161,8 +161,11 @@ public class VariableObject extends CObject implements ICDIVariableObject { public ICDIType getType() throws CDIException { if (type == null) { Target target = (Target)getTarget(); - ICDIStackFrame frame = getStackFrame(); Session session = (Session) (target.getSession()); + ICDIStackFrame frame = getStackFrame(); + if (frame == null) { + frame = target.getCurrentThread().getCurrentStackFrame(); + } SourceManager sourceMgr = (SourceManager) session.getSourceManager(); String nametype = sourceMgr.getTypeName(this, getQualifiedName()); try { diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java index 537707c1f3d..526eed1f17f 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/IntegralValue.java @@ -11,8 +11,11 @@ package org.eclipse.cdt.debug.mi.core.cdi.model.type; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIIntegralValue; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.cdi.model.Value; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; @@ -27,6 +30,24 @@ public abstract class IntegralValue extends Value implements ICDIIntegralValue { super(v); } + + + /* (non-Javadoc) + * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#biIntegerValue() + */ + public BigInteger bigIntegerValue() throws CDIException { + String valueString = getValueString(); + int space = valueString.indexOf(' '); + if (space != -1) { + valueString = valueString.substring(0, space).trim(); + } + try { + return MIFormat.getBigInteger(valueString); + } catch (NumberFormatException e) { + } + return BigInteger.ZERO; + } + /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.model.ICDIIntegralValue#longValue() */ @@ -38,7 +59,7 @@ public abstract class IntegralValue extends Value implements ICDIIntegralValue { valueString = valueString.substring(0, space).trim(); } try { - value = Long.decode(valueString).longValue(); + value = MIFormat.getBigInteger(valueString).longValue(); } catch (NumberFormatException e) { } return value; @@ -55,7 +76,7 @@ public abstract class IntegralValue extends Value implements ICDIIntegralValue { valueString = valueString.substring(0, space).trim(); } try { - value = Integer.decode(valueString).intValue(); + value = MIFormat.getBigInteger(valueString).intValue(); } catch (NumberFormatException e) { } return value; @@ -72,7 +93,7 @@ public abstract class IntegralValue extends Value implements ICDIIntegralValue { valueString = valueString.substring(0, space).trim(); } try { - value = Short.decode(valueString).shortValue(); + value = MIFormat.getBigInteger(valueString).shortValue(); } catch (NumberFormatException e) { } return value; @@ -89,7 +110,7 @@ public abstract class IntegralValue extends Value implements ICDIIntegralValue { valueString = valueString.substring(0, space).trim(); } try { - value = Byte.decode(valueString).byteValue(); + value = MIFormat.getBigInteger(valueString).byteValue(); } catch (NumberFormatException e) { } return value; diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java index a8b920067b6..77ac46fd205 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/PointerValue.java @@ -11,10 +11,11 @@ package org.eclipse.cdt.debug.mi.core.cdi.model.type; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; /** @@ -31,18 +32,15 @@ public class PointerValue extends DerivedValue implements ICDIPointerValue { /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue() */ - public IAddress pointerValue() throws CDIException { + public BigInteger pointerValue() throws CDIException { String valueString = getValueString().trim(); int space = valueString.indexOf(' '); if (space != -1) { valueString = valueString.substring(0, space).trim(); } - try{ - - return ((Target)getTarget()).getAddressFactory().createAddress(valueString); - } - catch(Exception e) - { + try { + return MIFormat.getBigInteger(valueString); + } catch(Exception e) { return null; } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java index 3a697af9d74..a2db7631f72 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/type/ReferenceValue.java @@ -11,10 +11,11 @@ package org.eclipse.cdt.debug.mi.core.cdi.model.type; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue; -import org.eclipse.cdt.debug.mi.core.cdi.model.Target; +import org.eclipse.cdt.debug.mi.core.MIFormat; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable; /** @@ -34,20 +35,19 @@ public class ReferenceValue extends DerivedValue implements ICDIReferenceValue { /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue() */ - public IAddress referenceValue() throws CDIException { + public BigInteger referenceValue() throws CDIException { String valueString = getValueString().trim(); - if ( valueString.startsWith("@") ) //$NON-NLS-1$ - valueString = valueString.substring( 1 ); + if (valueString.startsWith("@")) { //$NON-NLS-1$ + valueString = valueString.substring(1); + } int space = valueString.indexOf(":"); //$NON-NLS-1$ if (space != -1) { valueString = valueString.substring(0, space).trim(); } - try{ + try { - return ((Target)getTarget()).getAddressFactory().createAddress(valueString); - } - catch(Exception e) - { + return MIFormat.getBigInteger(valueString); + } catch(Exception e){ return null; } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java index d99684abb6f..225a73d323d 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/command/MIGDBShowAddressSize.java @@ -20,7 +20,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIOutput; public class MIGDBShowAddressSize extends MIGDBShow { public MIGDBShowAddressSize () { - super(new String[] { "remoteaddresssize" }); + super(new String[] { "remoteaddresssize" }); //$NON-NLS-1$ } public MIInfo getMIInfo() throws MIException { diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java index a4723471d85..c4ae917280e 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryChangedEvent.java @@ -10,9 +10,9 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.event; -import org.eclipse.cdt.debug.mi.core.MISession; +import java.math.BigInteger; -import org.eclipse.cdt.core.IAddress; +import org.eclipse.cdt.debug.mi.core.MISession; /** * This can not be detected yet by gdb/mi. @@ -20,18 +20,18 @@ import org.eclipse.cdt.core.IAddress; */ public class MIMemoryChangedEvent extends MIChangedEvent { - IAddress[] addresses; + BigInteger[] addresses; - public MIMemoryChangedEvent(MISession source, IAddress[] addrs) { + public MIMemoryChangedEvent(MISession source, BigInteger[] addrs) { this(source, 0, addrs); } - public MIMemoryChangedEvent(MISession source, int token, IAddress[] addrs) { + public MIMemoryChangedEvent(MISession source, int token, BigInteger[] addrs) { super(source, token); addresses = addrs; } - public IAddress[] getAddresses() { + public BigInteger[] getAddresses() { return addresses; } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java index ff44c84ff8a..d66b7bf9c14 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/event/MIMemoryCreatedEvent.java @@ -10,7 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core.event; -import org.eclipse.cdt.core.IAddress; +import java.math.BigInteger; + import org.eclipse.cdt.debug.mi.core.MISession; @@ -21,20 +22,20 @@ import org.eclipse.cdt.debug.mi.core.MISession; */ public class MIMemoryCreatedEvent extends MICreatedEvent { - IAddress address; + BigInteger address; long totalBytes; - public MIMemoryCreatedEvent(MISession source, IAddress addr, long total) { + public MIMemoryCreatedEvent(MISession source, BigInteger addr, long total) { this(source, 0, addr, total); } - public MIMemoryCreatedEvent(MISession source, int token, IAddress addr, long total) { + public MIMemoryCreatedEvent(MISession source, int token, BigInteger addr, long total) { super(source, token); address = addr; totalBytes = total; } - public IAddress getAddress() { + public BigInteger getAddress() { return address; } diff --git a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java index 82c6ed4f576..c0bfd4420e6 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java +++ b/debug/org.eclipse.cdt.debug.mi.core/mi/org/eclipse/cdt/debug/mi/core/output/MIInfoSharedLibraryInfo.java @@ -14,12 +14,7 @@ import java.util.ArrayList; import java.util.List; /** - * GDB/MI thread list parsing. -&"info shared\n" -~"From To Syms Read Shared Object Library\n" -~"0x40042fa0 0x4013ba9b Yes /lib/i686/libc.so.6\n" -~"0x40001db0 0x4001321c Yes /lib/ld-linux.so.2\n" - + * */ public class MIInfoSharedLibraryInfo extends MIInfo { @@ -80,8 +75,8 @@ public class MIInfoSharedLibraryInfo extends MIInfo { if (str.length() > 0) { // Pass the header int index = -1; - String from = ""; - String to = ""; + String from = ""; //$NON-NLS-1$ + String to = ""; //$NON-NLS-1$ boolean syms = false; String name = ""; //$NON-NLS-1$ @@ -117,8 +112,8 @@ public class MIInfoSharedLibraryInfo extends MIInfo { } void parseWinShared(String str, List aList) { - String from = ""; - String to = ""; + String from = ""; //$NON-NLS-1$ + String to = ""; //$NON-NLS-1$ boolean syms = true; int index = str.lastIndexOf(' '); diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java index 157c5795b36..fc941b1d44e 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java @@ -73,7 +73,7 @@ public class GDBDebugger implements ICDebugger { String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ File cwd = exe.getProject().getLocation().toFile(); String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), cwd, gdbinit); initializeLibraries(config, session); return session; } catch (IOException e) { @@ -105,7 +105,7 @@ public class GDBDebugger implements ICDebugger { String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ File cwd = exe.getProject().getLocation().toFile(); String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, pid, null, cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), pid, null, cwd, gdbinit); initializeLibraries(config, session); return session; } catch (IOException e) { @@ -137,7 +137,7 @@ public class GDBDebugger implements ICDebugger { String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ File cwd = exe.getProject().getLocation().toFile(); String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, corefile.toFile(), cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit); initializeLibraries(config, session); return session; } catch (IOException e) { diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java index 22a29501ca8..5a1decc0d6d 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBServerDebugger.java @@ -69,7 +69,7 @@ public class GDBServerDebugger implements ICDebugger { remote += ":"; //$NON-NLS-1$ remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$ String[] args = new String[] {"remote", remote}; //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, 0, args, cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), 0, args, cwd, gdbinit); } else { MIPlugin plugin = MIPlugin.getDefault(); Preferences prefs = plugin.getPluginPreferences(); @@ -77,7 +77,7 @@ public class GDBServerDebugger implements ICDebugger { String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$ String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$ - session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, -1, null, cwd, gdbinit); + session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), -1, null, cwd, gdbinit); ICDITarget[] targets = session.getTargets(); for (int i = 0; i < targets.length; ++i) { Target target = (Target)targets[i]; diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIFormat.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIFormat.java index 749efa97caa..6f07cbf19b9 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIFormat.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIFormat.java @@ -10,6 +10,8 @@ *******************************************************************************/ package org.eclipse.cdt.debug.mi.core; +import java.math.BigInteger; + /** * Help class to specify formats. */ @@ -31,4 +33,40 @@ public final class MIFormat { // no instanciation. private MIFormat() { } + + public static BigInteger getBigInteger(String address) { + int index = 0; + int radix = 10; + boolean negative = false; + + // Handle zero length + address = address.trim(); + if (address.length() == 0) { + return BigInteger.ZERO; + } + + // Handle minus sign, if present + if (address.startsWith("-")) { //$NON-NLS-1$ + negative = true; + index++; + } + if (address.startsWith("0x", index) || address.startsWith("0X", index)) { //$NON-NLS-1$ //$NON-NLS-2$ + index += 2; + radix = 16; + } else if (address.startsWith("#", index)) { //$NON-NLS-1$ + index ++; + radix = 16; + } else if (address.startsWith("0", index) && address.length() > 1 + index) { //$NON-NLS-1$ + index ++; + radix = 8; + } + + if (index > 0) { + address = address.substring(index); + } + if (negative) { + address = "-" + address; //$NON-NLS-1$ + } + return new BigInteger(address, radix); + } } diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java index 7614fa72da7..d5400d9b96e 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java @@ -21,10 +21,6 @@ import java.text.MessageFormat; import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.eclipse.cdt.core.CCorePlugin; -import org.eclipse.cdt.core.IAddressFactory; -import org.eclipse.cdt.core.model.IBinary; -import org.eclipse.cdt.core.model.ICElement; import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.command.CLICommand; @@ -34,8 +30,6 @@ import org.eclipse.cdt.debug.mi.core.command.MITargetSelect; import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.spawner.ProcessFactory; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IPluginDescriptor; import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Preferences; import org.osgi.framework.BundleContext; @@ -119,7 +113,7 @@ public class MIPlugin extends Plugin { * @return ICDISession * @throws MIException */ - public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit) throws IOException, MIException { + public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit) throws IOException, MIException { PTY pty = null; boolean failed = false; @@ -162,7 +156,7 @@ public class MIPlugin extends Plugin { * @return ICDISession * @throws IOException */ - public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit, PTY pty) throws IOException, MIException { + public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit, PTY pty) throws IOException, MIException { if (gdb == null || gdb.length() == 0) { gdb = GDB; } @@ -176,13 +170,13 @@ public class MIPlugin extends Plugin { if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } } else { if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1", program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1", program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } } @@ -212,7 +206,7 @@ public class MIPlugin extends Plugin { // If an exception is thrown that means ok // we did not attach to any target. } - return new Session(session, getAddressFactory(program), false); + return new Session(session, false); } /** @@ -222,7 +216,7 @@ public class MIPlugin extends Plugin { * @return ICDISession * @throws IOException */ - public ICDISession createCSession(String gdb, IFile program, File core, File cwd, String gdbinit) throws IOException, MIException { + public ICDISession createCSession(String gdb, File program, File core, File cwd, String gdbinit) throws IOException, MIException { if (gdb == null || gdb.length() == 0) { gdb = GDB; } @@ -235,7 +229,7 @@ public class MIPlugin extends Plugin { if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath(), program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath(), program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ } Process pgdb = getGDBProcess(args); MISession session; @@ -245,7 +239,7 @@ public class MIPlugin extends Plugin { pgdb.destroy(); throw e; } - return new Session(session, getAddressFactory(program)); + return new Session(session); } /** @@ -255,7 +249,7 @@ public class MIPlugin extends Plugin { * @return ICDISession * @throws IOException */ - public ICDISession createCSession(String gdb, IFile program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException { + public ICDISession createCSession(String gdb, File program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException { if (gdb == null || gdb.length() == 0) { gdb = GDB; } @@ -268,7 +262,7 @@ public class MIPlugin extends Plugin { if (program == null) { args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } else { - args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program.getLocation().toFile().getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ + args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ } Process pgdb = getGDBProcess(args); MISession session; @@ -304,7 +298,7 @@ public class MIPlugin extends Plugin { //@@@ We have to manually set the suspended state when we attach session.getMIInferior().setSuspended(); session.getMIInferior().update(); - return new Session(session, getAddressFactory(program), true); + return new Session(session, true); } /** @@ -429,16 +423,6 @@ public class MIPlugin extends Plugin { getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT); } - protected IAddressFactory getAddressFactory(IFile exe) - { - ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( exe ); - if ( cFile instanceof IBinary ) - { - return ((IBinary)cFile).getAddressFactory(); - } - return null; - } - /* (non-Javadoc) * @see org.eclipse.core.runtime.Plugin#shutdown() */