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
Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces.
* ICDebugTarget.java

View file

@ -10,6 +10,8 @@
*******************************************************************************/
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
*/
long getAddress();
IAddress getAddress();
/**
* Returns the source file of this location or <code>null</code>

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.core.IAddress;
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
* @throws CDIException on failure. Reasons include:
*/
ICDIMemoryBlock createMemoryBlock(long address, int length)
ICDIMemoryBlock createMemoryBlock(IAddress address, int length)
throws CDIException;
/**

View file

@ -11,6 +11,7 @@
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.ICDIMixedInstruction;
@ -40,7 +41,7 @@ public interface ICDISourceManager extends ICDIManager {
* @param endAddress is the end address
* @throws CDIException on failure.
*/
ICDIInstruction[] getInstructions(long startAddress, long endAddress)
ICDIInstruction[] getInstructions(IAddress startAddress, IAddress endAddress)
throws CDIException;
/**
@ -66,8 +67,8 @@ public interface ICDISourceManager extends ICDIManager {
* @throws CDIException on failure.
*/
ICDIMixedInstruction[] getMixedInstructions(
long startAddress,
long endAddress)
IAddress startAddress,
IAddress endAddress)
throws CDIException;
/**

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.model.ICDITracepoint;
/**
@ -155,5 +156,5 @@ public interface ICDITraceManager extends ICDISessionObject {
* @param address - an address
* @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;
import org.eclipse.cdt.core.IAddress;
/**
*
* Notifies that the originator has changed.
@ -19,5 +21,5 @@ public interface ICDIMemoryChangedEvent extends ICDIChangedEvent {
/**
* @return the modified addresses.
*/
Long[] getAddresses();
IAddress[] getAddresses();
}

View file

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

View file

@ -11,6 +11,7 @@
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
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
*/
long getStartAddress();
IAddress getStartAddress();
/**
* Returns the length of this memory block in bytes.

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException;
/**
@ -32,14 +33,14 @@ public interface ICDISharedLibrary extends ICDIObject {
*
* @return the start address of this library
*/
long getStartAddress();
IAddress getStartAddress();
/**
* Returns 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.

View file

@ -11,6 +11,7 @@
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.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -182,6 +183,6 @@ public interface ICDITarget extends ICDIThreadGroup, ICDISessionObject {
/**
* 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;
import org.eclipse.cdt.core.IAddress;
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 {
long pointerValue() throws CDIException;
IAddress pointerValue() throws CDIException;
}

View file

@ -10,11 +10,12 @@
*******************************************************************************/
package org.eclipse.cdt.debug.core.cdi.model.type;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException;
/**
*/
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.util.HashMap;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -255,7 +257,7 @@ public class CDIDebugModel {
*/
public static ICAddressBreakpoint createAddressBreakpoint( String sourceHandle,
IResource resource,
long address,
IAddress address,
boolean enabled,
int ignoreCount,
String condition,
@ -266,7 +268,7 @@ public class CDIDebugModel {
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( ICLineBreakpoint.ADDRESS, Long.toString( address ) );
attributes.put( ICLineBreakpoint.ADDRESS, address.toHexAddressString() );
attributes.put( IBreakpoint.ENABLED, new Boolean( enabled ) );
attributes.put( ICBreakpoint.IGNORE_COUNT, new Integer( ignoreCount ) );
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 )
{
return new char[]{ charFromByte( (byte)((b >>> 4) & 0x0f) ),
@ -201,18 +188,6 @@ public class CDebugUtils
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 )
{
char[] copy = new char[bytes.length];

View file

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

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException;
/**
@ -30,5 +31,5 @@ public interface IBreakpointTarget {
* @return the target address of the given breakpoint
* @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;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement;
@ -30,14 +31,14 @@ public interface ICSharedLibrary extends IDebugElement {
*
* @return the start address of this library
*/
long getStartAddress();
IAddress getStartAddress();
/**
* Returns 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.

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IValue;
@ -24,7 +25,7 @@ public interface ICStackFrame extends IStackFrame, ICDebugElement {
*
* @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>

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IMemoryBlock;
@ -104,13 +105,15 @@ public interface IFormattedMemoryBlock extends IMemoryBlock
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,
int wordSize,
@ -124,7 +127,7 @@ public interface IFormattedMemoryBlock extends IMemoryBlock
char paddingChar ) throws DebugException;
void dispose();
Long[] getChangedAddresses();
IAddress[] getChangedAddresses();
boolean isFrozen();

View file

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

View file

@ -10,6 +10,7 @@
***********************************************************************/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException;
/**
@ -22,12 +23,12 @@ public interface IJumpToAddress {
*
* @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.
*
* @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;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.debug.core.DebugException;
/**
@ -22,12 +23,12 @@ public interface IRunToAddress {
*
* @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.
*
* @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.Map;
import java.util.Set;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDIDebugModel;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
@ -256,7 +258,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
return getBreakpointMap().getCBreakpoint( cdiBreakpoint );
}
public long getBreakpointAddress( ICBreakpoint breakpoint ) {
public IAddress getBreakpointAddress( ICBreakpoint breakpoint ) {
if ( breakpoint != null ) {
ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint );
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 {
@ -493,7 +495,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
ICDITarget cdiTarget = getCDITarget();
ICDILocation location = cdiTarget.createLocation( Long.parseLong( breakpoint.getAddress() ) );
ICDILocation location = cdiTarget.createLocation( getDebugTarget().getAddressFactory().createAddress(breakpoint.getAddress()));
ICDIBreakpoint cdiBreakpoint = null;
synchronized ( getBreakpointMap() ) {
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() ) ) {
breakpoint = createFunctionBreakpoint( cdiBreakpoint );
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
else if ( ! cdiBreakpoint.getLocation().getAddress().isZero() ) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}
@ -571,7 +573,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) {
breakpoint = createFunctionBreakpoint( cdiBreakpoint );
}
else if ( cdiBreakpoint.getLocation().getAddress() > 0 ) {
else if ( ! cdiBreakpoint.getLocation().getAddress().isZero()) {
breakpoint = createAddressBreakpoint( cdiBreakpoint );
}
}

View file

@ -10,13 +10,12 @@
***********************************************************************/
package org.eclipse.cdt.debug.internal.core.breakpoints;
import java.text.MessageFormat;
import java.util.Map;
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.runtime.CoreException;
import org.eclipse.osgi.framework.msg.MessageFormat;
/**
* 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 );
}
try {
long address = Long.parseLong( getAddress() );
sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { CDebugUtils.toHexAddressString( address ) } ) ); //$NON-NLS-1$
sb.append( MessageFormat.format( BreakpointMessages.getString( "CAddressBreakpoint.2" ), new String[] { getAddress() } ) ); //$NON-NLS-1$
}
catch( NumberFormatException e ) {
}

View file

@ -10,6 +10,7 @@
***********************************************************************/
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.model.IAsmInstruction;
@ -30,7 +31,7 @@ public class AsmInstruction implements IAsmInstruction {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress()
*/
public long getAdress() {
public IAddress getAdress() {
return fCDIInstruction.getAdress();
}

View file

@ -15,7 +15,10 @@ import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.StringTokenizer;
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.CoreModel;
import org.eclipse.cdt.core.model.IBinary;
@ -205,6 +208,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
*/
private Preferences fPreferences = null;
private IAddressFactory fAddressFactory;
/**
* 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)
*/
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)
@ -1498,7 +1504,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long)
*/
public boolean canRunToAddress( long address ) {
public boolean canRunToAddress( IAddress address ) {
// for now
return canResume();
}
@ -1506,7 +1512,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @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 ) )
return;
if ( skipBreakpoints ) {
@ -1602,7 +1608,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @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
return canResume();
}
@ -1610,7 +1616,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @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 ) )
return;
ICDILocation location = getCDITarget().createLocation( address );
@ -1760,8 +1766,8 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.IBreakpointTarget#getBreakpointAddress(org.eclipse.cdt.debug.core.model.ICLineBreakpoint)
*/
public long getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException {
return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : 0;
public IAddress getBreakpointAddress( ICLineBreakpoint breakpoint ) throws DebugException {
return (getBreakpointManager() != null) ? getBreakpointManager().getBreakpointAddress( breakpoint ) : getAddressFactory().getZero();
}
/* (non-Javadoc)
@ -1838,4 +1844,21 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
public boolean isPostMortem() {
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;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -43,14 +45,14 @@ public class CFormattedMemoryBlock extends CDebugElement
{
class CFormattedMemoryBlockRow implements IFormattedMemoryBlockRow
{
private long fAddress;
private IAddress fAddress;
private String[] fData;
private String fAscii;
/**
* Constructor for CFormattedMemoryBlockRow.
*/
public CFormattedMemoryBlockRow( long address, String[] data, String ascii )
public CFormattedMemoryBlockRow( IAddress address, String[] data, String ascii )
{
fAddress = address;
fData = data;
@ -60,7 +62,7 @@ public class CFormattedMemoryBlock extends CDebugElement
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlockRow#getAddress()
*/
public long getAddress()
public IAddress getAddress()
{
return fAddress;
}
@ -92,7 +94,7 @@ public class CFormattedMemoryBlock extends CDebugElement
private boolean fDisplayAscii = true;
private char fPaddingChar = '.';
private List fRows = null;
private Long[] fChangedAddresses = new Long[0];
private IAddress[] fChangedAddresses = new IAddress[0];
private boolean fStartAddressChanged = false;
/**
@ -219,33 +221,33 @@ public class CFormattedMemoryBlock extends CDebugElement
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextRowAddress()
*/
public long nextRowAddress()
public IAddress nextRowAddress()
{
return 0;
return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousRowAddress()
*/
public long previousRowAddress()
public IAddress previousRowAddress()
{
return 0;
return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#nextPageAddress()
*/
public long nextPageAddress()
public IAddress nextPageAddress()
{
return 0;
return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IFormattedMemoryBlock#previousPageAddress()
*/
public long previousPageAddress()
public IAddress previousPageAddress()
{
return 0;
return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
}
/* (non-Javadoc)
@ -284,14 +286,19 @@ public class CFormattedMemoryBlock extends CDebugElement
* @see org.eclipse.debug.core.model.IMemoryBlock#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 )
{
return fCDIMemoryBlock.getStartAddress();
}
return 0;
return ((CDebugTarget)getDebugTarget()).getAddressFactory().getZero();
}
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IMemoryBlock#getLength()
*/
@ -510,19 +517,19 @@ public class CFormattedMemoryBlock extends CDebugElement
fireTerminateEvent();
}
public Long[] getChangedAddresses()
public IAddress[] getChangedAddresses()
{
return fChangedAddresses;
}
protected void setChangedAddresses( Long[] changedAddresses )
protected void setChangedAddresses( IAddress[] changedAddresses )
{
fChangedAddresses = changedAddresses;
}
protected void resetChangedAddresses()
{
fChangedAddresses = new Long[0];
fChangedAddresses = new IAddress[0];
}
/**
@ -679,12 +686,13 @@ public class CFormattedMemoryBlock extends CDebugElement
return fStartAddressChanged;
}
private long getRowAddress( int offset )
private IAddress getRowAddress(int offset )
{
long result = getStartAddress() + offset;
if ( result > 0xFFFFFFFFL )
IAddress result = getRealStartAddress().add(BigInteger.valueOf(offset));
IAddress max = ((CDebugTarget)getDebugTarget()).getAddressFactory().getMax();
if ( result.compareTo(max) > 0 )
{
result -= 0xFFFFFFFFL;
result = result.add(result.getMaxOffset().negate());
}
return result;
}

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -95,7 +95,7 @@ public class CreatedEvent implements ICDICreatedEvent {
MISession miSession = mblock.getMISession();
ICDIMemoryBlock[] blocks = mgr.getMemoryBlocks(miSession);
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()) {
source = blocks[i];
break;

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.debug.mi.core.cdi.event;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.event.ICDIMemoryChangedEvent;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
@ -36,16 +37,16 @@ public class MemoryChangedEvent implements ICDIMemoryChangedEvent {
/**
* @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. */
Long[] longs = miMem.getAddresses();
List aList = new ArrayList(longs.length);
for (int i = 0; i < longs.length; i++) {
if (source.contains(longs[i])) {
aList.add(longs[i]);
IAddress[] mi_addresses = miMem.getAddresses();
List aList = new ArrayList(mi_addresses.length);
for (int i = 0; i < mi_addresses.length; i++) {
if (source.contains(mi_addresses[i])) {
aList.add(mi_addresses[i]);
}
}
return (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(),
miBreakpoint.getFunction(),
miBreakpoint.getLine(),
miBreakpoint.getAddress());
((Target)getTarget()).getAddressFactory().createAddress(miBreakpoint.getAddress()));
}
}
return fLocation;

View file

@ -10,6 +10,7 @@
*******************************************************************************/
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.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()
*/
public long getAdress() {
return asm.getAddress();
public IAddress getAdress() {
return ((Target)getTarget()).getAddressFactory().createAddress(asm.getAddress());
}
/**

View file

@ -11,9 +11,11 @@
package org.eclipse.cdt.debug.mi.core.cdi.model;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.ICDIMemoryBlock;
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 {
MIDataReadMemoryInfo mem;
String expression;
boolean frozen;
boolean dirty;
private MIDataReadMemoryInfo mem;
private IAddress cStartAddress; //cashed start address
private byte[] cBytes; //cashed bytes
public MemoryBlock(Target target, String exp, MIDataReadMemoryInfo info) {
super(target);
expression = exp;
mem = info;
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) {
cStartAddress = ((Target)getTarget()).getAddressFactory().createAddress(m.getAddress());
cBytes = getBytes(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.
*/
public boolean contains(Long[] adds) {
public boolean contains(IAddress[] adds) {
for (int i = 0; i < adds.length; i++) {
if (contains(adds[i])) {
return true;
@ -80,10 +88,12 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
/**
* @return true if the address is within the block.
*/
public boolean contains(Long addr) {
long start = getStartAddress();
public boolean contains(IAddress addr) {
IAddress start = getStartAddress();
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 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 {
MIMemory[] miMem = mem.getMemories();
private byte[] getBytes(MIDataReadMemoryInfo m) {
MIMemory[] miMem = m.getMemories();
List aList = new ArrayList();
for (int i = 0; i < miMem.length; i++) {
long[] data = miMem[i].getData();
@ -123,6 +133,10 @@ public class MemoryBlock extends CObject implements ICDIMemoryBlock {
return bytes;
}
public byte[] getBytes() throws CDIException {
return cBytes;
}
/**
* @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();
MemoryManager mgr = (MemoryManager)target.getSession().getMemoryManager();
setDirty(true);
Long[] addresses = mgr.update(this, null);
IAddress[] addresses = mgr.update(this, null);
// Check if this affects other blocks.
if (addresses.length > 0) {
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()
*/
public long getStartAddress() {
return mem.getAddress();
public IAddress getStartAddress() {
return cStartAddress;
}
/**

View file

@ -11,6 +11,7 @@
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.model.ICDISharedLibrary;
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()
*/
public long getStartAddress() {
return miShared.getFrom();
public IAddress getStartAddress() {
return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getFrom());
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDISharedLibrary#getEndAddress()
*/
public long getEndAddress() {
return miShared.getTo();
public IAddress getEndAddress() {
return ((Target)getTarget()).getAddressFactory().createAddress(miShared.getTo());
}
/**

View file

@ -130,10 +130,12 @@ public class StackFrame extends CObject implements ICDIStackFrame {
*/
public ICDILocation getLocation() {
if (frame != null) {
return new Location(frame.getFile(), frame.getFunction(),
frame.getLine(), frame.getAddress());
return new Location(frame.getFile(),
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.List;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDICondition;
import org.eclipse.cdt.debug.core.cdi.ICDILocation;
@ -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.MISession;
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.RegisterManager;
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.MIInfoThreadsInfo;
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[] currentThreads;
int currentThreadId;
IAddressFactory addressFactory;
public Target(Session s, MISession mi) {
public Target(Session s, MISession mi, IAddressFactory addrFactory) {
session = s;
miSession = mi;
currentThreads = noThreads;
addressFactory = addrFactory;
}
public MISession getMISession() {
@ -464,8 +468,8 @@ public class Target implements ICDITarget {
loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
} else if (location.getFunction() != null && location.getFunction().length() > 0) {
loc = location.getFunction();
} else if (location.getAddress() != 0) {
loc = "*" + location.getAddress(); //$NON-NLS-1$
} else if ( ! location.getAddress().isZero() ) {
loc = "*" + location.getAddress().toString(); //$NON-NLS-1$
}
MIExecUntil until = factory.createMIExecUntil(loc);
try {
@ -575,8 +579,8 @@ public class Target implements ICDITarget {
loc = location.getFile() + ":" + location.getLineNumber(); //$NON-NLS-1$
} else if (location.getFunction() != null && location.getFunction().length() > 0) {
loc = location.getFunction();
} else if (location.getAddress() != 0) {
loc = "*" + location.getAddress(); //$NON-NLS-1$
} else if (! location.getAddress().isZero()) {
loc = "*" + location.getAddress().toString(); //$NON-NLS-1$
}
MIJump jump = factory.createMIJump(loc);
try {
@ -742,10 +746,44 @@ public class Target implements ICDITarget {
/* (non-Javadoc)
* @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();
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;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
/**
@ -29,17 +31,19 @@ public class PointerValue extends DerivedValue implements ICDIPointerValue {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIPointerValue#pointerValue()
*/
public long pointerValue() throws CDIException {
long value = 0;
String valueString = getValueString();
public IAddress pointerValue() throws CDIException {
String valueString = getValueString().trim();
int space = valueString.indexOf(' ');
if (space != -1) {
valueString = valueString.substring(0, space).trim();
}
try {
value = Long.decode(valueString).longValue();
} catch (NumberFormatException e) {
try{
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;
import org.eclipse.cdt.core.IAddress;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue;
import org.eclipse.cdt.debug.mi.core.cdi.model.Target;
import org.eclipse.cdt.debug.mi.core.cdi.model.Variable;
/**
@ -32,8 +34,7 @@ public class ReferenceValue extends DerivedValue implements ICDIReferenceValue {
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.cdi.model.type.ICDIReferenceValue#referenceValue()
*/
public long referenceValue() throws CDIException {
long value = 0;
public IAddress referenceValue() throws CDIException {
String valueString = getValueString().trim();
if ( valueString.startsWith("@") ) //$NON-NLS-1$
valueString = valueString.substring( 1 );
@ -41,10 +42,14 @@ public class ReferenceValue extends DerivedValue implements ICDIReferenceValue {
if (space != -1) {
valueString = valueString.substring(0, space).trim();
}
try {
value = Long.decode(valueString).longValue();
} catch (NumberFormatException e) {
try{
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();
}
public MIGDBShowAddressSize createMIGDBShowAddressSize() {
return new MIGDBShowAddressSize();
}
public MIStackInfoDepth createMIStackInfoDepth() {
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.core.IAddress;
/**
* 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 {
Long[] addresses;
IAddress[] addresses;
public MIMemoryChangedEvent(MISession source, Long[] addrs) {
public MIMemoryChangedEvent(MISession source, IAddress[] addrs) {
this(source, 0, addrs);
}
public MIMemoryChangedEvent(MISession source, int token, Long[] addrs) {
public MIMemoryChangedEvent(MISession source, int token, IAddress[] addrs) {
super(source, token);
addresses = addrs;
}
public Long[] getAddresses() {
public IAddress[] getAddresses() {
return addresses;
}
}

View file

@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.cdt.debug.mi.core.event;
import org.eclipse.cdt.core.IAddress;
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 {
long address;
IAddress address;
long totalBytes;
public MIMemoryCreatedEvent(MISession source, long addr, long total) {
public MIMemoryCreatedEvent(MISession source, IAddress addr, long 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);
address = addr;
totalBytes = total;
}
public long getAddress() {
public IAddress getAddress() {
return address;
}

View file

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

View file

@ -54,7 +54,7 @@ public class MIBreakpoint {
String type = ""; //$NON-NLS-1$
String disp = ""; //$NON-NLS-1$
boolean enabled;
long address;
String address;
String func = ""; //$NON-NLS-1$
String file = ""; //$NON-NLS-1$
int line;
@ -146,7 +146,7 @@ public class MIBreakpoint {
enabled = e;
}
public long getAddress() {
public String getAddress() {
return address;
}
@ -228,7 +228,7 @@ public class MIBreakpoint {
enabled = str.equals("y"); //$NON-NLS-1$
} else if (var.equals("addr")) { //$NON-NLS-1$
try {
address = Long.decode(str.trim()).longValue();
address = str.trim();
} catch (NumberFormatException e) {
}
} 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 {
long addr;
String addr;
long nextRow;
long prevRow;
long nextPage;
@ -33,7 +33,7 @@ public class MIDataReadMemoryInfo extends MIInfo {
parse();
}
public long getAddress() {
public String getAddress() {
return addr;
}
@ -96,7 +96,7 @@ public class MIDataReadMemoryInfo extends MIInfo {
if (var.equals("addr")) { //$NON-NLS-1$
try {
addr = Long.decode(str.trim()).longValue();
addr = str.trim();
} catch (NumberFormatException e) {
}
} 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 {
int level;
long addr;
String addr;
String func = ""; //$NON-NLS-1$
String file = ""; //$NON-NLS-1$
int line;
@ -42,7 +42,7 @@ public class MIFrame {
return line;
}
public long getAddress() {
public String getAddress() {
return addr;
}
@ -53,7 +53,7 @@ public class MIFrame {
public String toString() {
StringBuffer buffer = new StringBuffer();
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(",file=\"" + file + "\""); //$NON-NLS-1$//$NON-NLS-2$
buffer.append(",line=\"").append(line).append('"'); //$NON-NLS-1$
@ -86,7 +86,7 @@ public class MIFrame {
}
} else if (var.equals("addr")) { //$NON-NLS-1$
try {
addr = Long.decode(str.trim()).longValue();
addr = str.trim();
} catch (NumberFormatException e) {
}
} 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) {
// Pass the header
int index = -1;
long from = 0;
long to = 0;
String from = "";
String to = "";
boolean syms = false;
String name = ""; //$NON-NLS-1$
@ -102,16 +102,10 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
}
break;
case 2 : // second column is "To"
try {
to = Long.decode(sub).longValue();
} catch (NumberFormatException e) {
}
to = sub;
break;
case 3 : // first column is "From"
try {
from = Long.decode(sub).longValue();
} catch (NumberFormatException e) {
}
from = sub;
break;
}
}
@ -123,8 +117,8 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
}
void parseWinShared(String str, List aList) {
long from = 0;
long to = 0;
String from = "";
String to = "";
boolean syms = true;
int index = str.lastIndexOf(' ');
@ -134,10 +128,7 @@ public class MIInfoSharedLibraryInfo extends MIInfo {
if (!sub.startsWith("0x")) { //$NON-NLS-1$
sub = "0x" + sub; //$NON-NLS-1$
}
try {
from = Long.decode(sub).longValue();
} catch (NumberFormatException e) {
}
from = sub;
str = str.substring(0, index).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.
*/
public class MIMemory {
long addr;
String addr;
long [] data = new long[0];
String ascii = ""; //$NON-NLS-1$
@ -22,7 +22,7 @@ public class MIMemory {
parse(tuple);
}
public long getAddress() {
public String getAddress() {
return addr;
}
@ -36,7 +36,7 @@ public class MIMemory {
public String toSting() {
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$
for (int i = 0 ; i < data.length; i++) {
if (i != 0) {
@ -63,7 +63,7 @@ public class MIMemory {
if (var.equals("addr")) { //$NON-NLS-1$
try {
addr = Long.decode(str.trim()).longValue();
addr = str.trim();
} catch (NumberFormatException e) {
}
} 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 {
long from;
long to;
String from;
String to;
boolean isread;
String name;
public MIShared (long start, long end, boolean read, String location) {
public MIShared (String start, String end, boolean read, String location) {
from = start;
to = end;
isread = read;
name = location;
}
public long getFrom() {
public String getFrom() {
return from;
}
public long getTo() {
public String getTo() {
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$
File cwd = exe.getProject().getLocation().toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), cwd, gdbinit);
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, cwd, gdbinit);
initializeLibraries(config, session);
return session;
} catch (IOException e) {
@ -105,7 +105,7 @@ public class GDBDebugger implements ICDebugger {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
File cwd = exe.getProject().getLocation().toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), pid, null, cwd, gdbinit);
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, pid, null, cwd, gdbinit);
initializeLibraries(config, session);
return session;
} catch (IOException e) {
@ -137,7 +137,7 @@ public class GDBDebugger implements ICDebugger {
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
File cwd = exe.getProject().getLocation().toFile();
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit);
session = (Session)MIPlugin.getDefault().createCSession(gdb, exe, corefile.toFile(), cwd, gdbinit);
initializeLibraries(config, session);
return session;
} catch (IOException e) {

View file

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

View file

@ -21,6 +21,10 @@ import java.text.MessageFormat;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IAddressFactory;
import org.eclipse.cdt.core.model.IBinary;
import org.eclipse.cdt.core.model.ICElement;
import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.mi.core.cdi.Session;
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
@ -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.utils.pty.PTY;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.core.runtime.Preferences;
import org.osgi.framework.BundleContext;
@ -113,7 +119,7 @@ public class MIPlugin extends Plugin {
* @return ICDISession
* @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;
boolean failed = false;
@ -156,7 +162,7 @@ public class MIPlugin extends Plugin {
* @return ICDISession
* @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) {
gdb = GDB;
}
@ -170,13 +176,13 @@ public class MIPlugin extends Plugin {
if (program == null) {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
} else {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program.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 {
if (program == null) {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
} else {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", "mi1", program.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
// 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
* @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) {
gdb = GDB;
}
@ -229,7 +235,7 @@ public class MIPlugin extends Plugin {
if (program == null) {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
} else {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", "-c", core.getAbsolutePath(), program.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);
MISession session;
@ -239,7 +245,7 @@ public class MIPlugin extends Plugin {
pgdb.destroy();
throw e;
}
return new Session(session);
return new Session(session, getAddressFactory(program));
}
/**
@ -249,7 +255,7 @@ public class MIPlugin extends Plugin {
* @return ICDISession
* @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) {
gdb = GDB;
}
@ -262,7 +268,7 @@ public class MIPlugin extends Plugin {
if (program == null) {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
} else {
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program.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);
MISession session;
@ -298,7 +304,7 @@ public class MIPlugin extends Plugin {
//@@@ We have to manually set the suspended state when we attach
session.getMIInferior().setSuspended();
session.getMIInferior().update();
return new Session(session, 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);
}
protected IAddressFactory getAddressFactory(IFile exe)
{
ICElement cFile = CCorePlugin.getDefault().getCoreModel().create( exe );
if ( cFile instanceof IBinary )
{
return ((IBinary)cFile).getAddressFactory();
}
return null;
}
/* (non-Javadoc)
* @see org.eclipse.core.runtime.Plugin#shutdown()
*/

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
Removed the "ISwitchToThread" and "ISwitchToFrame" interfaces.
* CDebugUIPlugin.java

View file

@ -703,9 +703,8 @@ public class CDTDebugModelPresentation extends LabelProvider implements IDebugMo
protected StringBuffer appendAddress( ICAddressBreakpoint breakpoint, StringBuffer label ) throws CoreException {
try {
long address = Long.parseLong( breakpoint.getAddress() );
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 ) {
}

View file

@ -24,16 +24,7 @@ import org.eclipse.jface.text.Region;
*/
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 )
{

View file

@ -10,6 +10,7 @@
*******************************************************************************/
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.debug.core.model.IJumpToAddress;
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 );
if ( target != null )

View file

@ -10,6 +10,7 @@
***********************************************************************/
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.model.IJumpToAddress;
import org.eclipse.cdt.debug.core.model.IJumpToLine;
@ -247,7 +248,7 @@ public class ResumeAtLineActionDelegate implements IWorkbenchWindowActionDelegat
}
ITextSelection textSelection = (ITextSelection)selection;
int lineNumber = textSelection.getStartLine() + 1;
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
return jumpToAddress.canJumpToAddress( address );
}
return false;
@ -287,7 +288,7 @@ public class ResumeAtLineActionDelegate implements IWorkbenchWindowActionDelegat
else {
ITextSelection textSelection = (ITextSelection)selection;
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 );
if ( jumpToAddress != null )
jumpToAddress.jumpToAddress( address );

View file

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

View file

@ -10,6 +10,7 @@
***********************************************************************/
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.IDeclaration;
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$
}
else {
long address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
if ( address == 0 ) {
IAddress address = ((DisassemblyEditorInput)input).getAddress( lineNumber );
if ( address == null ) {
errorMessage = ActionMessages.getString( "ToggleBreakpointAdapter.Invalid_line_1" ); //$NON-NLS-1$
}
else {

View file

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

View file

@ -10,6 +10,7 @@
***********************************************************************/
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.ICStackFrame;
import org.eclipse.cdt.debug.core.model.IDisassembly;
@ -63,8 +64,8 @@ public class DisassemblyInstructionPointerAnnotation extends Annotation {
IDisassembly disassembly = getDisassembly( frame );
hashCode = 37*hashCode + (( disassembly != null ) ? disassembly.hashCode() : 0);
if ( frame != null ) {
long address = frame.getAddress();
hashCode = 37*hashCode + (int)(address^(address>>>32));
IAddress address = frame.getAddress();
hashCode = 37*hashCode + address.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.ICMemoryManager;
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.ui.CDebugUIPlugin;
import org.eclipse.debug.core.DebugException;
@ -430,7 +429,7 @@ public class MemoryControlArea extends Composite implements ITextOperationTarget
}
}
if ( getMemoryBlock() != null ) {
fAddressText.setText( CDebugUIUtils.toHexAddressString( getMemoryBlock().getStartAddress() ) );
fAddressText.setText( getMemoryBlock().getRealStartAddress().toHexAddressString() );
handleAddressEnter();
}
}

View file

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