1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

New files.

This commit is contained in:
Alain Magloire 2003-01-20 21:00:00 +00:00
parent d632d9b530
commit 458d1e28cb
5 changed files with 201 additions and 0 deletions

View file

@ -0,0 +1,40 @@
/*
*(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.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
import org.eclipse.cdt.debug.mi.core.output.MIPTypeInfo;
/**
*
* ptype type
*
*/
public class MIPType extends CLICommand
{
public MIPType(String var) {
super("ptype " + var);
}
public MIPTypeInfo getMIPtypeInfo() throws MIException {
return (MIPTypeInfo)getMIInfo();
}
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();
if (out != null) {
info = new MIPTypeInfo(out);
if (info.isError()) {
throw new MIException(info.getErrorMsg());
}
}
return info;
}
}

View file

@ -0,0 +1,25 @@
/*
*(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.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIInfoSharedLibraryInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
/**
*
* sharedlibrary regex
*
*/
public class MISharedLibrary extends CLICommand
{
public MISharedLibrary(String lib) {
super("sharedlibrary " + lib);
}
}

View file

@ -0,0 +1,40 @@
/*
*(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.MIInfo;
import org.eclipse.cdt.debug.mi.core.output.MIOutput;
import org.eclipse.cdt.debug.mi.core.output.MIWhatisInfo;
/**
*
* whatis type
*
*/
public class MIWhatis extends CLICommand
{
public MIWhatis(String var) {
super("whatis " + var);
}
public MIWhatisInfo getMIWhatisInfo() throws MIException {
return (MIWhatisInfo)getMIInfo();
}
public MIInfo getMIInfo() throws MIException {
MIInfo info = null;
MIOutput out = getMIOutput();
if (out != null) {
info = new MIWhatisInfo(out);
if (info.isError()) {
throw new MIException(info.getErrorMsg());
}
}
return info;
}
}

View file

@ -0,0 +1,48 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output;
/**
* GDB/MI whatis parsing.
*/
public class MIPTypeInfo extends MIInfo {
String type;
public MIPTypeInfo(MIOutput out) {
super(out);
parse();
}
public String getType() {
return type;
}
void parse() {
StringBuffer buffer = new StringBuffer();
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();
// We are interested in the shared info
if (str != null) {
str = str.trim();
if (str.startsWith ("type")) {
int equal = str.indexOf('=');
if (equal > 0) {
str = str.substring(equal + 1);
}
}
buffer.append(str);
}
}
}
}
type = buffer.toString().trim();
}
}

View file

@ -0,0 +1,48 @@
/*
* (c) Copyright QNX Software Systems Ltd. 2002.
* All Rights Reserved.
*/
package org.eclipse.cdt.debug.mi.core.output;
/**
* GDB/MI whatis parsing.
*/
public class MIWhatisInfo extends MIInfo {
String type;
public MIWhatisInfo(MIOutput out) {
super(out);
parse();
}
public String getType() {
return type;
}
void parse() {
StringBuffer buffer = new StringBuffer();
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();
// We are interested in the shared info
if (str != null) {
str = str.trim();
if (str.startsWith ("type")) {
int equal = str.indexOf('=');
if (equal > 0) {
str = str.substring(equal + 1);
}
}
buffer.append(str);
}
}
}
}
type = buffer.toString().trim();
}
}