1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-22 08:25:25 +02:00

More javadoc and comments.

This commit is contained in:
Alain Magloire 2002-08-26 23:10:52 +00:00
parent b6d69ba0e1
commit 094838afc5

View file

@ -26,7 +26,8 @@ public class MIPlugin extends Plugin {
private static MIPlugin plugin; private static MIPlugin plugin;
/** /**
* The constructor. * The constructor
* @see org.eclipse.core.runtime.Plugin#Plugin(IPluginDescriptor)
*/ */
public MIPlugin(IPluginDescriptor descriptor) { public MIPlugin(IPluginDescriptor descriptor) {
super(descriptor); super(descriptor);
@ -41,12 +42,21 @@ public class MIPlugin extends Plugin {
} }
/** /**
* Create a MI Session. * Method createMISession.
* @param in
* @param out
* @return MISession
*/ */
public MISession createMISession(InputStream in, OutputStream out) { public MISession createMISession(InputStream in, OutputStream out) {
return new MISession(in, out); return new MISession(in, out);
} }
/**
* Method createCSession.
* @param program
* @return ICDISession
* @throws IOException
*/
public ICDISession createCSession(String program) throws IOException { public ICDISession createCSession(String program) throws IOException {
String[]args = new String[]{"gdb", "-q", "-i", "mi", program}; String[]args = new String[]{"gdb", "-q", "-i", "mi", program};
Process gdb = Runtime.getRuntime().exec(args); Process gdb = Runtime.getRuntime().exec(args);
@ -58,7 +68,7 @@ public class MIPlugin extends Plugin {
session.postCommand(bkpt); session.postCommand(bkpt);
MIInfo info = bkpt.getMIInfo(); MIInfo info = bkpt.getMIInfo();
if (info == null) { if (info == null) {
throw new IOException("Timedout"); throw new IOException("No answer");
} }
} catch (MIException e) { } catch (MIException e) {
throw new IOException("Failed to attach"); throw new IOException("Failed to attach");
@ -67,6 +77,13 @@ public class MIPlugin extends Plugin {
return new CSession(session); return new CSession(session);
} }
/**
* Method createCSession.
* @param program
* @param core
* @return ICDISession
* @throws IOException
*/
public ICDISession createCSession(String program, String core) throws IOException { public ICDISession createCSession(String program, String core) throws IOException {
String[]args = new String[]{"gdb", "--quiet", "-i", "mi", program, core}; String[]args = new String[]{"gdb", "--quiet", "-i", "mi", program, core};
Process gdb = Runtime.getRuntime().exec(args); Process gdb = Runtime.getRuntime().exec(args);
@ -74,6 +91,13 @@ public class MIPlugin extends Plugin {
return new CSession(session); return new CSession(session);
} }
/**
* Method createCSession.
* @param program
* @param pid
* @return ICDISession
* @throws IOException
*/
public ICDISession createCSession(String program, int pid) throws IOException { public ICDISession createCSession(String program, int pid) throws IOException {
String[]args = new String[]{"gdb", "--quiet", "-i", "mi", program}; String[]args = new String[]{"gdb", "--quiet", "-i", "mi", program};
Process gdb = Runtime.getRuntime().exec(args); Process gdb = Runtime.getRuntime().exec(args);
@ -84,7 +108,7 @@ public class MIPlugin extends Plugin {
session.postCommand(attach); session.postCommand(attach);
MIInfo info = attach.getMIInfo(); MIInfo info = attach.getMIInfo();
if (info == null) { if (info == null) {
throw new IOException("Timedout"); throw new IOException("No answer");
} }
} catch (MIException e) { } catch (MIException e) {
throw new IOException("Failed to attach"); throw new IOException("Failed to attach");
@ -92,6 +116,7 @@ public class MIPlugin extends Plugin {
return new CSession(session); return new CSession(session);
} }
public static void debugLog(String message) { public static void debugLog(String message) {
// if ( getDefault().isDebugging() ) { // if ( getDefault().isDebugging() ) {
// getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null)); // getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null));