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

followup of mi.

This commit is contained in:
Alain Magloire 2002-07-29 20:57:32 +00:00
parent 7355736f9f
commit 799af8b586
14 changed files with 424 additions and 6 deletions

View file

@ -0,0 +1,34 @@
package org.eclipse.cdt.debug.mi.core;
/**
* @author alain
*
*/
public class MIBreakpointInfo extends MIInfo {
int line, number;
String function, file;
public MIBreakpointInfo(int no, String func, String filename, int lineno) {
number = no;
function = func;
file = filename;
line = lineno;
}
public int getNumber() {
return number;
}
public String getFunction() {
return function;
}
public String getFile() {
return file;
}
public int getLineNumber() {
return line;
}
}

View file

@ -0,0 +1,12 @@
package org.eclipse.cdt.debug.mi.core;
/**
* @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 MIInfo {
}

View file

@ -6,6 +6,9 @@
package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/**
*
* Represents a CLI command.
@ -27,5 +30,8 @@ public class CLICommand extends Command
public String toString(){
return "";
}
public MIInfo parse (MIOutput out) {
return new MIInfo();
}
}

View file

@ -6,6 +6,9 @@
package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/**
*
* A base class for all mi requests.
@ -23,4 +26,6 @@ public abstract class Command
public abstract String getToken();
public abstract String toString();
public abstract MIInfo parse(MIOutput out);
}

View file

@ -0,0 +1,26 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
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.
*
* Result:
* ^done
*
*/
public class MIBreakAfter extends MICommand
{
public MIBreakAfter(int brknum, int count) {
super("-break-after",new String[]{Integer.toString(brknum),
Integer.toString(count)});;
}
}

View file

@ -0,0 +1,23 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
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.
*
* Result:
* ^done
*/
public class MIBreakCondition extends MICommand
{
public MIBreakCondition (int brknum, String expr) {
super("-break-condition", new String[]{Integer.toString(brknum), expr});
}
}

View file

@ -0,0 +1,32 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -break-delete ( BREAKPOINT )+
*
* Delete the breakpoint(s) whose number(s) are specified in the
* argument list. This is obviously reflected in the breakpoint list.
*
* Result:
* ^done
*
*/
public class MIBreakDelete extends MICommand
{
public MIBreakDelete (int[] array) {
super("-break-delete");
if (array != null && array.length > 0) {
String[] brkids = new String[array.length];
for (int i = 0; i < array.length; i++) {
brkids[i] = Integer.toString(array[i]);
}
setParameters(brkids);
}
}
}

View file

@ -0,0 +1,31 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -break-disable ( BREAKPOINT )+
*
* Disable the named BREAKPOINT(s). The field `enabled' in the break
* list is now set to `n' for the named BREAKPOINT(s).
*
* Result:
* ^done
*/
public class MIBreakDisable extends MICommand
{
public MIBreakDisable (int[] array) {
super("-break-disable");
if (array != null && array.length > 0) {
String[] brkids = new String[array.length];
for (int i = 0; i < array.length; i++) {
brkids[i] = Integer.toString(array[i]);
}
setParameters(brkids);
}
}
}

View file

@ -0,0 +1,30 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -break-enable ( BREAKPOINT )+
*
* Enable (previously disabled) BREAKPOINT(s).
*
* Result:
* ^done
*/
public class MIBreakEnable extends MICommand
{
public MIBreakEnable (int[] array) {
super("-break-enable");
if (array != null && array.length > 0) {
String[] brkids = new String[array.length];
for (int i = 0; i < array.length; i++) {
brkids[i] = Integer.toString(array[i]);
}
setParameters(brkids);
}
}
}

View file

@ -0,0 +1,60 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -break-insert [ -t ] [ -h ] [ -r ]
* [ -c CONDITION ] [ -i IGNORE-COUNT ]
* [ -p THREAD ] [ LINE | ADDR ]
*
* If specified, LINE, can be one of:
*
* * function
*
* * filename:linenum
*
* * filename:function
*
* * *address
*
* The possible optional parameters of this command are:
*
* `-t'
* Insert a tempoary breakpoint.
*
* `-h'
* Insert a hardware breakpoint.
*
* `-c CONDITION'
* Make the breakpoint conditional on CONDITION.
*
* `-i IGNORE-COUNT'
* Initialize the IGNORE-COUNT.
*
* `-r'
*
* Insert a regular breakpoint in all the functions whose names match
* the given regular expression. Other flags are not applicable to
* regular expresson.
*
* The result is in the form:
*
* ^done,bkptno="NUMBER",func="FUNCNAME",
* file="FILENAME",line="LINENO"
*
*/
public class MIBreakInsert extends MICommand
{
public MIBreakInsert(String[] params) {
super("-break-insert", params);
}
public MIBreakInsert(String[] opts, String[] params) {
super("-break-insert", opts, params);
}
}

View file

@ -0,0 +1,47 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -break-list
*
* Displays the list of inserted breakpoints, showing the following
* fields:
*
* `Number'
* number of the breakpoint
*
* `Type'
* type of the breakpoint: `breakpoint' or `watchpoint'
*
* `Disposition'
* should the breakpoint be deleted or disabled when it is hit: `keep'
* or `nokeep'
*
* `Enabled'
* is the breakpoint enabled or no: `y' or `n'
*
* `Address'
* memory location at which the breakpoint is set
*
* `What'
* logical location of the breakpoint, expressed by function name,
*
* `Times'
* number of times the breakpoint has been hit
*
* If there are no breakpoints or watchpoints, the `BreakpointTable'
* `body' field is an empty list.
*
*/
public class MIBreakList extends MICommand
{
public MIBreakList () {
super("-break-list");
}
}

View file

@ -0,0 +1,30 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -break-watch [ -a | -r ]
*
* Create a watchpoint. With the `-a' option it will create an
* "access" watchpoint, i.e. a watchpoint that triggers either on a read
* from or on a write to the memory location. With the `-r' option, the
* watchpoint created is a "read" watchpoint, i.e. it will trigger only
* when the memory location is accessed for reading. Without either of
* the options, the watchpoint created is a regular watchpoint, i.e. it
* will trigger when the memory location is accessed for writing.
*
*/
public class MIBreakWatch extends MICommand
{
public MIBreakWatch (String[] opts, String expr) {
super("-break-insert", opts, new String[]{expr});
}
public MIBreakWatch (String expr) {
super("-break-insert", new String[]{expr});
}
}

View file

@ -6,6 +6,9 @@
package org.eclipse.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/**
*
* Represents a MI command.
@ -15,13 +18,34 @@ package org.eclipse.cdt.debug.mi.core.command;
*/
public class MICommand extends Command
{
final String[] empty = new String[0];
String[] options = empty;
String[] parameters = empty;
String operation = "";
String token;
public MICommand(String oper) {
this.operation = oper;
}
public MICommand(String oper, String[] param) {
this.operation = oper;
this.parameters = param;
}
public MICommand(String oper, String[] opt, String[] param) {
this.operation = oper;
this.options = opt;
this.parameters = param;
}
/**
* Returns the operation of this command.
*
* @return the operation of this command
*/
public String getOperation() {
return "";
return operation;
}
/**
@ -31,7 +55,11 @@ public class MICommand extends Command
* @return an array of command's options
*/
public String[] getOptions() {
return new String[0];
return options;
}
public void setOptions(String[] opt) {
options = opt;
}
/**
@ -41,14 +69,40 @@ public class MICommand extends Command
* @return an array of command's parameters
*/
public String[] getParameters() {
return new String[0];
return parameters;
}
public void setParameters(String[] p) {
parameters = p;
}
public String toString() {
return "";
String command = getToken() + "-" + getOperation();
if (options != null && options.length > 0) {
for (int i = 0; i < options.length; i++) {
command += " " + options[i];
}
}
if (parameters != null && parameters.length > 0) {
if (options != null && options.length > 0) {
command += " --";
}
for (int i = 0; i < parameters.length; i++) {
command += " " + parameters[i];
}
}
return command;
}
public String getToken() {
return "";
return token;
}
public void setToken(String t) {
token = t;
}
public MIInfo parse (MIOutput out) {
return new MIInfo();
}
}

View file

@ -0,0 +1,28 @@
/*
*(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;
/**
*
* Allows clients to communicate with the debug engine by posting
* MI requests.
*
* @author Mikhail Khodjaiants
* @since Jul 11, 2002
*/
public interface MICommandManager
{
/**
* Posts request to the debug engine.
*
* @param request - the request to post
* @throws MIException if this method fails. Reasons include:
*/
void postRequest (Command request) throws MIException;
}