Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Inglis2004-10-27 15:22:03 +0000
committerDavid Inglis2004-10-27 15:22:03 +0000
commit61b7feb54d9bcea051384c18cd634c030213a511 (patch)
treec8f61a328c65e639b509936fe4c202626355ff36
parent08412e5d6d4abf39f54d4c2d61bbe5a120644c79 (diff)
downloadorg.eclipse.cdt-61b7feb54d9bcea051384c18cd634c030213a511.tar.gz
org.eclipse.cdt-61b7feb54d9bcea051384c18cd634c030213a511.tar.xz
org.eclipse.cdt-61b7feb54d9bcea051384c18cd634c030213a511.zip
Added Debugger console to older debuggers
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java26
-rw-r--r--debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties1
2 files changed, 24 insertions, 3 deletions
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java
index 00533232d7d..9aeb0a331a6 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CDebugAdapter.java
@@ -8,6 +8,10 @@
******************************************************************************/
package org.eclipse.cdt.debug.internal.core;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.util.Date;
+
import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
import org.eclipse.cdt.core.model.ICProject;
@@ -27,8 +31,10 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IProcess;
public class CDebugAdapter implements ICDIDebugger {
@@ -58,17 +64,31 @@ public class CDebugAdapter implements ICDIDebugger {
ICDISession session;
try {
if (pid == -1 && coreFile == null) {
- return fDebugger.createLaunchSession(config, exeFile[0]);
+ session = fDebugger.createLaunchSession(config, exeFile[0]);
} else if (pid != -1) {
- return fDebugger.createAttachSession(config, exeFile[0], pid);
+ session = fDebugger.createAttachSession(config, exeFile[0], pid);
+ } else {
+ session = fDebugger.createCoreSession(config, exeFile[0], new Path(coreFile));
+ }
+ Process debugger = session.getSessionProcess();
+ if (debugger != null) {
+ IProcess debuggerProcess = DebugPlugin.newProcess(launch, debugger, renderDebuggerProcessLabel());
+ launch.addProcess(debuggerProcess);
}
- return fDebugger.createCoreSession(config, exeFile[0], new Path(coreFile));
+
} catch (CDIException e) {
abort(e.getLocalizedMessage(), e, -1);
}
throw new IllegalStateException(); // should never happen
}
+ protected String renderDebuggerProcessLabel() {
+ String format = "{0} ({1})"; //$NON-NLS-1$
+ String timestamp = DateFormat.getInstance().format(new Date(System.currentTimeMillis()));
+ String message = InternalDebugCoreMessages.getString("CDebugAdapter.1");
+ return MessageFormat.format(format, new String[]{message, timestamp}); //$NON-NLS-1$
+ }
+
protected void abort(String message, Throwable exception, int code) throws CoreException {
MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), code, message, exception);
status.add(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
index 8d2a19e46d1..8537903be3f 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/InternalDebugCoreMessages.properties
@@ -18,3 +18,4 @@ CGlobalVariableManager.0=Invalid global variables data.
CExtendedMemoryBlockRetrieval.0=Expression ''{0}'' evaluated to invalid address value: {1}.
DebugConfiguration.0=This debugger no longer supports this operation
CDebugAdapter.0=This debugger does not support debugging external files
+CDebugAdapter.1=Debugger Process \ No newline at end of file

Back to the top