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

more implementation.

This commit is contained in:
Alain Magloire 2002-07-30 20:58:29 +00:00
parent 937ffc0057
commit 4f4deeebe7
24 changed files with 710 additions and 1 deletions

View file

@ -30,5 +30,11 @@ public class MIPlugin extends Plugin {
public static MIPlugin getDefault() {
return plugin;
}
}
/**
* Create a MI Session.
*/
public MISession createSession(Process proc) {
return new MISession(proc);
}
}

View file

@ -0,0 +1,64 @@
package org.eclipse.cdt.debug.mi.core;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.Writer;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/**
*/
public class MISession {
Process process;
Writer consoleStreamOutput = null;
Writer targetStreamOutput = null;
Writer logStreamOutput = null;
/**
* The constructor.
*/
MISession(Process proc) {
process = proc;
}
/**
* Set Console Stream.
*/
public void setConsoleStreamOutput(Writer consoleOutput) {
consoleStreamOutput = consoleOutput;
}
/**
* Set Target Stream.
*/
public void setTargetStreamOutput(Writer targetOutput) {
targetStreamOutput = targetOutput;
}
/**
* Set Log Stream
*/
public void setLogStreamOutput(Writer logOutput) {
logStreamOutput = logOutput;
}
MIOutput parse(String buffer) {
return null;
}
OutputStream getSessionInputStream() {
if (process != null) {
process.getOutputStream();
}
return null;
}
InputStream getSessionOutputStream() {
if (process != null) {
process.getInputStream();
}
return null;
}
}

View file

@ -0,0 +1,26 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -stack-info-depth [ MAX-DEPTH ]
*
* Return the depth of the stack. If the integer argument MAX-DEPTH is
* specified, do not count beyond MAX-DEPTH frames.
*
*/
public class MIStackInfoDepth extends MICommand
{
public MIStackInfoDepth() {
super("-stack-info-depth");
}
public MIStackInfoDepth(int maxDepth) {
super("-stack-info-depth", new String[]{Integer.toString(maxDepth)});
}
}

View file

@ -0,0 +1,46 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -stack-list-arguments SHOW-VALUES
* [ LOW-FRAME HIGH-FRAME ]
*
* Display a list of the arguments for the frames between LOW-FRAME and
* HIGH-FRAME (inclusive). If LOW-FRAME and HIGH-FRAME are not provided,
* list the arguments for the whole call stack.
*
* The SHOW-VALUES argument must have a value of 0 or 1. A value of 0
* means that only the names of the arguments are listed, a value of 1
* means that both names and values of the arguments are printed.
*
*/
public class MIStackListArguments extends MICommand
{
public MIStackListArguments(boolean showValues) {
super("-stack-list-arguments");
if (showValues) {
setParameters(new String[]{"1"});
} else {
setParameters(new String[]{"0"});
}
}
public MIStackListArguments(boolean showValues, int low, int high) {
super("-stack-list-arguments");
String[] params = new String[3];
if (showValues) {
params[0] = "1";
} else {
params[0] = "0";
}
params[1] = Integer.toString(low);
params[2] = Integer.toString(high);
setParameters(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;
/**
*
* -stack-list-frames [ LOW-FRAME HIGH-FRAME ]
*
* List the frames currently on the stack. For each frame it displays
* the following info:
*
* `LEVEL'
* The frame number, 0 being the topmost frame, i.e. the innermost
* function.
*
* `ADDR'
* The `$pc' value for that frame.
*
* `FUNC'
* Function name.
*
* `FILE'
* File name of the source file where the function lives.
*
* `LINE'
* Line number corresponding to the `$pc'.
*
* If invoked without arguments, this command prints a backtrace for the
* whole stack. If given two integer arguments, it shows the frames whose
* levels are between the two arguments (inclusive). If the two arguments
* are equal, it shows the single frame at the corresponding level.
*
*/
public class MIStackListFrames extends MICommand
{
public MIStackListFrames() {
super("-stack-list-frames");
}
public MIStackListFrames(int low, int high) {
super("-stack-list-frames", new String[]{Integer.toString(low), Integer.toString(high)});
}
}

View file

@ -0,0 +1,28 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -stack-list-locals PRINT-VALUES
*
* Display the local variable names for the current frame. With an
* argument of 0 prints only the names of the variables, with argument of 1
* prints also their values.
*
*/
public class MIStackListLocals extends MICommand
{
public MIStackListLocals(boolean printValues) {
super("-stack-list-locals");
if (printValues) {
setParameters(new String[]{"1"});
} else {
setParameters(new String[]{"0"});
}
}
}

View file

@ -0,0 +1,22 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -stack-select-frame FRAMENUM
*
* Change the current frame. Select a different frame FRAMENUM on the
* stack.
*
*/
public class MIStackSelectFrame extends MICommand
{
public MIStackSelectFrame(int frameNum) {
super("-stack-select-frame", new String[]{Integer.toString(frameNum)});
}
}

View file

@ -0,0 +1,22 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
*
* -target-attach PID | FILE
*
* Attach to a process PID or a file FILE outside of GDB.
*
*/
public class MITargetAttach extends MICommand
{
public MITargetAttach(int pid) {
super("-target-attach", new String[]{Integer.toString(pid)});
}
}

View file

@ -0,0 +1,22 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
*
* -target-detach
*
* Disconnect from the remote target. There's no output.
*
*/
public class MITargetDetach extends MICommand
{
public MITargetDetach() {
super("-target-detach");
}
}

View file

@ -0,0 +1,34 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -target-select TYPE PARAMETERS ...
*
* Connect GDB to the remote target. This command takes two args:
*
* `TYPE'
* The type of target, for instance `async', `remote', etc.
*
* `PARAMETERS'
* Device names, host names and the like. *Note Commands for
* managing targets: Target Commands, for more details.
*
* The output is a connection notification, followed by the address at
* which the target program is, in the following form:
*
* ^connected,addr="ADDRESS",func="FUNCTION NAME",
* args=[ARG LIST]
*
*/
public class MITargetSelect extends MICommand
{
public MITargetSelect(String[] params) {
super("-target-select", params);
}
}

View file

@ -0,0 +1,22 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -thread-list-ids
*
* Produces a list of the currently known GDB thread ids. At the end
* of the list it also prints the total number of such threads.
*
*/
public class MIThreadListIds extends MICommand
{
public MIThreadListIds() {
super("-thread-list-ids");
}
}

View file

@ -0,0 +1,22 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -thread-select THREADNUM
*
* Make THREADNUM the current thread. It prints the number of the new
* current thread, and the topmost frame for that thread.
*
*/
public class MIThreadSelect extends MICommand
{
public MIThreadSelect(int threadNum) {
super("-thread-select", new String[]{Integer.toString(threadNum)});
}
}

View file

@ -0,0 +1,22 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-assign NAME EXPRESSION
*
* Assigns the value of EXPRESSION to the variable object specified by
* NAME. The object must be `editable'.
*
*/
public class MIVarAssign extends MICommand
{
public MIVarAssign(String name, String expression) {
super("-var-assign", new String[]{name, expression});
}
}

View file

@ -0,0 +1,50 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-create {NAME | "-"}
* {FRAME-ADDR | "*"} EXPRESSION
*
* This operation creates a variable object, which allows the
* monitoring of a variable, the result of an expression, a memory cell or
* a CPU register.
*
* The NAME parameter is the string by which the object can be
* referenced. It must be unique. If `-' is specified, the varobj system
* will generate a string "varNNNNNN" automatically. It will be unique
* provided that one does not specify NAME on that format. The command
* fails if a duplicate name is found.
*
* The frame under which the expression should be evaluated can be
* specified by FRAME-ADDR. A `*' indicates that the current frame should
* be used.
*
* EXPRESSION is any expression valid on the current language set (must
* not begin with a `*'), or one of the following:
*
* * `*ADDR', where ADDR is the address of a memory cell
*
* * `*ADDR-ADDR' -- a memory address range (TBD)
*
* * `$REGNAME' -- a CPU register name
*
*/
public class MIVarCreate extends MICommand
{
public MIVarCreate(String expression) {
this("-", "*", expression);
}
public MIVarCreate(String name, String expression) {
this(name, "*", expression);
}
public MIVarCreate(String name, String frameAddr, String expression) {
super("-var-name", new String[]{name, frameAddr, expression});
}
}

View file

@ -0,0 +1,24 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-delete NAME
*
* Deletes a previously created variable object and all of its children.
*
* Returns an error if the object NAME is not found.
*
*/
public class MIVarDelete extends MICommand
{
public MIVarDelete(String name) {
super("-var-delete", new String[]{name});
}
}

View file

@ -0,0 +1,25 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-evaluate-expression NAME
*
* Evaluates the expression that is represented by the specified
* variable object and returns its value as a string in the current format
* specified for the object:
*
* value=VALUE
*
*/
public class MIVarEvaluateExpression extends MICommand
{
public MIVarEvaluateExpression(String expression) {
super("-var-evaluate-expression", new String[]{expression});
}
}

View file

@ -0,0 +1,25 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-info-expression NAME
*
* Returns what is represented by the variable object NAME:
*
* lang=LANG-SPEC,exp=EXPRESSION
*
* where LANG-SPEC is `{"C" | "C++" | "Java"}'.
*
*/
public class MIVarInfoExpression extends MICommand
{
public MIVarInfoExpression(String name) {
super("-var-info-expression", new String[]{name});
}
}

View file

@ -0,0 +1,23 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-info-num-children NAME
*
* Returns the number of children of a variable object NAME:
*
* numchild=N
*
*/
public class MIVarInfoNumChildren extends MICommand
{
public MIVarInfoNumChildren(String name) {
super("-var-info-num-children", new String[]{name});
}
}

View file

@ -0,0 +1,24 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-info-type NAME
*
* Returns the type of the specified variable NAME. The type is
* returned as a string in the same format as it is output by the GDB CLI:
*
* type=TYPENAME
*
*/
public class MIVarInfoType extends MICommand
{
public MIVarInfoType(String name) {
super("-var-info-type", new String[]{name});
}
}

View file

@ -0,0 +1,24 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-list-children NAME
*
* Returns a list of the children of the specified variable object:
*
* numchild=N,children={{name=NAME,
* numchild=N,type=TYPE},(repeats N times)}
*
*/
public class MIVarListChildren extends MICommand
{
public MIVarListChildren(String name) {
super("-var-list-children", new String[]{name});
}
}

View file

@ -0,0 +1,56 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-set-format NAME FORMAT-SPEC
*
* Sets the output format for the value of the object NAME to be
* FORMAT-SPEC.
*
* The syntax for the FORMAT-SPEC is as follows:
*
* FORMAT-SPEC ==>
* {binary | decimal | hexadecimal | octal | natural}
*
*/
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) {
super("-var-set-format");
String format = "hexadecimal";
switch (fmt) {
case NATURAL:
format = "natural";
break;
case DECIMAL:
format = "decimal";
break;
case BINARY:
format = "binary";
break;
case OCTAL:
format = "octal";
break;
/*
case HEXADECIMAL:
default:
format = "x";
break;
*/
}
setParameters(new String[]{name, format});
}
}

View file

@ -0,0 +1,25 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-show-attributes NAME
*
* List attributes of the specified variable object NAME:
*
* status=ATTR [ ( ,ATTR )* ]
*
* where ATTR is `{ { editable | noneditable } | TBD }'.
*
*/
public class MIVarShowAttributes extends MICommand
{
public MIVarShowAttributes(String name) {
super("-var-show-attributes", new String[]{name});
}
}

View file

@ -0,0 +1,24 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-show-format NAME
*
* Returns the format used to display the value of the object NAME.
*
* FORMAT ==>
* FORMAT-SPEC
*
*/
public class MIVarShowFormat extends MICommand
{
public MIVarShowFormat(String name) {
super("-var-show-format", new String[]{name});
}
}

View file

@ -0,0 +1,26 @@
/*
*(c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*
*/
package org.eclipse.cdt.debug.mi.core.command;
/**
*
* -var-update {NAME | "*"}
*
* Update the value of the variable object NAME by evaluating its
* expression after fetching all the new values from memory or registers.
* A `*' causes all existing variable objects to be updated.
*
*/
public class MIVarUpdate extends MICommand
{
public MIVarUpdate() {
this("*");
}
public MIVarUpdate(String name) {
super("-var-update", new String[]{name});
}
}