From c23c011ae23c37a041e7da811687c4dc30caf8e1 Mon Sep 17 00:00:00 2001 From: Mikhail Khodjaiants Date: Mon, 13 Sep 2004 21:37:11 +0000 Subject: [PATCH] Moved to the new CDI interfaces. --- debug/org.eclipse.cdt.debug.core/ChangeLog | 7 +++++ .../internal/core/model/CDebugTarget.java | 12 ++++---- .../debug/internal/core/model/CSignal.java | 2 +- .../internal/core/model/CStackFrame.java | 30 ++++++------------- .../debug/internal/core/model/CThread.java | 20 ++++++++----- 5 files changed, 35 insertions(+), 36 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 1eb460f1859..905a42b4f8c 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,10 @@ +2004-09-13 Mikhail Khodjaiants + Moved to the new CDI interfaces. + * CDebugTarget.java + * CSignal.java + * CStackFrame.java + * CThread.java + 2004-09-13 Mikhail Khodjaiants Fix for bug 72555: "Toggle breakpoint" action doesn't remove function breakpoints from editor. * CDIDebugModel.java diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index de2dceb497e..c96e36aade6 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -487,7 +487,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv public void run() { try { - getCDITarget().resume(); + getCDITarget().resume( false ); } catch( CDIException e ) { setState( oldState ); @@ -1350,7 +1350,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv } ICDILocation location = getCDITarget().createLocation( fileName, null, lineNumber ); try { - getCDITarget().runUntil( location ); + getCDITarget().stepUntil( location ); } catch( CDIException e ) { if ( skipBreakpoints ) { @@ -1537,7 +1537,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv } ICDILocation location = getCDITarget().createLocation( address ); try { - getCDITarget().runUntil( location ); + getCDITarget().stepUntil( location ); } catch( CDIException e ) { if ( skipBreakpoints ) { @@ -1567,7 +1567,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv public void run() { try { - getCDITarget().signal(); + getCDITarget().resume( false ); } catch( CDIException e ) { setState( oldState ); @@ -1615,7 +1615,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv return; ICDILocation location = getCDITarget().createLocation( fileName, null, lineNumber ); try { - getCDITarget().jump( location ); + getCDITarget().resume( location ); } catch( CDIException e ) { targetRequestFailed( e.getMessage(), e ); @@ -1638,7 +1638,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv return; ICDILocation location = getCDITarget().createLocation( address ); try { - getCDITarget().jump( location ); + getCDITarget().resume( location ); } catch( CDIException e ) { targetRequestFailed( e.getMessage(), e ); diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSignal.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSignal.java index 1fd7f1735f9..fa598440997 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSignal.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CSignal.java @@ -107,7 +107,7 @@ public class CSignal extends CDebugElement implements ICSignal, ICDIEventListene { try { - getCDITarget().signal( getCDISignal() ); + getCDITarget().resume( getCDISignal() ); } catch( CDIException e ) { diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java index db97a689aef..fec2b540c44 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java @@ -234,7 +234,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart */ public boolean canStepInto() { try { - return exists() && isTopStackFrame() && getThread().canStepInto(); + return exists() /*&& isTopStackFrame()*/ && getThread().canStepInto(); } catch( DebugException e ) { logError( e ); @@ -295,34 +295,22 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart * @see org.eclipse.debug.core.model.IStep#stepOver() */ public void stepOver() throws DebugException { - if ( !canStepOver() ) { - return; - } - if ( isTopStackFrame() ) { + if ( canStepOver() ) { getThread().stepOver(); } - else { - // ((CThread)getThread()).stepToFrame( this ); - getThread().stepOver(); // for now - } } /* (non-Javadoc) * @see org.eclipse.debug.core.model.IStep#stepReturn() */ public void stepReturn() throws DebugException { - if ( !canStepReturn() ) { - return; - } - if ( isTopStackFrame() ) { - getThread().stepReturn(); - } - else { - /* - * List frames = ((CThread)getThread()).computeStackFrames(); int index = frames.indexOf( this ); if ( index >= 0 && index < frames.size() - 1 ) { - * IStackFrame nextFrame = (IStackFrame)frames.get( index + 1 ); ((CThread)getThread()).stepToFrame( nextFrame ); } - */ - getThread().stepReturn(); // for now + if ( canStepReturn() ) { + try { + getCDIStackFrame().stepReturn(); + } + catch( CDIException e ) { + targetRequestFailed( e.getMessage(), null ); + } } } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java index 45004878aba..6627f84c5e8 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CThread.java @@ -425,7 +425,7 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum public void run() { try { - getCDIThread().resume(); + getCDIThread().resume( false ); } catch( CDIException e ) { setState( oldState ); @@ -521,10 +521,10 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum public void run() { try { if ( !isInstructionsteppingEnabled() ) { - getCDIThread().stepInto(); + getCDIThread().stepInto( 1 ); } else { - getCDIThread().stepIntoInstruction(); + getCDIThread().stepIntoInstruction( 1 ); } } catch( CDIException e ) { @@ -548,10 +548,10 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum public void run() { try { if ( !isInstructionsteppingEnabled() ) { - getCDIThread().stepOver(); + getCDIThread().stepOver( 1 ); } else { - getCDIThread().stepOverInstruction(); + getCDIThread().stepOverInstruction( 1 ); } } catch( CDIException e ) { @@ -568,15 +568,19 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum public void stepReturn() throws DebugException { if ( !canStepReturn() ) return; + IStackFrame[] frames = getStackFrames(); + if ( frames.length == 0 ) + return; + final IStackFrame f = frames[0]; final CDebugElementState oldState = getState(); setState( CDebugElementState.STEPPING ); DebugPlugin.getDefault().asyncExec( new Runnable() { public void run() { try { - getCDIThread().stepReturn(); + f.stepReturn(); } - catch( CDIException e ) { + catch( DebugException e ) { setState( oldState ); failed( CoreModelMessages.getString( "CThread.6" ), e ); //$NON-NLS-1$ } @@ -923,7 +927,7 @@ public class CThread extends CDebugElement implements ICThread, IRestart, IResum return ((CDebugTarget)getDebugTarget()).isInstructionSteppingEnabled(); } - protected void failed( String message, CDIException e ) { + protected void failed( String message, Throwable e ) { MultiStatus ms = new MultiStatus( CDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, message, null ); ms.add( new Status( IStatus.ERROR, CDebugModel.getPluginIdentifier(), ICDebugInternalConstants.STATUS_CODE_ERROR, e.getMessage(), e ) ); CDebugUtils.error( ms, this );