mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fixed the problems with the Disassembly view and address breakpoints caused by switch to IAddress.
This commit is contained in:
parent
5cf6e98981
commit
f56efbce47
6 changed files with 32 additions and 56 deletions
|
@ -1,3 +1,11 @@
|
|||
2004-09-21 Mikhail Khodjaiants
|
||||
Fixed the problems with the Disassembly view and address breakpoints caused by switch to IAddress.
|
||||
* CBreakpointManager.java
|
||||
* AsmInstruction.java
|
||||
* Disassembly.java
|
||||
* DisassemblyBlock.java
|
||||
* src/org/eclipse/cdt/debug/internal/core/CDebugUtils.java: removed
|
||||
|
||||
2004-09-21 Mikhail Khodjaiants
|
||||
Changes to the IBinary interface
|
||||
* CDebugTarget.java
|
||||
|
|
|
@ -266,8 +266,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
|||
if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) {
|
||||
try {
|
||||
ICDILocation location = ((ICDILocationBreakpoint)cdiBreakpoint).getLocation();
|
||||
if ( location != null )
|
||||
{
|
||||
if ( location != null ) {
|
||||
IAddressFactory factory = getDebugTarget().getAddressFactory();
|
||||
return factory.createAddress( location.getAddress().toString() );
|
||||
}
|
||||
|
@ -499,13 +498,16 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
|||
}
|
||||
|
||||
private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
|
||||
ICDITarget cdiTarget = getCDITarget();
|
||||
ICDILocation location = cdiTarget.createLocation( new BigInteger ( breakpoint.getAddress() ) );
|
||||
ICDIBreakpoint cdiBreakpoint = null;
|
||||
ICDITarget cdiTarget = getCDITarget();
|
||||
String address = breakpoint.getAddress();
|
||||
if ( address.startsWith( "0x" ) ) { //$NON-NLS-1$
|
||||
ICDILocation location = cdiTarget.createLocation( new BigInteger ( breakpoint.getAddress().substring( 2 ), 16 ) );
|
||||
synchronized ( getBreakpointMap() ) {
|
||||
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
||||
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
||||
}
|
||||
}
|
||||
return cdiBreakpoint;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core;
|
||||
|
||||
/**
|
||||
* Utilities used by C/C++ Debug Plugin's classes.
|
||||
*/
|
||||
public class CDebugUtils {
|
||||
|
||||
/**
|
||||
* Returns the hexadecimal presentation of the given address.
|
||||
*
|
||||
* @param address an address to be converted to hex
|
||||
* @return the hexadecimal presentation of the given address
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
|
@ -21,25 +21,22 @@ import org.eclipse.cdt.debug.core.model.IAsmInstruction;
|
|||
public class AsmInstruction implements IAsmInstruction {
|
||||
|
||||
private ICDIInstruction fCDIInstruction;
|
||||
private IAddressFactory fAddressFactory;
|
||||
|
||||
private IAddress fAddress;
|
||||
|
||||
/**
|
||||
* Constructor for AsmInstruction.
|
||||
*/
|
||||
public AsmInstruction( IAddressFactory factory, ICDIInstruction cdiInstruction ) {
|
||||
fCDIInstruction = cdiInstruction;
|
||||
fAddressFactory = factory;
|
||||
}
|
||||
|
||||
public IAddressFactory getAddressFactory() {
|
||||
return fAddressFactory;
|
||||
fAddress = factory.createAddress( cdiInstruction.getAdress().toString() );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress()
|
||||
*/
|
||||
public IAddress getAdress() {
|
||||
IAddressFactory factory = getAddressFactory();
|
||||
return factory.createAddress( fCDIInstruction.getAdress().toString() );
|
||||
return fAddress;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -12,7 +12,6 @@ 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;
|
||||
|
@ -80,7 +79,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
|
|||
!containsAddress( mixedInstrs, address ) ) {
|
||||
try {
|
||||
BigInteger addr = new BigInteger( address.toString() );
|
||||
ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( addr, addr.add(BigInteger.valueOf(DISASSEMBLY_BLOCK_SIZE)) ) );
|
||||
ICDIInstruction[] instructions = getFunctionInstructions( sm.getInstructions( addr, addr.add( BigInteger.valueOf( DISASSEMBLY_BLOCK_SIZE ) ) ) );
|
||||
return DisassemblyBlock.create( this, instructions );
|
||||
}
|
||||
catch( CDIException e ) {
|
||||
|
@ -98,10 +97,13 @@ public class Disassembly extends CDebugElement implements IDisassembly {
|
|||
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 ( address.equals(instructions[j].getAdress()))
|
||||
for ( int j = 0; j < instructions.length; ++j ) {
|
||||
// TODO: better comparison of IAddress and BigInteger
|
||||
BigInteger a = new BigInteger( address.toString() );
|
||||
if ( a.equals( instructions[j].getAdress() ) )
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,11 +105,12 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
|
|||
if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) )
|
||||
return false;
|
||||
IAddress address = frame.getAddress();
|
||||
return ( address.compareTo(fStartAddress) >= 0 &&
|
||||
address.compareTo(fEndAddress) <= 0 );
|
||||
return (address.compareTo( fStartAddress ) >= 0 && address.compareTo( fEndAddress ) <= 0);
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getSourceLines()
|
||||
*/
|
||||
public IAsmSourceLine[] getSourceLines() {
|
||||
|
|
Loading…
Add table
Reference in a new issue