1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Set the corresponding thread as current before switching to another frame.

This commit is contained in:
Mikhail Khodjaiants 2002-10-14 05:03:22 +00:00
parent 271c58700c
commit 42ab22b236
5 changed files with 49 additions and 1 deletions

View file

@ -1,3 +1,8 @@
2002-10-14 Mikhail Khodjaiants
* ISwitchToThread.java: New method to get the current thread.
* CDebugTarget.java: Implemented the 'getCurrentThread' method of the 'ISwitchToThread' interface.
* CDebugTarget.java: Fix in the 'setCurrentThread' method.
2002-10-12 Alain Magloire
* core/cdi/model/ICDIMemoryBlock (supportValueModification):

View file

@ -16,5 +16,6 @@ import org.eclipse.debug.core.model.IThread;
*/
public interface ISwitchToThread
{
IThread getCurrentThread() throws DebugException;
void setCurrentThread( IThread thread ) throws DebugException;
}

View file

@ -1798,6 +1798,7 @@ public class CDebugTarget extends CDebugElement
try
{
getCDITarget().setCurrentThread( ((CThread)thread).getCDIThread() );
((CThread)thread).setCurrent( true );
}
catch( CDIException e )
{
@ -1805,6 +1806,20 @@ public class CDebugTarget extends CDebugElement
}
}
/**
* @see org.eclipse.cdt.debug.core.ISwitchToThread#getCurrentThread()
*/
public IThread getCurrentThread() throws DebugException
{
IThread[] threads = getThreads();
for ( int i = 0; i < threads.length; ++i )
{
if ( ((CThread)threads[i]).isCurrent() )
return threads[i];
}
return null;
}
protected ISourceLocator getSourceLocator()
{
return getLaunch().getSourceLocator();

View file

@ -1,3 +1,6 @@
2002-10-14 Mikhail Khodjaiants
* CDebugUIPlugin.java: In the 'selectionChanged' method check if the thread of the new frame is current. If not make it current.
2002-10-11 Mikhail Khodjaiants
* SwitchToDisassemblyActionDelegate.java: Implementation of the 'Switch to disassembly mode' action.
* plugin.properties: Action label and tooltip.

View file

@ -30,6 +30,7 @@ import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.IDebugEventSetListener;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.debug.core.model.IDebugTarget;
import org.eclipse.debug.core.model.IStackFrame;
import org.eclipse.debug.core.model.IThread;
@ -365,7 +366,10 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
{
try
{
((ISwitchToThread)((IThread)element).getDebugTarget()).setCurrentThread( (IThread)element );
if ( !sameThread( (IDebugElement)element ) )
{
((ISwitchToThread)((IThread)element).getDebugTarget()).setCurrentThread( (IThread)element );
}
}
catch( DebugException e )
{
@ -379,6 +383,10 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
{
try
{
if ( !sameThread( (IDebugElement)element ) )
{
((ISwitchToThread)((IStackFrame)element).getDebugTarget()).setCurrentThread( ((IStackFrame)element).getThread() );
}
((ISwitchToFrame)((IStackFrame)element).getThread()).switchToFrame( (IStackFrame)element );
}
catch( DebugException e )
@ -462,4 +470,20 @@ public class CDebugUIPlugin extends AbstractUIPlugin implements ISelectionListen
}
}
}
private boolean sameThread( IDebugElement element ) throws DebugException
{
if ( element.getDebugTarget() instanceof ISwitchToThread )
{
if ( element instanceof IThread )
{
return ((IThread)element).equals( ((ISwitchToThread)element.getDebugTarget()).getCurrentThread() );
}
if ( element instanceof IStackFrame )
{
return ((IStackFrame)element).getThread().equals( ((ISwitchToThread)element.getDebugTarget()).getCurrentThread() );
}
}
return false;
}
}