1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-07 17:56:01 +02:00

first framework to implement cdi.

This commit is contained in:
Alain Magloire 2002-08-08 04:07:00 +00:00
parent 0fecb04151
commit dda2bd3297
80 changed files with 1790 additions and 146 deletions

View file

@ -4,5 +4,6 @@
<classpathentry kind="src" path="/org.eclipse.core.runtime"/> <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
<classpathentry kind="src" path="/org.eclipse.core.boot"/> <classpathentry kind="src" path="/org.eclipse.core.boot"/>
<classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/> <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
<classpathentry kind="src" path="/org.eclipse.cdt.debug.core"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>

View file

@ -3,6 +3,7 @@
<name>org.eclipse.cdt.debug.mi.core</name> <name>org.eclipse.cdt.debug.mi.core</name>
<comment></comment> <comment></comment>
<projects> <projects>
<project>org.eclipse.cdt.debug.core</project>
<project>org.eclipse.core.boot</project> <project>org.eclipse.core.boot</project>
<project>org.eclipse.core.runtime</project> <project>org.eclipse.core.runtime</project>
</projects> </projects>

View file

@ -0,0 +1,28 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core;
/**
* Help class to specify formats.
*/
public final class MIFormat {
public final static int HEXADECIMAL = 0;
public final static int OCTAL = 1;
public final static int BINARY = 2;
public final static int DECIMAL = 3;
public final static int RAW = 4;
public final static int NATURAL = 5;
public final static int FLOAT = 10;
public final static int ADDRESS = 11;
public final static int INSTRUCTION = 12;
public final static int CHAR = 13;
public final static int STRING = 14;
public final static int UNSIGNED = 15;
// no instanciation.
private MIFormat() {
}
}

View file

@ -1,3 +1,7 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core; package org.eclipse.cdt.debug.mi.core;
import java.io.InputStream; import java.io.InputStream;
@ -7,7 +11,7 @@ import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.Plugin; import org.eclipse.core.runtime.Plugin;
/** /**
* * GDB/MI Plugin.
*/ */
public class MIPlugin extends Plugin { public class MIPlugin extends Plugin {

View file

@ -1,3 +1,7 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core; package org.eclipse.cdt.debug.mi.core;
import java.io.IOException; import java.io.IOException;
@ -175,6 +179,10 @@ public class MISession extends Observable {
} }
} }
public boolean isTerminated() {
return (!txThread.isAlive() || !rxThread.isAlive());
}
/** /**
* Close the MISession. * Close the MISession.
*/ */

View file

@ -1,9 +1,8 @@
package org.eclipse.cdt.debug.mi.core;
/* /*
* (c) Copyright QNX Software Systems Ltd. 2002. * (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved. * All Rights Reserved.
*/ */
package org.eclipse.cdt.debug.mi.core;
import java.util.Collections; import java.util.Collections;
import java.util.LinkedList; import java.util.LinkedList;
@ -11,6 +10,9 @@ import java.util.List;
import org.eclipse.cdt.debug.mi.core.command.Command; import org.eclipse.cdt.debug.mi.core.command.Command;
/**
* Simple thread-safe Queue implemetation.
*/
public class Queue { public class Queue {
private List list; private List list;

View file

@ -1,3 +1,7 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core; package org.eclipse.cdt.debug.mi.core;
import java.io.BufferedReader; import java.io.BufferedReader;
@ -31,12 +35,9 @@ import org.eclipse.cdt.debug.mi.core.output.MIStreamRecord;
import org.eclipse.cdt.debug.mi.core.output.MITargetStreamOutput; import org.eclipse.cdt.debug.mi.core.output.MITargetStreamOutput;
import org.eclipse.cdt.debug.mi.core.output.MIValue; import org.eclipse.cdt.debug.mi.core.output.MIValue;
/* /**
* (c) Copyright QNX Software Systems Ltd. 2002. * Receiving thread of gdb, read the input channel.
* All Rights Reserved.
*/ */
public class RxThread extends Thread { public class RxThread extends Thread {
final MISession session; final MISession session;

View file

@ -1,15 +1,19 @@
package org.eclipse.cdt.debug.mi.core;
/* /*
* (c) Copyright QNX Software Systems Ltd. 2002. * (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved. * All Rights Reserved.
*/ */
package org.eclipse.cdt.debug.mi.core;
import java.io.IOException; import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import org.eclipse.cdt.debug.mi.core.command.Command; import org.eclipse.cdt.debug.mi.core.command.Command;
/**
* Transmission command thread blocks on the command Queue
* and wake cmd are available and push them to gdb out channel.
*/
public class TxThread extends Thread { public class TxThread extends Thread {
MISession session; MISession session;

View file

@ -0,0 +1,110 @@
/*
*(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;
import org.eclipse.cdt.debug.core.cdi.ICBreakpoint;
import org.eclipse.cdt.debug.core.cdi.ICBreakpointManager;
import org.eclipse.cdt.debug.core.cdi.ICCatchEvent;
import org.eclipse.cdt.debug.core.cdi.ICCatchpoint;
import org.eclipse.cdt.debug.core.cdi.ICCondition;
import org.eclipse.cdt.debug.core.cdi.ICLocation;
import org.eclipse.cdt.debug.core.cdi.ICLocationBreakpoint;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.ICWatchpoint;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
*
*/
public class BreakpointManager implements ICBreakpointManager {
MISession session;
public BreakpointManager(MISession s) {
session = s;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#deleteAllBreakpoints()
*/
public void deleteAllBreakpoints() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#deleteBreakpoint(ICBreakpoint)
*/
public void deleteBreakpoint(ICBreakpoint breakpoint) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#deleteBreakpoints(ICBreakpoint[])
*/
public void deleteBreakpoints(ICBreakpoint[] breakpoints)
throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#getBreakpoint(String)
*/
public ICBreakpoint getBreakpoint(String breakpointId)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#getBreakpoints()
*/
public ICBreakpoint[] getBreakpoints() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#setCatchpoint(int, ICCatchEvent, String, ICCondition, boolean)
*/
public ICCatchpoint setCatchpoint(
int type,
ICCatchEvent event,
String expression,
ICCondition condition,
boolean enabled)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#setLocationBreakpoint(int, ICLocation, ICCondition, boolean, String)
*/
public ICLocationBreakpoint setLocationBreakpoint(
int type,
ICLocation location,
ICCondition condition,
boolean enabled,
String threadId)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICBreakpointManager#setWatchpoint(int, int, String, ICCondition, boolean)
*/
public ICWatchpoint setWatchpoint(
int type,
int watchType,
String expression,
ICCondition condition,
boolean enabled)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSessionObject#getSession()
*/
public ICSession getSession() {
return null;
}
}

View file

@ -0,0 +1,126 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.cdi;
import java.util.Properties;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICBreakpointManager;
import org.eclipse.cdt.debug.core.cdi.ICEventManager;
import org.eclipse.cdt.debug.core.cdi.ICExpressionManager;
import org.eclipse.cdt.debug.core.cdi.ICMemoryManager;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.ICSignalManager;
import org.eclipse.cdt.debug.core.cdi.ICSourceManager;
import org.eclipse.cdt.debug.core.cdi.model.ICTarget;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession
*/
public class CSession implements ICSession {
Properties props;
MISession session;
BreakpointManager breakpointManager;
EventManager eventManager;
ExpressionManager expressionManager;
MemoryManager memoryManager;
SignalManager signalManager;
SourceManager sourceManager;
CTarget ctarget;
public CSession(MISession s) {
session = s;
props = new Properties();
breakpointManager = new BreakpointManager(session);
eventManager = new EventManager(session);
expressionManager = new ExpressionManager(session);
memoryManager = new MemoryManager(session);
signalManager = new SignalManager(session);
sourceManager = new SourceManager(session);
ctarget = new CTarget(session);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getAttribute(String)
*/
public String getAttribute(String key) {
return props.getProperty(key);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getBreakpointManager()
*/
public ICBreakpointManager getBreakpointManager() {
return breakpointManager;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getEventManager()
*/
public ICEventManager getEventManager() {
return eventManager;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getExpressionManager()
*/
public ICExpressionManager getExpressionManager() {
return expressionManager;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getMemoryManager()
*/
public ICMemoryManager getMemoryManager() {
return memoryManager;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getSignalManager()
*/
public ICSignalManager getSignalManager() {
return signalManager;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getSourceManager()
*/
public ICSourceManager getSourceManager() {
return sourceManager;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#getTargets()
*/
public ICTarget[] getTargets() {
return new ICTarget[]{ctarget};
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#isTerminated()
*/
public boolean isTerminated() {
return session.isTerminated();
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#setAttribute(String, String)
*/
public void setAttribute(String key, String value) {
props.setProperty(key, value);
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSession#terminate()
*/
public void terminate() throws CDIException {
session.terminate();
}
}

View file

@ -0,0 +1,234 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.cdi;
import java.io.InputStream;
import java.io.OutputStream;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.model.ICExpression;
import org.eclipse.cdt.debug.core.cdi.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.cdi.model.ICMemoryBlock;
import org.eclipse.cdt.debug.core.cdi.model.ICObject;
import org.eclipse.cdt.debug.core.cdi.model.ICRegisterGroup;
import org.eclipse.cdt.debug.core.cdi.model.ICSharedLibrary;
import org.eclipse.cdt.debug.core.cdi.model.ICTarget;
import org.eclipse.cdt.debug.core.cdi.model.ICThread;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @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 CTarget implements ICTarget {
MISession session;
public CTarget(MISession s) {
session = s;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#disconnect()
*/
public void disconnect() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#evaluateExpression(ICExpression)
*/
public void evaluateExpression(ICExpression expression)
throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#evaluateExpression(String)
*/
public ICExpression evaluateExpression(String expressionText)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#finish()
*/
public void finish() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getCMemoryBlock(long, long)
*/
public ICMemoryBlock getCMemoryBlock(long startAddress, long length)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getErrorStream()
*/
public InputStream getErrorStream() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getGlobalVariables()
*/
public ICGlobalVariable[] getGlobalVariables() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getInputStream()
*/
public InputStream getInputStream() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getOutputStream()
*/
public OutputStream getOutputStream() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getRegisterGroups()
*/
public ICRegisterGroup[] getRegisterGroups() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getSession()
*/
public ICSession getSession() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getSharedLibraries()
*/
public ICSharedLibrary[] getSharedLibraries() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getThread(String)
*/
public ICThread getThread(String id) throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#getThreads()
*/
public ICThread[] getThreads() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#isDisconnected()
*/
public boolean isDisconnected() {
return false;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#isStepping()
*/
public boolean isStepping() {
return false;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#isSuspended()
*/
public boolean isSuspended() {
return false;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#isTerminated()
*/
public boolean isTerminated() {
return false;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#restart()
*/
public void restart() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#resume()
*/
public void resume() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#stepInto()
*/
public void stepInto() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#stepIntoInstruction()
*/
public void stepIntoInstruction() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#stepOver()
*/
public void stepOver() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#stepOverInstruction()
*/
public void stepOverInstruction() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#suspend()
*/
public void suspend() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICTarget#terminate()
*/
public void terminate() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICObject#getCDITarget()
*/
public ICTarget getCDITarget() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICObject#getId()
*/
public String getId() {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.model.ICObject#getParent()
*/
public ICObject getParent() {
return null;
}
}

View file

@ -0,0 +1,48 @@
/*
*(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.ICEventManager;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.event.ICEventListener;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @author alain
*
* To change this generated comment edit the template variable "typecomment":
* Window>Preferences>Java>Templates.
* To enable and disable the creation oEventManagerts go to
* Window>Preferences>Java>Code Generation.
*/
public class EventManager implements ICEventManager {
MISession session;
public EventManager(MISession s) {
session = s;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICEventManager#addEventListener(ICEventListener)
*/
public void addEventListener(ICEventListener listener) {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICEventManager#removeEventListener(ICEventListener)
*/
public void removeEventListener(ICEventListener listener) {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSessionObject#getSession()
*/
public ICSession getSession() {
return null;
}
}

View file

@ -0,0 +1,71 @@
/*
*(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;
import org.eclipse.cdt.debug.core.cdi.ICExpressionManager;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.model.ICExpression;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @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 ExpressionManager implements ICExpressionManager {
MISession session;
public ExpressionManager(MISession s) {
session = s;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICExpressionManager#addExpression(ICExpression)
*/
public void addExpression(ICExpression expression) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICExpressionManager#getExpression(String)
*/
public ICExpression getExpression(String expressionId)
throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICExpressionManager#getExpressions()
*/
public ICExpression[] getExpressions() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICExpressionManager#removeExpression(ICExpression)
*/
public void removeExpression(ICExpression expression) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICExpressionManager#removeExpressions(ICExpression[])
*/
public void removeExpressions(ICExpression[] expressions)
throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSessionObject#getSession()
*/
public ICSession getSession() {
return null;
}
}

View file

@ -0,0 +1,76 @@
/*
*(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;
import org.eclipse.cdt.debug.core.cdi.ICMemoryManager;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.model.ICMemoryBlock;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @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 MemoryManager implements ICMemoryManager {
MISession session;
public MemoryManager(MISession s) {
session = s;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICMemoryManager#addBlock(ICMemoryBlock)
*/
public void addBlock(ICMemoryBlock memoryBlock) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICMemoryManager#getBlock(String)
*/
public ICMemoryBlock getBlock(String id) throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICMemoryManager#getBlocks()
*/
public ICMemoryBlock[] getBlocks() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICMemoryManager#removeAllBlocks()
*/
public void removeAllBlocks() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICMemoryManager#removeBlock(ICMemoryBlock)
*/
public void removeBlock(ICMemoryBlock memoryBlock) {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICMemoryManager#removeBlocks(ICMemoryBlock[])
*/
public void removeBlocks(ICMemoryBlock[] memoryBlocks)
throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSessionObject#getSession()
*/
public ICSession getSession() {
return null;
}
}

View file

@ -0,0 +1,44 @@
/*
*(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;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.ICSignal;
import org.eclipse.cdt.debug.core.cdi.ICSignalManager;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @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 SignalManager implements ICSignalManager {
MISession session;
public SignalManager(MISession s) {
session = s;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSignalManager#getSignals()
*/
public ICSignal[] getSignals() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSessionObject#getSession()
*/
public ICSession getSession() {
return null;
}
}

View file

@ -0,0 +1,57 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.cdi;
import java.io.File;
import org.eclipse.cdt.debug.core.cdi.CDIException;
import org.eclipse.cdt.debug.core.cdi.ICSession;
import org.eclipse.cdt.debug.core.cdi.ICSourceManager;
import org.eclipse.cdt.debug.mi.core.MISession;
/**
* @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 SourceManager implements ICSourceManager {
MISession session;
public SourceManager(MISession s) {
session = s;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSourceManager#getDirectories()
*/
public File[] getDirectories() throws CDIException {
return null;
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSourceManager#reset()
*/
public void reset() throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSourceManager#set(File[])
*/
public void set(File[] directories) throws CDIException {
}
/**
* @see org.eclipse.cdt.debug.core.cdi.ICSessionObject#getSession()
*/
public ICSession getSession() {
return null;
}
}

View file

@ -10,7 +10,6 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput; import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/** /**
*
* Represents a CLI command. * Represents a CLI command.
*/ */
public class CLICommand extends Command public class CLICommand extends Command
@ -28,6 +27,8 @@ public class CLICommand extends Command
* @return the text representation of this command * @return the text representation of this command
*/ */
public String toString(){ public String toString(){
if (operation.endsWith("\n"))
return operation; return operation;
return operation + "\n";
} }
} }

View file

@ -11,11 +11,7 @@ import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput; import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/** /**
*
* A base class for all mi requests. * A base class for all mi requests.
*
* @author Mikhail Khodjaiants
* @since Jul 11, 2002
*/ */
public abstract class Command public abstract class Command
{ {

View file

@ -1,9 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.command; package org.eclipse.cdt.debug.mi.core.command;
/** /**
* * Factory to create GDB commands.
*/ */
public class CommandFactory { public class CommandFactory {
@ -68,8 +71,8 @@ public class CommandFactory {
return new MIDataListRegisterValues(fmt, regno); return new MIDataListRegisterValues(fmt, regno);
} }
public MIDataReadMemory createMIDataReadMemory(int offset, String address, public MIDataReadMemory createMIDataReadMemory(long offset, String address,
String wordFormat, int wordSize, int wordFormat, int wordSize,
int rows, int cols, Character asChar) { int rows, int cols, Character asChar) {
return new MIDataReadMemory(offset, address, wordFormat, wordSize, return new MIDataReadMemory(offset, address, wordFormat, wordSize,
rows, cols, asChar); rows, cols, asChar);
@ -147,6 +150,14 @@ public class CommandFactory {
return new MIGDBExit(); return new MIGDBExit();
} }
public MIGDBSet createMIGDBSet(String[] params) {
return new MIGDBSet(params);
}
public MIGDBShow createMIGDBShow(String[] params) {
return new MIGDBShow(params);
}
public MIStackInfoDepth createMIStackInfoDepth(int depth) { public MIStackInfoDepth createMIStackInfoDepth(int depth) {
return new MIStackInfoDepth(depth); return new MIStackInfoDepth(depth);
} }

View file

@ -8,10 +8,11 @@ package org.eclipse.cdt.debug.mi.core.command;
/** /**
* *
* -break-after NUMBER COUNT
* The breakpoint number NUMBER is not in effect until it has been hit
* COUNT times.
* *
* -break-condition NUMBER EXPR
*
* Breakpoint NUMBER will stop the program only if the condition in
* EXPR is true. The condition becomes part of the `-break-list' output
* Result: * Result:
* ^done * ^done
*/ */

View file

@ -7,6 +7,7 @@
package org.eclipse.cdt.debug.mi.core.command; package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MIFormat;
import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterValuesInfo; import org.eclipse.cdt.debug.mi.core.output.MIDataListRegisterValuesInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput; import org.eclipse.cdt.debug.mi.core.output.MIOutput;
@ -24,13 +25,6 @@ import org.eclipse.cdt.debug.mi.core.output.MIOutput;
*/ */
public class MIDataListRegisterValues extends MICommand public class MIDataListRegisterValues extends MICommand
{ {
public final static int HEXADECIMAL = 0;
public final static int OCTAL = 1;
public final static int BINARY = 2;
public final static int DECIMAL = 3;
public final static int RAW = 4;
public final static int NATURAL = 5;
public MIDataListRegisterValues(int fmt) { public MIDataListRegisterValues(int fmt) {
this(fmt, null); this(fmt, null);
} }
@ -40,27 +34,30 @@ public class MIDataListRegisterValues extends MICommand
String format = "x"; String format = "x";
switch (fmt) { switch (fmt) {
case NATURAL: case MIFormat.NATURAL:
format = "N"; format = "N";
break; break;
case RAW:
case MIFormat.RAW:
format = "r"; format = "r";
break; break;
case DECIMAL:
case MIFormat.DECIMAL:
format = "d"; format = "d";
break; break;
case BINARY:
case MIFormat.BINARY:
format = "t"; format = "t";
break; break;
case OCTAL:
case MIFormat.OCTAL:
format = "o"; format = "o";
break; break;
/*
case HEXADECIMAL: case MIFormat.HEXADECIMAL:
default: default:
format = "x"; format = "x";
break; break;
*/
} }
setOptions(new String[]{format}); setOptions(new String[]{format});

View file

@ -7,6 +7,7 @@
package org.eclipse.cdt.debug.mi.core.command; package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIException; import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.MIFormat;
import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo; import org.eclipse.cdt.debug.mi.core.output.MIDataReadMemoryInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo; import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput; import org.eclipse.cdt.debug.mi.core.output.MIOutput;
@ -49,22 +50,81 @@ import org.eclipse.cdt.debug.mi.core.output.MIOutput;
* *
* *
*/ */
public class MIDataReadMemory extends MICommand public class MIDataReadMemory extends MICommand {
{
public MIDataReadMemory (int offset, String address, public MIDataReadMemory(
String wordFormat, int wordSize, long offset,
int rows, int cols, Character asChar) { String address,
int wordFormat,
int wordSize,
int rows,
int cols,
Character asChar) {
super("-data-read-memory"); super("-data-read-memory");
if (offset != 0) { if (offset != 0) {
setOptions(new String[]{"-o", Integer.toString(offset)}); setOptions(new String[] { "-o", Long.toString(offset)});
} }
String format = "x";
switch (wordFormat) {
case MIFormat.UNSIGNED :
format = "u";
break;
case MIFormat.FLOAT :
format = "f";
break;
case MIFormat.ADDRESS :
format = "a";
break;
case MIFormat.INSTRUCTION :
format = "i";
break;
case MIFormat.CHAR :
format = "c";
break;
case MIFormat.STRING :
format = "s";
break;
case MIFormat.DECIMAL :
format = "d";
break;
case MIFormat.BINARY :
format = "t";
break;
case MIFormat.OCTAL :
format = "o";
break;
case MIFormat.HEXADECIMAL :
default :
format = "x";
break;
}
if (asChar == null) { if (asChar == null) {
setParameters(new String[]{address, wordFormat, Integer.toString(wordSize), setParameters(
Integer.toString(rows), Integer.toString(cols)}); new String[] {
address,
format,
Integer.toString(wordSize),
Integer.toString(rows),
Integer.toString(cols)});
} else { } else {
setParameters(new String[]{address, wordFormat, Integer.toString(wordSize), setParameters(
Integer.toString(rows), Integer.toString(cols), new String[] {
address,
format,
Integer.toString(wordSize),
Integer.toString(rows),
Integer.toString(cols),
asChar.toString()}); asChar.toString()});
} }
} }

View file

@ -6,6 +6,11 @@
package org.eclipse.cdt.debug.mi.core.command; package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.output.MIEnvironmentPWDInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/** /**
* *
* -environment-pwd * -environment-pwd
@ -18,4 +23,17 @@ public class MIEnvironmentPWD extends MICommand
public MIEnvironmentPWD() { public MIEnvironmentPWD() {
super("-environment-pwd"); super("-environment-pwd");
} }
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();
if (out != null) {
info = new MIEnvironmentPWDInfo(out);
if (info.isError()) {
throw new MIException(info.getErrorMsg());
}
}
return info;
}
} }

View file

@ -26,17 +26,4 @@ public class MIExecStepInstruction extends MICommand
public MIExecStepInstruction() { public MIExecStepInstruction() {
super("-exec-step-instruction"); super("-exec-step-instruction");
} }
/*
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();
if (out != null) {
info = new MIExecStepInstructionInfo(out);
if (info.isError()) {
throw new MIException(info.getErrorMsg());
}
}
return info;
}
*/
} }

View file

@ -0,0 +1,21 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -gdb-set
*
* Set an internal GDB variable.
*
*/
public class MIGDBSet extends MICommand
{
public MIGDBSet(String[] params) {
super("-gdb-set", params);
}
}

View file

@ -0,0 +1,38 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIException;
import org.eclipse.cdt.debug.mi.core.output.MIGDBShowInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/**
*
* -gdb-show
*
* Show the current value of a GDB variable.
*
*/
public class MIGDBShow extends MICommand
{
public MIGDBShow(String[] params) {
super("-gdb-show", params);
}
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();
if (out != null) {
info = new MIGDBShowInfo(out);
if (info.isError()) {
throw new MIException(info.getErrorMsg());
}
}
return info;
}
}

View file

@ -6,6 +6,8 @@
package org.eclipse.cdt.debug.mi.core.command; package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIFormat;
/** /**
* *
* -var-set-format NAME FORMAT-SPEC * -var-set-format NAME FORMAT-SPEC
@ -21,33 +23,27 @@ package org.eclipse.cdt.debug.mi.core.command;
*/ */
public class MIVarSetFormat extends MICommand public class MIVarSetFormat extends MICommand
{ {
public final static int HEXADECIMAL = 0;
public final static int OCTAL = 1;
public final static int BINARY = 2;
public final static int DECIMAL = 3;
// public final static int RAW = 4;
public final static int NATURAL = 5;
public MIVarSetFormat(String name, int fmt) { public MIVarSetFormat(String name, int fmt) {
super("-var-set-format"); super("-var-set-format");
String format = "hexadecimal"; String format = "hexadecimal";
switch (fmt) { switch (fmt) {
case NATURAL: case MIFormat.NATURAL:
format = "natural"; format = "natural";
break; break;
case DECIMAL: case MIFormat.DECIMAL:
format = "decimal"; format = "decimal";
break; break;
case BINARY: case MIFormat.BINARY:
format = "binary"; format = "binary";
break; break;
case OCTAL: case MIFormat.OCTAL:
format = "octal"; format = "octal";
break; break;
/* /*
case HEXADECIMAL: case MIFormat.HEXADECIMAL:
case MIFormat.RAW:
default: default:
format = "x"; format = "hexadecimal";
break; break;
*/ */
} }

View file

@ -1,11 +1,16 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* Represents a set name=value.
*/ */
public class MIArg { public class MIArg {
String name; String name;

View file

@ -1,8 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* Represent a GDB Tuple MI assembly response.
*/ */
public class MIAsm { public class MIAsm {
long address; long address;

View file

@ -1,6 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* base Abstract class for the OOB stream MI responses.
*/ */
public abstract class MIAsyncRecord extends MIOOBRecord { public abstract class MIAsyncRecord extends MIOOBRecord {

View file

@ -1,10 +1,14 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* -break-insert main * -break-insert main
* ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x08048468",func="main",file="hello.c",line="4",times="0"} * ^done,bkpt={number="1",type="breakpoint",disp="keep",enabled="y",addr="0x08048468",func="main",file="hello.c",line="4",times="0"}

View file

@ -1,10 +1,13 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* A -break-list result-record is the form: * A -break-list result-record is the form:
* <pre> * <pre>

View file

@ -1,6 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* Contain info about the GDB/MI breakpoint info.
*/ */
public class MIBreakPoint { public class MIBreakPoint {

View file

@ -1,3 +1,8 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
@ -6,7 +11,6 @@ import java.util.List;
import org.eclipse.cdt.debug.mi.core.command.MIBreakInsert; import org.eclipse.cdt.debug.mi.core.command.MIBreakInsert;
/** /**
* -break-watch buf * -break-watch buf
* ^done,wpt={number="2",exp="buf"} * ^done,wpt={number="2",exp="buf"}

View file

@ -0,0 +1,35 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output;
/**
* GDB/MI var-update.
*/
public class MIChange {
String name;
boolean inScope;
boolean changed;
public MIChange(String n) {
name = n;
}
public boolean isInScope() {
return inScope;
}
public boolean isChanged() {
return changed;
}
public void setInScope(boolean b) {
inScope = b;
}
public void setChanged(boolean c) {
changed = c;
}
}

View file

@ -0,0 +1,58 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output;
/**
* GDB/MI var-list-children
* -var-list-children var2
* ^done,numchild="6",children={child={name="var2.0",exp="0",numchild="0",type="char"},child={name="var2.1",exp="1",numchild="0",type="char"},child={name="var2.2",exp="2",numchild="0",type="char"},child={name="var2.3",exp="3",numchild="0",type="char"},child={name="var2.4",exp="4",numchild="0",type="char"},child={name="var2.5",exp="5",numchild="0",type="char"}}
*
*/
public class MIChild {
String name = "";
String type = "";
int numchild;
public MIChild(MITuple tuple) {
parse(tuple);
}
public String getName() {
return name;
}
public String getType() {
return type;
}
public int getnumChild() {
return numchild;
}
void parse(MITuple tuple) {
MIResult[] results = tuple.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue value = results[i].getMIValue();
String str = "";
if (value != null && value instanceof MIConst) {
str = ((MIConst)value).getCString();
}
if (var.equals("numchild")) {
try {
numchild = Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
}
} else if (var.equals("name")) {
name = str;
} else if (var.equals("type")) {
type = str;
}
}
}
}

View file

@ -1,6 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* @see MIStreamRecord
*/ */
public class MIConsoleStreamOutput extends MIStreamRecord { public class MIConsoleStreamOutput extends MIStreamRecord {
} }

View file

@ -1,6 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI const value represents a ios-c string.
*/ */
public class MIConst extends MIValue { public class MIConst extends MIValue {
String cstring = ""; String cstring = "";

View file

@ -1,9 +1,15 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* GDB/MI disassemble parsing response.
*/ */
public class MIDataDisassembleInfo extends MIInfo { public class MIDataDisassembleInfo extends MIInfo {

View file

@ -1,8 +1,13 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI Data evalue expression parsing response.
*/ */
public class MIDataEvaluateExpressionInfo extends MIInfo{ public class MIDataEvaluateExpressionInfo extends MIInfo{

View file

@ -1,9 +1,14 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* GDB/MI data list changed registers response parsing.
*/ */
public class MIDataListChangedRegistersInfo extends MIInfo { public class MIDataListChangedRegistersInfo extends MIInfo {

View file

@ -1,9 +1,15 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* GDB/MI data list regiter names response extraction.
*/ */
public class MIDataListRegisterNamesInfo extends MIInfo { public class MIDataListRegisterNamesInfo extends MIInfo {

View file

@ -1,8 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI data list register values extraction.
*/ */
public class MIDataListRegisterValuesInfo extends MIInfo { public class MIDataListRegisterValuesInfo extends MIInfo {

View file

@ -1,11 +1,15 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* GDB/MI data read memor info extraction.
*/ */
public class MIDataReadMemoryInfo extends MIInfo { public class MIDataReadMemoryInfo extends MIInfo {

View file

@ -1,16 +1,50 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList;
import java.util.List;
/** /**
* GDB/MI environment PWD info extraction.
*/ */
public class MIEnvironmentPWDInfo extends MIInfo { public class MIEnvironmentPWDInfo extends MIInfo {
String pwd = "";
public MIEnvironmentPWDInfo(MIOutput o) { public MIEnvironmentPWDInfo(MIOutput o) {
super(o); super(o);
parse();
} }
public String getWorkingDirectory() { public String getWorkingDirectory() {
return "."; return pwd;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIOOBRecord[] oobs = out.getMIOOBRecords();
for (int i = 0; i < oobs.length; i++) {
if (oobs[i] instanceof MIConsoleStreamOutput) {
MIStreamRecord cons = (MIStreamRecord)oobs[i];
String str = cons.getString();
if (str.startsWith("Working directory")) {
int len = "Working directory".length();
str = str.substring(len).trim();
len = str.indexOf('.');
if (len != -1) {
str = str.substring(0, len);
}
pwd = str;
} }
} }
}
}
}
}

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* @see MIAsyncRecord
*/ */
public class MIExecAsyncOutput extends MIAsyncRecord { public class MIExecAsyncOutput extends MIAsyncRecord {
} }

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI Frame tuple parsing.
*/ */
public class MIFrame { public class MIFrame {

View file

@ -0,0 +1,45 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList;
import java.util.List;
/**
* GDB/MI show parsing.
*/
public class MIGDBShowInfo extends MIInfo {
String value = "";
public MIGDBShowInfo(MIOutput o) {
super(o);
parse();
}
public String getValue() {
return value;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("value")) {
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
value = ((MIConst)val).getString();
}
}
}
}
}
}
}

View file

@ -1,8 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* Base class for teh parsing/info GDB/MI classes.
*/ */
public class MIInfo { public class MIInfo {

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI list semantic.
*/ */
public class MIList extends MIValue { public class MIList extends MIValue {

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* @see MIStreamRecord
*/ */
public class MILogStreamOutput extends MIStreamRecord { public class MILogStreamOutput extends MIStreamRecord {

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI memory parsing.
*/ */
public class MIMemory { public class MIMemory {
long addr; long addr;

View file

@ -1,7 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* * @see MIAsyncRecord
*/ */
public class MINotifyAsyncOutput extends MIAsyncRecord { public class MINotifyAsyncOutput extends MIAsyncRecord {
} }

View file

@ -1,7 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* * @see MIOOBRecord
*/ */
public abstract class MIOOBRecord { public abstract class MIOOBRecord {
} }

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI response.
*/ */
public class MIOutput { public class MIOutput {

View file

@ -1,3 +1,7 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;

View file

@ -1,3 +1,7 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
@ -6,6 +10,7 @@ import java.util.List;
/** /**
* GDB/MI register response parsing.
*/ */
public class MIRegisterValue { public class MIRegisterValue {
int name; int name;

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI result sematic (Variable=Value)
*/ */
public class MIResult { public class MIResult {
String variable = ""; String variable = "";

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI ResultRecord.
*/ */
public class MIResultRecord { public class MIResultRecord {

View file

@ -1,8 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI stack info depth parsing.
*/ */
public class MIStackInfoDepthInfo extends MIInfo { public class MIStackInfoDepthInfo extends MIInfo {

View file

@ -1,11 +1,16 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* GDB/MI stack list arguments parsing.
*/ */
public class MIStackListArgumentsInfo extends MIInfo { public class MIStackListArgumentsInfo extends MIInfo {

View file

@ -1,11 +1,15 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
/** /**
* GDB/MI stack list frames info.
*/ */
public class MIStackListFramesInfo extends MIInfo { public class MIStackListFramesInfo extends MIInfo {

View file

@ -1,8 +1,12 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI stack list locals parsing.
*/ */
public class MIStackListLocalsInfo extends MIInfo { public class MIStackListLocalsInfo extends MIInfo {

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* @see MIAsyncRecord
*/ */
public class MIStatusAsyncOutput extends MIAsyncRecord { public class MIStatusAsyncOutput extends MIAsyncRecord {

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI stream record response.
*/ */
public abstract class MIStreamRecord extends MIOOBRecord { public abstract class MIStreamRecord extends MIOOBRecord {

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* @see MIStreamRecord
*/ */
public class MITargetStreamOutput extends MIStreamRecord { public class MITargetStreamOutput extends MIStreamRecord {
} }

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI thread list parsing.
*/ */
public class MIThreadListIdsInfo extends MIInfo { public class MIThreadListIdsInfo extends MIInfo {

View file

@ -1,8 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI thread select parsing.
*/ */
public class MIThreadSelectInfo extends MIInfo { public class MIThreadSelectInfo extends MIInfo {

View file

@ -1,6 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI tuple value.
*/ */
public class MITuple extends MIValue { public class MITuple extends MIValue {

View file

@ -1,12 +1,11 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* @author alain * GDB/MI value.
*
* 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 abstract class MIValue { public abstract class MIValue {
} }

View file

@ -1,24 +1,64 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI var-create.
* -var-create "-" * buf3
* ^done,name="var1",numchild="6",type="char [6]"
*/ */
public class MIVarCreateInfo extends MIInfo { public class MIVarCreateInfo extends MIInfo {
String name = "";
int children;
String type = "";
public MIVarCreateInfo(MIOutput record) { public MIVarCreateInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public String getName () { public String getName () {
return ""; return name;
} }
public int getChildNumber() { public int getChildNumber() {
return 0; return children;
} }
public String getType() { public String getType() {
return ""; return type;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue value = results[i].getMIValue();
String str = "";
if (value instanceof MIConst) {
str = ((MIConst)value).getString();
}
if (var.equals("name")) {
name = str;
} else if (var.equals("numchild")) {
try {
children = Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
}
} else if (var.equals("type")) {
type = str;
}
}
}
}
} }
} }

View file

@ -1,16 +1,46 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI var-delete.
*/ */
public class MIVarDeleteInfo extends MIInfo { public class MIVarDeleteInfo extends MIInfo {
int ndeleted;
public MIVarDeleteInfo(MIOutput record) { public MIVarDeleteInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public int getNumberDeleted () { public int getNumberDeleted () {
return 0; return ndeleted;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("ndeleted")) {
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
String str = ((MIConst)value).getString();
try {
ndeleted = Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
}
}
}
}
}
}
} }
} }

View file

@ -1,16 +1,41 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI var-evalute-expression
*/ */
public class MIVarEvaluateExpressionInfo extends MIInfo { public class MIVarEvaluateExpressionInfo extends MIInfo {
String value = "";
public MIVarEvaluateExpressionInfo(MIOutput record) { public MIVarEvaluateExpressionInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public String getValue () { public String getValue () {
return ""; return value;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("name")) {
MIValue val = results[i].getMIValue();
if (val instanceof MIConst) {
value = ((MIConst)val).getString();
}
}
}
}
}
} }
} }

View file

@ -1,20 +1,51 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI var-info-expression.
*/ */
public class MIVarInfoExpressionInfo extends MIInfo { public class MIVarInfoExpressionInfo extends MIInfo {
String lang = "";
String exp = "";
public MIVarInfoExpressionInfo(MIOutput record) { public MIVarInfoExpressionInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public String getLanguage () { public String getLanguage () {
return ""; return lang;
} }
public String getExpression() { public String getExpression() {
return ""; return exp;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue value = results[i].getMIValue();
String str = "";
if (value instanceof MIConst) {
str = ((MIConst)value).getString();
}
if (var.equals("lang")) {
lang = str;
} else if (var.equals("exp")) {
exp = str;
}
}
}
}
} }
} }

View file

@ -1,16 +1,48 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI var-info-num-children.
*/ */
public class MIVarInfoNumChildrenInfo extends MIInfo { public class MIVarInfoNumChildrenInfo extends MIInfo {
int children;
public MIVarInfoNumChildrenInfo(MIOutput record) { public MIVarInfoNumChildrenInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public int getChildNumber() { public int getChildNumber() {
return 0; return children;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("numchild")) {
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
String str = ((MIConst)value).getString();
try {
children = Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
}
}
}
}
}
}
} }
} }

View file

@ -1,16 +1,42 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI var-info-type
*/ */
public class MIVarInfoTypeInfo extends MIInfo { public class MIVarInfoTypeInfo extends MIInfo {
String type = "";
public MIVarInfoTypeInfo(MIOutput record) { public MIVarInfoTypeInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public String getType() { public String getType() {
return ""; return type;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("type")) {
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
type = ((MIConst)value).getString();
}
}
}
}
}
} }
} }

View file

@ -1,22 +1,72 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList;
import java.util.List;
/** /**
* GDB/MI var-list-children
* -var-list-children var2
* ^done,numchild="6",children={child={name="var2.0",exp="0",numchild="0",type="char"},child={name="var2.1",exp="1",numchild="0",type="char"},child={name="var2.2",exp="2",numchild="0",type="char"},child={name="var2.3",exp="3",numchild="0",type="char"},child={name="var2.4",exp="4",numchild="0",type="char"},child={name="var2.5",exp="5",numchild="0",type="char"}}
*
*/ */
public class MIVarListChildrenInfo extends MIInfo { public class MIVarListChildrenInfo extends MIInfo {
public class Children { MIChild[] children = new MIChild[0];
String name;
int numchild; int numchild;
String type;
}
public MIVarListChildrenInfo(MIOutput record) { public MIVarListChildrenInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public Children[] getChildren() { public MIChild[] getChildren() {
return null; return children;
}
void parse() {
List aList = new ArrayList();
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue value = results[i].getMIValue();
if (var.equals("numchild")) {
if (value instanceof MIConst) {
String str = ((MIConst)value).getString();
try {
numchild = Integer.parseInt(str.trim());
} catch (NumberFormatException e) {
}
}
} else if (var.equals("children")) {
if (value instanceof MITuple) {
parseChildren((MITuple)value, aList);
}
}
}
}
}
children = (MIChild[])aList.toArray(new MIChild[aList.size()]);
}
void parseChildren(MITuple tuple, List aList) {
MIResult[] results = tuple.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("child")) {
MIValue value = results[i].getMIValue();
if (value instanceof MITuple) {
aList.add(new MIChild((MITuple)value));
}
}
}
} }
} }

View file

@ -1,16 +1,41 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
/** /**
* GDB/MI var-show-attributes
*/ */
public class MIVarShowAttributesInfo extends MIInfo { public class MIVarShowAttributesInfo extends MIInfo {
String attr = "";
public MIVarShowAttributesInfo(MIOutput record) { public MIVarShowAttributesInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public String[] getAttributes () { public String getAttributes () {
return null; return attr;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("attr")) {
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
attr = ((MIConst)value).getString();
}
}
}
}
}
} }
} }

View file

@ -1,16 +1,54 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import org.eclipse.cdt.debug.mi.core.MIFormat;
/** /**
* GDB/MI var-show-format
*/ */
public class MIVarShowFormatInfo extends MIInfo { public class MIVarShowFormatInfo extends MIInfo {
int format = MIFormat.NATURAL;
public MIVarShowFormatInfo(MIOutput record) { public MIVarShowFormatInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public int getFormat() { public int getFormat() {
return 0; return format;
}
void parse() {
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("name")) {
MIValue value = results[i].getMIValue();
if (value instanceof MIConst) {
String str = ((MIConst)value).getString();
if ("binary".equals(str)) {
format = MIFormat.BINARY;
} else if ("decimal".equals(str)) {
format = MIFormat.DECIMAL;
} else if ("hexadecimal".equals(str)) {
format = MIFormat.HEXADECIMAL;
} else if ("octal".equals(str)) {
format = MIFormat.OCTAL;
} else if ("natural".equals(str)) {
format = MIFormat.NATURAL;
}
}
}
}
}
}
} }
} }

View file

@ -1,8 +1,16 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output; package org.eclipse.cdt.debug.mi.core.output;
import java.util.ArrayList;
import java.util.List;
/** /**
* GDB/MI var-update.
* -var-update *
* ^done,changelist={name="var3",in_scope="true",type_changed="false",name="var2",in_scope="true",type_changed="false"}
*/ */
public class MIVarUpdateInfo extends MIInfo { public class MIVarUpdateInfo extends MIInfo {
@ -12,11 +20,60 @@ public class MIVarUpdateInfo extends MIInfo {
boolean changed; boolean changed;
} }
MIChange[] changeList;
public MIVarUpdateInfo(MIOutput record) { public MIVarUpdateInfo(MIOutput record) {
super(record); super(record);
parse();
} }
public Change[] getChangeList () { public MIChange[] getChangeList () {
return null; return changeList;
}
void parse() {
List aList = new ArrayList();
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
if (var.equals("changelist")) {
MIValue value = results[i].getMIValue();
if (value instanceof MITuple) {
parseChangeList((MITuple)value, aList);
}
}
}
}
}
changeList = (MIChange[])aList.toArray(new MIChange[aList.size()]);
}
void parseChangeList(MITuple tuple, List aList) {
MIResult[] results = tuple.getMIResults();
MIChange change = null;
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue value = results[i].getMIValue();
String str = "";
if (value instanceof MIConst) {
str = ((MIConst)value).getString();
}
if (var.equals("name")) {
change = new MIChange(str);
aList.add(change);
} else if (var.equals("in_scope")) {
if (change != null) {
change.setInScope("true".equals(str));
}
} else if (var.equals("type_changed")) {
if (change != null) {
change.setChanged("true".equals(str));
}
}
}
} }
} }