mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
New files.
This commit is contained in:
parent
d632d9b530
commit
458d1e28cb
5 changed files with 201 additions and 0 deletions
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
|
@ -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();
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue