mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-19 23:15:24 +02:00
Bug 120390: Avoiding .gdbinit
This commit is contained in:
parent
556fda170b
commit
4c2b367e01
9 changed files with 44 additions and 38 deletions
|
@ -1,3 +1,12 @@
|
|||
2005-12-20 Mikhail Khodjaiants
|
||||
Bug 120390: Avoiding .gdbinit
|
||||
* GDBCDIDebugger.java
|
||||
* GDBDebugger.java
|
||||
* GDBServerCDIDebugger.java
|
||||
* GDBServerDebugger.java
|
||||
* IMILaunchConfigurationConstants.java
|
||||
* MIPlugin.java
|
||||
|
||||
2005-11-29 Mikhail Khodjaiants
|
||||
Partial fix for bug 118114: Cannot view typedef'ed array in debugger.
|
||||
* cdi/org/eclipse/cdt/debug/mi/core/cdi/model/VariableDescriptor.java
|
||||
|
|
|
@ -97,7 +97,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
|
|||
String miVersion = getMIVersion(config);
|
||||
boolean usePty = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_USE_TERMINAL, true);
|
||||
File cwd = getProjectPath(config).toFile();
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
if (usePty) {
|
||||
session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getPath().toFile(), cwd, gdbinit, monitor);
|
||||
} else {
|
||||
|
@ -133,7 +133,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
|
|||
String miVersion = getMIVersion(config);
|
||||
int pid = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_ATTACH_PROCESS_ID, -1);
|
||||
File cwd = getProjectPath(config).toFile();
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
File exeFile = exe != null ? exe.getPath().toFile() : null;
|
||||
session = MIPlugin.getDefault().createCSession(gdb, miVersion, exeFile, pid, null, cwd, gdbinit, monitor);
|
||||
initializeLibraries(config, session);
|
||||
|
@ -166,7 +166,7 @@ public class GDBCDIDebugger implements ICDIDebugger {
|
|||
String miVersion = getMIVersion(config);
|
||||
File cwd = getProjectPath(config).toFile();
|
||||
IPath coreFile = new Path(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_COREFILE_PATH, (String)null));
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getPath().toFile(), coreFile.toFile(), cwd, gdbinit, monitor);
|
||||
initializeLibraries(config, session);
|
||||
return session;
|
||||
|
|
|
@ -76,7 +76,7 @@ public class GDBDebugger implements ICDebugger {
|
|||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
|
||||
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
|
||||
File cwd = exe.getProject().getLocation().toFile();
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), cwd, gdbinit, null);
|
||||
initializeLibraries(config, session);
|
||||
return session;
|
||||
|
@ -109,7 +109,7 @@ public class GDBDebugger implements ICDebugger {
|
|||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
|
||||
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
|
||||
File cwd = exe.getProject().getLocation().toFile();
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), pid, null, cwd, gdbinit, null);
|
||||
initializeLibraries(config, session);
|
||||
return session;
|
||||
|
@ -142,7 +142,7 @@ public class GDBDebugger implements ICDebugger {
|
|||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
|
||||
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
|
||||
File cwd = exe.getProject().getLocation().toFile();
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
session = MIPlugin.getDefault().createCSession(gdb, miVersion, exe.getLocation().toFile(), corefile.toFile(), cwd, gdbinit, null);
|
||||
initializeLibraries(config, session);
|
||||
return session;
|
||||
|
|
|
@ -26,10 +26,7 @@ import org.eclipse.core.runtime.Preferences;
|
|||
import org.eclipse.debug.core.ILaunchConfiguration;
|
||||
|
||||
/**
|
||||
* @author User
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Style - Code Templates
|
||||
* Implementing cdebugger extension point
|
||||
*/
|
||||
public class GDBServerCDIDebugger extends GDBCDIDebugger {
|
||||
|
||||
|
@ -44,7 +41,7 @@ public class GDBServerCDIDebugger extends GDBCDIDebugger {
|
|||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
|
||||
String miVersion = getMIVersion(config);
|
||||
File cwd = getProjectPath(config).toFile();
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
if (config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false)) {
|
||||
String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, "invalid"); //$NON-NLS-1$
|
||||
remote += ":"; //$NON-NLS-1$
|
||||
|
|
|
@ -66,7 +66,7 @@ public class GDBServerDebugger implements ICDebugger {
|
|||
String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb"); //$NON-NLS-1$
|
||||
String miVersion = config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi"); //$NON-NLS-1$
|
||||
File cwd = exe.getProject().getLocation().toFile();
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit"); //$NON-NLS-1$
|
||||
String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT);
|
||||
if (config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_REMOTE_TCP, false)) {
|
||||
String remote = config.getAttribute(IGDBServerMILaunchConfigurationConstants.ATTR_HOST, "invalid"); //$NON-NLS-1$
|
||||
remote += ":"; //$NON-NLS-1$
|
||||
|
|
|
@ -43,12 +43,17 @@ public interface IMILaunchConfigurationConstants {
|
|||
/**
|
||||
* Launch configuration attribute value. The key is ATTR_DEBUGGER_AUTO_SOLIB.
|
||||
*/
|
||||
public static boolean DEBUGGER_AUTO_SOLIB_DEFAULT = true;
|
||||
public static final String DEBUGGER_GDB_INIT_DEFAULT = ".gdbinit"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute value. The key is ATTR_DEBUGGER_AUTO_SOLIB.
|
||||
*/
|
||||
public static final boolean DEBUGGER_AUTO_SOLIB_DEFAULT = true;
|
||||
|
||||
/**
|
||||
* Launch configuration attribute value. The key is ATTR_DEBUGGER_STOP_ON_SOLIB_EVENTS.
|
||||
*/
|
||||
public static boolean DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT = false;
|
||||
public static final boolean DEBUGGER_STOP_ON_SOLIB_EVENTS_DEFAULT = false;
|
||||
|
||||
/**
|
||||
* launch configuration attribute key. The value is a string specifying the protocol to
|
||||
|
|
|
@ -48,9 +48,6 @@ public class MIPlugin extends Plugin {
|
|||
//The shared instance.
|
||||
private static MIPlugin plugin;
|
||||
|
||||
// GDB init command file
|
||||
private static final String GDBINIT = ".gdbinit"; //$NON-NLS-1$
|
||||
|
||||
// GDB command
|
||||
private static final String GDB = "gdb"; //$NON-NLS-1$
|
||||
|
||||
|
@ -164,9 +161,7 @@ public class MIPlugin extends Plugin {
|
|||
gdb = GDB;
|
||||
}
|
||||
|
||||
if (gdbinit == null || gdbinit.length() == 0) {
|
||||
gdbinit = GDBINIT;
|
||||
}
|
||||
String commandFile = (gdbinit != null && gdbinit.length() > 0) ? "--command="+gdbinit : "--nx"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
|
@ -175,15 +170,15 @@ public class MIPlugin extends Plugin {
|
|||
String[] args;
|
||||
if (pty != null) {
|
||||
if (program == null) {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||
} else {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||
}
|
||||
} else {
|
||||
if (program == null) {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
} else {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "-q", "-nw", "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "-q", "-nw", "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -239,19 +234,17 @@ public class MIPlugin extends Plugin {
|
|||
gdb = GDB;
|
||||
}
|
||||
|
||||
if (gdbinit == null || gdbinit.length() == 0) {
|
||||
gdbinit = GDBINIT;
|
||||
}
|
||||
|
||||
String commandFile = (gdbinit != null && gdbinit.length() > 0) ? "--command="+gdbinit : "--nx"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
}
|
||||
|
||||
String[] args;
|
||||
if (program == null) {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", miVersion, "-c", core.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion, "-c", core.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||
} else {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", miVersion, "-c", core.getAbsolutePath(), program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion, "-c", core.getAbsolutePath(), program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
|
||||
}
|
||||
|
||||
int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
|
||||
|
@ -290,9 +283,7 @@ public class MIPlugin extends Plugin {
|
|||
gdb = GDB;
|
||||
}
|
||||
|
||||
if (gdbinit == null || gdbinit.length() == 0) {
|
||||
gdbinit = GDBINIT;
|
||||
}
|
||||
String commandFile = (gdbinit != null && gdbinit.length() > 0) ? "--command="+gdbinit : "--nx"; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
if (monitor == null) {
|
||||
monitor = new NullProgressMonitor();
|
||||
|
@ -300,9 +291,9 @@ public class MIPlugin extends Plugin {
|
|||
|
||||
String[] args;
|
||||
if (program == null) {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
} else {
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), "--command="+gdbinit, "--quiet", "-nw", "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
|
||||
args = new String[] {gdb, "--cd="+cwd.getAbsolutePath(), commandFile, "--quiet", "-nw", "-i", miVersion, program.getAbsolutePath()}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
}
|
||||
|
||||
int launchTimeout = MIPlugin.getDefault().getPluginPreferences().getInt(IMIConstants.PREF_REQUEST_LAUNCH_TIMEOUT);
|
||||
|
|
|
@ -1,3 +1,7 @@
|
|||
2005-12-20 Mikhail Khodjaiants
|
||||
Bug 120390: Avoiding .gdbinit
|
||||
* GDBDebuggerPage.java
|
||||
|
||||
2005-09-06 Mikhail Khodjaiants
|
||||
Cleanup: replaced "new Boolean" by the static Boolean objects (Java 1.4).
|
||||
* GDBSolibBlock.java
|
||||
|
|
|
@ -73,7 +73,7 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
|
|||
|
||||
public void setDefaults( ILaunchConfigurationWorkingCopy configuration ) {
|
||||
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
|
||||
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$
|
||||
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT );
|
||||
configuration.setAttribute( IMILaunchConfigurationConstants.ATTR_DEBUGGER_PROTOCOL, "mi" ); //$NON-NLS-1$
|
||||
if ( fSolibBlock != null )
|
||||
fSolibBlock.setDefaults( configuration );
|
||||
|
@ -95,14 +95,14 @@ public class GDBDebuggerPage extends AbstractLaunchConfigurationTab implements O
|
|||
public void initializeFrom( ILaunchConfiguration configuration ) {
|
||||
setInitializing( true );
|
||||
String gdbCommand = "gdb"; //$NON-NLS-1$
|
||||
String gdbInit = ""; //$NON-NLS-1$
|
||||
String gdbInit = IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT;
|
||||
try {
|
||||
gdbCommand = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb" ); //$NON-NLS-1$
|
||||
}
|
||||
catch( CoreException e ) {
|
||||
}
|
||||
try {
|
||||
gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, "" ); //$NON-NLS-1$
|
||||
gdbInit = configuration.getAttribute( IMILaunchConfigurationConstants.ATTR_GDB_INIT, IMILaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT );
|
||||
}
|
||||
catch( CoreException e ) {
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue