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

Bug 222766

Adds the use of solib-search-path as done in the CDT (by filling the Shared Library subtab in the debugger tab of the launch).
Also adds the use of auto-solib-add as in the CDT.
This commit is contained in:
Marc Khouzam 2008-04-01 18:23:01 +00:00
parent 624f00aa98
commit 4fe0578953
6 changed files with 135 additions and 3 deletions

View file

@ -10,9 +10,13 @@
*******************************************************************************/
package org.eclipse.dd.gdb.internal.provisional.launching;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceLookupDirector;
import org.eclipse.cdt.debug.mi.core.IGDBServerMILaunchConfigurationConstants;
import org.eclipse.cdt.debug.mi.core.IMILaunchConfigurationConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
@ -34,6 +38,8 @@ import org.eclipse.dd.mi.service.command.commands.MIExecContinue;
import org.eclipse.dd.mi.service.command.commands.MIExecRun;
import org.eclipse.dd.mi.service.command.commands.MIFileExecFile;
import org.eclipse.dd.mi.service.command.commands.MIFileSymbolFile;
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.MITargetSelect;
import org.eclipse.dd.mi.service.command.output.MIBreakInsertInfo;
import org.eclipse.dd.mi.service.command.output.MIInfo;
@ -73,6 +79,44 @@ public class FinalLaunchSequence extends Sequence {
fCommandControl.getExecutablePath().toOSString()),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
}},
/*
* Tell GDB to automatically load or not the shared library symbols
*/
new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
try {
boolean autolib = fLaunch.getLaunchConfiguration().getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_AUTO_SOLIB,
IMILaunchConfigurationConstants.DEBUGGER_AUTO_SOLIB_DEFAULT);
fCommandControl.queueCommand(
new MIGDBSetAutoSolib(fCommandControl.getControlDMContext(), autolib),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} catch (CoreException e) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot set shared library option", e)); //$NON-NLS-1$
requestMonitor.done();
}
}},
/*
* Set the shared library paths
*/
new Step() { @Override
public void execute(RequestMonitor requestMonitor) {
try {
@SuppressWarnings("unchecked")
List<String> p = fLaunch.getLaunchConfiguration().getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUGGER_SOLIB_PATH,
new ArrayList<String>(1));
if (p.size() > 0) {
String[] paths = p.toArray(new String[p.size()]);
fCommandControl.queueCommand(
new MIGDBSetSolibSearchPath(fCommandControl.getControlDMContext(), paths),
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
} else {
requestMonitor.done();
}
} catch (CoreException e) {
requestMonitor.setStatus(new Status(IStatus.ERROR, GdbPlugin.PLUGIN_ID, -1, "Cannot set share library paths", e)); //$NON-NLS-1$
requestMonitor.done();
}
}},
/*
* Setup the source paths
*/

View file

@ -27,7 +27,7 @@ import org.eclipse.dd.mi.service.command.output.MIInfo;
public class MIFileExecFile extends MICommand<MIInfo>
{
public MIFileExecFile(MIControlDMContext dmc, String file) {
super(dmc, "-file-exec-file", new String[] {file}); //$NON-NLS-1$
super(dmc, "-file-exec-file", null, new String[] {file}); //$NON-NLS-1$
}
public MIFileExecFile(MIControlDMContext dmc) {

View file

@ -26,7 +26,7 @@ import org.eclipse.dd.mi.service.command.output.MIInfo;
public class MIFileSymbolFile extends MICommand<MIInfo>
{
public MIFileSymbolFile(MIControlDMContext dmc, String file) {
super(dmc, "-file-symbol-file", new String[] {file}); //$NON-NLS-1$
super(dmc, "-file-symbol-file", null, new String[] {file}); //$NON-NLS-1$
}
public MIFileSymbolFile(MIControlDMContext dmc) {

View file

@ -0,0 +1,26 @@
/*******************************************************************************
* 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.dsf.datamodel.IDMContext;
import org.eclipse.dd.mi.service.command.output.MIInfo;
/**
*
* -gdb-set
*
*/
public class MIGDBSet extends MICommand<MIInfo>
{
public MIGDBSet(IDMContext ctx, String[] params) {
super(ctx, "-gdb-set", null, params); //$NON-NLS-1$
}
}

View file

@ -0,0 +1,25 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems 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
*
*/
public class MIGDBSetAutoSolib extends MIGDBSet
{
public MIGDBSetAutoSolib(MIControlDMContext ctx, boolean isSet) {
super(ctx, new String[] {"auto-solib-add", isSet ? "on" : "off"});//$NON-NLS-1$//$NON-NLS-2$//$NON-NLS-3$
}
}

View file

@ -0,0 +1,37 @@
/*******************************************************************************
* Copyright (c) 2008 QNX Software Systems 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
*
*/
public class MIGDBSetSolibSearchPath extends MIGDBSet
{
public MIGDBSetSolibSearchPath(MIControlDMContext ctx, String[] paths) {
super(ctx, paths);
// Overload the parameter
String sep = System.getProperty("path.separator", ":"); //$NON-NLS-1$ //$NON-NLS-2$
StringBuffer buffer = new StringBuffer();
for (int i = 0; i < paths.length; i++) {
if (buffer.length() == 0) {
buffer.append(paths[i]);
} else {
buffer.append(sep).append(paths[i]);
}
}
String[] p = new String [] {"solib-search-path", buffer.toString()}; //$NON-NLS-1$
setParameters(p);
}
}