diff --git a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/FinalLaunchSequence.java b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/FinalLaunchSequence.java index b2a0b56f2f6..6d7ce41ce63 100644 --- a/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/FinalLaunchSequence.java +++ b/plugins/org.eclipse.dd.gdb/src/org/eclipse/dd/gdb/internal/provisional/launching/FinalLaunchSequence.java @@ -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 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(getExecutor(), requestMonitor)); + new DataRequestMonitor(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(getExecutor(), requestMonitor)); + }; + }); } else { requestMonitor.done(); } diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIGDBSetSolibSearchPath.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIGDBSetSolibSearchPath.java index cc27b724634..4e9a0b564c0 100644 --- a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIGDBSetSolibSearchPath.java +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIGDBSetSolibSearchPath.java @@ -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(); diff --git a/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIGDBSetSysroot.java b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIGDBSetSysroot.java new file mode 100644 index 00000000000..25ca890dd59 --- /dev/null +++ b/plugins/org.eclipse.dd.mi/src/org/eclipse/dd/mi/service/command/commands/MIGDBSetSysroot.java @@ -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$ + } +}