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

Add getUniqIdentifier.

This commit is contained in:
Alain Magloire 2002-09-23 19:25:08 +00:00
parent cec7386710
commit ebb45efa08
2 changed files with 46 additions and 17 deletions

View file

@ -0,0 +1,19 @@
package org.eclipse.cdt.debug.mi.core;
/*
* (c) Copyright QNX Software System 2002.
* All Rights Reserved.
*/
public interface IMILaunchConfigurationConstants {
/**
* Launch configuration attribute key. The value is a name of
* a C/C++ project associated with a C/C++ launch configuration.
*/
public static final String ATTR_DEBUG_NAME = MIPlugin.getUniqueIdentifier() + ".DEBUG_NAME"; //$NON-NLS-1$
public static final String ATTR_DEBUG_ARGS = MIPlugin.getUniqueIdentifier() + ".DEBUG_ARGS"; //$NON-NLS-1$
public static final String ATTR_AUTO_SOLIB = MIPlugin.getUniqueIdentifier() + ".AUTO_SOLIB"; //$NON-NLS-1$
}

View file

@ -71,11 +71,11 @@ public class MIPlugin extends Plugin {
try {
pty = new PTY();
String ttyName = pty.getSlaveName();
args = new String[]{"gdb", "-q", "-nw", "-tty", ttyName, "-i", "mi", program};
args = new String[] {"gdb", "-q", "-nw", "-tty", ttyName, "-i", "mi", program};
} catch (IOException e) {
//e.printStackTrace();
pty = null;
args = new String[]{"gdb", "-q", "-nw", "-i", "mi", program};
args = new String[] {"gdb", "-q", "-nw", "-i", "mi", program};
}
Process gdb = ProcessFactory.getFactory().exec(args);
@ -104,7 +104,7 @@ public class MIPlugin extends Plugin {
* @throws IOException
*/
public ICDISession createCSession(String program, String core) throws IOException, MIException {
String[]args = new String[]{"gdb", "--quiet", "-nw", "-i", "mi", program, core};
String[] args = new String[] {"gdb", "--quiet", "-nw", "-i", "mi", program, core};
Process gdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(gdb);
return new CSession(session);
@ -118,7 +118,7 @@ public class MIPlugin extends Plugin {
* @throws IOException
*/
public ICDISession createCSession(String program, int pid) throws IOException, MIException {
String[]args = new String[]{"gdb", "--quiet", "-nw", "-i", "mi", program};
String[] args = new String[] {"gdb", "--quiet", "-nw", "-i", "mi", program};
Process gdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(gdb);
try {
@ -130,8 +130,6 @@ public class MIPlugin extends Plugin {
throw new IOException("No answer");
}
//@@@ We have to manually set the suspended state when we attach
//(assuming the attach works) as a safeguard since GDB man not
//notice the attach (the behaviour in gdb 5.0).
session.getMIInferior().setSuspended();
} catch (MIException e) {
throw new IOException("Failed to attach");
@ -139,6 +137,18 @@ public class MIPlugin extends Plugin {
return new CSession(session, true);
}
/**
* Convenience method which returns the unique identifier of this plugin.
*/
public static String getUniqueIdentifier() {
if (getDefault() == null) {
// If the default instance is not yet initialized,
// return a static identifier. This identifier must
// match the plugin id defined in plugin.xml
return "org.eclipse.cdt.debug.mi.core"; //$NON-NLS-1$
}
return getDefault().getDescriptor().getUniqueIdentifier();
}
public static void debugLog(String message) {
// if ( getDefault().isDebugging() ) {