mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-25 18:05:33 +02:00
Bug 202339 comment #3
Currently, DSF launches gdb with a <file> argument, which tells gdb where the executable file and the symbols are. This is potentially restrictive to someone wanting to extend gdb. This change removes the <file> argument to gdb and uses -file-exec-file and -file-symbol-file commands to set this parameter in the FinalLaunchSequence. This has the exact same effect, but allows to easily override these commands by using a tailored FinalLaunchSequence.
This commit is contained in:
parent
a74f59c186
commit
bb57cba31b
5 changed files with 98 additions and 7 deletions
|
@ -32,6 +32,8 @@ import org.eclipse.dd.mi.service.command.commands.MIBreakInsert;
|
|||
import org.eclipse.dd.mi.service.command.commands.MICommand;
|
||||
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.MITargetSelect;
|
||||
import org.eclipse.dd.mi.service.command.output.MIBreakInsertInfo;
|
||||
import org.eclipse.dd.mi.service.command.output.MIInfo;
|
||||
|
@ -51,6 +53,26 @@ public class FinalLaunchSequence extends Sequence {
|
|||
|
||||
requestMonitor.done();
|
||||
}},
|
||||
/*
|
||||
* Specify the executable file to be debugged.
|
||||
*/
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fCommandControl.queueCommand(
|
||||
new MIFileExecFile(fCommandControl.getControlDMContext(),
|
||||
fCommandControl.getExecutablePath().toOSString()),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
}},
|
||||
/*
|
||||
* Read symbol table.
|
||||
*/
|
||||
new Step() { @Override
|
||||
public void execute(RequestMonitor requestMonitor) {
|
||||
fCommandControl.queueCommand(
|
||||
new MIFileSymbolFile(fCommandControl.getControlDMContext(),
|
||||
fCommandControl.getExecutablePath().toOSString()),
|
||||
new DataRequestMonitor<MIInfo>(getExecutor(), requestMonitor));
|
||||
}},
|
||||
/*
|
||||
* Setup the source paths
|
||||
*/
|
||||
|
|
|
@ -147,9 +147,10 @@ public class ServicesLaunchSequence extends Sequence {
|
|||
}
|
||||
|
||||
private IPath getGDBPath() {
|
||||
IPath retVal = new Path("gdb.exe"); //$NON-NLS-1$
|
||||
IPath retVal = new Path(IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT);
|
||||
try {
|
||||
retVal = new Path( fLaunch.getLaunchConfiguration().getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT ) );
|
||||
retVal = new Path(fLaunch.getLaunchConfiguration().getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME,
|
||||
IMILaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT));
|
||||
} catch (CoreException e) {
|
||||
}
|
||||
return retVal;
|
||||
|
|
|
@ -375,11 +375,8 @@ public class GDBControl extends AbstractMIControl {
|
|||
List<String> commandList = new ArrayList<String>();
|
||||
|
||||
commandList.add(fGdbPath.toOSString());
|
||||
if (fExecPath != null) {
|
||||
commandList.add("--interpreter"); //$NON-NLS-1$
|
||||
commandList.add("mi"); //$NON-NLS-1$
|
||||
commandList.add(fExecPath.toOSString());
|
||||
}
|
||||
commandList.add("--interpreter"); //$NON-NLS-1$
|
||||
commandList.add("mi"); //$NON-NLS-1$
|
||||
|
||||
String[] commandLine = commandList.toArray(new String[commandList.size()]);
|
||||
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2007 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ericsson - Modified for handling of contexts
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dd.mi.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.mi.service.command.MIControlDMContext;
|
||||
import org.eclipse.dd.mi.service.command.output.MIInfo;
|
||||
|
||||
|
||||
/**
|
||||
* -file-exec-file [FILE]
|
||||
*
|
||||
* Specify the executable file to be debugged. Unlike `-file-exec-and-symbols',
|
||||
* the symbol table is not read from this file. If used without argument, GDB
|
||||
* clears the information about the executable file. No output is produced,
|
||||
* except a completion notification.
|
||||
*/
|
||||
public class MIFileExecFile extends MICommand<MIInfo>
|
||||
{
|
||||
public MIFileExecFile(MIControlDMContext dmc, String file) {
|
||||
super(dmc, "-file-exec-file", new String[] {file}); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public MIFileExecFile(MIControlDMContext dmc) {
|
||||
super(dmc, "-file-exec-file"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*******************************************************************************
|
||||
* Copyright (c) 2000, 2007 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:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ericsson - Modified for handling of contexts
|
||||
*******************************************************************************/
|
||||
|
||||
package org.eclipse.dd.mi.service.command.commands;
|
||||
|
||||
import org.eclipse.dd.mi.service.command.MIControlDMContext;
|
||||
import org.eclipse.dd.mi.service.command.output.MIInfo;
|
||||
|
||||
|
||||
/**
|
||||
* -file-symbol-file [FILE]
|
||||
*
|
||||
* Read symbol table info from the specified file argument. When used without
|
||||
* arguments, clears GDB's symbol table info. No output is produced, except
|
||||
* for a completion notification.
|
||||
*/
|
||||
public class MIFileSymbolFile extends MICommand<MIInfo>
|
||||
{
|
||||
public MIFileSymbolFile(MIControlDMContext dmc, String file) {
|
||||
super(dmc, "-file-symbol-file", new String[] {file}); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public MIFileSymbolFile(MIControlDMContext dmc) {
|
||||
super(dmc, "-file-symbol-file"); //$NON-NLS-1$
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue