diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java index bb192729ac2..e0c5fc5cd23 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/cdi/CThread.java @@ -1,3 +1,8 @@ +/* + * (c) Copyright QNX Software Systems Ltd. 2002. + * All Rights Reserved. + * + */ package org.eclipse.cdt.debug.mi.core.cdi; import org.eclipse.cdt.debug.core.cdi.CDIException; @@ -17,6 +22,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo; public class CThread extends CObject implements ICDIThread { int id; + static StackFrame[] noStack = new StackFrame[0]; public CThread(CTarget target, int threadId) { super(target); @@ -35,6 +41,7 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#finish() */ public void finish() throws CDIException { + getCTarget().setCurrentThread(this); getTarget().finish(); } @@ -42,36 +49,47 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#getStackFrames() */ public ICDIStackFrame[] getStackFrames() throws CDIException { - MISession mi = getCTarget().getCSession().getMISession(); + + StackFrame[] stack = noStack; + CSession session = getCTarget().getCSession(); + VariableManager mgr = (VariableManager)session.getVariableManager(); + + MISession mi = session.getMISession(); CommandFactory factory = mi.getCommandFactory(); MIStackListFrames frames = factory.createMIStackListFrames(); try { + getCTarget().setCurrentThread(this); mi.postCommand(frames); MIStackListFramesInfo info = frames.getMIStackListFramesInfo(); if (info == null) { throw new CDIException("No answer"); } MIFrame[] miFrames = info.getMIFrames(); - StackFrame[] stack = new StackFrame[miFrames.length]; + stack = new StackFrame[miFrames.length]; for (int i = 0; i < stack.length; i++) { stack[i] = new StackFrame(this, miFrames[i]); } return stack; } catch (MIException e) { - throw new CDIException(e.toString()); + //throw new CDIException(e.toString()); + System.out.println(e); + } catch (CDIException e) { + //throw e; + System.out.println(e); } + return stack; } /** * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#setCurrentStackFrame(ICDIStackFrame) */ public void setCurrentStackFrame(StackFrame stackframe) throws CDIException { - getCTarget().setCurrentThread(this); MISession mi = getCTarget().getCSession().getMISession(); CommandFactory factory = mi.getCommandFactory(); int frameNum = stackframe.getLevel(); MIStackSelectFrame frame = factory.createMIStackSelectFrame(frameNum); try { + getCTarget().setCurrentThread(this); mi.postCommand(frame); MIInfo info = frame.getMIInfo(); if (info == null) { @@ -100,6 +118,7 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepInto() */ public void stepInto() throws CDIException { + getCTarget().setCurrentThread(this); getTarget().stepInto(); } @@ -107,6 +126,7 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepIntoInstruction() */ public void stepIntoInstruction() throws CDIException { + getCTarget().setCurrentThread(this); getTarget().stepIntoInstruction(); } @@ -114,6 +134,7 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOver() */ public void stepOver() throws CDIException { + getCTarget().setCurrentThread(this); getTarget().stepOver(); } @@ -121,6 +142,7 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepOverInstruction() */ public void stepOverInstruction() throws CDIException { + getCTarget().setCurrentThread(this); getTarget().stepOverInstruction(); } @@ -128,6 +150,7 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#stepReturn() */ public void stepReturn() throws CDIException { + getCTarget().setCurrentThread(this); getTarget().stepReturn(); } @@ -135,6 +158,7 @@ public class CThread extends CObject implements ICDIThread { * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#suspend() */ public void suspend() throws CDIException { + getCTarget().setCurrentThread(this); getTarget().suspend(); }