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:
parent
359ef3e7dd
commit
e4ff3089d4
5 changed files with 47 additions and 48 deletions
|
@ -23,7 +23,6 @@ public class MIInferior extends Process {
|
|||
|
||||
public final static int SUSPENDED = 1;
|
||||
public final static int RUNNING = 2;
|
||||
public final static int STEPPING = 3;
|
||||
public final static int TERMINATED = 4;
|
||||
|
||||
int state = 0;
|
||||
|
@ -133,10 +132,6 @@ public class MIInferior extends Process {
|
|||
return state == RUNNING;
|
||||
}
|
||||
|
||||
public synchronized boolean isStepping() {
|
||||
return state == STEPPING;
|
||||
}
|
||||
|
||||
public synchronized boolean isTerminated() {
|
||||
return state == TERMINATED;
|
||||
}
|
||||
|
@ -149,10 +144,6 @@ public class MIInferior extends Process {
|
|||
state = RUNNING;
|
||||
}
|
||||
|
||||
public synchronized void setStepping() {
|
||||
state = STEPPING;
|
||||
}
|
||||
|
||||
public synchronized void setTerminated() {
|
||||
state = TERMINATED;
|
||||
notifyAll();
|
||||
|
|
|
@ -128,14 +128,14 @@ public class CTarget implements ICDITarget {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getGlobalVariables()
|
||||
*/
|
||||
public ICDIGlobalVariable[] getGlobalVariables() throws CDIException {
|
||||
return null;
|
||||
return new ICDIGlobalVariable[0];
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDITarget#getRegisterGroups()
|
||||
*/
|
||||
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 {
|
||||
return null;
|
||||
|
@ -188,13 +188,6 @@ public class CTarget implements ICDITarget {
|
|||
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()
|
||||
*/
|
||||
|
@ -232,7 +225,7 @@ public class CTarget implements ICDITarget {
|
|||
*/
|
||||
public void resume() throws CDIException {
|
||||
MISession mi = session.getMISession();
|
||||
if (mi.getMIInferior().isRunning() || mi.getMIInferior().isStepping()) {
|
||||
if (mi.getMIInferior().isRunning()) {
|
||||
throw new CDIException("Inferior already running");
|
||||
} else if (mi.getMIInferior().isSuspended()) {
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
|
|
|
@ -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.MISession;
|
||||
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.MIStackListArgumentsInfo;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIStackListFramesInfo;
|
||||
|
||||
/**
|
||||
* @author alain
|
||||
|
@ -48,12 +48,10 @@ public class CThread extends CObject implements ICDIThread {
|
|||
public ICDIStackFrame[] getStackFrames() throws CDIException {
|
||||
MISession mi = getCTarget().getCSession().getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
//MIStackListFrames frames = factory.createMIStackListFrames();
|
||||
MIStackListArguments frames = factory.createMIStackListArguments(true);
|
||||
MIStackListFrames frames = factory.createMIStackListFrames();
|
||||
try {
|
||||
mi.postCommand(frames);
|
||||
//MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
||||
MIStackListArgumentsInfo info = frames.getMIStackListArgumentsInfo();
|
||||
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
||||
if (info == null) {
|
||||
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()
|
||||
*/
|
||||
|
|
|
@ -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.ICDILocation;
|
||||
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.ICDITarget;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
|
||||
import org.eclipse.cdt.debug.mi.core.MIException;
|
||||
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.MIStackListArguments;
|
||||
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.MIFrame;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIStackListArgumentsInfo;
|
||||
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 {
|
||||
|
||||
|
@ -36,15 +30,34 @@ public class StackFrame extends CObject implements ICDIStackFrame {
|
|||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getArguments()
|
||||
*/
|
||||
public ICDIArgument[] getArguments() throws CDIException {
|
||||
MIArg[] args = null;
|
||||
ICDIArgument[] cdiArgs = null;
|
||||
if (frame != null) {
|
||||
MIArg[] args = frame.getArgs();
|
||||
ICDIArgument[] cargs = new ICDIArgument[args.length];
|
||||
for (int i = 0; i < cargs.length; i++) {
|
||||
cargs[i] = new Argument(getCTarget(), args[i]);
|
||||
MISession mi = getCTarget().getCSession().getMISession();
|
||||
CommandFactory factory = mi.getCommandFactory();
|
||||
int level = frame.getLevel();
|
||||
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();
|
||||
}
|
||||
} catch (MIException e) {
|
||||
//throw new CDIException(e);
|
||||
}
|
||||
return cargs;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIStackFrame#getLevel()
|
||||
*/
|
||||
public int getLevel() {
|
||||
if (frame != null) {
|
||||
return frame.getLevel();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -203,6 +203,9 @@ public class MIParser {
|
|||
async.setAsyncClass(asyncClass);
|
||||
// Consume the async-class and the comma
|
||||
buffer.delete(0, i + 1);
|
||||
} else {
|
||||
async.setAsyncClass(buffer.toString().trim());
|
||||
buffer.setLength(0);
|
||||
}
|
||||
MIResult[] res = processMIResults(buffer);
|
||||
async.setMIResults(res);
|
||||
|
|
Loading…
Add table
Reference in a new issue