mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
2004-11-07 Alain Magloire
Support for MIInterpreterExec
This commit is contained in:
parent
60a0f4fa81
commit
d44dbb5d43
10 changed files with 151 additions and 9 deletions
|
@ -1,3 +1,6 @@
|
|||
2004-11-07 Alain Magloire
|
||||
Support for MIInterpreterExec
|
||||
|
||||
2004-11-03 Alain Magloire
|
||||
Partial fix for 77435
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/VariableManager.java
|
||||
|
|
|
@ -331,7 +331,12 @@ public class BreakpointManager extends Manager {
|
|||
if (hasBreakpointChanged(miBps[j], allMIBreakpoints[i])) {
|
||||
miBps[j] = allMIBreakpoints[i];
|
||||
bp.setEnabled0(allMIBreakpoints[i].isEnabled());
|
||||
// FIXME: do the conditions also.
|
||||
// FIXME: We have a problem if the thread id change.
|
||||
ICDICondition oldCond = bp.getCondition();
|
||||
String[] tids = oldCond.getThreadIds();
|
||||
Condition newCondition = new Condition(allMIBreakpoints[i].getIgnoreCount(),
|
||||
allMIBreakpoints[i].getCondition(), tids);
|
||||
bp.setCondition0(newCondition);
|
||||
// Fire ChangedEvent
|
||||
eventList.add(new MIBreakpointChangedEvent(miSession, no));
|
||||
}
|
||||
|
@ -345,8 +350,13 @@ public class BreakpointManager extends Manager {
|
|||
} else if (allMIBreakpoints[i].isTemporary()) {
|
||||
type = ICDIBreakpoint.TEMPORARY;
|
||||
}
|
||||
String[] tids = null;
|
||||
String tid = allMIBreakpoints[i].getThreadId();
|
||||
if (tid != null && tid.length() > 0) {
|
||||
tids = new String[] { tid };
|
||||
}
|
||||
Condition condition = new Condition(allMIBreakpoints[i].getIgnoreCount(),
|
||||
allMIBreakpoints[i].getCondition(), new String[] {allMIBreakpoints[i].getThreadId()});
|
||||
allMIBreakpoints[i].getCondition(), tids);
|
||||
|
||||
if (allMIBreakpoints[i].isWatchpoint()) {
|
||||
int watchType = 0;
|
||||
|
|
|
@ -65,7 +65,10 @@ public class Breakpoint extends CObject implements ICDILocationBreakpoint {
|
|||
if (miBreakpoints != null && miBreakpoints.length > 0) {
|
||||
List list = new ArrayList(miBreakpoints.length);
|
||||
for (int i = 0; i < miBreakpoints.length; i++) {
|
||||
list.add(miBreakpoints[i].getThreadId());
|
||||
String tid = miBreakpoints[i].getThreadId();
|
||||
if (tid != null && tid.length() > 0) {
|
||||
list.add(miBreakpoints[i].getThreadId());
|
||||
}
|
||||
}
|
||||
String[] tids = (String[]) list.toArray(new String[list.size()]);
|
||||
int icount = miBreakpoints[0].getIgnoreCount();
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
package org.eclipse.cdt.debug.mi.core;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIBreakpointChangedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIDetachedEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
|
@ -36,6 +37,17 @@ public class CLIProcessor {
|
|||
*/
|
||||
void process(CLICommand cmd) {
|
||||
String operation = cmd.getOperation().trim();
|
||||
process(cmd.getToken(), operation);
|
||||
}
|
||||
|
||||
void process(MIInterpreterExecConsole exec) {
|
||||
String[] operations = exec.getParameters();
|
||||
if (operations != null && operations.length > 0) {
|
||||
process(exec.getToken(), operations[0]);
|
||||
}
|
||||
}
|
||||
|
||||
void process(int token, String operation) {
|
||||
// Get the command name.
|
||||
int indx = operation.indexOf(' ');
|
||||
if (indx != -1) {
|
||||
|
@ -50,7 +62,7 @@ public class CLIProcessor {
|
|||
if (type != -1) {
|
||||
// if it was a step instruction set state running
|
||||
session.getMIInferior().setRunning();
|
||||
MIEvent event = new MIRunningEvent(session, cmd.getToken(), type);
|
||||
MIEvent event = new MIRunningEvent(session, token, type);
|
||||
session.fireEvent(event);
|
||||
} else if (isSettingBreakpoint(operation) ||
|
||||
isSettingWatchpoint(operation) ||
|
||||
|
@ -65,7 +77,7 @@ public class CLIProcessor {
|
|||
} else if (isDetach(operation)) {
|
||||
// if it was a "detach" command change the state.
|
||||
session.getMIInferior().setDisconnected();
|
||||
MIEvent event = new MIDetachedEvent(session, cmd.getToken());
|
||||
MIEvent event = new MIDetachedEvent(session, token);
|
||||
session.fireEvent(event);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ import org.eclipse.cdt.debug.mi.core.command.CommandFactory;
|
|||
import org.eclipse.cdt.debug.mi.core.command.MIExecInterrupt;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBExit;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIGDBSet;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.event.MIGDBExitEvent;
|
||||
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
|
||||
|
@ -51,6 +52,7 @@ public class MISession extends Observable {
|
|||
public final static int CORE = 2;
|
||||
|
||||
boolean terminated;
|
||||
boolean useInterpreterExecConsole;
|
||||
|
||||
// hold the type of the session(post-mortem, attach etc ..)
|
||||
int sessionType;
|
||||
|
@ -149,11 +151,20 @@ public class MISession extends Observable {
|
|||
|
||||
MIGDBSet width = new MIGDBSet(new String[]{"width", "0"}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
postCommand(width, launchTimeout);
|
||||
confirm.getMIInfo();
|
||||
width.getMIInfo();
|
||||
|
||||
MIGDBSet height = new MIGDBSet(new String[]{"height", "0"}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
postCommand(height, launchTimeout);
|
||||
confirm.getMIInfo();
|
||||
height.getMIInfo();
|
||||
|
||||
try {
|
||||
MIInterpreterExecConsole echo = new MIInterpreterExecConsole("echo"); //$NON-NLS-1$
|
||||
postCommand(echo, launchTimeout);
|
||||
echo.getMIInfo();
|
||||
useInterpreterExecConsole = true;
|
||||
} catch (MIException e) {
|
||||
//
|
||||
}
|
||||
|
||||
} catch (MIException exc) {
|
||||
// Kill the Transmition thread.
|
||||
|
@ -246,6 +257,10 @@ public class MISession extends Observable {
|
|||
sessionType = type;
|
||||
}
|
||||
|
||||
public boolean useExecConsole() {
|
||||
return useInterpreterExecConsole;
|
||||
}
|
||||
|
||||
/**
|
||||
* The debug session is a program being debug.
|
||||
*/
|
||||
|
|
|
@ -15,6 +15,8 @@ import java.io.InputStream;
|
|||
import java.io.OutputStream;
|
||||
|
||||
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
||||
import org.eclipse.cdt.debug.mi.core.command.Command;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -74,8 +76,13 @@ public class SessionProcess extends Process {
|
|||
public void post() throws IOException {
|
||||
// Throw away the newline.
|
||||
String str = buf.toString().trim();
|
||||
CLICommand cmd = new CLICommand(str);
|
||||
buf.setLength(0);
|
||||
Command cmd = null;
|
||||
if (session.useExecConsole() && str.length() > 0) {
|
||||
cmd = new MIInterpreterExecConsole(str);
|
||||
} else {
|
||||
cmd = new CLICommand(str);
|
||||
}
|
||||
try {
|
||||
session.postCommand(cmd);
|
||||
} catch (MIException e) {
|
||||
|
|
|
@ -16,6 +16,7 @@ import java.io.OutputStream;
|
|||
|
||||
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
|
||||
import org.eclipse.cdt.debug.mi.core.command.Command;
|
||||
import org.eclipse.cdt.debug.mi.core.command.MIInterpreterExecConsole;
|
||||
|
||||
/**
|
||||
* Transmission command thread blocks on the command Queue
|
||||
|
@ -65,6 +66,8 @@ public class TxThread extends Thread {
|
|||
// Process the Command line to recognise patterns we may need to fire event.
|
||||
if (cmd instanceof CLICommand) {
|
||||
cli.process((CLICommand)cmd);
|
||||
} else if (cmd instanceof MIInterpreterExecConsole) {
|
||||
cli.process((MIInterpreterExecConsole)cmd);
|
||||
}
|
||||
|
||||
// shove in the pipe
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.mi.core.command;
|
||||
|
||||
/**
|
||||
* MIInterpreterExec
|
||||
*
|
||||
* -interpreter-exec
|
||||
*
|
||||
* -interpreter-exec interpreter command
|
||||
*
|
||||
* Execute the specified command in the given interpreter.
|
||||
*
|
||||
* -interpreter-exec console "break main"
|
||||
* &"During symbol reading, couldn't parse type; debugger out of date?.\n"
|
||||
* &"During symbol reading, bad structure-type format.\n"
|
||||
* ~"Breakpoint 1 at 0x8074fc6: file ../../src/gdb/main.c, line 743.\n"
|
||||
* ^done
|
||||
*
|
||||
*/
|
||||
public class MIInterpreterExec extends MICommand {
|
||||
|
||||
/**
|
||||
* @param oper
|
||||
*/
|
||||
public MIInterpreterExec(String interpreter, String cmd) {
|
||||
super("-interpreter-exec", new String[]{interpreter}, new String[] {cmd}); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
/**********************************************************************
|
||||
* Copyright (c) 2002,2003,2004 QNX Software Systems and others.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the Common Public License v1.0
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.eclipse.org/legal/cpl-v10.html
|
||||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
***********************************************************************/
|
||||
|
||||
package org.eclipse.cdt.debug.mi.core.command;
|
||||
|
||||
/**
|
||||
* MIInterpreterExecConsole
|
||||
*/
|
||||
public class MIInterpreterExecConsole extends MIInterpreterExec {
|
||||
|
||||
/**
|
||||
* @param interpreter
|
||||
* @param cmd
|
||||
*/
|
||||
public MIInterpreterExecConsole(String cmd) {
|
||||
super("console", cmd); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
}
|
|
@ -46,7 +46,12 @@ public class MIConst extends MIValue {
|
|||
}
|
||||
} else {
|
||||
if (escape) {
|
||||
buffer.append(isoC(c));
|
||||
if (isIsoCSpecialChar(c)) {
|
||||
buffer.append(isoC(c));
|
||||
} else {
|
||||
buffer.append('\\');
|
||||
buffer.append(c);
|
||||
}
|
||||
} else {
|
||||
buffer.append(c);
|
||||
}
|
||||
|
@ -96,4 +101,22 @@ public class MIConst extends MIValue {
|
|||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
private static boolean isIsoCSpecialChar(char c) {
|
||||
switch (c) {
|
||||
case '"':
|
||||
case '\'':
|
||||
case '?':
|
||||
case 'a':
|
||||
case 'b':
|
||||
case 'f':
|
||||
case 'n':
|
||||
case 'r':
|
||||
case 't':
|
||||
case 'v':
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue