1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-30 21:55:31 +02:00

Bug 458499 - Unable to debug when GDB command contains additional

arguments

Change-Id: I0cfb07dd04d28062a653f76dbd23510d712e4c71
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Marc Khouzam 2015-01-30 14:03:21 -05:00 committed by Gerrit Code Review @ Eclipse.org
parent b662f3b063
commit 624446b2c3
2 changed files with 21 additions and 12 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2010, 2014 Ericsson and others.
* Copyright (c) 2010, 2015 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
@ -46,6 +46,7 @@ import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.service.SessionType;
import org.eclipse.cdt.utils.CommandLineUtil;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
@ -299,8 +300,11 @@ public class LaunchUtils {
* A timeout is scheduled which will kill the process if it takes too long.
*/
public static String getGDBVersion(final ILaunchConfiguration configuration) throws CoreException {
String cmd = getGDBPath(configuration).toOSString();
String[] args = new String[] { cmd, "--version" }; //$NON-NLS-1$
String cmd = getGDBPath(configuration).toOSString() + " --version"; //$NON-NLS-1$
// Parse cmd to properly handle spaces and such things (bug 458499)
String[] args = CommandLineUtil.argumentsToArray(cmd);
Process process = null;
Job timeoutJob = null;
try {

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2006, 2012 Wind River Systems, Nokia and others.
* Copyright (c) 2006, 2015 Wind River Systems, Nokia 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
@ -47,6 +47,7 @@ import org.eclipse.cdt.dsf.mi.service.command.events.MIStoppedEvent;
import org.eclipse.cdt.dsf.service.AbstractDsfService;
import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.cdt.utils.CommandLineUtil;
import org.eclipse.cdt.utils.spawner.ProcessFactory;
import org.eclipse.cdt.utils.spawner.Spawner;
import org.eclipse.core.resources.IContainer;
@ -203,14 +204,18 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
// The goal here is to keep options to an absolute minimum.
// All configuration should be done in the final launch sequence
// to allow for more flexibility.
return new String[] { getGDBPath().toOSString(), // This could contain spaces
"--interpreter", //$NON-NLS-1$
// We currently work with MI version 2. Don't use just 'mi' because it
// points to the latest MI version, while we want mi2 specifically.
"mi2", //$NON-NLS-1$
// Don't read the gdbinit file here. It is read explicitly in
// the LaunchSequence to make it easier to customize.
"--nx" }; //$NON-NLS-1$
String cmd = getGDBPath().toOSString() +
" --interpreter" + //$NON-NLS-1$
// We currently work with MI version 2. Don't use just 'mi' because it
// points to the latest MI version, while we want mi2 specifically.
" mi2" + //$NON-NLS-1$
// Don't read the gdbinit file here. It is read explicitly in
// the LaunchSequence to make it easier to customize.
" --nx"; //$NON-NLS-1$
// Parse to properly handle spaces and such things (bug 458499)
return CommandLineUtil.argumentsToArray(cmd);
}
@Override