mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-08 10:16:03 +02:00
Added Debugger console to older debuggers
This commit is contained in:
parent
08412e5d6d
commit
61b7feb54d
2 changed files with 24 additions and 3 deletions
|
@ -8,6 +8,10 @@
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.core;
|
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.CCorePlugin;
|
||||||
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
|
import org.eclipse.cdt.core.IBinaryParser.IBinaryExecutable;
|
||||||
import org.eclipse.cdt.core.model.ICProject;
|
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.MultiStatus;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
|
import org.eclipse.debug.core.DebugPlugin;
|
||||||
import org.eclipse.debug.core.ILaunch;
|
import org.eclipse.debug.core.ILaunch;
|
||||||
import org.eclipse.debug.core.ILaunchConfiguration;
|
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||||
|
import org.eclipse.debug.core.model.IProcess;
|
||||||
|
|
||||||
public class CDebugAdapter implements ICDIDebugger {
|
public class CDebugAdapter implements ICDIDebugger {
|
||||||
|
|
||||||
|
@ -58,17 +64,31 @@ public class CDebugAdapter implements ICDIDebugger {
|
||||||
ICDISession session;
|
ICDISession session;
|
||||||
try {
|
try {
|
||||||
if (pid == -1 && coreFile == null) {
|
if (pid == -1 && coreFile == null) {
|
||||||
return fDebugger.createLaunchSession(config, exeFile[0]);
|
session = fDebugger.createLaunchSession(config, exeFile[0]);
|
||||||
} else if (pid != -1) {
|
} 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));
|
||||||
}
|
}
|
||||||
return 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);
|
||||||
|
}
|
||||||
|
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
abort(e.getLocalizedMessage(), e, -1);
|
abort(e.getLocalizedMessage(), e, -1);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException(); // should never happen
|
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 {
|
protected void abort(String message, Throwable exception, int code) throws CoreException {
|
||||||
MultiStatus status = new MultiStatus(CDebugCorePlugin.getUniqueIdentifier(), code, message, exception);
|
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$
|
status.add(new Status(IStatus.ERROR, CDebugCorePlugin.getUniqueIdentifier(), code, exception == null ? "" : exception.getLocalizedMessage(), //$NON-NLS-1$
|
||||||
|
|
|
@ -18,3 +18,4 @@ CGlobalVariableManager.0=Invalid global variables data.
|
||||||
CExtendedMemoryBlockRetrieval.0=Expression ''{0}'' evaluated to invalid address value: {1}.
|
CExtendedMemoryBlockRetrieval.0=Expression ''{0}'' evaluated to invalid address value: {1}.
|
||||||
DebugConfiguration.0=This debugger no longer supports this operation
|
DebugConfiguration.0=This debugger no longer supports this operation
|
||||||
CDebugAdapter.0=This debugger does not support debugging external files
|
CDebugAdapter.0=This debugger does not support debugging external files
|
||||||
|
CDebugAdapter.1=Debugger Process
|
Loading…
Add table
Reference in a new issue