1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Support for the instruction stepping mode.

This commit is contained in:
Mikhail Khodjaiants 2004-05-13 18:55:09 +00:00
parent 437c6840b1
commit 64e6bbf48d
7 changed files with 175 additions and 137 deletions

View file

@ -1,3 +1,12 @@
2004-05-13 Mikhail Khodjaiants
Support for the instruction stepping mode.
* ICDebugTarget.java
* ISteppingModeTarget.java: new
* ITargetProperties.java: new
* IInstructionstep.java: deleted
* CDebugTarget.java
* CThread.java
2004-05-06 Mikhail Khodjaiants
Implementation of mixed disassembly mode.
* IAsmSourceLine.java: new

View file

@ -29,7 +29,9 @@ public interface ICDebugTarget extends IDebugTarget,
IState,
ISwitchToThread,
ICDebugElement,
IBreakpointTarget {
IBreakpointTarget,
ISteppingModeTarget,
ITargetProperties {
/**
* Returns the shared libraries loaded in this debug target. An

View file

@ -1,50 +0,0 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.core.model;
import org.eclipse.debug.core.DebugException;
/**
* Provides the ability to step into and over machine instruction
* at the current execution location.
*
*/
public interface IInstructionStep
{
/**
* Returns whether this element can currently perform a step
* into the instruction.
*
* @return whether this element can currently perform a step
* into the instruction
*/
boolean canStepIntoInstruction();
/**
* Returns whether this element can currently perform a step
* over the instruction (nexti command).
*
* @return whether this element can currently perform a step
* over the instruction
*/
boolean canStepOverInstruction();
/**
* Steps into the current instruction.
*
* @exception DebugException on failure. Reasons include:<ul>
* </ul>
*/
void stepIntoInstruction() throws DebugException;
/**
* Steps over the current instruction.
*
* @exception DebugException on failure. Reasons include:<ul>
* </ul>
*/
void stepOverInstruction() throws DebugException;
}

View file

@ -0,0 +1,40 @@
/**********************************************************************
* 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;
/**
* Support for the instruction stepping mode for a debug target.
*/
public interface ISteppingModeTarget {
/**
* Returns whether this debug target supports instruction stepping.
*
* @return whether this debug target supports instruction stepping
*/
boolean supportsInstructionStepping();
/**
* Sets whether the instruction stepping are enabled in this debug target.
*
* @param enabled whether the instruction stepping are enabled in this debug target
*/
void enableInstructionStepping( boolean enabled );
/**
* Returns whether the instruction stepping are currently enabled in this
* debug target.
*
* @return whether the instruction stepping are currently enabled in this
* debug target
*/
boolean isInstructionSteppingEnabled();
}

View file

@ -0,0 +1,37 @@
/**********************************************************************
* 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.Preferences;
/**
* Provides access to the properties of a debug target.
*/
public interface ITargetProperties {
public static final String PREF_INSTRUCTION_STEPPING_MODE = "instruction_stepping_mode"; //$NON-NLS-1$
/**
* Adds a property change listener to this target.
* Has no affect if the identical listener is already registered.
*
* @param listener a property change listener
*/
void addPropertyChangeListener( Preferences.IPropertyChangeListener listener );
/**
* Removes the given listener from this target.
* Has no affect if the listener is not registered.
*
* @param listener a property change listener
*/
void removePropertyChangeListener( Preferences.IPropertyChangeListener listener );
}

View file

@ -91,7 +91,9 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Preferences;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
@ -278,7 +280,12 @@ public class CDebugTarget extends CDebugElement
private Boolean fIsLittleEndian = null;
private RunningInfo fRunningInfo = null;
/**
* The target's preference set.
*/
private Preferences fPreferences = null;
/**
* Constructor for CDebugTarget.
* @param target
@ -300,6 +307,7 @@ public class CDebugTarget extends CDebugElement
setName( name );
setProcess( debuggeeProcess );
setCDITarget( cdiTarget );
initializePreferences();
setExecFile( file );
setConfiguration( cdiTarget.getSession().getConfiguration() );
setThreadList( new ArrayList( 5 ) );
@ -1249,6 +1257,7 @@ public class CDebugTarget extends CDebugElement
disposeSourceManager();
disposeBreakpointManager();
removeAllExpressions();
disposePreferences();
}
/**
@ -2470,4 +2479,50 @@ public class CDebugTarget extends CDebugElement
public boolean isTargetBreakpoint( ICBreakpoint breakpoint ) {
return ( getBreakpointManager() != null ) ? getBreakpointManager().isTargetBreakpoint( breakpoint ) : false;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#enableInstructionStepping(boolean)
*/
public void enableInstructionStepping( boolean enabled ) {
fPreferences.setValue( PREF_INSTRUCTION_STEPPING_MODE, enabled );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#isInstructionSteppingEnabled()
*/
public boolean isInstructionSteppingEnabled() {
return fPreferences.getBoolean( PREF_INSTRUCTION_STEPPING_MODE );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ISteppingModeTarget#supportsInstructionStepping()
*/
public boolean supportsInstructionStepping() {
return getConfiguration().supportsInstructionStepping();
}
private void initializePreferences() {
fPreferences = new Preferences();
fPreferences.setDefault( PREF_INSTRUCTION_STEPPING_MODE, false );
}
private void disposePreferences() {
fPreferences = null;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ITargetProperties#addPropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
*/
public void addPropertyChangeListener( IPropertyChangeListener listener ) {
if ( fPreferences!= null )
fPreferences.addPropertyChangeListener( listener );
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.ITargetProperties#removePropertyChangeListener(org.eclipse.core.runtime.Preferences.IPropertyChangeListener)
*/
public void removePropertyChangeListener( IPropertyChangeListener listener ) {
if ( fPreferences!= null )
fPreferences.removePropertyChangeListener( listener );
}
}

View file

@ -11,6 +11,7 @@ import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugUtils;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDIConfiguration;
@ -31,7 +32,6 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.core.model.ICDebugElementErrorStatus;
import org.eclipse.cdt.debug.core.model.IDummyStackFrame;
import org.eclipse.cdt.debug.core.model.IInstructionStep;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
import org.eclipse.cdt.debug.core.model.IRunToLine;
@ -45,7 +45,6 @@ import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IThread;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
/**
*
@ -57,7 +56,6 @@ public class CThread extends CDebugElement
implements IThread,
IState,
IRestart,
IInstructionStep,
IResumeWithoutSignal,
ISwitchToFrame,
ICDIEventListener
@ -608,69 +606,62 @@ public class CThread extends CDebugElement
/* (non-Javadoc)
* @see org.eclipse.debug.core.model.IStep#stepInto()
*/
public void stepInto() throws DebugException
{
public void stepInto() throws DebugException {
if ( !canStepInto() )
return;
try
{
if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
{
try {
if ( !isInstructionsteppingEnabled() ) {
getCDIThread().stepInto();
}
else
{
else {
getCDIThread().stepIntoInstruction();
}
}
catch( CDIException e )
{
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#stepOver()
*/
public void stepOver() throws DebugException
{
public void stepOver() throws DebugException {
if ( !canStepOver() )
return;
try
{
if ( getRealSourceMode() == ISourceMode.MODE_SOURCE )
{
try {
if ( !isInstructionsteppingEnabled() ) {
getCDIThread().stepOver();
}
else
{
else {
getCDIThread().stepOverInstruction();
}
}
catch( CDIException e )
{
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.IStep#stepReturn()
*/
public void stepReturn() throws DebugException
{
public void stepReturn() throws DebugException {
if ( !canStepReturn() )
return;
try
{
try {
getCDIThread().stepReturn();
}
catch( CDIException e )
{
}
catch( CDIException e ) {
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
/*
* (non-Javadoc)
*
* @see org.eclipse.debug.core.model.ITerminate#canTerminate()
*/
public boolean canTerminate()
@ -838,56 +829,6 @@ public class CThread extends CDebugElement
fCurrentStateInfo = info;
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IInstructionStep#canStepIntoInstruction()
*/
public boolean canStepIntoInstruction()
{
return canStepInto();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IInstructionStep#canStepOverInstruction()
*/
public boolean canStepOverInstruction()
{
return canStepOver();
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IInstructionStep#stepIntoInstruction()
*/
public void stepIntoInstruction() throws DebugException
{
if ( !canStepIntoInstruction() )
return;
try
{
getCDIThread().stepIntoInstruction();
}
catch( CDIException e )
{
targetRequestFailed( e.getMessage(), e );
}
}
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IInstructionStep#stepOverInstruction()
*/
public void stepOverInstruction() throws DebugException
{
if ( !canStepOverInstruction() )
return;
try
{
getCDIThread().stepOverInstruction();
}
catch( CDIException e )
{
targetRequestFailed( e.getMessage(), e );
}
}
private void handleSuspendedEvent( ICDISuspendedEvent event )
{
setRunning( false );
@ -1220,4 +1161,8 @@ public class CThread extends CDebugElement
setCurrentStateId( state );
setCurrentStateInfo( null );
}
private boolean isInstructionsteppingEnabled() {
return ((CDebugTarget)getDebugTarget()).isInstructionSteppingEnabled();
}
}