1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-29 20:05:35 +02:00

Bug 337602: Setting program arguments should be done per process

This commit is contained in:
Marc Khouzam 2011-02-18 19:49:18 +00:00
parent 8f44836698
commit 82a91d1c7f
4 changed files with 16 additions and 34 deletions

View file

@ -183,9 +183,9 @@ public class DebugNewProcessSequence extends ReflectionSequence {
String args = fBackend.getProgramArguments(); String args = fBackend.getProgramArguments();
if (args != null) { if (args != null) {
String[] argArray = args.replaceAll("\n", " ").split(" "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
fCommandControl.queueCommand( fCommandControl.queueCommand(
// here we need to pass the proper container context fCommandFactory.createMIGDBSetArgs(getContainerContext(), argArray),
fCommandFactory.createMIGDBSetArgs(fCommandControl.getContext(), args),
new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm)); new DataRequestMonitor<MIInfo>(ImmediateExecutor.getInstance(), rm));
} else { } else {
rm.done(); rm.done();

View file

@ -527,16 +527,6 @@ public class CommandFactory {
return new MIExecUntil(dmc, loc); return new MIExecUntil(dmc, loc);
} }
@Deprecated
public ICommand<MIInfo> createMIFileExecAndSymbols(ICommandControlDMContext dmc, String file) {
return new MIFileExecAndSymbols(dmc, file);
}
@Deprecated
public ICommand<MIInfo> createMIFileExecAndSymbols(ICommandControlDMContext dmc) {
return new MIFileExecAndSymbols(dmc);
}
/** @since 4.0 */ /** @since 4.0 */
public ICommand<MIInfo> createMIFileExecAndSymbols(IMIContainerDMContext dmc, String file) { public ICommand<MIInfo> createMIFileExecAndSymbols(IMIContainerDMContext dmc, String file) {
return new MIFileExecAndSymbols(dmc, file); return new MIFileExecAndSymbols(dmc, file);
@ -571,16 +561,13 @@ public class CommandFactory {
return new MIGDBSet(ctx, params); return new MIGDBSet(ctx, params);
} }
public ICommand<MIInfo> createMIGDBSetArgs(ICommandControlDMContext dmc) { /** @since 4.0 */
public ICommand<MIInfo> createMIGDBSetArgs(IMIContainerDMContext dmc) {
return new MIGDBSetArgs(dmc); return new MIGDBSetArgs(dmc);
} }
public ICommand<MIInfo> createMIGDBSetArgs(ICommandControlDMContext dmc, String arguments) {
return new MIGDBSetArgs(dmc, arguments);
}
/** @since 4.0 */ /** @since 4.0 */
public ICommand<MIInfo> createMIGDBSetArgs(ICommandControlDMContext dmc, String[] arguments) { public ICommand<MIInfo> createMIGDBSetArgs(IMIContainerDMContext dmc, String[] arguments) {
return new MIGDBSetArgs(dmc, arguments); return new MIGDBSetArgs(dmc, arguments);
} }

View file

@ -1,5 +1,5 @@
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2008, 2009 Ericsson and others. * Copyright (c) 2008, 2011 Ericsson and others.
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at * which accompanies this distribution, and is available at
@ -12,7 +12,7 @@
package org.eclipse.cdt.dsf.mi.service.command.commands; 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.IMIContainerDMContext;
/** /**
* -gdb-set args ARGS * -gdb-set args ARGS
@ -21,14 +21,14 @@ import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommand
* @since 1.1 * @since 1.1
*/ */
public class MIGDBSetArgs extends MIGDBSet { public class MIGDBSetArgs extends MIGDBSet {
public MIGDBSetArgs(ICommandControlDMContext dmc) {
/** @since 4.0 */
public MIGDBSetArgs(IMIContainerDMContext dmc) {
this(dmc, new String[0]); this(dmc, new String[0]);
} }
/** /** @since 4.0 */
* @since 4.0 public MIGDBSetArgs(IMIContainerDMContext dmc, String[] arguments) {
*/
public MIGDBSetArgs(ICommandControlDMContext dmc, String[] arguments) {
super(dmc, null); super(dmc, null);
String[] cmdArray = new String[arguments.length + 1]; String[] cmdArray = new String[arguments.length + 1];
@ -38,12 +38,4 @@ public class MIGDBSetArgs extends MIGDBSet {
} }
setParameters(cmdArray); setParameters(cmdArray);
} }
/**
* @deprecated Use MIGDBSetArgs(ICommandControlDMContext, String[]) instead.
*/
@Deprecated
public MIGDBSetArgs(ICommandControlDMContext dmc, String arguments) {
this(dmc, arguments.replaceAll("\n", " ").split(" ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
}
} }

View file

@ -51,6 +51,7 @@ import org.eclipse.cdt.dsf.mi.service.CSourceLookup;
import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext; import org.eclipse.cdt.dsf.mi.service.IMIContainerDMContext;
import org.eclipse.cdt.dsf.mi.service.IMIProcesses; import org.eclipse.cdt.dsf.mi.service.IMIProcesses;
import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager; import org.eclipse.cdt.dsf.mi.service.MIBreakpointsManager;
import org.eclipse.cdt.dsf.mi.service.MIProcesses;
import org.eclipse.cdt.dsf.mi.service.command.CommandFactory; import org.eclipse.cdt.dsf.mi.service.command.CommandFactory;
import org.eclipse.cdt.dsf.mi.service.command.commands.CLICommand; import org.eclipse.cdt.dsf.mi.service.command.commands.CLICommand;
import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo; import org.eclipse.cdt.dsf.mi.service.command.output.MIInfo;
@ -212,8 +213,10 @@ public class GDBJtagDSFFinalLaunchSequence extends Sequence {
String args = fGDBBackend.getProgramArguments(); String args = fGDBBackend.getProgramArguments();
if (args != null) { if (args != null) {
String[] argArray = args.replaceAll("\n", " ").split(" "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
IMIContainerDMContext containerDmc = fProcService.createContainerContextFromGroupId(fCommandControl.getContext(), MIProcesses.UNIQUE_GROUP_ID);
fCommandControl.queueCommand( fCommandControl.queueCommand(
fCommandFactory.createMIGDBSetArgs(fCommandControl.getContext(), args), fCommandFactory.createMIGDBSetArgs(containerDmc, argArray),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor)); new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else { } else {
requestMonitor.done(); requestMonitor.done();