diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses.java index ccc0f6a3fcf..28c97a38d81 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/service/GDBProcesses.java @@ -31,6 +31,7 @@ import org.eclipse.dd.dsf.service.DsfSession; import org.eclipse.dd.gdb.internal.GdbPlugin; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl; import org.eclipse.dd.gdb.internal.provisional.service.command.GDBControl.SessionType; +import org.eclipse.dd.mi.service.IMIProcessDMContext; import org.eclipse.dd.mi.service.command.commands.CLIAttach; import org.eclipse.dd.mi.service.command.commands.CLIMonitorListProcesses; import org.eclipse.dd.mi.service.command.output.CLIMonitorListProcessesInfo; @@ -84,7 +85,7 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses { @Immutable protected class GdbProcessDMC extends GdbThreadDMC - implements IProcessDMContext + implements IMIProcessDMContext { /** * Constructor for the context. It should not be called directly by clients. @@ -99,6 +100,8 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses { super(sessionId, null, id); } + public String getProcId() { return getId(); } + @Override public String toString() { return baseToString() + ".proc[" + getId() + "]"; } //$NON-NLS-1$ //$NON-NLS-2$ @@ -269,18 +272,9 @@ public class GDBProcesses extends AbstractDsfService implements IProcesses { } public void attachDebuggerToProcess(IProcessDMContext procCtx, final DataRequestMonitor rm) { - if (procCtx instanceof GdbProcessDMC) { - int pid; - try { - pid = Integer.parseInt(((GdbProcessDMC)procCtx).getId()); - } catch (NumberFormatException e) { - rm.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, INVALID_HANDLE, "Invalid process id.", null)); //$NON-NLS-1$ - rm.done(); - return; - } - + if (procCtx instanceof IMIProcessDMContext) { fCommandControl.queueCommand( - new CLIAttach(procCtx, pid), + new CLIAttach((IMIProcessDMContext)procCtx), new DataRequestMonitor(getExecutor(), rm) { @Override protected void handleSuccess() { diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/CLIAttach.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/CLIAttach.java index be79c4538c8..7ddc37f401d 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/CLIAttach.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/CLIAttach.java @@ -11,6 +11,7 @@ package org.eclipse.dd.mi.service.command.commands; import org.eclipse.dd.dsf.datamodel.IDMContext; +import org.eclipse.dd.mi.service.IMIProcessDMContext; import org.eclipse.dd.mi.service.command.output.MIInfo; /** @@ -18,7 +19,13 @@ import org.eclipse.dd.mi.service.command.output.MIInfo; */ public class CLIAttach extends CLICommand { + @Deprecated public CLIAttach(IDMContext ctx, int pid) { super(ctx, "attach " + Integer.toString(pid)); //$NON-NLS-1$ } + + public CLIAttach(IMIProcessDMContext ctx) { + super(ctx, "attach " + ctx.getProcId()); //$NON-NLS-1$ + } + } \ No newline at end of file diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIThreadSelect.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIThreadSelect.java index c25fd671079..5a3a50569d9 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIThreadSelect.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIThreadSelect.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2006 QNX Software Systems and others. + * Copyright (c) 2008 QNX Software Systems and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -13,6 +13,7 @@ package org.eclipse.dd.mi.service.command.commands; import org.eclipse.dd.dsf.datamodel.IDMContext; +import org.eclipse.dd.mi.service.IMIExecutionDMContext; import org.eclipse.dd.mi.service.command.output.MIInfo; @@ -27,9 +28,12 @@ import org.eclipse.dd.mi.service.command.output.MIInfo; public class MIThreadSelect extends MICommand { - + @Deprecated public MIThreadSelect(IDMContext ctx, int threadNum) { super(ctx, "-thread-select", new String[]{Integer.toString(threadNum)}); //$NON-NLS-1$ } + public MIThreadSelect(IMIExecutionDMContext ctx) { + super(ctx, "-thread-select", new String[]{Integer.toString(ctx.getThreadId())}); //$NON-NLS-1$ + } }