1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-08 02:06:01 +02:00

Changes and additions to support the new implementations of Shared Libraries, Signals and Disassembly views.

This commit is contained in:
Mikhail Khodjaiants 2004-04-02 00:05:34 +00:00
parent 79caadc27f
commit 863c45ab6c
15 changed files with 520 additions and 49 deletions

View file

@ -1,3 +1,21 @@
2004-04-01 Mikhail Khodjaiants
Changes and additions to support the new implementations of Shared Libraries,
Signals and Disassembly views.
* CDebugElementState.java
* IAsmInstruction.java
* ICDebugElement.java
* ICDebugTarget.java
* ICDebugTargetGroup.java
* ICSharedLibrary.java
* ICSignal.java
* ICStackFrame.java
* IDisassembly.java
* CSharedLibraryManager.java
* CSignalManager.java
* CDebugElement.java
* CDebugTarget.java
* CSignal.java
2004-03-31 Mikhail Khodjaiants 2004-03-31 Mikhail Khodjaiants
Added default preferences to the C/C++ Debug preference page. Added default preferences to the C/C++ Debug preference page.
* CDebugCorePlugin.java * CDebugCorePlugin.java

View file

@ -0,0 +1,43 @@
/**********************************************************************
* 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.core.model;
/**
* The state of a debug element.
*/
public class CDebugElementState {
private final String fName;
private CDebugElementState( String name ) {
this.fName = name;
}
public String toString() {
return this.fName;
}
public static final CDebugElementState UNDEFINED = new CDebugElementState( "undefined" ); //$NON-NLS-1$
public static final CDebugElementState TERMINATING = new CDebugElementState( "terminating" ); //$NON-NLS-1$
public static final CDebugElementState TERMINATED = new CDebugElementState( "terminated" ); //$NON-NLS-1$
public static final CDebugElementState DISCONNECTING = new CDebugElementState( "disconnecting" ); //$NON-NLS-1$
public static final CDebugElementState DISCONNECTED = new CDebugElementState( "disconnected" ); //$NON-NLS-1$
public static final CDebugElementState RESUMING = new CDebugElementState( "resuming" ); //$NON-NLS-1$
public static final CDebugElementState RESUMED = new CDebugElementState( "resumed" ); //$NON-NLS-1$
public static final CDebugElementState STEPPING = new CDebugElementState( "stepping" ); //$NON-NLS-1$
public static final CDebugElementState SUSPENDING = new CDebugElementState( "suspending" ); //$NON-NLS-1$
public static final CDebugElementState SUSPENDED = new CDebugElementState( "suspended" ); //$NON-NLS-1$
public static final CDebugElementState EVALUATING = new CDebugElementState( "evaluating" ); //$NON-NLS-1$
public static final CDebugElementState EVALUATED = new CDebugElementState( "evaluated" ); //$NON-NLS-1$
public static final CDebugElementState CHANGING = new CDebugElementState( "changing" ); //$NON-NLS-1$
public static final CDebugElementState CHANGED = new CDebugElementState( "changed" ); //$NON-NLS-1$
public static final CDebugElementState POSTMORTEM = new CDebugElementState( "postmortem" ); //$NON-NLS-1$
}

View file

@ -0,0 +1,60 @@
/**********************************************************************
* 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.core.model;
/**
* An instruction of disassemby.
*/
public interface IAsmInstruction {
/**
* Returns the address of this instruction.
*
* @return the address of this instruction
*/
long getAdress();
/**
* Returns the function name of this instruction,
* or empty string if function is not available.
*
* @return the function name of this instruction
*/
String getFunctionName();
/**
* Returns the instruction's text.
*
* @return the instruction's text.
*/
String getInstructionText();
/**
* Returns the opcode of this instruction.
*
* @return the opcode of this instruction
*/
String getOpcode();
/**
* Returns the arguments to the opcode.
*
* @return the arguments to the opcode
*/
String getArguments();
/**
* Returns the offset of this machine instruction.
*
* @return the offset of this machine instruction
*/
long getOffset();
}

View file

@ -0,0 +1,26 @@
/**********************************************************************
* 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.core.model;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.debug.core.model.IDebugElement;
/**
* C/C++ specific extension of <code>ICDebugElement</code>.
*/
public interface ICDebugElement extends IDebugElement {
public CDebugElementState getState();
public IStatus getStatus();
public String getSubModelIdentifier();
}

View file

@ -1,16 +1,20 @@
/* /**********************************************************************
*(c) Copyright QNX Software Systems Ltd. 2002. * Copyright (c) 2004 QNX Software Systems and others.
* All Rights Reserved. * 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.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugTarget; import org.eclipse.debug.core.model.IDebugTarget;
/** /**
* A C/C++ specific extension of IDebugTarget. * C/C++ extension of <code>IDebugTarget</code>.
*
* @since: Dec 2, 2002
*/ */
public interface ICDebugTarget extends IDebugTarget, public interface ICDebugTarget extends IDebugTarget,
ICDebugTargetType, ICDebugTargetType,
@ -24,6 +28,63 @@ public interface ICDebugTarget extends IDebugTarget,
IJumpToAddress, IJumpToAddress,
IResumeWithoutSignal, IResumeWithoutSignal,
IState, IState,
ISwitchToThread ISwitchToThread,
{ ICDebugElement {
/**
* Returns the shared libraries loaded in this debug target. An
* empty collection is returned if no shared libraries are loaded.
*
* @return a collection of shred libraries
*
* @throws DebugException
*/
public ICSharedLibrary[] getSharedLibraries() throws DebugException;
/**
* Returns whether there are shared libraries currently loaded in this debug target.
*
* @return whether there are shared libraries currently loaded in this debug target
*
* @throws DebugException
*/
public boolean hasSharedLibraries() throws DebugException;
/**
* Load the symbols of all shared objects.
*
* @throws DebugException
*/
public void loadSymbols() throws DebugException;
/**
* Returns whether this target is little endian.
*
* @return whether this target is little endian
*/
public boolean isLittleEndian();
/**
* Returns whether this target supports signals.
*
* @return whether this target supports signals
* @throws DebugException if this method fails.
*/
public boolean hasSignals() throws DebugException;
/**
* Returns the list of signals defined for this target.
*
* @return the list of signals defined for this target
* @throws DebugException if this method fails.
*/
public ICSignal[] getSignals() throws DebugException;
/**
* Returns the disassembly provider of this debug target.
*
* @return the disassembly provider of this debug target
* @throws DebugException if this method fails.
*/
public IDisassembly getDisassembly() throws DebugException;
} }

View file

@ -0,0 +1,20 @@
/**********************************************************************
* 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.core.model;
import org.eclipse.debug.core.model.IDebugTarget;
/**
* Represents a group of C/C++ debug targets.
*/
public interface ICDebugTargetGroup extends IDebugTarget, ICDebugElement {
}

View file

@ -1,27 +1,30 @@
/* /**********************************************************************
*(c) Copyright QNX Software Systems Ltd. 2002. * Copyright (c) 2004 QNX Software Systems and others.
* All Rights Reserved. * 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.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement; import org.eclipse.debug.core.model.IDebugElement;
/** /**
* Enter type comment. * Represents a shared library.
*
* @since: Jan 15, 2003
*/ */
public interface ICSharedLibrary extends IDebugElement public interface ICSharedLibrary extends IDebugElement {
{
/** /**
* Returns the name of shared library file. * Returns the name of shared library file.
* *
* @return the name of shared library file * @return the name of shared library file
*/ */
String getFileName(); String getFileName();
/** /**
* Returns the start address of this library. * Returns the start address of this library.
* *
@ -38,17 +41,15 @@ public interface ICSharedLibrary extends IDebugElement
/** /**
* Returns whether the symbols of this library are read. * Returns whether the symbols of this library are read.
* *
* @return whether the symbols of this library are read * @return whether the symbols of this library are read
*/ */
boolean areSymbolsLoaded(); boolean areSymbolsLoaded();
/** /**
* Loads the library symbols. * Loads the library symbols.
* *
* @throws DebugException if this method fails. Reasons include: * @throws DebugException if this method fails. Reasons include:
*/ */
void loadSymbols() throws DebugException; void loadSymbols() throws DebugException;
void dispose();
} }

View file

@ -1,33 +1,83 @@
/* /**********************************************************************
*(c) Copyright QNX Software Systems Ltd. 2002. * Copyright (c) 2004 QNX Software Systems and others.
* All Rights Reserved. * 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.core.model; package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.DebugException; import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IDebugElement;
/** /**
* Enter type comment. * Represents a signal.
* *
* @since: Jan 31, 2003 * @since: Mar 5, 2004
*/ */
public interface ICSignal extends IDebugElement public interface ICSignal extends ICDebugElement {
{
String getName();
String getDescription(); /**
* Returns the name of this signal
*
* @return this signal's name
* @throws DebugException if this method fails.
*/
public String getName() throws DebugException;
boolean isPassEnabled(); /**
* Returns the description of this signal.
*
* @return this signal's description
* @throws DebugException if this method fails.
*/
public String getDescription() throws DebugException;
boolean isStopEnabled(); /**
* Returns whether "pass" is in effect for this signal.
*
* @return whether "pass" is in effect for this signal
* @throws DebugException if this method fails.
*/
public boolean isPassEnabled() throws DebugException;
void setPassEnabled( boolean enable ) throws DebugException; /**
* Returns whether "stop" is in effect for this signal.
*
* @return whether "stop" is in effect for this signal
* @throws DebugException if this method fails.
*/
public boolean isStopEnabled() throws DebugException;
void setStopEnabled( boolean enable ) throws DebugException; /**
* Enables/disables the "pass" flag of this signal.
*
* @param enable the flag value to set
* @throws DebugException if this method fails.
*/
public void setPassEnabled( boolean enable ) throws DebugException;
/**
* Enables/disables the "stop" flag of this signal.
*
* @param enable the flag value to set
* @throws DebugException if this method fails.
*/
public void setStopEnabled( boolean enable ) throws DebugException;
void signal() throws DebugException; /**
* Resumes execution, but immediately gives the target this signal.
*
* @throws DebugException if this method fails.
*/
public void signal() throws DebugException;
void dispose(); /**
* Returns whether modification is allowed for this signal's parameters.
*
* @return whether modification is allowed for this signal's parameters
*/
public boolean canModify();
} }

View file

@ -0,0 +1,57 @@
/**********************************************************************
* 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.core.model;
import org.eclipse.debug.core.model.IStackFrame;
/**
* C/C++ extension of <code>IStackFrame</code>.
*/
public interface ICStackFrame extends IStackFrame, ICDebugElement {
/**
* Returns the address of this stack frame.
*
* @return the address of this stack frame
*/
public long getAddress();
/**
* Returns the source file of this stack frame or <code>null</code>
* if the source file is unknown.
*
* @return the source file of this stack frame
*/
public String getFile();
/**
* Returns the function of this stack frame or <code>null</code>
* if the function is unknown.
*
* @return the function of this stack frame
*/
public String getFunction();
/**
* Returns the line number of this stack frame or <code>0</code>
* if the line number is unknown.
*
* @return the line number of this stack frame
*/
public int getFrameLineNumber();
/**
* Returns the level of this stack frame.
*
* @return the level of this stack frame
*/
public int getLevel();
}

View file

@ -0,0 +1,41 @@
/**********************************************************************
* 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.core.model;
import org.eclipse.debug.core.DebugException;
/**
* Represents the disassembly of a debug target.
*/
public interface IDisassembly extends ICDebugElement {
/**
* Returns the list of disassembly instructions associated
* with the given stack frame.
*
* @param frame the stack frame for which the instructions re required.
* @return the list of disassembly instructions associated with
* the given stack frame
* @throws DebugException if this method fails.
*/
public IAsmInstruction[] getInstructions( ICStackFrame frame ) throws DebugException;
/**
* Returns the list of disassembly instructions that begins at the given address.
* The size of the requested list is specified by <code>length</code>.
*
* @param address the start address
* @param length the size of the requested list
* @return the specified list of disassembly instructions
* @throws DebugException if this method fails.
*/
public IAsmInstruction[] getInstructions( long address, int length ) throws DebugException;
}

View file

@ -97,7 +97,7 @@ public class CSharedLibraryManager extends CUpdateManager implements ICSharedLib
Iterator it = fSharedLibraries.iterator(); Iterator it = fSharedLibraries.iterator();
while( it.hasNext() ) while( it.hasNext() )
{ {
((ICSharedLibrary)it.next()).dispose(); ((CSharedLibrary)it.next()).dispose();
} }
fSharedLibraries.clear(); fSharedLibraries.clear();
} }

View file

@ -71,7 +71,7 @@ public class CSignalManager extends CUpdateManager implements ICSignalManager
if ( fSignals != null ) if ( fSignals != null )
for ( int i = 0; i < fSignals.length; ++i ) for ( int i = 0; i < fSignals.length; ++i )
{ {
fSignals[i].dispose(); ((CSignal)fSignals[i]).dispose();
} }
fSignals = null; fSignals = null;
fIsDisposed = true; fIsDisposed = true;

View file

@ -12,6 +12,8 @@ import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.core.cdi.ICDISession;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget; import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.model.CDebugElementState;
import org.eclipse.cdt.debug.core.model.ICDebugElement;
import org.eclipse.cdt.debug.core.model.ICDebugElementErrorStatus; import org.eclipse.cdt.debug.core.model.ICDebugElementErrorStatus;
import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants; import org.eclipse.cdt.debug.internal.core.ICDebugInternalConstants;
import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.IStatus;
@ -31,7 +33,7 @@ import org.eclipse.debug.core.model.IDebugTarget;
* @since Aug 1, 2002 * @since Aug 1, 2002
*/ */
public class CDebugElement extends PlatformObject public class CDebugElement extends PlatformObject
implements IDebugElement, implements ICDebugElement,
ICDebugElementErrorStatus ICDebugElementErrorStatus
{ {
private CDebugTarget fDebugTarget; private CDebugTarget fDebugTarget;
@ -357,4 +359,26 @@ public class CDebugElement extends PlatformObject
{ {
return fMessage; return fMessage;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugElement#getState()
*/
public CDebugElementState getState() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugElement#getStatus()
*/
public IStatus getStatus() {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugElement#getSubModelIdentifier()
*/
public String getSubModelIdentifier() {
// TODO Auto-generated method stub
return null;
}
} }

View file

@ -58,7 +58,10 @@ import org.eclipse.cdt.debug.core.model.ICDebugElementErrorStatus;
import org.eclipse.cdt.debug.core.model.ICDebugTarget; import org.eclipse.cdt.debug.core.model.ICDebugTarget;
import org.eclipse.cdt.debug.core.model.ICDebugTargetType; import org.eclipse.cdt.debug.core.model.ICDebugTargetType;
import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator; import org.eclipse.cdt.debug.core.model.ICExpressionEvaluator;
import org.eclipse.cdt.debug.core.model.ICSharedLibrary;
import org.eclipse.cdt.debug.core.model.ICSignal;
import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport; import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport;
import org.eclipse.cdt.debug.core.model.IDisassembly;
import org.eclipse.cdt.debug.core.model.IExecFileInfo; import org.eclipse.cdt.debug.core.model.IExecFileInfo;
import org.eclipse.cdt.debug.core.model.IGlobalVariable; import org.eclipse.cdt.debug.core.model.IGlobalVariable;
import org.eclipse.cdt.debug.core.model.IJumpToAddress; import org.eclipse.cdt.debug.core.model.IJumpToAddress;
@ -2387,4 +2390,66 @@ public class CDebugTarget extends CDebugElement
} }
return result; return result;
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#getDisassembly()
*/
public IDisassembly getDisassembly() throws DebugException {
// TODO Auto-generated method stub
return null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#getSharedLibraries()
*/
public ICSharedLibrary[] getSharedLibraries() throws DebugException {
ICSharedLibraryManager slm = getSharedLibraryManager();
if ( slm != null ) {
return slm.getSharedLibraries();
}
return new ICSharedLibrary[0];
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#getSignals()
*/
public ICSignal[] getSignals() throws DebugException {
ICSignalManager sm = getSignalManager();
if ( sm != null ) {
return sm.getSignals();
}
return new ICSignal[0];
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#hasSharedLibraries()
*/
public boolean hasSharedLibraries() throws DebugException {
ICSharedLibraryManager slm = getSharedLibraryManager();
if ( slm != null ) {
return ( slm.getSharedLibraries().length > 0 );
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#hasSignals()
*/
public boolean hasSignals() throws DebugException {
ICSignalManager sm = getSignalManager();
if ( sm != null ) {
return ( sm.getSignals().length > 0 );
}
return false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#loadSymbols()
*/
public void loadSymbols() throws DebugException {
ICSharedLibraryManager slm = getSharedLibraryManager();
if ( slm != null ) {
slm.loadSymbolsForAll();
}
}
} }

View file

@ -35,7 +35,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICSignal#getDescription() * @see org.eclipse.cdt.debug.core.model.ICSignal#getDescription()
*/ */
public String getDescription() public String getDescription() throws DebugException
{ {
return getCDISignal().getDescription(); return getCDISignal().getDescription();
} }
@ -43,7 +43,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICSignal#getName() * @see org.eclipse.cdt.debug.core.model.ICSignal#getName()
*/ */
public String getName() public String getName() throws DebugException
{ {
return getCDISignal().getName(); return getCDISignal().getName();
} }
@ -51,7 +51,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICSignal#isPassEnabled() * @see org.eclipse.cdt.debug.core.model.ICSignal#isPassEnabled()
*/ */
public boolean isPassEnabled() public boolean isPassEnabled() throws DebugException
{ {
return !getCDISignal().isIgnore(); return !getCDISignal().isIgnore();
} }
@ -59,7 +59,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
/* (non-Javadoc) /* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ICSignal#isStopEnabled() * @see org.eclipse.cdt.debug.core.model.ICSignal#isStopEnabled()
*/ */
public boolean isStopEnabled() public boolean isStopEnabled() throws DebugException
{ {
return getCDISignal().isStopSet(); return getCDISignal().isStopSet();
} }
@ -126,4 +126,9 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene
targetRequestFailed( e.getMessage(), null ); targetRequestFailed( e.getMessage(), null );
} }
} }
public boolean canModify() {
// TODO add canModify method to ICDISignal
return true;
}
} }