1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-04 06:03:18 +02:00

Bug 240525

Updates CLIAttach and MIThreadSelect.
I didn't update the usage of MIThreadSelect because it required more cleanup than I cared to do at this point.
This commit is contained in:
Marc Khouzam 2008-07-18 15:09:06 +00:00
parent cd35d1037b
commit 2a48c0efbd
3 changed files with 19 additions and 14 deletions

View file

@ -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<IDMContext> 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<MIInfo>(getExecutor(), rm) {
@Override
protected void handleSuccess() {

View file

@ -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<MIInfo> {
@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$
}
}

View file

@ -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<MIInfo>
{
@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$
}
}