1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

gdb could send a OOB (*stopped) without any reasons.

This commit is contained in:
Alain Magloire 2002-08-15 18:38:59 +00:00
parent 359ef3e7dd
commit e4ff3089d4
5 changed files with 47 additions and 48 deletions

View file

@ -23,7 +23,6 @@ public class MIInferior extends Process {
public final static int SUSPENDED = 1; public final static int SUSPENDED = 1;
public final static int RUNNING = 2; public final static int RUNNING = 2;
public final static int STEPPING = 3;
public final static int TERMINATED = 4; public final static int TERMINATED = 4;
int state = 0; int state = 0;
@ -133,10 +132,6 @@ public class MIInferior extends Process {
return state == RUNNING; return state == RUNNING;
} }
public synchronized boolean isStepping() {
return state == STEPPING;
}
public synchronized boolean isTerminated() { public synchronized boolean isTerminated() {
return state == TERMINATED; return state == TERMINATED;
} }
@ -149,10 +144,6 @@ public class MIInferior extends Process {
state = RUNNING; state = RUNNING;
} }
public synchronized void setStepping() {
state = STEPPING;
}
public synchronized void setTerminated() { public synchronized void setTerminated() {
state = TERMINATED; state = TERMINATED;
notifyAll(); notifyAll();

View file

@ -128,14 +128,14 @@ public class CTarget implements ICDITarget {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getGlobalVariables() * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getGlobalVariables()
*/ */
public ICDIGlobalVariable[] getGlobalVariables() throws CDIException { public ICDIGlobalVariable[] getGlobalVariables() throws CDIException {
return null; return new ICDIGlobalVariable[0];
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterGroups() * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterGroups()
*/ */
public ICDIRegisterGroup[] getRegisterGroups() throws CDIException { public ICDIRegisterGroup[] getRegisterGroups() throws CDIException {
return null; return new ICDIRegisterGroup[0];
} }
/** /**
@ -146,7 +146,7 @@ public class CTarget implements ICDITarget {
} }
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getThread(String) * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getCurrentThread()
*/ */
public ICDIThread getCurrentThread() throws CDIException { public ICDIThread getCurrentThread() throws CDIException {
return null; return null;
@ -188,13 +188,6 @@ public class CTarget implements ICDITarget {
return false; return false;
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isStepping()
*/
public boolean isStepping() {
return session.getMISession().getMIInferior().isRunning();
}
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isSuspended() * @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#isSuspended()
*/ */
@ -232,7 +225,7 @@ public class CTarget implements ICDITarget {
*/ */
public void resume() throws CDIException { public void resume() throws CDIException {
MISession mi = session.getMISession(); MISession mi = session.getMISession();
if (mi.getMIInferior().isRunning() || mi.getMIInferior().isStepping()) { if (mi.getMIInferior().isRunning()) {
throw new CDIException("Inferior already running"); throw new CDIException("Inferior already running");
} else if (mi.getMIInferior().isSuspended()) { } else if (mi.getMIInferior().isSuspended()) {
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();

View file

@ -6,9 +6,9 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIThread;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory; import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIStackListArguments; import org.eclipse.cdt.debug.mi.core.command.MIStackListFrames;
import org.eclipse.cdt.debug.mi.core.output.MIFrame; import org.eclipse.cdt.debug.mi.core.output.MIFrame;
import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo; import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo;
/** /**
* @author alain * @author alain
@ -48,12 +48,10 @@ public class CThread extends CObject implements ICDIThread {
public ICDIStackFrame[] getStackFrames() throws CDIException { public ICDIStackFrame[] getStackFrames() throws CDIException {
MISession mi = getCTarget().getCSession().getMISession(); MISession mi = getCTarget().getCSession().getMISession();
CommandFactory factory = mi.getCommandFactory(); CommandFactory factory = mi.getCommandFactory();
//MIStackListFrames frames = factory.createMIStackListFrames(); MIStackListFrames frames = factory.createMIStackListFrames();
MIStackListArguments frames = factory.createMIStackListArguments(true);
try { try {
mi.postCommand(frames); mi.postCommand(frames);
//MIStackListFramesInfo info = frames.getMIStackListFramesInfo(); MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
MIStackListArgumentsInfo info = frames.getMIStackListArgumentsInfo();
if (info == null) { if (info == null) {
throw new CDIException("Timedout"); throw new CDIException("Timedout");
} }
@ -68,14 +66,6 @@ public class CThread extends CObject implements ICDIThread {
} }
} }
/*
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isStepping()
*
public boolean isStepping() {
return getTarget().isStepping();
}
*/
/** /**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isSuspended() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIThread#isSuspended()
*/ */

View file

@ -3,25 +3,19 @@ package org.eclipse.cdt.debug.mi.core.cdi;
import org.eclipse.cdt.debug.core.cdi.CDIException; import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation;
import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument; import org.eclipse.cdt.debug.core.cdi.model.ICDIArgument;
import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame; import org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDITarget;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable; import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MISession; import org.eclipse.cdt.debug.mi.core.MISession;
import org.eclipse.cdt.debug.mi.core.command.CommandFactory; import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
import org.eclipse.cdt.debug.mi.core.command.MIStackListArguments;
import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals; import org.eclipse.cdt.debug.mi.core.command.MIStackListLocals;
import org.eclipse.cdt.debug.mi.core.output.MIArg; import org.eclipse.cdt.debug.mi.core.output.MIArg;
import org.eclipse.cdt.debug.mi.core.output.MIFrame; import org.eclipse.cdt.debug.mi.core.output.MIFrame;
import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo;
import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo; import org.eclipse.cdt.debug.mi.core.output.MIStackListLocalsInfo;
/** /**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation of type comments go to
* Window>Preferences>Java>Code Generation.
*/ */
public class StackFrame extends CObject implements ICDIStackFrame { public class StackFrame extends CObject implements ICDIStackFrame {
@ -36,15 +30,34 @@ public class StackFrame extends CObject implements ICDIStackFrame {
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArguments() * @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArguments()
*/ */
public ICDIArgument[] getArguments() throws CDIException { public ICDIArgument[] getArguments() throws CDIException {
MIArg[] args = null;
ICDIArgument[] cdiArgs = null;
if (frame != null) { if (frame != null) {
MIArg[] args = frame.getArgs(); MISession mi = getCTarget().getCSession().getMISession();
ICDIArgument[] cargs = new ICDIArgument[args.length]; CommandFactory factory = mi.getCommandFactory();
for (int i = 0; i < cargs.length; i++) { int level = frame.getLevel();
cargs[i] = new Argument(getCTarget(), args[i]); MIStackListArguments listArgs =
factory.createMIStackListArguments(true, level, level);
try {
mi.postCommand(listArgs);
MIStackListArgumentsInfo info = listArgs.getMIStackListArgumentsInfo();
MIFrame[] miFrames = info.getMIFrames();
if (miFrames != null && miFrames.length == 1) {
args = miFrames[0].getArgs();
} }
return cargs; } catch (MIException e) {
//throw new CDIException(e);
} }
return new ICDIArgument[0]; }
if (args != null) {
cdiArgs = new ICDIArgument[args.length];
for (int i = 0; i < cdiArgs.length; i++) {
cdiArgs[i] = new Argument(getCTarget(), args[i]);
}
} else {
cdiArgs = new ICDIArgument[0];
}
return cdiArgs;
} }
/** /**
@ -89,4 +102,13 @@ public class StackFrame extends CObject implements ICDIStackFrame {
return new Location("", "", 0, 0); return new Location("", "", 0, 0);
} }
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLevel()
*/
public int getLevel() {
if (frame != null) {
return frame.getLevel();
}
return 0;
}
} }

View file

@ -203,6 +203,9 @@ public class MIParser {
async.setAsyncClass(asyncClass); async.setAsyncClass(asyncClass);
// Consume the async-class and the comma // Consume the async-class and the comma
buffer.delete(0, i + 1); buffer.delete(0, i + 1);
} else {
async.setAsyncClass(buffer.toString().trim());
buffer.setLength(0);
} }
MIResult[] res = processMIResults(buffer); MIResult[] res = processMIResults(buffer);
async.setMIResults(res); async.setMIResults(res);