From 1b5eec73188de24e51aecbbbb04a42d8ff9a5670 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Wed, 30 Jun 2004 02:21:28 +0000 Subject: [PATCH] When selecting threads gdb can reset the current stack frame on us. We should be aware of it and reset. * cdi/org/eclipse/cdt/debug/mi/core/cdi/mode/Target.java --- debug/org.eclipse.cdt.debug.mi.core/ChangeLog | 7 +++++++ .../eclipse/cdt/debug/mi/core/cdi/model/Target.java | 10 ++++++++++ 2 files changed, 17 insertions(+) diff --git a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog index 00f094e58ff..5e68df78c77 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.mi.core/ChangeLog @@ -1,3 +1,10 @@ +2004-06-29 Alain Magloire + + When selecting threads gdb can reset the current + stack frame on us. We should be aware of it and reset. + + * cdi/org/eclipse/cdt/debug/mi/core/cdi/mode/Target.java + 2004-06-24 Alain Magloire Fix 68226 diff --git a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java index f0c558094f7..12754f3795d 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java +++ b/debug/org.eclipse.cdt.debug.mi.core/cdi/org/eclipse/cdt/debug/mi/core/cdi/model/Target.java @@ -46,6 +46,7 @@ import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent; import org.eclipse.cdt.debug.mi.core.event.MIThreadCreatedEvent; import org.eclipse.cdt.debug.mi.core.event.MIThreadExitEvent; import org.eclipse.cdt.debug.mi.core.output.MIDataEvaluateExpressionInfo; +import org.eclipse.cdt.debug.mi.core.output.MIFrame; import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfoThreadsInfo; import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo; @@ -130,6 +131,15 @@ public class Target implements ICDITarget { throw new CDIException(CdiResources.getString("cdi.model.Target.Target_not_responding")); //$NON-NLS-1$ } currentThreadId = info.getNewThreadId(); + + // @^&#@^$*^$ + // GDB reset the currentFrame to some other level 0 when switching thread. + // we need to reposition the current stack level. + MIFrame miFrame = info.getFrame(); + if (miFrame != null) { + int depth = cthread.getStackFrameCount(); + cthread.currentFrame = new StackFrame(cthread, miFrame, depth - miFrame.getLevel()); + } } catch (MIException e) { throw new MI2CDIException(e); }