1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

2004-09-17 Alain Magloire

Support for 64 bits application
	PR 74056. Pathc from Artyom Kuanbekov
	To much files to enumerate.
This commit is contained in:
Alain Magloire 2004-09-17 19:01:32 +00:00
parent a6f4bef6ba
commit 70e192037c
78 changed files with 574 additions and 373 deletions

View file

@ -1,3 +1,8 @@
2004-09-17 Alain Magloire
Support for 64 bits application
PR 74056. Pathc from Artyom Kuanbekov
To much files to enumerate.
2004-09-15 Mikhail Khodjaiants 2004-09-15 Mikhail Khodjaiants
Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces. Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces.
* ICDebugTarget.java * ICDebugTarget.java

View file

@ -10,6 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.core.cdi; package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.core.IAddress;
/** /**
* *
@ -24,7 +26,7 @@ public interface ICDILocation {
* *
* @return the address of this location * @return the address of this location
*/ */
long getAddress(); IAddress getAddress();
/** /**
* Returns the source file of this location or <code>null</code> * Returns the source file of this location or <code>null</code>

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi; package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
/** /**
@ -41,7 +42,7 @@ public interface ICDIMemoryManager extends ICDIManager {
* @return a memory block with the specified identifier * @return a memory block with the specified identifier
* @throws CDIException on failure. Reasons include: * @throws CDIException on failure. Reasons include:
*/ */
ICDIMemoryBlock createMemoryBlock(long address, int length) ICDIMemoryBlock createMemoryBlock(IAddress address, int length)
throws CDIException; throws CDIException;
/** /**

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi; package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
@ -40,7 +41,7 @@ public interface ICDISourceManager extends ICDIManager {
* @param endAddress is the end address * @param endAddress is the end address
* @throws CDIException on failure. * @throws CDIException on failure.
*/ */
ICDIInstruction[] getInstructions(long startAddress, long endAddress) ICDIInstruction[] getInstructions(IAddress startAddress, IAddress endAddress)
throws CDIException; throws CDIException;
/** /**
@ -66,8 +67,8 @@ public interface ICDISourceManager extends ICDIManager {
* @throws CDIException on failure. * @throws CDIException on failure.
*/ */
ICDIMixedInstruction[] getMixedInstructions( ICDIMixedInstruction[] getMixedInstructions(
long startAddress, IAddress startAddress,
long endAddress) IAddress endAddress)
throws CDIException; throws CDIException;
/** /**

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi; package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint; import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint;
/** /**
@ -155,5 +156,5 @@ public interface ICDITraceManager extends ICDISessionObject {
* @param address - an address * @param address - an address
* @return an ICDILocation object * @return an ICDILocation object
*/ */
ICDILocation createLocation( long address ); ICDILocation createLocation( IAddress address );
} }

View file

@ -10,6 +10,8 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.event; package org.eclipse.cdt.debug.core.cdi.event;
import org.eclipse.cdt.core.IAddress;
/** /**
* *
* Notifies that the originator has changed. * Notifies that the originator has changed.
@ -19,5 +21,5 @@ public interface ICDIMemoryChangedEvent extends ICDIChangedEvent {
/** /**
* @return the modified addresses. * @return the modified addresses.
*/ */
Long[] getAddresses(); IAddress[] getAddresses();
} }

View file

@ -11,6 +11,8 @@
package org.eclipse.cdt.debug.core.cdi.model; package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
/** /**
* *
* Represents a machine instruction. * Represents a machine instruction.
@ -22,7 +24,7 @@ public interface ICDIInstruction extends ICDIObject {
* Returns the Address. * Returns the Address.
* @return the address. * @return the address.
*/ */
long getAdress(); IAddress getAdress();
/** /**
* @return the function name. * @return the function name.

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi.model; package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
/** /**
@ -26,7 +27,7 @@ public interface ICDIMemoryBlock extends ICDIObject {
* *
* @return the start address of this memory block * @return the start address of this memory block
*/ */
long getStartAddress(); IAddress getStartAddress();
/** /**
* Returns the length of this memory block in bytes. * Returns the length of this memory block in bytes.

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model; package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
/** /**
@ -32,14 +33,14 @@ public interface ICDISharedLibrary extends ICDIObject {
* *
* @return the start address of this library * @return the start address of this library
*/ */
long getStartAddress(); IAddress getStartAddress();
/** /**
* Returns the end address of this library. * Returns the end address of this library.
* *
* @return the end address of this library * @return the end address of this library
*/ */
long getEndAddress(); IAddress getEndAddress();
/** /**
* Returns whether the symbols of this library are read. * Returns whether the symbols of this library are read.

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi.model; package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -182,6 +183,6 @@ public interface ICDITarget extends ICDIThreadGroup, ICDISessionObject {
/** /**
* Returns a ICDILocation * Returns a ICDILocation
*/ */
ICDILocation createLocation(long address); ICDILocation createLocation(IAddress address);
} }

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi.model.type; package org.eclipse.cdt.debug.core.cdi.model.type;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -22,5 +23,5 @@ import org.eclipse.cdt.debug.core.cdi.CDIException;
*/ */
public interface ICDIPointerValue extends ICDIDerivedValue { public interface ICDIPointerValue extends ICDIDerivedValue {
long pointerValue() throws CDIException; IAddress pointerValue() throws CDIException;
} }

View file

@ -10,11 +10,12 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model.type; package org.eclipse.cdt.debug.core.cdi.model.type;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
/** /**
*/ */
public interface ICDIReferenceValue extends ICDIDerivedValue { public interface ICDIReferenceValue extends ICDIDerivedValue {
long referenceValue() throws CDIException; IAddress referenceValue() throws CDIException;
} }

View file

@ -12,6 +12,8 @@ package org.eclipse.cdt.debug.core;
import java.text.MessageFormat; import java.text.MessageFormat;
import java.util.HashMap; import java.util.HashMap;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -255,7 +257,7 @@ public class CDIDebugModel {
*/ */
public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle, public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle,
IResource resource, IResource resource,
long address, IAddress address,
boolean enabled, boolean enabled,
int ignoreCount, int ignoreCount,
String condition, String condition,
@ -266,7 +268,7 @@ public class CDIDebugModel {
attributes.put( IMarker.CHAR_END, new Integer( 0 ) ); attributes.put( IMarker.CHAR_END, new Integer( 0 ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) ); attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) ); attributes.put( IMarker.LINE_NUMBER, new Integer( -1 ) );
attributes.put( ICLineBreakpoint.ADDRESS, Long.toString( address ) ); attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) ); attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) ); attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
attributes.put( ICBreakpoint.CONDITION, condition ); attributes.put( ICBreakpoint.CONDITION, condition );

View file

@ -91,19 +91,6 @@ public class CDebugUtils
} }
} }
public static String toHexAddressString( long address )
{
String addressString = Long.toHexString( address );
StringBuffer sb = new StringBuffer( 10 );
sb.append( "0x" ); //$NON-NLS-1$
for ( int i = 0; i < 8 - addressString.length(); ++i )
{
sb.append( '0' );
}
sb.append( addressString );
return sb.toString();
}
public static char[] getByteText( byte b ) public static char[] getByteText( byte b )
{ {
return new char[]{ charFromByte( (byte)((b >>> 4) & 0x0f) ), return new char[]{ charFromByte( (byte)((b >>> 4) & 0x0f) ),
@ -201,18 +188,6 @@ public class CDebugUtils
return Long.parseLong( bytesToString( bytes, le, false ), 16 ); return Long.parseLong( bytesToString( bytes, le, false ), 16 );
} }
public static long toLongLong( char[] bytes, boolean le )
{
if ( bytes.length != 16 )
return 0;
return Long.parseLong( bytesToString( bytes, le, false ), 16 );
}
public static long toUnsignedLongLong( char[] bytes, boolean le )
{
return 0;
}
private static String bytesToString( char[] bytes, boolean le, boolean signed ) private static String bytesToString( char[] bytes, boolean le, boolean signed )
{ {
char[] copy = new char[bytes.length]; char[] copy = new char[bytes.length];

View file

@ -10,6 +10,8 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
/** /**
* An instruction of disassemby. * An instruction of disassemby.
*/ */
@ -20,7 +22,7 @@ public interface IAsmInstruction {
* *
* @return the address of this instruction * @return the address of this instruction
*/ */
long getAdress(); IAddress getAdress();
/** /**
* Returns the function name of this instruction, * Returns the function name of this instruction,

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
/** /**
@ -30,5 +31,5 @@ public interface IBreakpointTarget {
* @return the target address of the given breakpoint * @return the target address of the given breakpoint
* @throws DebugException if the address is not available * @throws DebugException if the address is not available
*/ */
long getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException; IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException;
} }

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IDebugElement;
@ -30,14 +31,14 @@ public interface ICSharedLibrary extends IDebugElement {
* *
* @return the start address of this library * @return the start address of this library
*/ */
long getStartAddress(); IAddress getStartAddress();
/** /**
* Returns the end address of this library. * Returns the end address of this library.
* *
* @return the end address of this library * @return the end address of this library
*/ */
long getEndAddress(); IAddress getEndAddress();
/** /**
* Returns whether the symbols of this library are read. * Returns whether the symbols of this library are read.

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IStackFrame; import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IValue; import org.eclipse.debug.core.model.IValue;
@ -24,7 +25,7 @@ public interface ICStackFrame extends IStackFrame, ICDebugElement {
* *
* @return the address of this stack frame * @return the address of this stack frame
*/ */
public long getAddress(); public IAddress getAddress();
/** /**
* Returns the source file of this stack frame or <code>null</code> * Returns the source file of this stack frame or <code>null</code>

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock; import org.eclipse.debug.core.model.IMemoryBlock;
@ -104,13 +105,15 @@ public interface IFormattedMemoryBlock extends IMemoryBlock
char getPaddingCharacter(); char getPaddingCharacter();
long nextRowAddress(); public IAddress getRealStartAddress();
long previousRowAddress(); IAddress nextRowAddress();
long nextPageAddress(); IAddress previousRowAddress();
long previousPageAddress(); IAddress nextPageAddress();
IAddress previousPageAddress();
void reformat( int format, void reformat( int format,
int wordSize, int wordSize,
@ -124,7 +127,7 @@ public interface IFormattedMemoryBlock extends IMemoryBlock
char paddingChar ) throws DebugException; char paddingChar ) throws DebugException;
void dispose(); void dispose();
Long[] getChangedAddresses(); IAddress[] getChangedAddresses();
boolean isFrozen(); boolean isFrozen();

View file

@ -11,6 +11,8 @@
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
/** /**
* *
* Represents a row in the output table of formatted memory block. * Represents a row in the output table of formatted memory block.
@ -24,7 +26,7 @@ public interface IFormattedMemoryBlockRow
* *
* @return the address of this row * @return the address of this row
*/ */
long getAddress(); IAddress getAddress();
/** /**
* Returns the array of memory words. * Returns the array of memory words.

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
/** /**
@ -22,12 +23,12 @@ public interface IJumpToAddress {
* *
* @return whether this operation is currently available * @return whether this operation is currently available
*/ */
public boolean canJumpToAddress( long address ); public boolean canJumpToAddress( IAddress address );
/** /**
* Causes this element to resume the execution at the specified address. * Causes this element to resume the execution at the specified address.
* *
* @exception DebugException on failure. Reasons include: * @exception DebugException on failure. Reasons include:
*/ */
public void jumpToAddress( long address ) throws DebugException; public void jumpToAddress( IAddress address ) throws DebugException;
} }

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
/** /**
@ -22,12 +23,12 @@ public interface IRunToAddress {
* *
* @return whether this operation is currently available * @return whether this operation is currently available
*/ */
public boolean canRunToAddress( long address ); public boolean canRunToAddress( IAddress address );
/** /**
* Causes this element to run to specified address. * Causes this element to run to specified address.
* *
* @exception DebugException on failure. Reasons include: * @exception DebugException on failure. Reasons include:
*/ */
public void runToAddress( long address, boolean skipBreakpoints ) throws DebugException; public void runToAddress( IAddress address, boolean skipBreakpoints ) throws DebugException;
} }

View file

@ -15,6 +15,8 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.CDebugUtils;
@ -256,7 +258,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
return getBreakpointMap().getCBreakpoint( cdiBreakpoint ); return getBreakpointMap().getCBreakpoint( cdiBreakpoint );
} }
public long getBreakpointAddress( ICBreakpoint breakpoint ) { public IAddress getBreakpointAddress( ICBreakpoint breakpoint ) {
if ( breakpoint != null ) { if ( breakpoint != null ) {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint ); ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) { if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) {
@ -269,7 +271,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
} }
} }
} }
return 0; return fDebugTarget.getAddressFactory().getZero();
} }
public void setBreakpoint( ICBreakpoint breakpoint ) throws DebugException { public void setBreakpoint( ICBreakpoint breakpoint ) throws DebugException {
@ -493,7 +495,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException { private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
ICDITarget cdiTarget = getCDITarget(); ICDITarget cdiTarget = getCDITarget();
ICDILocation location = cdiTarget.createLocation( Long.parseLong( breakpoint.getAddress() ) ); ICDILocation location = cdiTarget.createLocation( getDebugTarget().getAddressFactory().createAddress(breakpoint.getAddress()));
ICDIBreakpoint cdiBreakpoint = null; ICDIBreakpoint cdiBreakpoint = null;
synchronized ( getBreakpointMap() ) { synchronized ( getBreakpointMap() ) {
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true ); cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
@ -563,7 +565,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) { else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
breakpoint = createFunctionBreakpoint( cdiBreakpoint ); breakpoint = createFunctionBreakpoint( cdiBreakpoint );
} }
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) { else if ( ! cdiBreakpoint.getLocation().getAddress().isZero() ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint ); breakpoint = createAddressBreakpoint( cdiBreakpoint );
} }
} }
@ -571,7 +573,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) { else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
breakpoint = createFunctionBreakpoint( cdiBreakpoint ); breakpoint = createFunctionBreakpoint( cdiBreakpoint );
} }
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) { else if ( ! cdiBreakpoint.getLocation().getAddress().isZero()) {
breakpoint = createAddressBreakpoint( cdiBreakpoint ); breakpoint = createAddressBreakpoint( cdiBreakpoint );
} }
} }

View file

@ -10,13 +10,12 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints; package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.text.MessageFormat;
import java.util.Map; import java.util.Map;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.CDebugUtils;
import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.osgi.framework.msg.MessageFormat;
/** /**
* A breakpoint that suspend the execution when a particular address is reached. * A breakpoint that suspend the execution when a particular address is reached.
@ -58,8 +57,7 @@ public class CAddressBreakpoint extends AbstractLineBreakpoint implements ICAddr
sb.append( name ); sb.append( name );
} }
try { try {
long address = Long.parseLong( getAddress() ); sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { getAddress() } ) ); //$NON-NLS-1$
sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { CDebugUtils.toHexAddressString( address ) } ) ); //$NON-NLS-1$
} }
catch( NumberFormatException e ) { catch( NumberFormatException e ) {
} }

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.core.model.IAsmInstruction; import org.eclipse.cdt.debug.core.model.IAsmInstruction;
@ -30,7 +31,7 @@ public class AsmInstruction implements IAsmInstruction {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress() * @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress()
*/ */
public long getAdress() { public IAddress getAdress() {
return fCDIInstruction.getAdress(); return fCDIInstruction.getAdress();
} }

View file

@ -15,7 +15,10 @@ import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.CoreModel; import org.eclipse.cdt.core.model.CoreModel;
import org.eclipse.cdt.core.model.IBinary; import org.eclipse.cdt.core.model.IBinary;
@ -205,6 +208,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*/ */
private Preferences fPreferences = null; private Preferences fPreferences = null;
private IAddressFactory fAddressFactory;
/** /**
* Constructor for CDebugTarget. * Constructor for CDebugTarget.
*/ */
@ -754,7 +759,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
* @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long) * @see org.eclipse.debug.core.model.IMemoryBlockRetrieval#getMemoryBlock(long, long)
*/ */
public IMemoryBlock getMemoryBlock( long startAddress, long length ) throws DebugException { public IMemoryBlock getMemoryBlock( long startAddress, long length ) throws DebugException {
return null; //TODO:IPF_TODO look into implementation
throw new RuntimeException("Method getMemoryBlock should not be called from CDT");
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -1498,7 +1504,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long) * @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long)
*/ */
public boolean canRunToAddress( long address ) { public boolean canRunToAddress( IAddress address ) {
// for now // for now
return canResume(); return canResume();
} }
@ -1506,7 +1512,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToAddress(long, boolean) * @see org.eclipse.cdt.debug.core.model.IRunToAddress#runToAddress(long, boolean)
*/ */
public void runToAddress( long address, boolean skipBreakpoints ) throws DebugException { public void runToAddress( IAddress address, boolean skipBreakpoints ) throws DebugException {
if ( !canRunToAddress( address ) ) if ( !canRunToAddress( address ) )
return; return;
if ( skipBreakpoints ) { if ( skipBreakpoints ) {
@ -1602,7 +1608,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToAddress#canJumpToAddress(long) * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#canJumpToAddress(long)
*/ */
public boolean canJumpToAddress( long address ) { public boolean canJumpToAddress( IAddress address ) {
// check if supports jump to address // check if supports jump to address
return canResume(); return canResume();
} }
@ -1610,7 +1616,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IJumpToAddress#jumpToAddress(long) * @see org.eclipse.cdt.debug.core.model.IJumpToAddress#jumpToAddress(long)
*/ */
public void jumpToAddress( long address ) throws DebugException { public void jumpToAddress( IAddress address ) throws DebugException {
if ( !canJumpToAddress( address ) ) if ( !canJumpToAddress( address ) )
return; return;
ICDILocation location = getCDITarget().createLocation( address ); ICDILocation location = getCDITarget().createLocation( address );
@ -1760,8 +1766,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint) * @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint)
*/ */
public long getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException { public IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException {
return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : 0; return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -1838,4 +1844,21 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public boolean isPostMortem() { public boolean isPostMortem() {
return false; return false;
} }
public IAddressFactory getAddressFactory()
{
if ( fAddressFactory == null )
{
if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
{
ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( getExecFile() );
if ( cFile instanceof IBinary )
{
fAddressFactory = ((IBinary)cFile).getAddressFactory();
}
}
}
return fAddressFactory;
}
} }

View file

@ -10,9 +10,11 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -43,14 +45,14 @@ public class CFormattedMemoryBlock extends CDebugElement
{ {
class CFormattedMemoryBlockRow implements IFormattedMemoryBlockRow class CFormattedMemoryBlockRow implements IFormattedMemoryBlockRow
{ {
private long fAddress; private IAddress fAddress;
private String[] fData; private String[] fData;
private String fAscii; private String fAscii;
/** /**
* Constructor for CFormattedMemoryBlockRow. * Constructor for CFormattedMemoryBlockRow.
*/ */
public CFormattedMemoryBlockRow( long address, String[] data, String ascii ) public CFormattedMemoryBlockRow( IAddress address, String[] data, String ascii )
{ {
fAddress = address; fAddress = address;
fData = data; fData = data;
@ -60,7 +62,7 @@ public class CFormattedMemoryBlock extends CDebugElement
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow#getAddress() * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow#getAddress()
*/ */
public long getAddress() public IAddress getAddress()
{ {
return fAddress; return fAddress;
} }
@ -92,7 +94,7 @@ public class CFormattedMemoryBlock extends CDebugElement
private boolean fDisplayAscii = true; private boolean fDisplayAscii = true;
private char fPaddingChar = '.'; private char fPaddingChar = '.';
private List fRows = null; private List fRows = null;
private Long[] fChangedAddresses = new Long[0]; private IAddress[] fChangedAddresses = new IAddress[0];
private boolean fStartAddressChanged = false; private boolean fStartAddressChanged = false;
/** /**
@ -219,33 +221,33 @@ public class CFormattedMemoryBlock extends CDebugElement
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextRowAddress() * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextRowAddress()
*/ */
public long nextRowAddress() public IAddress nextRowAddress()
{ {
return 0; return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousRowAddress() * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousRowAddress()
*/ */
public long previousRowAddress() public IAddress previousRowAddress()
{ {
return 0; return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextPageAddress() * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextPageAddress()
*/ */
public long nextPageAddress() public IAddress nextPageAddress()
{ {
return 0; return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousPageAddress() * @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousPageAddress()
*/ */
public long previousPageAddress() public IAddress previousPageAddress()
{ {
return 0; return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)
@ -284,14 +286,19 @@ public class CFormattedMemoryBlock extends CDebugElement
* @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress() * @see org.eclipse.debug.core.model.IMemoryBlock#getStartAddress()
*/ */
public long getStartAddress() public long getStartAddress()
{
//IPF_TODO look into implementation
throw new RuntimeException("Method IMemoryBlock.getStartAddress shoud not be called in CDT debug");
}
public IAddress getRealStartAddress()
{ {
if ( fCDIMemoryBlock != null ) if ( fCDIMemoryBlock != null )
{ {
return fCDIMemoryBlock.getStartAddress(); return fCDIMemoryBlock.getStartAddress();
} }
return 0; return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getLength() * @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
*/ */
@ -510,19 +517,19 @@ public class CFormattedMemoryBlock extends CDebugElement
fireTerminateEvent(); fireTerminateEvent();
} }
public Long[] getChangedAddresses() public IAddress[] getChangedAddresses()
{ {
return fChangedAddresses; return fChangedAddresses;
} }
protected void setChangedAddresses( Long[] changedAddresses ) protected void setChangedAddresses( IAddress[] changedAddresses )
{ {
fChangedAddresses = changedAddresses; fChangedAddresses = changedAddresses;
} }
protected void resetChangedAddresses() protected void resetChangedAddresses()
{ {
fChangedAddresses = new Long[0]; fChangedAddresses = new IAddress[0];
} }
/** /**
@ -679,12 +686,13 @@ public class CFormattedMemoryBlock extends CDebugElement
return fStartAddressChanged; return fStartAddressChanged;
} }
private long getRowAddress( int offset ) private IAddress getRowAddress(int offset )
{ {
long result = getStartAddress() + offset; IAddress result = getRealStartAddress().add(BigInteger.valueOf(offset));
if ( result > 0xFFFFFFFFL ) IAddress max = ((CDebugTarget)getDebugTarget()).getAddressFactory().getMax();
if ( result.compareTo(max) > 0 )
{ {
result -= 0xFFFFFFFFL; result = result.add(result.getMaxOffset().negate());
} }
return result; return result;
} }

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; 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.ICDIEvent;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener;
@ -52,21 +53,21 @@ public class CSharedLibrary extends CDebugElement
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getStartAddress() * @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getStartAddress()
*/ */
public long getStartAddress() public IAddress getStartAddress()
{ {
if ( getCDISharedLibrary() != null ) if ( getCDISharedLibrary() != null )
return getCDISharedLibrary().getStartAddress(); return getCDISharedLibrary().getStartAddress();
return 0; return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getEndAddress() * @see org.eclipse.cdt.debug.core.model.ICSharedLibrary#getEndAddress()
*/ */
public long getEndAddress() public IAddress getEndAddress()
{ {
if ( getCDISharedLibrary() != null ) if ( getCDISharedLibrary() != null )
return getCDISharedLibrary().getEndAddress(); return getCDISharedLibrary().getEndAddress();
return 0; return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -16,6 +16,8 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent;
@ -529,7 +531,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress() * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getAddress()
*/ */
public long getAddress() { public IAddress getAddress() {
return getCDIStackFrame().getLocation().getAddress(); return getCDIStackFrame().getLocation().getAddress();
} }

View file

@ -16,6 +16,8 @@ import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue; 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.ICDIVariable;
@ -274,12 +276,20 @@ public class CValue extends AbstractCValue {
private String getLongValueString( ICDILongValue value ) throws CDIException { private String getLongValueString( ICDILongValue value ) throws CDIException {
CVariableFormat format = getParentVariable().getFormat(); CVariableFormat format = getParentVariable().getFormat();
if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.DECIMAL.equals( format ) ) { if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.DECIMAL.equals( format ) ) {
return (isUnsigned()) ? Long.toString( value.longValue() ) : Integer.toString( value.intValue() ); if ( isUnsigned() ) {
BigInteger bigValue = new BigInteger( value.getValueString() );
return bigValue.toString();
}
return Long.toString( value.longValue() );
} }
else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) { else if ( CVariableFormat.HEXADECIMAL.equals( format ) ) {
StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$
String stringValue = Long.toHexString( (isUnsigned()) ? value.longValue() : value.intValue() ); if ( isUnsigned() ) {
sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue ); BigInteger bigValue = new BigInteger( value.getValueString() );
sb.append( bigValue.toString( 16 ) );
}
else
sb.append( Long.toHexString( value.longValue() ) );
return sb.toString(); return sb.toString();
} }
return null; return null;
@ -351,33 +361,32 @@ public class CValue extends AbstractCValue {
return null; return null;
} }
private String getPointerValueString( ICDIPointerValue value ) throws CDIException { private String getPointerValueString( ICDIPointerValue value ) throws CDIException
long longValue = value.pointerValue(); {
//IPF_TODO Workaround to solve incoorect handling of structures referenced by pointers or references
IAddress address = value.pointerValue();
if(address == null) return "";
CVariableFormat format = getParentVariable().getFormat(); CVariableFormat format = getParentVariable().getFormat();
if ( CVariableFormat.DECIMAL.equals( format ) ) { if( CVariableFormat.NATURAL.equals( format ) ||
return Long.toString( longValue ); CVariableFormat.HEXADECIMAL.equals( format ) )
} return address.toHexAddressString();
else if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) { if( CVariableFormat.DECIMAL.equals( format ))
StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ return address.toString();
String stringValue = Long.toHexString( longValue );
sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue );
return sb.toString();
}
return null; return null;
} }
private String getReferenceValueString( ICDIReferenceValue value ) throws CDIException { private String getReferenceValueString( ICDIReferenceValue value ) throws CDIException
long longValue = value.referenceValue(); {
//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 "";
CVariableFormat format = getParentVariable().getFormat(); CVariableFormat format = getParentVariable().getFormat();
if ( CVariableFormat.DECIMAL.equals( format ) ) { if( CVariableFormat.NATURAL.equals( format ) ||
return Long.toString( longValue ); CVariableFormat.HEXADECIMAL.equals( format ) )
} return address.toHexAddressString();
else if ( CVariableFormat.NATURAL.equals( format ) || CVariableFormat.HEXADECIMAL.equals( format ) ) { if( CVariableFormat.DECIMAL.equals( format ))
StringBuffer sb = new StringBuffer( "0x" ); //$NON-NLS-1$ return address.toString();
String stringValue = Long.toHexString( longValue );
sb.append( (stringValue.length() > 8) ? stringValue.substring( stringValue.length() - 8 ) : stringValue );
return sb.toString();
}
return null; return null;
} }

View file

@ -10,8 +10,10 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.internal.core.model; package org.eclipse.cdt.debug.internal.core.model;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDebugCorePlugin; import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.ICDebugConstants; import org.eclipse.cdt.debug.core.ICDebugConstants;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -62,7 +64,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
String fileName = frame.getFile(); String fileName = frame.getFile();
int lineNumber = frame.getLineNumber(); int lineNumber = frame.getLineNumber();
ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0]; ICDIMixedInstruction[] mixedInstrs = new ICDIMixedInstruction[0];
long address = frame.getAddress(); IAddress address = frame.getAddress();
if ( fileName != null && fileName.length() > 0 ) { if ( fileName != null && fileName.length() > 0 ) {
try { try {
mixedInstrs = sm.getMixedInstructions( fileName, mixedInstrs = sm.getMixedInstructions( fileName,
@ -73,19 +75,17 @@ public class Disassembly extends CDebugElement implements IDisassembly {
targetRequestFailed( e.getMessage(), e ); targetRequestFailed( e.getMessage(), e );
} }
} }
if ( mixedInstrs.length == 0 ||
// Double check if debugger returns correct address range. // Double check if debugger returns correct address range.
if ( mixedInstrs.length == 0 ||
!containsAddress( mixedInstrs, address ) ) { !containsAddress( mixedInstrs, address ) ) {
if ( address >= 0 ) {
try { try {
ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( address, address + DISASSEMBLY_BLOCK_SIZE ) ); ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( address, address.add(BigInteger.valueOf(DISASSEMBLY_BLOCK_SIZE)) ) );
return DisassemblyBlock.create( this, instructions ); return DisassemblyBlock.create( this, instructions );
} }
catch( CDIException e ) { catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e ); targetRequestFailed( e.getMessage(), e );
} }
} }
}
else { else {
return DisassemblyBlock.create( this, mixedInstrs ); return DisassemblyBlock.create( this, mixedInstrs );
} }
@ -94,11 +94,11 @@ public class Disassembly extends CDebugElement implements IDisassembly {
return null; return null;
} }
private boolean containsAddress( ICDIMixedInstruction[] mi, long address ) { private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) {
for( int i = 0; i < mi.length; ++i ) { for( int i = 0; i < mi.length; ++i ) {
ICDIInstruction[] instructions = mi[i].getInstructions(); ICDIInstruction[] instructions = mi[i].getInstructions();
for ( int j = 0; j < instructions.length; ++j ) for ( int j = 0; j < instructions.length; ++j )
if ( instructions[j].getAdress() == address ) if ( address.equals(instructions[j].getAdress()))
return true; return true;
} }
return false; return false;

View file

@ -16,6 +16,7 @@ import java.io.FileReader;
import java.io.IOException; import java.io.IOException;
import java.io.LineNumberReader; import java.io.LineNumberReader;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIMixedInstruction;
import org.eclipse.cdt.debug.core.model.IAsmInstruction; import org.eclipse.cdt.debug.core.model.IAsmInstruction;
@ -39,9 +40,9 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
private IAsmSourceLine[] fSourceLines; private IAsmSourceLine[] fSourceLines;
private long fStartAddress = 0; private IAddress fStartAddress;
private long fEndAddress = 0; private IAddress fEndAddress;
private boolean fMixedMode = false; private boolean fMixedMode = false;
@ -100,8 +101,9 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
public boolean contains( ICStackFrame frame ) { public boolean contains( ICStackFrame frame ) {
if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) ) if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) )
return false; return false;
long address = frame.getAddress(); IAddress address = frame.getAddress();
return (address >= fStartAddress && address <= fEndAddress); return ( address.compareTo(fStartAddress) >= 0 &&
address.compareTo(fEndAddress) <= 0 );
} }
/* (non-Javadoc) /* (non-Javadoc)

View file

@ -1,3 +1,8 @@
2004-09-17 Alain Magloire
Support for 64 bits application
PR 74056. Pathc from Artyom Kuanbekov
To much files to enumerate.
2004-09-15 Alain Magloire 2004-09-15 Alain Magloire
Chang Type to take a VariableObject. Chang Type to take a VariableObject.

View file

@ -16,6 +16,7 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -649,7 +650,7 @@ public class BreakpointManager extends Manager {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(long) * @see org.eclipse.cdt.debug.core.cdi.ICDIBreakpointManager#createLocation(long)
*/ */
public ICDILocation createLocation(long address) { public ICDILocation createLocation(IAddress address) {
return new Location(address); return new Location(address);
} }

View file

@ -16,6 +16,7 @@ import java.util.List;
import java.util.Observable; import java.util.Observable;
import java.util.Observer; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager; import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
@ -119,7 +120,7 @@ public class EventManager extends SessionObject implements ICDIEventManager, Obs
MemoryManager mgr = (MemoryManager)session.getMemoryManager(); MemoryManager mgr = (MemoryManager)session.getMemoryManager();
MemoryBlock[] blocks = mgr.getMemoryBlocks(miEvent.getMISession()); MemoryBlock[] blocks = mgr.getMemoryBlocks(miEvent.getMISession());
MIMemoryChangedEvent miMem = (MIMemoryChangedEvent)miEvent; MIMemoryChangedEvent miMem = (MIMemoryChangedEvent)miEvent;
Long[] addresses = miMem.getAddresses(); IAddress[] addresses = miMem.getAddresses();
for (int i = 0; i < blocks.length; i++) { for (int i = 0; i < blocks.length; i++) {
if (blocks[i].contains(addresses) && if (blocks[i].contains(addresses) &&
(! blocks[i].isFrozen() || blocks[i].isDirty())) { (! blocks[i].isFrozen() || blocks[i].isDirty())) {

View file

@ -10,22 +10,23 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi; package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
/** /**
*/ */
public class Location implements ICDILocation { public class Location implements ICDILocation {
long addr; IAddress addr;
String file = ""; //$NON-NLS-1$ String file = ""; //$NON-NLS-1$
String function = ""; //$NON-NLS-1$ String function = ""; //$NON-NLS-1$
int line; int line;
public Location(String f, String fnct, int l) { public Location(String f, String fnct, int l) {
this(f, fnct, l, 0); this(f, fnct, l, null);
} }
public Location(String f, String fnct, int l, long a) { public Location(String f, String fnct, int l, IAddress a) {
if (f != null) if (f != null)
file = f; file = f;
if (fnct != null) if (fnct != null)
@ -34,14 +35,14 @@ public class Location implements ICDILocation {
addr = a; addr = a;
} }
public Location(long address) { public Location(IAddress address) {
addr = address; addr = address;
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress() * @see org.eclipse.cdt.debug.core.cdi.ICDILocation#getAddress()
*/ */
public long getAddress() { public IAddress getAddress() {
return addr; return addr;
} }
@ -86,9 +87,9 @@ public class Location implements ICDILocation {
} }
} }
} }
long oaddr = location.getAddress(); IAddress oaddr = location.getAddress();
if (addr != 0 && oaddr != 0) { if (addr != null && oaddr != null) { //IPF_TODO: check ZERO addresses
if (addr == oaddr) { if (addr.equals(oaddr)) {
return true; return true;
} }
} }

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi; package org.eclipse.cdt.debug.mi.core.cdi;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
@ -17,6 +18,7 @@ import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.Map; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager; import org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
@ -100,12 +102,12 @@ public class MemoryManager extends Manager implements ICDIMemoryManager {
/** /**
* update one Block. * update one Block.
*/ */
public Long[] update(MemoryBlock block, List aList) throws CDIException { public IAddress[] update(MemoryBlock block, List aList) throws CDIException {
Target target = (Target)block.getTarget(); Target target = (Target)block.getTarget();
MISession miSession = target.getMISession(); MISession miSession = target.getMISession();
MemoryBlock newBlock = cloneBlock(block); MemoryBlock newBlock = cloneBlock(block);
boolean newAddress = ( newBlock.getStartAddress() != block.getStartAddress() ); boolean newAddress = ! newBlock.getStartAddress().equals(block.getStartAddress());
Long[] array = compareBlocks(block, newBlock); IAddress[] array = compareBlocks(block, newBlock);
// Update the block MIDataReadMemoryInfo. // Update the block MIDataReadMemoryInfo.
block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo()); block.setMIDataReadMemoryInfo(newBlock.getMIDataReadMemoryInfo());
if (array.length > 0 || newAddress) { if (array.length > 0 || newAddress) {
@ -126,21 +128,23 @@ public class MemoryManager extends Manager implements ICDIMemoryManager {
* oldBlock.getLength() == newBlock.getLength(); * oldBlock.getLength() == newBlock.getLength();
* @return Long[] array of modified addresses. * @return Long[] array of modified addresses.
*/ */
Long[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException { IAddress[] compareBlocks (MemoryBlock oldBlock, MemoryBlock newBlock) throws CDIException {
byte[] oldBytes = oldBlock.getBytes(); byte[] oldBytes = oldBlock.getBytes();
byte[] newBytes = newBlock.getBytes(); byte[] newBytes = newBlock.getBytes();
List aList = new ArrayList(newBytes.length); List aList = new ArrayList(newBytes.length);
long diff = newBlock.getStartAddress() - oldBlock.getStartAddress(); BigInteger distance = newBlock.getStartAddress().distance(oldBlock.getStartAddress());
if ( Math.abs( diff ) < newBytes.length ) { //IPF_TODO enshure it is OK here
int diff = distance.intValue();
if ( Math.abs(diff) < newBytes.length) {
for (int i = 0; i < newBytes.length; i++) { for (int i = 0; i < newBytes.length; i++) {
if (i + (int)diff < oldBytes.length && i + (int)diff >= 0) { if (i + diff < oldBytes.length && i + diff >= 0) {
if (oldBytes[i + (int)diff] != newBytes[i]) { if (oldBytes[i + diff] != newBytes[i]) {
aList.add(new Long(newBlock.getStartAddress() + i)); aList.add(newBlock.getStartAddress().add(BigInteger.valueOf(i)));
} }
} }
} }
} }
return (Long[])aList.toArray(new Long[0]); return (IAddress[])aList.toArray(new IAddress[0]);
} }
/** /**
@ -176,10 +180,9 @@ public class MemoryManager extends Manager implements ICDIMemoryManager {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(long, int) * @see org.eclipse.cdt.debug.core.cdi.ICDIMemoryManager#createMemoryBlock(long, int)
*/ */
public ICDIMemoryBlock createMemoryBlock(long address, int length) public ICDIMemoryBlock createMemoryBlock(IAddress address, int length)
throws CDIException { throws CDIException {
String addr = "0x" + Long.toHexString(address); //$NON-NLS-1$ return createMemoryBlock(address.toHexAddressString(), length);
return createMemoryBlock(addr, length);
} }
/** /**

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
import java.util.Properties; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDIEventManager; import org.eclipse.cdt.debug.core.cdi.ICDIEventManager;
@ -54,19 +55,19 @@ public class Session implements ICDISession, ICDISessionObject {
SourceManager sourceManager; SourceManager sourceManager;
ICDIConfiguration configuration; ICDIConfiguration configuration;
public Session(MISession miSession, boolean attach) { public Session(MISession miSession, IAddressFactory addrFactory, boolean attach) {
commonSetup(); commonSetup();
setConfiguration(new Configuration(miSession, attach)); setConfiguration(new Configuration(miSession, attach));
Target target = new Target(this, miSession); Target target = new Target(this, miSession, addrFactory);
addTargets(new Target[] { target }, target); addTargets(new Target[] { target }, target);
} }
public Session(MISession miSession) { public Session(MISession miSession, IAddressFactory addrFactory) {
commonSetup(); commonSetup();
setConfiguration(new CoreFileConfiguration()); setConfiguration(new CoreFileConfiguration());
Target target = new Target(this, miSession); Target target = new Target(this, miSession, addrFactory);
addTargets(new Target[] { target }, target); addTargets(new Target[] { target }, target);
} }

View file

@ -17,6 +17,7 @@ import java.util.Hashtable;
import java.util.List; import java.util.List;
import java.util.Map; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration; import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager; import org.eclipse.cdt.debug.core.cdi.ICDISharedLibraryManager;
@ -145,9 +146,10 @@ public class SharedLibraryManager extends Manager implements ICDISharedLibraryMa
} }
public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) { public boolean hasSharedLibChanged(ICDISharedLibrary lib, MIShared miLib) {
IAddressFactory af = ((Target)getSession().getCurrentTarget()).getAddressFactory();
return !miLib.getName().equals(lib.getFileName()) || return !miLib.getName().equals(lib.getFileName()) ||
miLib.getFrom() != lib.getStartAddress() || !af.createAddress(miLib.getFrom()).equals(lib.getStartAddress()) ||
miLib.getTo() != lib.getEndAddress() || !af.createAddress(miLib.getTo()).equals(lib.getEndAddress()) ||
miLib.isRead() != lib.areSymbolsLoaded(); miLib.isRead() != lib.areSymbolsLoaded();
} }

View file

@ -12,6 +12,7 @@ package org.eclipse.cdt.debug.mi.core.cdi;
import java.util.StringTokenizer; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISourceManager; import org.eclipse.cdt.debug.core.cdi.ICDISourceManager;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
@ -145,16 +146,16 @@ public class SourceManager extends Manager implements ICDISourceManager {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long) * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getInstructions(long, long)
*/ */
public ICDIInstruction[] getInstructions(long start, long end) throws CDIException { public ICDIInstruction[] getInstructions(IAddress start, IAddress end) throws CDIException {
Target target = (Target)getSession().getCurrentTarget(); Target target = (Target)getSession().getCurrentTarget();
return getInstructions(target, start, end); return getInstructions(target, start, end);
} }
public ICDIInstruction[] getInstructions(Target target, long start, long end) throws CDIException { public ICDIInstruction[] getInstructions(Target target, IAddress start, IAddress end) throws CDIException {
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
String hex = "0x"; //$NON-NLS-1$ String hex = "0x"; //$NON-NLS-1$
String sa = hex + Long.toHexString(start); String sa = start.toHexAddressString();
String ea = hex + Long.toHexString(end); String ea = end.toHexAddressString();
MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, false); MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, false);
try { try {
mi.postCommand(dis); mi.postCommand(dis);
@ -205,16 +206,15 @@ public class SourceManager extends Manager implements ICDISourceManager {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long) * @see org.eclipse.cdt.debug.core.cdi.ICDISourceManager#getMixedInstructions(long, long)
*/ */
public ICDIMixedInstruction[] getMixedInstructions(long start, long end) throws CDIException { public ICDIMixedInstruction[] getMixedInstructions(IAddress start, IAddress end) throws CDIException {
Target target = (Target)getSession().getCurrentTarget(); Target target = (Target)getSession().getCurrentTarget();
return getMixedInstructions(target, start, end); return getMixedInstructions(target, start, end);
} }
public ICDIMixedInstruction[] getMixedInstructions(Target target, long start, long end) throws CDIException { public ICDIMixedInstruction[] getMixedInstructions(Target target, IAddress start, IAddress end) throws CDIException {
MISession mi = target.getMISession(); MISession mi = target.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
String hex = "0x"; //$NON-NLS-1$ String sa = start.toHexAddressString();
String sa = hex + Long.toHexString(start); String ea = end.toHexAddressString();
String ea = hex + Long.toHexString(end);
MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, true); MIDataDisassemble dis = factory.createMIDataDisassemble(sa, ea, true);
try { try {
mi.postCommand(dis); mi.postCommand(dis);

View file

@ -95,7 +95,7 @@ public class CreatedEvent implements ICDICreatedEvent {
MISession miSession = mblock.getMISession(); MISession miSession = mblock.getMISession();
ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession); ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession);
for (int i = 0; i < blocks.length; i++) { for (int i = 0; i < blocks.length; i++) {
if (blocks[i].getStartAddress() == mblock.getAddress() && if (blocks[i].getStartAddress().equals(mblock.getAddress()) &&
blocks[i].getLength() == mblock.getLength()) { blocks[i].getLength() == mblock.getLength()) {
source = blocks[i]; source = blocks[i];
break; break;

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.event;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.event.ICDIMemoryChangedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject; import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.Session;
@ -36,16 +37,16 @@ public class MemoryChangedEvent implements ICDIMemoryChangedEvent {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getAddresses() * @see org.eclipse.cdt.debug.core.cdi.event.ICDIEvent#getAddresses()
*/ */
public Long[] getAddresses() { public IAddress[] getAddresses() {
/* But only returns the address that are in the block. */ /* But only returns the address that are in the block. */
Long[] longs = miMem.getAddresses(); IAddress[] mi_addresses = miMem.getAddresses();
List aList = new ArrayList(longs.length); List aList = new ArrayList(mi_addresses.length);
for (int i = 0; i < longs.length; i++) { for (int i = 0; i < mi_addresses.length; i++) {
if (source.contains(longs[i])) { if (source.contains(mi_addresses[i])) {
aList.add(longs[i]); aList.add(mi_addresses[i]);
} }
} }
return (Long[])aList.toArray(new Long[0]); return (IAddress[])aList.toArray(new IAddress[0]);
} }
/** /**

View file

@ -153,7 +153,7 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
fLocation = new Location (miBreakpoint.getFile(), fLocation = new Location (miBreakpoint.getFile(),
miBreakpoint.getFunction(), miBreakpoint.getFunction(),
miBreakpoint.getLine(), miBreakpoint.getLine(),
miBreakpoint.getAddress()); ((Target)getTarget()).getAddressFactory().createAddress(miBreakpoint.getAddress()));
} }
} }
return fLocation; return fLocation;

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.core.cdi.model; package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction; import org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction;
import org.eclipse.cdt.debug.mi.core.output.MIAsm; import org.eclipse.cdt.debug.mi.core.output.MIAsm;
@ -26,8 +27,8 @@ public class Instruction extends CObject implements ICDIInstruction {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getAdress() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIInstruction#getAdress()
*/ */
public long getAdress() { public IAddress getAdress() {
return asm.getAddress(); return ((Target)getTarget()).getAddressFactory().createAddress(asm.getAddress());
} }
/** /**

View file

@ -11,9 +11,11 @@
package org.eclipse.cdt.debug.mi.core.cdi.model; package org.eclipse.cdt.debug.mi.core.cdi.model;
import java.math.BigInteger;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock; import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
@ -32,16 +34,19 @@ import org.eclipse.cdt.debug.mi.core.output.MIMemory;
*/ */
public class MemoryBlock extends CObject implements ICDIMemoryBlock { public class MemoryBlock extends CObject implements ICDIMemoryBlock {
MIDataReadMemoryInfo mem;
String expression; String expression;
boolean frozen; boolean frozen;
boolean dirty; boolean dirty;
private MIDataReadMemoryInfo mem;
private IAddress cStartAddress; //cashed start address
private byte[] cBytes; //cashed bytes
public MemoryBlock(Target target, String exp, MIDataReadMemoryInfo info) { public MemoryBlock(Target target, String exp, MIDataReadMemoryInfo info) {
super(target); super(target);
expression = exp; expression = exp;
mem = info;
frozen = true; frozen = true;
setMIDataReadMemoryInfo(info);
} }
/** /**
@ -52,9 +57,12 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
} }
/** /**
* Reset the internal MIDataReadMemoryInfo. * Reset the internal MIDataReadMemoryInfo. All modifications into mem info should be done
* using this method
*/ */
public void setMIDataReadMemoryInfo(MIDataReadMemoryInfo m) { public void setMIDataReadMemoryInfo(MIDataReadMemoryInfo m) {
cStartAddress = ((Target)getTarget()).getAddressFactory().createAddress(m.getAddress());
cBytes = getBytes(m);
mem = m; mem = m;
} }
@ -68,7 +76,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
/** /**
* @return true if any address in the array is within the block. * @return true if any address in the array is within the block.
*/ */
public boolean contains(Long[] adds) { public boolean contains(IAddress[] adds) {
for (int i = 0; i < adds.length; i++) { for (int i = 0; i < adds.length; i++) {
if (contains(adds[i])) { if (contains(adds[i])) {
return true; return true;
@ -80,10 +88,12 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
/** /**
* @return true if the address is within the block. * @return true if the address is within the block.
*/ */
public boolean contains(Long addr) { public boolean contains(IAddress addr) {
long start = getStartAddress(); IAddress start = getStartAddress();
long length = getLength(); long length = getLength();
if (start <= addr.longValue() && addr.longValue() <= start + length) { if ( start.compareTo(addr) <= 0 &&
addr.compareTo(start.add(BigInteger.valueOf(length))) <= 0 )
{
return true; return true;
} }
return false; return false;
@ -104,10 +114,10 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getBytes() *
*/ */
public byte[] getBytes() throws CDIException { private byte[] getBytes(MIDataReadMemoryInfo m) {
MIMemory[] miMem = mem.getMemories(); MIMemory[] miMem = m.getMemories();
List aList = new ArrayList(); List aList = new ArrayList();
for (int i = 0; i < miMem.length; i++) { for (int i = 0; i < miMem.length; i++) {
long[] data = miMem[i].getData(); long[] data = miMem[i].getData();
@ -123,6 +133,10 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
return bytes; return bytes;
} }
public byte[] getBytes() throws CDIException {
return cBytes;
}
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#refresh() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#refresh()
*/ */
@ -130,7 +144,7 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
Target target = (Target)getTarget(); Target target = (Target)getTarget();
MemoryManager mgr = (MemoryManager)target.getSession().getMemoryManager(); MemoryManager mgr = (MemoryManager)target.getSession().getMemoryManager();
setDirty(true); setDirty(true);
Long[] addresses = mgr.update(this, null); IAddress[] addresses = mgr.update(this, null);
// Check if this affects other blocks. // Check if this affects other blocks.
if (addresses.length > 0) { if (addresses.length > 0) {
MemoryBlock[] blocks = mgr.getMemoryBlocks(target.getMISession()); MemoryBlock[] blocks = mgr.getMemoryBlocks(target.getMISession());
@ -154,8 +168,8 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getStartAddress() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock#getStartAddress()
*/ */
public long getStartAddress() { public IAddress getStartAddress() {
return mem.getAddress(); return cStartAddress;
} }
/** /**

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.mi.core.cdi.model; package org.eclipse.cdt.debug.mi.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary; import org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary;
import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.Session;
@ -47,15 +48,15 @@ public class SharedLibrary extends CObject implements ICDISharedLibrary {
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getStartAddress() * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getStartAddress()
*/ */
public long getStartAddress() { public IAddress getStartAddress() {
return miShared.getFrom(); return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getFrom());
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress() * @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress()
*/ */
public long getEndAddress() { public IAddress getEndAddress() {
return miShared.getTo(); return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getTo());
} }
/** /**

View file

@ -130,10 +130,12 @@ public class StackFrame extends CObject implements ICDIStackFrame {
*/ */
public ICDILocation getLocation() { public ICDILocation getLocation() {
if (frame != null) { if (frame != null) {
return new Location(frame.getFile(), frame.getFunction(), return new Location(frame.getFile(),
frame.getLine(), frame.getAddress()); frame.getFunction(),
frame.getLine(),
((Target)getTarget()).getAddressFactory().createAddress(frame.getAddress()));
} }
return new Location("", "", 0, 0); //$NON-NLS-1$ //$NON-NLS-2$ return new Location("", "", 0, ((Target)getTarget()).getAddressFactory().getZero()); //$NON-NLS-1$ //$NON-NLS-2$
} }
/** /**

View file

@ -13,6 +13,8 @@ package org.eclipse.cdt.debug.mi.core.cdi.model;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; 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.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDICondition; import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -26,6 +28,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIWatchpoint;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager; import org.eclipse.cdt.debug.mi.core.cdi.BreakpointManager;
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException; import org.eclipse.cdt.debug.mi.core.cdi.MI2CDIException;
import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager; import org.eclipse.cdt.debug.mi.core.cdi.RegisterManager;
import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.Session;
@ -52,7 +55,6 @@ import org.eclipse.cdt.debug.mi.core.output.MIFrame;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfoThreadsInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfoThreadsInfo;
import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo; import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
import org.eclipse.cdt.debug.mi.core.cdi.CdiResources;
/** /**
*/ */
@ -63,11 +65,13 @@ public class Target implements ICDITarget {
Thread[] noThreads = new Thread[0]; Thread[] noThreads = new Thread[0];
Thread[] currentThreads; Thread[] currentThreads;
int currentThreadId; int currentThreadId;
IAddressFactory addressFactory;
public Target(Session s, MISession mi) { public Target(Session s, MISession mi, IAddressFactory addrFactory) {
session = s; session = s;
miSession = mi; miSession = mi;
currentThreads = noThreads; currentThreads = noThreads;
addressFactory = addrFactory;
} }
public MISession getMISession() { public MISession getMISession() {
@ -464,8 +468,8 @@ public class Target implements ICDITarget {
loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
} else if (location.getFunction() != null && location.getFunction().length() > 0) { } else if (location.getFunction() != null && location.getFunction().length() > 0) {
loc = location.getFunction(); loc = location.getFunction();
} else if (location.getAddress() != 0) { } else if ( ! location.getAddress().isZero() ) {
loc = "*" + location.getAddress(); //$NON-NLS-1$ loc = "*" + location.getAddress().toString(); //$NON-NLS-1$
} }
MIExecUntil until = factory.createMIExecUntil(loc); MIExecUntil until = factory.createMIExecUntil(loc);
try { try {
@ -575,8 +579,8 @@ public class Target implements ICDITarget {
loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$ loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
} else if (location.getFunction() != null && location.getFunction().length() > 0) { } else if (location.getFunction() != null && location.getFunction().length() > 0) {
loc = location.getFunction(); loc = location.getFunction();
} else if (location.getAddress() != 0) { } else if (! location.getAddress().isZero()) {
loc = "*" + location.getAddress(); //$NON-NLS-1$ loc = "*" + location.getAddress().toString(); //$NON-NLS-1$
} }
MIJump jump = factory.createMIJump(loc); MIJump jump = factory.createMIJump(loc);
try { try {
@ -742,10 +746,44 @@ public class Target implements ICDITarget {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLocation(long) * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#createLocation(long)
*/ */
public ICDILocation createLocation(long address) { public ICDILocation createLocation(IAddress address) {
BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager(); BreakpointManager bMgr = ((Session)getSession()).getBreakpointManager();
return bMgr.createLocation(address); 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;
}
} }

View file

@ -11,8 +11,10 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue; 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.cdi.model.Variable; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
/** /**
@ -29,17 +31,19 @@ public class PointerValue extends DerivedValue implements ICDIPointerValue {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue() * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
*/ */
public long pointerValue() throws CDIException { public IAddress pointerValue() throws CDIException {
long value = 0; String valueString = getValueString().trim();
String valueString = getValueString();
int space = valueString.indexOf(' '); int space = valueString.indexOf(' ');
if (space != -1) { if (space != -1) {
valueString = valueString.substring(0, space).trim(); valueString = valueString.substring(0, space).trim();
} }
try { try{
value = Long.decode(valueString).longValue();
} catch (NumberFormatException e) { return ((Target)getTarget()).getAddressFactory().createAddress(valueString);
}
catch(Exception e)
{
return null;
} }
return value;
} }
} }

View file

@ -11,8 +11,10 @@
package org.eclipse.cdt.debug.mi.core.cdi.model.type; package org.eclipse.cdt.debug.mi.core.cdi.model.type;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue; 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.cdi.model.Variable; import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
/** /**
@ -32,8 +34,7 @@ public class ReferenceValue extends DerivedValue implements ICDIReferenceValue {
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue() * @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue()
*/ */
public long referenceValue() throws CDIException { public IAddress referenceValue() throws CDIException {
long value = 0;
String valueString = getValueString().trim(); String valueString = getValueString().trim();
if ( valueString.startsWith("@") ) //$NON-NLS-1$ if ( valueString.startsWith("@") ) //$NON-NLS-1$
valueString = valueString.substring( 1 ); valueString = valueString.substring( 1 );
@ -41,10 +42,14 @@ public class ReferenceValue extends DerivedValue implements ICDIReferenceValue {
if (space != -1) { if (space != -1) {
valueString = valueString.substring(0, space).trim(); valueString = valueString.substring(0, space).trim();
} }
try { try{
value = Long.decode(valueString).longValue();
} catch (NumberFormatException e) { return ((Target)getTarget()).getAddressFactory().createAddress(valueString);
} }
return value; catch(Exception e)
{
return null;
}
} }
} }

View file

@ -222,6 +222,10 @@ public class CommandFactory {
return new MIGDBShowSolibSearchPath(); return new MIGDBShowSolibSearchPath();
} }
public MIGDBShowAddressSize createMIGDBShowAddressSize() {
return new MIGDBShowAddressSize();
}
public MIStackInfoDepth createMIStackInfoDepth() { public MIStackInfoDepth createMIStackInfoDepth() {
return new MIStackInfoDepth(); return new MIStackInfoDepth();
} }

View file

@ -0,0 +1,38 @@
/*
* Created on Jun 4, 2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowAddressSizeInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/**
* @author root
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public class MIGDBShowAddressSize extends MIGDBShow {
public MIGDBShowAddressSize () {
super(new String[] { "remoteaddresssize" });
}
public MIInfo getMIInfo() throws MIException {
MIGDBShowAddressSizeInfo info = null;
MIOutput out = getMIOutput();
if (out != null) {
info = new MIGDBShowAddressSizeInfo(out);
if (info.isError()) {
throwMIException(info, out);
}
}
return info;
}
}

View file

@ -12,7 +12,7 @@ package org.eclipse.cdt.debug.mi.core.event;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.core.IAddress;
/** /**
* This can not be detected yet by gdb/mi. * This can not be detected yet by gdb/mi.
@ -20,18 +20,18 @@ import org.eclipse.cdt.debug.mi.core.MISession;
*/ */
public class MIMemoryChangedEvent extends MIChangedEvent { public class MIMemoryChangedEvent extends MIChangedEvent {
Long[] addresses; IAddress[] addresses;
public MIMemoryChangedEvent(MISession source, Long[] addrs) { public MIMemoryChangedEvent(MISession source, IAddress[] addrs) {
this(source, 0, addrs); this(source, 0, addrs);
} }
public MIMemoryChangedEvent(MISession source, int token, Long[] addrs) { public MIMemoryChangedEvent(MISession source, int token, IAddress[] addrs) {
super(source, token); super(source, token);
addresses = addrs; addresses = addrs;
} }
public Long[] getAddresses() { public IAddress[] getAddresses() {
return addresses; return addresses;
} }
} }

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.mi.core.event; package org.eclipse.cdt.debug.mi.core.event;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
@ -20,20 +21,20 @@ import org.eclipse.cdt.debug.mi.core.MISession;
*/ */
public class MIMemoryCreatedEvent extends MICreatedEvent { public class MIMemoryCreatedEvent extends MICreatedEvent {
long address; IAddress address;
long totalBytes; long totalBytes;
public MIMemoryCreatedEvent(MISession source, long addr, long total) { public MIMemoryCreatedEvent(MISession source, IAddress addr, long total) {
this(source, 0, addr, total); this(source, 0, addr, total);
} }
public MIMemoryCreatedEvent(MISession source, int token, long addr, long total) { public MIMemoryCreatedEvent(MISession source, int token, IAddress addr, long total) {
super(source, token); super(source, token);
address = addr; address = addr;
totalBytes = total; totalBytes = total;
} }
public long getAddress() { public IAddress getAddress() {
return address; return address;
} }

View file

@ -14,7 +14,7 @@ package org.eclipse.cdt.debug.mi.core.output;
* Represent a GDB Tuple MI assembly response. * Represent a GDB Tuple MI assembly response.
*/ */
public class MIAsm { public class MIAsm {
long address; String address;
String function = ""; //$NON-NLS-1$ String function = ""; //$NON-NLS-1$
String opcode = ""; //$NON-NLS-1$ String opcode = ""; //$NON-NLS-1$
String args = ""; //$NON-NLS-1$ String args = ""; //$NON-NLS-1$
@ -24,7 +24,7 @@ public class MIAsm {
parse(tuple); parse(tuple);
} }
public long getAddress() { public String getAddress() {
return address; return address;
} }
@ -43,7 +43,7 @@ public class MIAsm {
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append('{'); buffer.append('{');
buffer.append("address=\"" + Long.toHexString(address) +"\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append("address=\"" + address +"\""); //$NON-NLS-1$//$NON-NLS-2$
buffer.append(",func-name=\"" + function + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",func-name=\"" + function + "\""); //$NON-NLS-1$//$NON-NLS-2$
buffer.append(",offset=\"").append(offset).append('"'); //$NON-NLS-1$ buffer.append(",offset=\"").append(offset).append('"'); //$NON-NLS-1$
buffer.append(",inst=\"" + getInstruction() + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",inst=\"" + getInstruction() + "\""); //$NON-NLS-1$//$NON-NLS-2$
@ -64,7 +64,7 @@ public class MIAsm {
if (var.equals("address")) { //$NON-NLS-1$ if (var.equals("address")) { //$NON-NLS-1$
try { try {
address = Long.decode(str.trim()).longValue(); address = str.trim();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
} else if (var.equals("func-name")) { //$NON-NLS-1$ } else if (var.equals("func-name")) { //$NON-NLS-1$

View file

@ -54,7 +54,7 @@ public class MIBreakpoint {
String type = ""; //$NON-NLS-1$ String type = ""; //$NON-NLS-1$
String disp = ""; //$NON-NLS-1$ String disp = ""; //$NON-NLS-1$
boolean enabled; boolean enabled;
long address; String address;
String func = ""; //$NON-NLS-1$ String func = ""; //$NON-NLS-1$
String file = ""; //$NON-NLS-1$ String file = ""; //$NON-NLS-1$
int line; int line;
@ -146,7 +146,7 @@ public class MIBreakpoint {
enabled = e; enabled = e;
} }
public long getAddress() { public String getAddress() {
return address; return address;
} }
@ -228,7 +228,7 @@ public class MIBreakpoint {
enabled = str.equals("y"); //$NON-NLS-1$ enabled = str.equals("y"); //$NON-NLS-1$
} else if (var.equals("addr")) { //$NON-NLS-1$ } else if (var.equals("addr")) { //$NON-NLS-1$
try { try {
address = Long.decode(str.trim()).longValue(); address = str.trim();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
} else if (var.equals("func")) { //$NON-NLS-1$ } else if (var.equals("func")) { //$NON-NLS-1$

View file

@ -18,7 +18,7 @@ package org.eclipse.cdt.debug.mi.core.output;
*/ */
public class MIDataReadMemoryInfo extends MIInfo { public class MIDataReadMemoryInfo extends MIInfo {
long addr; String addr;
long nextRow; long nextRow;
long prevRow; long prevRow;
long nextPage; long nextPage;
@ -33,7 +33,7 @@ public class MIDataReadMemoryInfo extends MIInfo {
parse(); parse();
} }
public long getAddress() { public String getAddress() {
return addr; return addr;
} }
@ -96,7 +96,7 @@ public class MIDataReadMemoryInfo extends MIInfo {
if (var.equals("addr")) { //$NON-NLS-1$ if (var.equals("addr")) { //$NON-NLS-1$
try { try {
addr = Long.decode(str.trim()).longValue(); addr = str.trim();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
} else if (var.equals("nr-bytes")) { //$NON-NLS-1$ } else if (var.equals("nr-bytes")) { //$NON-NLS-1$

View file

@ -16,7 +16,7 @@ package org.eclipse.cdt.debug.mi.core.output;
public class MIFrame { public class MIFrame {
int level; int level;
long addr; String addr;
String func = ""; //$NON-NLS-1$ String func = ""; //$NON-NLS-1$
String file = ""; //$NON-NLS-1$ String file = ""; //$NON-NLS-1$
int line; int line;
@ -42,7 +42,7 @@ public class MIFrame {
return line; return line;
} }
public long getAddress() { public String getAddress() {
return addr; return addr;
} }
@ -53,7 +53,7 @@ public class MIFrame {
public String toString() { public String toString() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("level=\"" + level + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append("level=\"" + level + "\""); //$NON-NLS-1$//$NON-NLS-2$
buffer.append(",addr=\"" + Long.toHexString(addr) + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",addr=\"" + addr + "\""); //$NON-NLS-1$//$NON-NLS-2$
buffer.append(",func=\"" + func + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",func=\"" + func + "\""); //$NON-NLS-1$//$NON-NLS-2$
buffer.append(",file=\"" + file + "\""); //$NON-NLS-1$//$NON-NLS-2$ buffer.append(",file=\"" + file + "\""); //$NON-NLS-1$//$NON-NLS-2$
buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$ buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$
@ -86,7 +86,7 @@ public class MIFrame {
} }
} else if (var.equals("addr")) { //$NON-NLS-1$ } else if (var.equals("addr")) { //$NON-NLS-1$
try { try {
addr = Long.decode(str.trim()).longValue(); addr = str.trim();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
} else if (var.equals("func")) { //$NON-NLS-1$ } else if (var.equals("func")) { //$NON-NLS-1$

View file

@ -0,0 +1,25 @@
/*
* Created on Jun 7, 2004
*
* To change the template for this generated file go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
package org.eclipse.cdt.debug.mi.core.output;
/**
* @author root
*
* To change the template for this generated type comment go to
* Window&gt;Preferences&gt;Java&gt;Code Generation&gt;Code and Comments
*/
public class MIGDBShowAddressSizeInfo extends MIGDBShowInfo {
public MIGDBShowAddressSizeInfo(MIOutput o) {
super(o);
}
public int getAddressSize()
{
return Integer.parseInt(getValue());
}
}

View file

@ -80,8 +80,8 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
if (str.length() > 0) { if (str.length() > 0) {
// Pass the header // Pass the header
int index = -1; int index = -1;
long from = 0; String from = "";
long to = 0; String to = "";
boolean syms = false; boolean syms = false;
String name = ""; //$NON-NLS-1$ String name = ""; //$NON-NLS-1$
@ -102,16 +102,10 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
} }
break; break;
case 2 : // second column is "To" case 2 : // second column is "To"
try { to = sub;
to = Long.decode(sub).longValue();
} catch (NumberFormatException e) {
}
break; break;
case 3 : // first column is "From" case 3 : // first column is "From"
try { from = sub;
from = Long.decode(sub).longValue();
} catch (NumberFormatException e) {
}
break; break;
} }
} }
@ -123,8 +117,8 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
} }
void parseWinShared(String str, List aList) { void parseWinShared(String str, List aList) {
long from = 0; String from = "";
long to = 0; String to = "";
boolean syms = true; boolean syms = true;
int index = str.lastIndexOf(' '); int index = str.lastIndexOf(' ');
@ -134,10 +128,7 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
if (!sub.startsWith("0x")) { //$NON-NLS-1$ if (!sub.startsWith("0x")) { //$NON-NLS-1$
sub = "0x" + sub; //$NON-NLS-1$ sub = "0x" + sub; //$NON-NLS-1$
} }
try { from = sub;
from = Long.decode(sub).longValue();
} catch (NumberFormatException e) {
}
str = str.substring(0, index).trim(); str = str.substring(0, index).trim();
} }
MIShared s = new MIShared(from, to, syms, str.trim()); MIShared s = new MIShared(from, to, syms, str.trim());

View file

@ -14,7 +14,7 @@ package org.eclipse.cdt.debug.mi.core.output;
* GDB/MI memory parsing. * GDB/MI memory parsing.
*/ */
public class MIMemory { public class MIMemory {
long addr; String addr;
long [] data = new long[0]; long [] data = new long[0];
String ascii = ""; //$NON-NLS-1$ String ascii = ""; //$NON-NLS-1$
@ -22,7 +22,7 @@ public class MIMemory {
parse(tuple); parse(tuple);
} }
public long getAddress() { public String getAddress() {
return addr; return addr;
} }
@ -36,7 +36,7 @@ public class MIMemory {
public String toSting() { public String toSting() {
StringBuffer buffer = new StringBuffer(); StringBuffer buffer = new StringBuffer();
buffer.append("addr=\"" + Long.toHexString(addr) + "\""); //$NON-NLS-1$ //$NON-NLS-2$ buffer.append("addr=\"" + addr + "\""); //$NON-NLS-1$ //$NON-NLS-2$
buffer.append("data=["); //$NON-NLS-1$ buffer.append("data=["); //$NON-NLS-1$
for (int i = 0 ; i < data.length; i++) { for (int i = 0 ; i < data.length; i++) {
if (i != 0) { if (i != 0) {
@ -63,7 +63,7 @@ public class MIMemory {
if (var.equals("addr")) { //$NON-NLS-1$ if (var.equals("addr")) { //$NON-NLS-1$
try { try {
addr = Long.decode(str.trim()).longValue(); addr = str.trim();
} catch (NumberFormatException e) { } catch (NumberFormatException e) {
} }
} else if (var.equals("data")) { //$NON-NLS-1$ } else if (var.equals("data")) { //$NON-NLS-1$

View file

@ -16,23 +16,23 @@ package org.eclipse.cdt.debug.mi.core.output;
*/ */
public class MIShared { public class MIShared {
long from; String from;
long to; String to;
boolean isread; boolean isread;
String name; String name;
public MIShared (long start, long end, boolean read, String location) { public MIShared (String start, String end, boolean read, String location) {
from = start; from = start;
to = end; to = end;
isread = read; isread = read;
name = location; name = location;
} }
public long getFrom() { public String getFrom() {
return from; return from;
} }
public long getTo() { public String getTo() {
return to; return to;
} }

View file

@ -73,7 +73,7 @@ public class GDBDebugger implements ICDebugger {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
File cwd = exe.getProject().getLocation().toFile(); File cwd = exe.getProject().getLocation().toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), cwd, gdbinit); session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, cwd, gdbinit);
initializeLibraries(config, session); initializeLibraries(config, session);
return session; return session;
} catch (IOException e) { } catch (IOException e) {
@ -105,7 +105,7 @@ public class GDBDebugger implements ICDebugger {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
File cwd = exe.getProject().getLocation().toFile(); File cwd = exe.getProject().getLocation().toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), pid, null, cwd, gdbinit); session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, pid, null, cwd, gdbinit);
initializeLibraries(config, session); initializeLibraries(config, session);
return session; return session;
} catch (IOException e) { } catch (IOException e) {
@ -137,7 +137,7 @@ public class GDBDebugger implements ICDebugger {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$ String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
File cwd = exe.getProject().getLocation().toFile(); File cwd = exe.getProject().getLocation().toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$ String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit); session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, corefile.toFile(), cwd, gdbinit);
initializeLibraries(config, session); initializeLibraries(config, session);
return session; return session;
} catch (IOException e) { } catch (IOException e) {

View file

@ -69,7 +69,7 @@ public class GDBServerDebugger implements ICDebugger {
remote += ":"; //$NON-NLS-1$ remote += ":"; //$NON-NLS-1$
remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$ remote += config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_PORT, "invalid"); //$NON-NLS-1$
String[] args = new String[] {"remote", remote}; //$NON-NLS-1$ String[] args = new String[] {"remote", remote}; //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), 0, args, cwd, gdbinit); session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, 0, args, cwd, gdbinit);
} else { } else {
MIPlugin plugin = MIPlugin.getDefault(); MIPlugin plugin = MIPlugin.getDefault();
Preferences prefs = plugin.getPluginPreferences(); 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 remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV, "invalid"); //$NON-NLS-1$
String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$ String remoteBaud = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_DEV_SPEED, "invalid"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), -1, null, cwd, gdbinit); session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, -1, null, cwd, gdbinit);
ICDITarget[] targets = session.getTargets(); ICDITarget[] targets = session.getTargets();
for (int i = 0; i < targets.length; ++i) { for (int i = 0; i < targets.length; ++i) {
Target target = (Target)targets[i]; Target target = (Target)targets[i];

View file

@ -21,6 +21,10 @@ import java.text.MessageFormat;
import java.util.MissingResourceException; import java.util.MissingResourceException;
import java.util.ResourceBundle; 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.core.cdi.ICDISession;
import org.eclipse.cdt.debug.mi.core.cdi.Session; import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.command.CLICommand; import org.eclipse.cdt.debug.mi.core.command.CLICommand;
@ -30,6 +34,8 @@ import org.eclipse.cdt.debug.mi.core.command.MITargetSelect;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.utils.pty.PTY; import org.eclipse.cdt.utils.pty.PTY;
import org.eclipse.cdt.utils.spawner.ProcessFactory; 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.Plugin;
import org.eclipse.core.runtime.Preferences; import org.eclipse.core.runtime.Preferences;
import org.osgi.framework.BundleContext; import org.osgi.framework.BundleContext;
@ -113,7 +119,7 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws MIException * @throws MIException
*/ */
public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit) throws IOException, MIException { public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit) throws IOException, MIException {
PTY pty = null; PTY pty = null;
boolean failed = false; boolean failed = false;
@ -156,7 +162,7 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws IOException * @throws IOException
*/ */
public ICDISession createCSession(String gdb, File program, File cwd, String gdbinit, PTY pty) throws IOException, MIException { public ICDISession createCSession(String gdb, IFile program, File cwd, String gdbinit, PTY pty) throws IOException, MIException {
if (gdb == null || gdb.length() == 0) { if (gdb == null || gdb.length() == 0) {
gdb = GDB; gdb = GDB;
} }
@ -170,13 +176,13 @@ public class MIPlugin extends Plugin {
if (program == null) { 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$ 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 { } else {
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$ 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$
} }
} else { } else {
if (program == null) { 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$ 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 { } else {
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$ 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$
} }
} }
@ -206,7 +212,7 @@ public class MIPlugin extends Plugin {
// If an exception is thrown that means ok // If an exception is thrown that means ok
// we did not attach to any target. // we did not attach to any target.
} }
return new Session(session, false); return new Session(session, getAddressFactory(program), false);
} }
/** /**
@ -216,7 +222,7 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws IOException * @throws IOException
*/ */
public ICDISession createCSession(String gdb, File program, File core, File cwd, String gdbinit) throws IOException, MIException { public ICDISession createCSession(String gdb, IFile program, File core, File cwd, String gdbinit) throws IOException, MIException {
if (gdb == null || gdb.length() == 0) { if (gdb == null || gdb.length() == 0) {
gdb = GDB; gdb = GDB;
} }
@ -229,7 +235,7 @@ public class MIPlugin extends Plugin {
if (program == null) { 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$ 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 { } else {
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$ 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$
} }
Process pgdb = getGDBProcess(args); Process pgdb = getGDBProcess(args);
MISession session; MISession session;
@ -239,7 +245,7 @@ public class MIPlugin extends Plugin {
pgdb.destroy(); pgdb.destroy();
throw e; throw e;
} }
return new Session(session); return new Session(session, getAddressFactory(program));
} }
/** /**
@ -249,7 +255,7 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws IOException * @throws IOException
*/ */
public ICDISession createCSession(String gdb, File program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException { public ICDISession createCSession(String gdb, IFile program, int pid, String[] targetParams, File cwd, String gdbinit) throws IOException, MIException {
if (gdb == null || gdb.length() == 0) { if (gdb == null || gdb.length() == 0) {
gdb = GDB; gdb = GDB;
} }
@ -262,7 +268,7 @@ public class MIPlugin extends Plugin {
if (program == null) { 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$ 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 { } else {
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$ 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$
} }
Process pgdb = getGDBProcess(args); Process pgdb = getGDBProcess(args);
MISession session; MISession session;
@ -298,7 +304,7 @@ public class MIPlugin extends Plugin {
//@@@ We have to manually set the suspended state when we attach //@@@ We have to manually set the suspended state when we attach
session.getMIInferior().setSuspended(); session.getMIInferior().setSuspended();
session.getMIInferior().update(); session.getMIInferior().update();
return new Session(session, true); return new Session(session, getAddressFactory(program), true);
} }
/** /**
@ -423,6 +429,16 @@ public class MIPlugin extends Plugin {
getPluginPreferences().setDefault(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT, IMIConstants.DEF_REQUEST_LAUNCH_TIMEOUT); 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) /* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#shutdown() * @see org.eclipse.core.runtime.Plugin#shutdown()
*/ */

View file

@ -1,3 +1,8 @@
2004-09-17 Alain Magloire
Support for 64 bits application
PR 74056. Pathc from Artyom Kuanbekov
To much files to enumerate.
2004-09-15 Mikhail Khodjaiants 2004-09-15 Mikhail Khodjaiants
Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces. Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces.
* CDebugUIPlugin.java * CDebugUIPlugin.java

View file

@ -703,9 +703,8 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
protected StringBuffer appendAddress( ICAddressBreakpoint breakpoint, StringBuffer label ) throws CoreException { protected StringBuffer appendAddress( ICAddressBreakpoint breakpoint, StringBuffer label ) throws CoreException {
try { try {
long address = Long.parseLong( breakpoint.getAddress() );
label.append( ' ' ); label.append( ' ' );
label.append( MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.27" ), new String[]{ CDebugUtils.toHexAddressString( address ) } ) ); //$NON-NLS-1$ label.append( MessageFormat.format( CDebugUIMessages.getString( "CDTDebugModelPresentation.27" ), new String[]{ breakpoint.getAddress() } ) ); //$NON-NLS-1$
} }
catch( NumberFormatException e ) { catch( NumberFormatException e ) {
} }

View file

@ -24,16 +24,7 @@ import org.eclipse.jface.text.Region;
*/ */
public class CDebugUIUtils public class CDebugUIUtils
{ {
static public String toHexAddressString( long address )
{
String tmp = Long.toHexString( address );
char[] prefix = new char[10 - tmp.length()];
prefix[0] = '0';
prefix[1] = 'x';
for ( int i = 2; i < prefix.length; ++i )
prefix[i] = '0';
return new String( prefix ) + tmp;
}
static public IRegion findWord( IDocument document, int offset ) static public IRegion findWord( IDocument document, int offset )
{ {

View file

@ -10,6 +10,7 @@
*******************************************************************************/ *******************************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions; package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.resources.FileStorage; import org.eclipse.cdt.core.resources.FileStorage;
import org.eclipse.cdt.debug.core.model.IJumpToAddress; import org.eclipse.cdt.debug.core.model.IJumpToAddress;
import org.eclipse.cdt.debug.core.model.IJumpToLine; import org.eclipse.cdt.debug.core.model.IJumpToLine;
@ -176,7 +177,7 @@ public class JumpToLineActionDelegate extends AbstractEditorActionDelegate
} }
} }
protected void jumpToAddress( long address ) protected void jumpToAddress( IAddress address )
{ {
IJumpToAddress target = (IJumpToAddress)getDebugTarget().getAdapter( IJumpToAddress.class ); IJumpToAddress target = (IJumpToAddress)getDebugTarget().getAdapter( IJumpToAddress.class );
if ( target != null ) if ( target != null )

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions; package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.IJumpToAddress; import org.eclipse.cdt.debug.core.model.IJumpToAddress;
import org.eclipse.cdt.debug.core.model.IJumpToLine; import org.eclipse.cdt.debug.core.model.IJumpToLine;
@ -247,7 +248,7 @@ public class ResumeAtLineActionDelegate implements IWorkbenchWindowActionDelegat
} }
ITextSelection textSelection = (ITextSelection)selection; ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1; int lineNumber = textSelection.getStartLine() + 1;
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
return jumpToAddress.canJumpToAddress( address ); return jumpToAddress.canJumpToAddress( address );
} }
return false; return false;
@ -287,7 +288,7 @@ public class ResumeAtLineActionDelegate implements IWorkbenchWindowActionDelegat
else { else {
ITextSelection textSelection = (ITextSelection)selection; ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1; int lineNumber = textSelection.getStartLine() + 1;
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
IJumpToAddress jumpToAddress = (IJumpToAddress)((IAdaptable)debugTarget).getAdapter( IJumpToAddress.class ); IJumpToAddress jumpToAddress = (IJumpToAddress)((IAdaptable)debugTarget).getAdapter( IJumpToAddress.class );
if ( jumpToAddress != null ) if ( jumpToAddress != null )
jumpToAddress.jumpToAddress( address ); jumpToAddress.jumpToAddress( address );

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions; package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.IRunToAddress; import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine; import org.eclipse.cdt.debug.core.model.IRunToLine;
@ -83,7 +84,7 @@ public class RunToLineAdapter implements IRunToLineTarget {
else { else {
ITextSelection textSelection = (ITextSelection)selection; ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1; int lineNumber = textSelection.getStartLine() + 1;
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
if ( target instanceof IAdaptable ) { if ( target instanceof IAdaptable ) {
IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class ); IRunToAddress runToAddress = (IRunToAddress)((IAdaptable)target).getAdapter( IRunToAddress.class );
if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) { if ( runToAddress != null && runToAddress.canRunToAddress( address ) ) {

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.internal.ui.actions; package org.eclipse.cdt.debug.internal.ui.actions;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.model.CModelException; import org.eclipse.cdt.core.model.CModelException;
import org.eclipse.cdt.core.model.IDeclaration; import org.eclipse.cdt.core.model.IDeclaration;
import org.eclipse.cdt.core.model.IFunction; import org.eclipse.cdt.core.model.IFunction;
@ -110,8 +111,8 @@ public class ToggleBreakpointAdapter implements IToggleBreakpointsTarget {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
} }
else { else {
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber ); IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
if ( address == 0 ) { if ( address == null ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$ errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
} }
else { else {

View file

@ -13,7 +13,7 @@ package org.eclipse.cdt.debug.internal.ui.propertypages;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint; import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint; import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint; import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
@ -293,13 +293,6 @@ public class CBreakpointPropertyPage extends FieldEditorPreferencePage implement
ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint; ICAddressBreakpoint abrkpt = (ICAddressBreakpoint)breakpoint;
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), PropertyPageMessages.getString( "CBreakpointPropertyPage.6" ) ) ); //$NON-NLS-1$//$NON-NLS-2$ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.18" ), PropertyPageMessages.getString( "CBreakpointPropertyPage.6" ) ) ); //$NON-NLS-1$//$NON-NLS-2$
String address = PropertyPageMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$ String address = PropertyPageMessages.getString( "CBreakpointPropertyPage.4" ); //$NON-NLS-1$
try {
address = CDebugUtils.toHexAddressString( Long.parseLong( abrkpt.getAddress() ) );
}
catch( CoreException e ) {
}
catch( NumberFormatException e ) {
}
if ( address != null ) { if ( address != null ) {
addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$ addField( createLabelEditor( getFieldEditorParent(), PropertyPageMessages.getString( "CBreakpointPropertyPage.5" ), address ) ); //$NON-NLS-1$
} }

View file

@ -11,6 +11,8 @@
package org.eclipse.cdt.debug.internal.ui.views.disassembly; package org.eclipse.cdt.debug.internal.ui.views.disassembly;
import java.util.Arrays; import java.util.Arrays;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.model.IAsmInstruction; import org.eclipse.cdt.debug.core.model.IAsmInstruction;
import org.eclipse.cdt.debug.core.model.IAsmSourceLine; import org.eclipse.cdt.debug.core.model.IAsmSourceLine;
@ -20,7 +22,6 @@ import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.IDisassembly; import org.eclipse.cdt.debug.core.model.IDisassembly;
import org.eclipse.cdt.debug.core.model.IDisassemblyBlock; import org.eclipse.cdt.debug.core.model.IDisassemblyBlock;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.DebugPlugin;
@ -67,7 +68,7 @@ public class DisassemblyEditorInput implements IEditorInput {
* @param disassembly * @param disassembly
* @param instructions * @param instructions
*/ */
private DisassemblyEditorInput( IDisassemblyBlock block ) { private DisassemblyEditorInput( IDisassemblyBlock block) {
fBlock = block; fBlock = block;
createContents(); createContents();
} }
@ -125,7 +126,7 @@ public class DisassemblyEditorInput implements IEditorInput {
return fContents; return fContents;
} }
public int getInstructionLine( long address ) { public int getInstructionLine( IAddress address ) {
if ( fBlock != null ) { if ( fBlock != null ) {
IAsmSourceLine[] lines = fBlock.getSourceLines(); IAsmSourceLine[] lines = fBlock.getSourceLines();
int result = 0; int result = 0;
@ -134,13 +135,13 @@ public class DisassemblyEditorInput implements IEditorInput {
++result; ++result;
for ( int j = 0; j < instructions.length; ++j ) { for ( int j = 0; j < instructions.length; ++j ) {
++result; ++result;
if ( instructions[j].getAdress() == address ) { if ( address.compareTo(instructions[j].getAdress()) == 0) {
return result; return result;
} }
} }
} }
} }
return 0; return -1;
} }
public int getInstructionLine( ICLineBreakpoint breakpoint ) { public int getInstructionLine( ICLineBreakpoint breakpoint ) {
@ -150,8 +151,8 @@ public class DisassemblyEditorInput implements IEditorInput {
IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class ); IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class );
if ( bt != null ) { if ( bt != null ) {
try { try {
long address = bt.getBreakpointAddress( breakpoint ); IAddress address = bt.getBreakpointAddress( breakpoint );
if ( address != 0 ) if ( ! address.isZero() )
return getInstructionLine( address ); return getInstructionLine( address );
} }
catch( DebugException e ) { catch( DebugException e ) {
@ -159,10 +160,10 @@ public class DisassemblyEditorInput implements IEditorInput {
} }
} }
} }
return 0; return -1;
} }
public long getAddress( int lineNumber ) { public IAddress getAddress( int lineNumber ) {
if ( fBlock != null ) { if ( fBlock != null ) {
IAsmSourceLine[] lines = fBlock.getSourceLines(); IAsmSourceLine[] lines = fBlock.getSourceLines();
int current = 0; int current = 0;
@ -176,7 +177,7 @@ public class DisassemblyEditorInput implements IEditorInput {
current += instructions.length; current += instructions.length;
} }
} }
return 0; return null;
} }
public String getModuleFile() { public String getModuleFile() {
@ -185,10 +186,11 @@ public class DisassemblyEditorInput implements IEditorInput {
public static DisassemblyEditorInput create( ICStackFrame frame ) throws DebugException { public static DisassemblyEditorInput create( ICStackFrame frame ) throws DebugException {
DisassemblyEditorInput input = null; DisassemblyEditorInput input = null;
IDisassembly disassembly = ((ICDebugTarget)frame.getDebugTarget()).getDisassembly(); ICDebugTarget target = ((ICDebugTarget)frame.getDebugTarget());
IDisassembly disassembly = target.getDisassembly();
if ( disassembly != null ) { if ( disassembly != null ) {
IDisassemblyBlock block = disassembly.getDisassemblyBlock( frame ); IDisassemblyBlock block = disassembly.getDisassemblyBlock( frame );
input = new DisassemblyEditorInput( block ); input = new DisassemblyEditorInput( block);
} }
return input; return input;
} }
@ -216,7 +218,8 @@ public class DisassemblyEditorInput implements IEditorInput {
} }
} }
} }
int instrPos = calculateInstructionPosition( maxFunctionName, maxOffset ); int instrPos = calculateInstructionPosition( maxFunctionName, maxOffset,
fBlock.getSourceLines()[0].getInstructions()[0].getAdress().getCharsNum());
int argPosition = instrPos + maxOpcodeLength + 1; int argPosition = instrPos + maxOpcodeLength + 1;
if ( fBlock.isMixedMode() ) if ( fBlock.isMixedMode() )
fSourceRegions = new IRegion[mi.length]; fSourceRegions = new IRegion[mi.length];
@ -241,7 +244,7 @@ public class DisassemblyEditorInput implements IEditorInput {
Arrays.fill( spaces, ' ' ); Arrays.fill( spaces, ' ' );
StringBuffer sb = new StringBuffer(); StringBuffer sb = new StringBuffer();
if ( instruction != null ) { if ( instruction != null ) {
sb.append( CDebugUIUtils.toHexAddressString( instruction.getAdress() ) ); sb.append( instruction.getAdress().toHexAddressString() );
sb.append( ' ' ); sb.append( ' ' );
String functionName = instruction.getFunctionName(); String functionName = instruction.getFunctionName();
if ( functionName != null && functionName.length() > 0 ) { if ( functionName != null && functionName.length() > 0 ) {
@ -262,8 +265,9 @@ public class DisassemblyEditorInput implements IEditorInput {
return sb.toString(); return sb.toString();
} }
private int calculateInstructionPosition( int maxFunctionName, long maxOffset ) { private int calculateInstructionPosition( int maxFunctionName, long maxOffset, int addressLength ) {
return (16 + maxFunctionName + Long.toString( maxOffset ).length()); //(Address prefix address representation in chars) + (space) + (<) + (+) + (>) + (:) + (space)
return ( addressLength + 6 + maxFunctionName + Long.toString( maxOffset ).length() );
} }
private String getSourceLineString( IAsmSourceLine line ) { private String getSourceLineString( IAsmSourceLine line ) {
@ -282,8 +286,8 @@ public class DisassemblyEditorInput implements IEditorInput {
return ( fBlock != null ) ? fBlock.getDisassembly() : null; return ( fBlock != null ) ? fBlock.getDisassembly() : null;
} }
public ICLineBreakpoint breakpointExists( long address ) throws CoreException { public ICLineBreakpoint breakpointExists( IAddress address ) throws CoreException {
Assert.isTrue( address != 0 ); Assert.isTrue( address != null );
IDisassembly dis = getDisassembly(); IDisassembly dis = getDisassembly();
if ( dis != null ) { if ( dis != null ) {
IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class ); IBreakpointTarget bt = (IBreakpointTarget)dis.getDebugTarget().getAdapter( IBreakpointTarget.class );
@ -294,7 +298,7 @@ public class DisassemblyEditorInput implements IEditorInput {
if ( bps[i] instanceof ICLineBreakpoint ) { if ( bps[i] instanceof ICLineBreakpoint ) {
ICLineBreakpoint b = (ICLineBreakpoint)bps[i]; ICLineBreakpoint b = (ICLineBreakpoint)bps[i];
try { try {
if ( address == bt.getBreakpointAddress( b ) ) if ( address.compareTo(bt.getBreakpointAddress( b )) == 0)
return b; return b;
} }
catch( NumberFormatException e ) { catch( NumberFormatException e ) {

View file

@ -10,6 +10,7 @@
***********************************************************************/ ***********************************************************************/
package org.eclipse.cdt.debug.internal.ui.views.disassembly; package org.eclipse.cdt.debug.internal.ui.views.disassembly;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICStackFrame; import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.IDisassembly; import org.eclipse.cdt.debug.core.model.IDisassembly;
@ -63,8 +64,8 @@ public class DisassemblyInstructionPointerAnnotation extends Annotation {
IDisassembly disassembly = getDisassembly( frame ); IDisassembly disassembly = getDisassembly( frame );
hashCode = 37*hashCode + (( disassembly != null ) ? disassembly.hashCode() : 0); hashCode = 37*hashCode + (( disassembly != null ) ? disassembly.hashCode() : 0);
if ( frame != null ) { if ( frame != null ) {
long address = frame.getAddress(); IAddress address = frame.getAddress();
hashCode = 37*hashCode + (int)(address^(address>>>32)); hashCode = 37*hashCode + address.hashCode();
} }
return hashCode; return hashCode;
} }

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.internal.ui.views.memory;
import org.eclipse.cdt.debug.core.CDebugModel; import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.ICMemoryManager; import org.eclipse.cdt.debug.core.ICMemoryManager;
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock; import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants; import org.eclipse.cdt.debug.internal.ui.preferences.ICDebugPreferenceConstants;
import org.eclipse.cdt.debug.ui.CDebugUIPlugin; import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
@ -430,7 +429,7 @@ public class MemoryControlArea extends Composite implements ITextOperationTarget
} }
} }
if ( getMemoryBlock() != null ) { if ( getMemoryBlock() != null ) {
fAddressText.setText( CDebugUIUtils.toHexAddressString( getMemoryBlock().getStartAddress() ) ); fAddressText.setText( getMemoryBlock().getRealStartAddress().toHexAddressString() );
handleAddressEnter(); handleAddressEnter();
} }
} }

View file

@ -11,15 +11,16 @@
package org.eclipse.cdt.debug.internal.ui.views.memory; package org.eclipse.cdt.debug.internal.ui.views.memory;
import java.math.BigInteger;
import java.util.Arrays; import java.util.Arrays;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.ICMemoryManager; import org.eclipse.cdt.debug.core.ICMemoryManager;
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock; import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlock;
import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlockRow; import org.eclipse.cdt.debug.core.model.IFormattedMemoryBlockRow;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Display;
@ -77,7 +78,7 @@ public class MemoryPresentation
{ {
int offset = sb.length(); int offset = sb.length();
sb.append( getRowText( rows[i] ) ); sb.append( getRowText( rows[i] ) );
fAddressZones.add( new Point( offset, offset + getAddressLength() ) ); fAddressZones.add( new Point( offset, offset + rows[i].getAddress().getCharsNum() ) );
} }
return sb.toString(); return sb.toString();
} }
@ -104,7 +105,7 @@ public class MemoryPresentation
public Point[] getChangedZones() public Point[] getChangedZones()
{ {
fChangedZones.clear(); fChangedZones.clear();
Long[] changedAddresses = getChangedAddresses(); IAddress[] changedAddresses = getChangedAddresses();
for ( int i = 0; i < changedAddresses.length; ++i ) for ( int i = 0; i < changedAddresses.length; ++i )
{ {
int dataOffset = getDataItemOffsetByAddress( changedAddresses[i] ); int dataOffset = getDataItemOffsetByAddress( changedAddresses[i] );
@ -126,7 +127,7 @@ public class MemoryPresentation
public String getStartAddress() public String getStartAddress()
{ {
return ( fBlock != null ) ? getAddressString( fBlock.getStartAddress() ) : ""; //$NON-NLS-1$ return ( fBlock != null ) ? fBlock.getRealStartAddress().toHexAddressString() : ""; //$NON-NLS-1$
} }
public String getAddressExpression() public String getAddressExpression()
@ -141,15 +142,10 @@ public class MemoryPresentation
return new String( chars ); return new String( chars );
} }
private String getAddressString( long address )
{
return CDebugUIUtils.toHexAddressString( address );
}
private String getRowText( IFormattedMemoryBlockRow row ) private String getRowText( IFormattedMemoryBlockRow row )
{ {
StringBuffer result = new StringBuffer( getRowLength() ); StringBuffer result = new StringBuffer( getRowLength( ) );
result.append( getAddressString( row.getAddress() ) ); result.append( row.getAddress().toHexAddressString() );
result.append( getInterval( INTERVAL_BETWEEN_ADDRESS_AND_DATA ) ); result.append( getInterval( INTERVAL_BETWEEN_ADDRESS_AND_DATA ) );
String[] items = row.getData(); String[] items = row.getData();
for ( int i = 0; i < items.length; ++i ) for ( int i = 0; i < items.length; ++i )
@ -175,9 +171,9 @@ public class MemoryPresentation
getDataBytesPerRow() : 0 ) + 1; getDataBytesPerRow() : 0 ) + 1;
} }
private int getAddressLength()
{ private int getAddressLength() {
return 10; return fBlock.getRealStartAddress().getCharsNum();
} }
private boolean isInAsciiArea( int offset ) private boolean isInAsciiArea( int offset )
@ -293,12 +289,12 @@ public class MemoryPresentation
return IFormattedMemoryBlock.MEMORY_FORMAT_HEX; return IFormattedMemoryBlock.MEMORY_FORMAT_HEX;
} }
private Long[] getChangedAddresses() private IAddress[] getChangedAddresses()
{ {
return ( getMemoryBlock() != null ) ? getMemoryBlock().getChangedAddresses() : new Long[0]; return ( getMemoryBlock() != null ) ? getMemoryBlock().getChangedAddresses() : new IAddress[0];
} }
private int getDataItemOffsetByAddress( Long address ) private int getDataItemOffsetByAddress( IAddress address )
{ {
if ( getMemoryBlock() != null ) if ( getMemoryBlock() != null )
{ {
@ -307,15 +303,16 @@ public class MemoryPresentation
{ {
int wordSize = getMemoryBlock().getWordSize(); int wordSize = getMemoryBlock().getWordSize();
int numberOfColumns = getMemoryBlock().getNumberOfColumns(); int numberOfColumns = getMemoryBlock().getNumberOfColumns();
if ( address.longValue() >= rows[i].getAddress() &&
address.longValue() < rows[i].getAddress() + (wordSize * numberOfColumns) ) if( address.compareTo( rows[i].getAddress()) >=0 &&
address.compareTo( rows[i].getAddress().add(BigInteger.valueOf(wordSize * numberOfColumns))) <0)
{ {
for ( int j = 1; j <= numberOfColumns; ++j ) for ( int j = 1; j <= numberOfColumns; ++j )
{ {
if ( address.longValue() >= rows[i].getAddress() + ((j - 1) * wordSize) && if( address.compareTo( rows[i].getAddress().add(BigInteger.valueOf( (j - 1) * wordSize))) >=0 &&
address.longValue() < rows[i].getAddress() + (j * wordSize) ) address.compareTo( rows[i].getAddress().add(BigInteger.valueOf( j * wordSize))) <0)
{ {
return (i * getRowLength()) + ((j - 1) * (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS)) + getAddressLength() + INTERVAL_BETWEEN_ADDRESS_AND_DATA; return (i * getRowLength()) + ((j - 1) * (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS)) + address.getCharsNum() + INTERVAL_BETWEEN_ADDRESS_AND_DATA;
} }
} }
} }
@ -325,7 +322,7 @@ public class MemoryPresentation
return -1; return -1;
} }
private int getAsciiOffsetByAddress( Long address ) private int getAsciiOffsetByAddress( IAddress address )
{ {
if ( getMemoryBlock() != null ) if ( getMemoryBlock() != null )
{ {
@ -334,14 +331,16 @@ public class MemoryPresentation
{ {
IFormattedMemoryBlockRow firstRow = rows[0]; IFormattedMemoryBlockRow firstRow = rows[0];
IFormattedMemoryBlockRow lastRow = rows[rows.length - 1]; IFormattedMemoryBlockRow lastRow = rows[rows.length - 1];
if ( address.longValue() >= firstRow.getAddress() && address.longValue() <= lastRow.getAddress() )
if (address.compareTo( firstRow.getAddress()) >=0 && address.compareTo( lastRow.getAddress()) <=0)
{ {
int asciiOffset = (int)(address.longValue() - firstRow.getAddress()); BigInteger asciiOffset = address.distance( firstRow.getAddress());
int asciiRowlength = getMemoryBlock().getWordSize() * getMemoryBlock().getNumberOfColumns(); int asciiRowlength = getMemoryBlock().getWordSize() * getMemoryBlock().getNumberOfColumns();
int numberOfRows = asciiOffset / asciiRowlength; int numberOfRows = asciiOffset.intValue() / asciiRowlength;
int offsetInRow = asciiOffset % asciiRowlength; int offsetInRow = asciiOffset.intValue() % asciiRowlength;
return (numberOfRows * getRowLength()) + return (numberOfRows * getRowLength()) +
getAddressLength() + INTERVAL_BETWEEN_ADDRESS_AND_DATA + address.getCharsNum() + INTERVAL_BETWEEN_ADDRESS_AND_DATA +
(getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) * getMemoryBlock().getNumberOfColumns() + (getDataItemLength() + INTERVAL_BETWEEN_DATA_ITEMS) * getMemoryBlock().getNumberOfColumns() +
INTERVAL_BETWEEN_DATA_AND_ASCII + offsetInRow; INTERVAL_BETWEEN_DATA_AND_ASCII + offsetInRow;
} }
@ -513,13 +512,13 @@ public class MemoryPresentation
{ {
if ( getMemoryBlock() != null ) if ( getMemoryBlock() != null )
{ {
int index = getDataItemIndex( offset ); int index = getDataItemIndex(offset );
if ( index != -1 ) if ( index != -1 )
{ {
char[] chars = getDataItemChars( index ); char[] chars = getDataItemChars( index );
if ( isInDataArea( offset ) ) if ( isInDataArea( offset ) )
{ {
int charIndex = getOffsetInDataItem( offset, index ); int charIndex = getOffsetInDataItem(offset, index );
chars[charIndex] = newChar; chars[charIndex] = newChar;
} }
if ( isInAsciiArea( offset ) ) if ( isInAsciiArea( offset ) )
@ -539,7 +538,7 @@ public class MemoryPresentation
int index = getDataItemIndex( offset ); int index = getDataItemIndex( offset );
if ( index != -1 ) if ( index != -1 )
{ {
String newValue = getNewItemValue( offset, ch ); String newValue = getNewItemValue(offset, ch );
if ( newValue != null ) if ( newValue != null )
{ {
try try

View file

@ -13,7 +13,6 @@ package org.eclipse.cdt.debug.internal.ui.views.sharedlibs;
import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICSharedLibrary; import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation; import org.eclipse.cdt.debug.internal.ui.CDebugModelPresentation;
import org.eclipse.cdt.debug.internal.ui.CDebugUIUtils;
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds; import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
import org.eclipse.cdt.debug.internal.ui.PixelConverter; import org.eclipse.cdt.debug.internal.ui.PixelConverter;
import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler; import org.eclipse.cdt.debug.internal.ui.views.AbstractDebugEventHandler;
@ -83,11 +82,9 @@ public class SharedLibrariesView extends AbstractDebugEventHandlerView
case 2: case 2:
return ( library.areSymbolsLoaded() ) ? SharedLibrariesMessages.getString( "SharedLibrariesView.Loaded_1" ) : SharedLibrariesMessages.getString( "SharedLibrariesView.Not_loaded_1" ); //$NON-NLS-1$ //$NON-NLS-2$ return ( library.areSymbolsLoaded() ) ? SharedLibrariesMessages.getString( "SharedLibrariesView.Loaded_1" ) : SharedLibrariesMessages.getString( "SharedLibrariesView.Not_loaded_1" ); //$NON-NLS-1$ //$NON-NLS-2$
case 3: case 3:
return ( library.getStartAddress() > 0 ) ? return library.getStartAddress().toHexAddressString(); //$NON-NLS-1$
CDebugUIUtils.toHexAddressString( library.getStartAddress() ) : ""; //$NON-NLS-1$
case 4: case 4:
return ( library.getEndAddress() > 0 ) ? return library.getEndAddress().toHexAddressString(); //$NON-NLS-1$
CDebugUIUtils.toHexAddressString( library.getEndAddress() ) : ""; //$NON-NLS-1$
} }
} }
return null; return null;