Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-patch] gdbinit location

Index: ChangeLog
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/ChangeLog,v
retrieving revision 1.64
diff -u -r1.64 ChangeLog
--- ChangeLog	16 Jan 2003 20:25:21 -0000	1.64
+++ ChangeLog	17 Jan 2003 15:11:06 -0000
@@ -1,5 +1,17 @@
 2003-01-16 Alain Magloire
 
+	Process gdbinit configuration file.
+
+	* src/.../mi/core/MIPlugin.java (createCSession): Takes now two new
+	arguments for working directory and configuration file gdbinit.
+	* src/.../mi/core/GDBDebugger.java (createAttachSession):
+	(createCoreSession): pass the working directory and gdbinit file
+	(createLaunchSession): pass the working directory and gdbinit file
+	* src/.../mi/core/IMILaunchConfigurationConstants.java:
+	New constant ATTR_GDB_INIT.
+
+2003-01-16 Alain Magloire
+
 	* src/.../mi/core/cdi/EventManager.java (processSuspended):
 	Also process the Shared lib by calling update on the manager.
 
Index: src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java,v
retrieving revision 1.9
diff -u -r1.9 GDBDebugger.java
--- src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java	3 Jan 2003 20:30:06 -0000	1.9
+++ src/org/eclipse/cdt/debug/mi/core/GDBDebugger.java	17 Jan 2003 15:11:06 -0000
@@ -38,7 +38,9 @@
 	public ICDISession createLaunchSession(ILaunchConfiguration config, IFile exe) throws CDIException {
 		try {
 			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
-			CSession session = (CSession)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toOSString());
+			String cwd = exe.getProject().getLocation().toOSString();
+			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
+			CSession session = (CSession)MIPlugin.getDefault().createCSession(cwd, gdbinit, gdb, exe.getLocation().toOSString());
 			initializeLibraries(config, session);
 			return session;
 		} catch (IOException e) {
@@ -53,7 +55,9 @@
 	public ICDISession createAttachSession(ILaunchConfiguration config, IFile exe, int pid) throws CDIException {
 		try {
 			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
-			CSession session = (CSession)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toOSString(), pid, null);
+			String cwd = exe.getProject().getLocation().toOSString();
+			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
+			CSession session = (CSession)MIPlugin.getDefault().createCSession(cwd, gdbinit, gdb, exe.getLocation().toOSString(), pid, null);
 			initializeLibraries(config, session);
 			return session;
 		} catch (IOException e) {
@@ -69,7 +73,9 @@
 	public ICDISession createCoreSession(ILaunchConfiguration config, IFile exe, IPath corefile) throws CDIException {
 		try {
 			String gdb = config.getAttribute(IMILaunchConfigurationConstants.ATTR_DEBUG_NAME, "gdb");
-			CSession session = (CSession)MIPlugin.getDefault().createCSession(gdb, exe.getLocation().toOSString(), corefile.toOSString());
+			String cwd = exe.getProject().getLocation().toOSString();
+			String gdbinit = config.getAttribute(IMILaunchConfigurationConstants.ATTR_GDB_INIT, ".gdbinit");
+			CSession session = (CSession)MIPlugin.getDefault().createCSession(cwd, gdbinit, gdb, exe.getLocation().toOSString(), corefile.toOSString());
 			initializeLibraries(config, session);
 			return session;
 		} catch (IOException e) {
Index: src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java,v
retrieving revision 1.2
diff -u -r1.2 IMILaunchConfigurationConstants.java
--- src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java	24 Sep 2002 19:08:42 -0000	1.2
+++ src/org/eclipse/cdt/debug/mi/core/IMILaunchConfigurationConstants.java	17 Jan 2003 15:11:06 -0000
@@ -24,4 +24,11 @@
 	 * Debuger/gdb/MI property.
 	 */
 	public static final String ATTR_AUTO_SOLIB = MIPlugin.getUniqueIdentifier() + ".AUTO_SOLIB"; //$NON-NLS-1$
+
+	/**
+	 * Launch configuration attribute key. Boolean value to set the auto-solib-add
+	 * Debuger/gdb/MI property.
+	 */
+	public static final String ATTR_GDB_INIT = MIPlugin.getUniqueIdentifier() + ".GDB_INIT"; //$NON-NLS-1$
+
 }
Index: src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
===================================================================
RCS file: /home/tools/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIPlugin.java,v
retrieving revision 1.33
diff -u -r1.33 MIPlugin.java
--- src/org/eclipse/cdt/debug/mi/core/MIPlugin.java	7 Jan 2003 17:12:22 -0000	1.33
+++ src/org/eclipse/cdt/debug/mi/core/MIPlugin.java	17 Jan 2003 15:11:06 -0000
@@ -84,13 +84,13 @@
 	 * @return ICDISession
 	 * @throws MIException
 	 */
-	public ICDISession createCSession(String gdb, String program) throws IOException, MIException {
+	public ICDISession createCSession(String cwd, String gdbinit, String gdb, String program) throws IOException, MIException {
 		PTY pty = null;
 		try {
 			pty = new PTY();
 		} catch (IOException e) {
 		}
-		return createCSession(gdb, program, pty);
+		return createCSession(cwd, gdbinit, gdb, program, pty);
 	}
 
 	/**
@@ -99,16 +99,16 @@
 	 * @return ICDISession
 	 * @throws IOException
 	 */
-	public ICDISession createCSession(String gdb, String program, PTY pty) throws IOException, MIException {
+	public ICDISession createCSession(String cwd, String gdbinit, String gdb, String program, PTY pty) throws IOException, MIException {
 		if (gdb == null || gdb.length() == 0) {
 			gdb =  "gdb";
 		}
 
 		String[] args;
 		if (pty != null) {
-			args = new String[] {gdb, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program};
+			args = new String[] {gdb, "--cd="+cwd, "--command="+gdbinit, "-q", "-nw", "-tty", pty.getSlaveName(), "-i", "mi1", program};
 		} else {
-			args = new String[] {gdb, "-q", "-nw", "-i", "mi1", program};
+			args = new String[] {gdb, "--cd="+cwd, "--command="+gdbinit, "-q", "-nw", "-i", "mi1", program};
 		}
 
 		Process pgdb = ProcessFactory.getFactory().exec(args);
@@ -137,11 +137,11 @@
 	 * @return ICDISession
 	 * @throws IOException
 	 */
-	public ICDISession createCSession(String gdb, String program, String core) throws IOException, MIException {
+	public ICDISession createCSession(String cwd, String gdbinit, String gdb, String program, String core) throws IOException, MIException {
 		if (gdb == null || gdb.length() == 0) {
 			gdb =  "gdb";
 		}
-		String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi1", program, core};
+		String[] args = new String[] {gdb, "--cd="+cwd, "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program, core};
 		Process pgdb = ProcessFactory.getFactory().exec(args);
 		MISession session = createMISession(pgdb, null, MISession.CORE);
 		return new CSession(session);
@@ -154,11 +154,11 @@
 	 * @return ICDISession
 	 * @throws IOException
 	 */
-	public ICDISession createCSession(String gdb, String program, int pid, String[] targetParams) throws IOException, MIException {
+	public ICDISession createCSession(String cwd, String gdbinit, String gdb, String program, int pid, String[] targetParams) throws IOException, MIException {
 		if (gdb == null || gdb.length() == 0) {
 			gdb =  "gdb";
 		}
-		String[] args = new String[] {gdb, "--quiet", "-nw", "-i", "mi1", program};
+		String[] args = new String[] {gdb, "--cd="+cwd, "--command="+gdbinit, "--quiet", "-nw", "-i", "mi1", program};
 		Process pgdb = ProcessFactory.getFactory().exec(args);
 		MISession session = createMISession(pgdb, null, MISession.ATTACH);
 		MIInfo info = null;



Back to the top