When switching between frames from different
threads the current thread doesn't set correctly.
Index:
ChangeLog
===================================================================
RCS
file: /home/tools/org.eclipse.cdt.debug.core/ChangeLog,v
retrieving revision
1.12
diff -u -r1.12 ChangeLog
--- ChangeLog 13 Oct 2002 02:33:31
-0000 1.12
+++ ChangeLog 14 Oct 2002 04:56:37 -0000
@@ -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):
Index:
src/org/eclipse/cdt/debug/core/ISwitchToThread.java
===================================================================
RCS
file:
/home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ISwitchToThread.java,v
retrieving
revision 1.1
diff -u -r1.1 ISwitchToThread.java
---
src/org/eclipse/cdt/debug/core/ISwitchToThread.java 20 Sep 2002 15:12:53
-0000 1.1
+++
src/org/eclipse/cdt/debug/core/ISwitchToThread.java 14 Oct 2002 04:56:37
-0000
@@ -16,5 +16,6 @@
*/
public interface
ISwitchToThread
{
+ IThread getCurrentThread() throws
DebugException;
void setCurrentThread( IThread thread )
throws DebugException;
}
Index:
src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java
===================================================================
RCS
file:
/home/tools/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java,v
retrieving
revision 1.43
diff -u -r1.43 CDebugTarget.java
---
src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 11 Oct 2002
21:41:50 -0000 1.43
+++
src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java 14 Oct 2002
04:56:40 -0000
@@ -1798,11 +1798,26
@@
try
{
getCDITarget().setCurrentThread(
((CThread)thread).getCDIThread()
);
+ ((CThread)thread).setCurrent( true
);
}
catch( CDIException e
)
{
targetRequestFailed(
e.getMessage(), null
);
}
+ }
+
+ /**
+ * @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()
Index:
ChangeLog
===================================================================
RCS
file: /home/tools/org.eclipse.cdt.debug.ui/ChangeLog,v
retrieving revision
1.1
diff -u -r1.1 ChangeLog
--- ChangeLog 11 Oct 2002 21:51:18
-0000 1.1
+++ ChangeLog 14 Oct 2002 05:00:43 -0000
@@ -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.
Index:
src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java
===================================================================
RCS
file:
/home/tools/org.eclipse.cdt.debug.ui/src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java,v
retrieving
revision 1.9
diff -u -r1.9 CDebugUIPlugin.java
---
src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java 9 Oct 2002 23:10:16
-0000 1.9
+++ src/org/eclipse/cdt/debug/ui/CDebugUIPlugin.java 14
Oct 2002 05:00:44 -0000
@@ -30,6 +30,7 @@
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
@@
{
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
@@
{
try
{
+ if
( !sameThread( (IDebugElement)element )
)
+ {
+ ((ISwitchToThread)((IStackFrame)element).getDebugTarget()).setCurrentThread(
((IStackFrame)element).getThread()
);
+ }
((ISwitchToFrame)((IStackFrame)element).getThread()).switchToFrame(
(IStackFrame)element
);
}
catch(
DebugException e )
@@ -461,5 +469,21
@@
}
}
}
+ }
+
+ 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;
}
}