mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +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
|
2004-09-21 Mikhail Khodjaiants
|
||||||
Changes to the IBinary interface
|
Changes to the IBinary interface
|
||||||
* CDebugTarget.java
|
* CDebugTarget.java
|
||||||
|
|
|
@ -266,8 +266,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent
|
||||||
if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) {
|
if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) {
|
||||||
try {
|
try {
|
||||||
ICDILocation location = ((ICDILocationBreakpoint)cdiBreakpoint).getLocation();
|
ICDILocation location = ((ICDILocationBreakpoint)cdiBreakpoint).getLocation();
|
||||||
if ( location != null )
|
if ( location != null ) {
|
||||||
{
|
|
||||||
IAddressFactory factory = getDebugTarget().getAddressFactory();
|
IAddressFactory factory = getDebugTarget().getAddressFactory();
|
||||||
return factory.createAddress( location.getAddress().toString() );
|
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 {
|
private ICDIBreakpoint setAddressBreakpoint( ICAddressBreakpoint breakpoint ) throws CDIException, CoreException, NumberFormatException {
|
||||||
ICDITarget cdiTarget = getCDITarget();
|
|
||||||
ICDILocation location = cdiTarget.createLocation( new BigInteger ( breakpoint.getAddress() ) );
|
|
||||||
ICDIBreakpoint cdiBreakpoint = null;
|
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() ) {
|
synchronized ( getBreakpointMap() ) {
|
||||||
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
cdiBreakpoint = cdiTarget.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, null, null, true );
|
||||||
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
getBreakpointMap().put( breakpoint, cdiBreakpoint );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return 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 {
|
public class AsmInstruction implements IAsmInstruction {
|
||||||
|
|
||||||
private ICDIInstruction fCDIInstruction;
|
private ICDIInstruction fCDIInstruction;
|
||||||
private IAddressFactory fAddressFactory;
|
|
||||||
|
private IAddress fAddress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor for AsmInstruction.
|
* Constructor for AsmInstruction.
|
||||||
*/
|
*/
|
||||||
public AsmInstruction( IAddressFactory factory, ICDIInstruction cdiInstruction ) {
|
public AsmInstruction( IAddressFactory factory, ICDIInstruction cdiInstruction ) {
|
||||||
fCDIInstruction = cdiInstruction;
|
fCDIInstruction = cdiInstruction;
|
||||||
fAddressFactory = factory;
|
fAddress = factory.createAddress( cdiInstruction.getAdress().toString() );
|
||||||
}
|
|
||||||
|
|
||||||
public IAddressFactory getAddressFactory() {
|
|
||||||
return fAddressFactory;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress()
|
* @see org.eclipse.cdt.debug.core.model.IAsmInstruction#getAdress()
|
||||||
*/
|
*/
|
||||||
public IAddress getAdress() {
|
public IAddress getAdress() {
|
||||||
IAddressFactory factory = getAddressFactory();
|
return fAddress;
|
||||||
return factory.createAddress( fCDIInstruction.getAdress().toString() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
@ -12,7 +12,6 @@ package org.eclipse.cdt.debug.internal.core.model;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.cdt.core.IAddress;
|
import org.eclipse.cdt.core.IAddress;
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||||
|
@ -80,7 +79,7 @@ public class Disassembly extends CDebugElement implements IDisassembly {
|
||||||
!containsAddress( mixedInstrs, address ) ) {
|
!containsAddress( mixedInstrs, address ) ) {
|
||||||
try {
|
try {
|
||||||
BigInteger addr = new BigInteger( address.toString() );
|
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 );
|
return DisassemblyBlock.create( this, instructions );
|
||||||
}
|
}
|
||||||
catch( CDIException e ) {
|
catch( CDIException e ) {
|
||||||
|
@ -98,10 +97,13 @@ public class Disassembly extends CDebugElement implements IDisassembly {
|
||||||
private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) {
|
private boolean containsAddress( ICDIMixedInstruction[] mi, IAddress address ) {
|
||||||
for( int i = 0; i < mi.length; ++i ) {
|
for( int i = 0; i < mi.length; ++i ) {
|
||||||
ICDIInstruction[] instructions = mi[i].getInstructions();
|
ICDIInstruction[] instructions = mi[i].getInstructions();
|
||||||
for ( int j = 0; j < instructions.length; ++j )
|
for ( int j = 0; j < instructions.length; ++j ) {
|
||||||
if ( address.equals(instructions[j].getAdress()))
|
// TODO: better comparison of IAddress and BigInteger
|
||||||
|
BigInteger a = new BigInteger( address.toString() );
|
||||||
|
if ( a.equals( instructions[j].getAdress() ) )
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,11 +105,12 @@ public class DisassemblyBlock implements IDisassemblyBlock, IAdaptable {
|
||||||
if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) )
|
if ( !getDisassembly().getDebugTarget().equals( frame.getDebugTarget() ) )
|
||||||
return false;
|
return false;
|
||||||
IAddress address = frame.getAddress();
|
IAddress address = frame.getAddress();
|
||||||
return ( address.compareTo(fStartAddress) >= 0 &&
|
return (address.compareTo( fStartAddress ) >= 0 && address.compareTo( fEndAddress ) <= 0);
|
||||||
address.compareTo(fEndAddress) <= 0 );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/*
|
||||||
|
* (non-Javadoc)
|
||||||
|
*
|
||||||
* @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getSourceLines()
|
* @see org.eclipse.cdt.debug.core.model.IDisassemblyBlock#getSourceLines()
|
||||||
*/
|
*/
|
||||||
public IAsmSourceLine[] getSourceLines() {
|
public IAsmSourceLine[] getSourceLines() {
|
||||||
|
|
Loading…
Add table
Reference in a new issue