1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 240525

This patch cleans up MITargetAttach/Detach to use the context properly.  Since these classes are new, we don't need to worry about an API change.

A new class IMIProcessDMContext is introduced to be able to access the pid.
This commit is contained in:
Marc Khouzam 2008-07-14 19:59:45 +00:00
parent ec6e6b4dc8
commit 169508e98e
3 changed files with 37 additions and 10 deletions

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2008 Ericsson 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
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Ercisson - initial API and implementation
*******************************************************************************/
package org.eclipse.dd.mi.service;
import org.eclipse.dd.dsf.debug.service.IProcesses.IProcessDMContext;
/**
* A process context object. In the GDB/MI protocol, processes are represented
* by an string identifier, which is the basis for this context.
*/
public interface IMIProcessDMContext extends IProcessDMContext {
/**
* Returns the GDB/MI process identifier of this context.
* @return
*/
public String getProcId();
}

View file

@ -10,7 +10,8 @@
*******************************************************************************/
package org.eclipse.dd.mi.service.command.commands;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.mi.service.IMIExecutionGroupDMContext;
import org.eclipse.dd.mi.service.IMIProcessDMContext;
import org.eclipse.dd.mi.service.command.output.MIInfo;
/**
@ -21,11 +22,11 @@ import org.eclipse.dd.mi.service.command.output.MIInfo;
*/
public class MITargetAttach extends MICommand<MIInfo> {
public MITargetAttach(IDMContext ctx, String threadGroupId) {
super(ctx, "-target-attach", new String[] {threadGroupId}); //$NON-NLS-1$
public MITargetAttach(IMIExecutionGroupDMContext ctx) {
super(ctx, "-target-attach", new String[] {ctx.getGroupId()}); //$NON-NLS-1$
}
public MITargetAttach(IDMContext ctx, int pid) {
super(ctx, "-target-attach" , new String[] {"--pid " + pid}); //$NON-NLS-1$//$NON-NLS-2$
public MITargetAttach(IMIProcessDMContext ctx) {
super(ctx, "-target-attach", new String[] {"--pid " + ctx.getProcId()}); //$NON-NLS-1$//$NON-NLS-2$
}
}

View file

@ -10,7 +10,8 @@
*******************************************************************************/
package org.eclipse.dd.mi.service.command.commands;
import org.eclipse.dd.dsf.datamodel.IDMContext;
import org.eclipse.dd.mi.service.IMIExecutionGroupDMContext;
import org.eclipse.dd.mi.service.IMIProcessDMContext;
import org.eclipse.dd.mi.service.command.output.MIInfo;
/**
@ -21,11 +22,11 @@ import org.eclipse.dd.mi.service.command.output.MIInfo;
*/
public class MITargetDetach extends MICommand<MIInfo> {
public MITargetDetach(IDMContext ctx, String threadGroupId) {
super(ctx, "-target-detach", new String[] {threadGroupId}); //$NON-NLS-1$
public MITargetDetach(IMIExecutionGroupDMContext ctx) {
super(ctx, "-target-detach", new String[] {ctx.getGroupId()}); //$NON-NLS-1$
}
public MITargetDetach(IDMContext ctx, int pid) {
super(ctx, "-target-detach" , new String[] {"--pid " + pid}); //$NON-NLS-1$//$NON-NLS-2$
public MITargetDetach(IMIProcessDMContext ctx) {
super(ctx, "-target-detach", new String[] {"--pid " + ctx.getProcId()}); //$NON-NLS-1$//$NON-NLS-2$
}
}