1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-05 08:46:02 +02:00

Set the current thread and stack and do not throw unecessary exception.

This commit is contained in:
Alain Magloire 2002-08-26 05:21:54 +00:00
parent eaf8bdf762
commit 9cf3fc83e9

View file

@ -1,3 +1,8 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.cdi; package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
@ -44,13 +49,13 @@ public class StackFrame extends CObject implements ICDIStackFrame {
if (frame != null) { if (frame != null) {
CSession session = getCTarget().getCSession(); CSession session = getCTarget().getCSession();
VariableManager mgr = (VariableManager)session.getVariableManager(); VariableManager mgr = (VariableManager)session.getVariableManager();
mgr.update();
MISession mi = session.getMISession(); MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
int level = frame.getLevel(); int level = frame.getLevel();
MIStackListArguments listArgs = MIStackListArguments listArgs =
factory.createMIStackListArguments(false, level, level); factory.createMIStackListArguments(false, level, level);
try { try {
cthread.setCurrentStackFrame(this);
MIArg[] args = null; MIArg[] args = null;
mi.postCommand(listArgs); mi.postCommand(listArgs);
MIStackListArgumentsInfo info = MIStackListArgumentsInfo info =
@ -72,9 +77,16 @@ public class StackFrame extends CObject implements ICDIStackFrame {
cdiArgs = new ICDIArgument[0]; cdiArgs = new ICDIArgument[0];
} }
} catch (MIException e) { } catch (MIException e) {
throw new CDIException(e.toString()); //throw new CDIException(e.toString());
System.err.println(e);
} catch (CDIException e) {
//throw e;
System.err.println(e);
} }
} }
if (cdiArgs == null) {
cdiArgs = new ICDIArgument[0];
}
return cdiArgs; return cdiArgs;
} }
@ -82,15 +94,15 @@ public class StackFrame extends CObject implements ICDIStackFrame {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariables() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLocalVariables()
*/ */
public ICDIVariable[] getLocalVariables() throws CDIException { public ICDIVariable[] getLocalVariables() throws CDIException {
ICDIVariable[] variables = null;
CSession session = getCTarget().getCSession(); CSession session = getCTarget().getCSession();
VariableManager mgr = (VariableManager)session.getVariableManager(); VariableManager mgr = (VariableManager)session.getVariableManager();
mgr.update();
MISession mi = session.getMISession(); MISession mi = session.getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
MIStackListLocals locals = factory.createMIStackListLocals(false); MIStackListLocals locals = factory.createMIStackListLocals(false);
try { try {
cthread.setCurrentStackFrame(this);
MIArg[] args = null; MIArg[] args = null;
ICDIVariable[] variables = null;
mi.postCommand(locals); mi.postCommand(locals);
MIStackListLocalsInfo info = locals.getMIStackListLocalsInfo(); MIStackListLocalsInfo info = locals.getMIStackListLocalsInfo();
if (info == null) { if (info == null) {
@ -105,10 +117,17 @@ public class StackFrame extends CObject implements ICDIStackFrame {
} else { } else {
variables = new ICDIVariable[0]; variables = new ICDIVariable[0];
} }
return variables;
} catch (MIException e) { } catch (MIException e) {
throw new CDIException(e.toString()); //throw new CDIException(e.toString());
System.err.println(e);
} catch (CDIException e) {
//throw e;
System.err.println(e);
} }
if (variables == null) {
variables = new ICDIVariable[0];
}
return variables;
} }
/** /**