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

Bug 229288

The GDB documentation says that sysroot should be disabled when
solib-search-path is used.  This change does this.
This commit is contained in:
Marc Khouzam 2008-06-10 13:21:59 +00:00
parent 5b3c5c8a19
commit ce33d6a9cf
3 changed files with 47 additions and 5 deletions

View file

@ -52,6 +52,7 @@ import org.eclipse.dd.mi.service.command.commands.MIFileExecAndSymbols;
import org.eclipse.dd.mi.service.command.commands.MIGDBSetArgs;
import org.eclipse.dd.mi.service.command.commands.MIGDBSetAutoSolib;
import org.eclipse.dd.mi.service.command.commands.MIGDBSetSolibSearchPath;
import org.eclipse.dd.mi.service.command.commands.MIGDBSetSysroot;
import org.eclipse.dd.mi.service.command.commands.MITargetSelect;
import org.eclipse.dd.mi.service.command.output.CLIMonitorListProcessesInfo;
import org.eclipse.dd.mi.service.command.output.MIInfo;
@ -227,7 +228,7 @@ public class FinalLaunchSequence extends Sequence {
* Set the shared library paths
*/
new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
public void execute(final RequestMonitor requestMonitor) {
try {
@SuppressWarnings("unchecked")
List<String> p = fLaunch.getLaunchConfiguration().getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH,
@ -236,7 +237,18 @@ public class FinalLaunchSequence extends Sequence {
String[] paths = p.toArray(new String[p.size()]);
fCommandControl.queueCommand(
new MIGDBSetSolibSearchPath(fCommandControl.getControlDMContext(), paths),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor) {
@Override
protected void handleSuccess() {
// If we are able to set the solib-search-path,
// we should disable the sysroot variable, as indicated
// in the GDB documentation. This is to avoid the sysroot
// variable finding libraries that were not meant to be found.
fCommandControl.queueCommand(
new MIGDBSetSysroot(fCommandControl.getControlDMContext()),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
};
});
} else {
requestMonitor.done();
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems and others.
* 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
@ -14,13 +14,13 @@ import org.eclipse.dd.mi.service.command.MIControlDMContext;
/**
*
* -gdb-set
* -gdb-set solib-search-path COLON-SEPARATED-PATH
*
*/
public class MIGDBSetSolibSearchPath extends MIGDBSet
{
public MIGDBSetSolibSearchPath(MIControlDMContext ctx, String[] paths) {
super(ctx, paths);
super(ctx, null);
// Overload the parameter
String sep = System.getProperty("path.separator", ":"); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer buffer = new StringBuffer();

View file

@ -0,0 +1,30 @@
/*******************************************************************************
* 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
package org.eclipse.dd.mi.service.command.commands;
import org.eclipse.dd.mi.service.command.MIControlDMContext;
/**
*
* -gdb-set sysroot PATH
*
*/
public class MIGDBSetSysroot extends MIGDBSet
{
public MIGDBSetSysroot(MIControlDMContext ctx, String path) {
super(ctx, new String[] {"sysroot", path});//$NON-NLS-1$
}
// Using /dev/null is the recommended way to disable sysroot
public MIGDBSetSysroot(MIControlDMContext ctx) {
this(ctx, "/dev/null"); //$NON-NLS-1$
}
}