1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

Bug 237306: Added -add-inferior and -remove-inferior commands

This commit is contained in:
Marc Khouzam 2010-08-12 20:16:26 +00:00
parent 91ca9b78d5
commit 1b4cb4d213
4 changed files with 133 additions and 0 deletions

View file

@ -41,6 +41,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.CLISource;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIThread;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLITrace;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLIUnsetEnv;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIAddInferior;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakAfter;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakCommands;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIBreakCondition;
@ -94,6 +95,7 @@ import org.eclipse.cdt.dsf.mi.service.command.commands.MIInferiorTTYSet;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInterpreterExec;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIInterpreterExecConsole;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIListThreadGroups;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIRemoveInferior;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackInfoDepth;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListArguments;
import org.eclipse.cdt.dsf.mi.service.command.commands.MIStackListFrames;
@ -136,6 +138,7 @@ import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoSharedLibraryInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIInfoThreadsInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLIThreadInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.CLITraceInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakInsertInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIBreakListInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIDataDisassembleInfo;
@ -252,6 +255,11 @@ public class CommandFactory {
return new CLIUnsetEnv(ctx, name);
}
/** @since 4.0 */
public ICommand<MIAddInferiorInfo> createMIAddInferior(ICommandControlDMContext ctx) {
return new MIAddInferior(ctx);
}
public ICommand<MIInfo> createMIBreakAfter(IBreakpointsTargetDMContext ctx, int breakpoint, int ignoreCount) {
return new MIBreakAfter(ctx, breakpoint, ignoreCount);
}
@ -592,6 +600,11 @@ public class CommandFactory {
return new MIListThreadGroups(ctx, listAll);
}
/** @since 4.0 */
public ICommand<MIInfo> createMIRemoveInferior(ICommandControlDMContext ctx, String groupId) {
return new MIRemoveInferior(ctx, groupId);
}
public ICommand<MIStackInfoDepthInfo> createMIStackInfoDepth(IMIExecutionDMContext ctx) {
return new MIStackInfoDepth(ctx);
}

View file

@ -0,0 +1,40 @@
/*******************************************************************************
* Copyright (c) 2010 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIAddInferiorInfo;
import org.eclipse.cdt.dsf.mi.service.command.output.MIOutput;
/**
* -add-inferior
* ^done,inferior="i2"
*
* Creates a new inferior. The created inferior is not associated with any executable.
* Such association may be established with the '-file-exec-and-symbols' command.
* The command response has a single field, 'thread-group', whose value is the
* identifier of the thread group corresponding to the new inferior.
*
* @since 4.0
*/
public class MIAddInferior extends MICommand<MIAddInferiorInfo>
{
public MIAddInferior(ICommandControlDMContext dmc) {
super(dmc, "-add-inferior"); //$NON-NLS-1$
}
@Override
public MIAddInferiorInfo getResult(MIOutput output) {
return new MIAddInferiorInfo(output);
}
}

View file

@ -0,0 +1,30 @@
/*******************************************************************************
* Copyright (c) 2010 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.commands;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
/**
* -remove-inferior GROUPID
* ^done
*
* Remove the specified inferior.
*
* @since 4.0
*/
public class MIRemoveInferior extends MICommand<MIInfo>
{
public MIRemoveInferior(ICommandControlDMContext dmc, String groupId) {
super(dmc, "-remove-inferior", new String[] { groupId }); //$NON-NLS-1$
}
}

View file

@ -0,0 +1,50 @@
/*******************************************************************************
* Copyright (c) 2010 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.cdt.dsf.mi.service.command.output;
/**
* -add-inferior
* ^done,inferior="i2"
*
* @since 4.0
*/
public class MIAddInferiorInfo extends MIInfo {
private String fGroupId;
public MIAddInferiorInfo(MIOutput record) {
super(record);
if (isDone()) {
MIOutput out = getMIOutput();
MIResultRecord rr = out.getMIResultRecord();
if (rr != null) {
MIResult[] results = rr.getMIResults();
for (int i = 0; i < results.length; i++) {
String var = results[i].getVariable();
MIValue resultVal = results[i].getMIValue();
String str = ""; //$NON-NLS-1$
if (resultVal instanceof MIConst) {
str = ((MIConst)resultVal).getString();
}
if (var.equals("inferior")) { //$NON-NLS-1$
fGroupId = str;
}
}
}
}
}
public String getGroupId() {
return fGroupId;
}
}