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

New arguments to createCSession() for cwd and location of

gdbinit.
This commit is contained in:
Alain Magloire 2003-01-17 15:12:32 +00:00
parent 90e870294f
commit 120be7b40c

View file

@ -84,13 +84,13 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws MIException * @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; PTY pty = null;
try { try {
pty = new PTY(); pty = new PTY();
} catch (IOException e) { } catch (IOException e) {
} }
return createCSession(gdb, program, pty); return createCSession(cwd, gdbinit, gdb, program, pty);
} }
/** /**
@ -99,16 +99,16 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws IOException * @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) { if (gdb == null || gdb.length() == 0) {
gdb = "gdb"; gdb = "gdb";
} }
String[] args; String[] args;
if (pty != null) { 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 { } 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); Process pgdb = ProcessFactory.getFactory().exec(args);
@ -137,11 +137,11 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws IOException * @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) { if (gdb == null || gdb.length() == 0) {
gdb = "gdb"; 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); Process pgdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(pgdb, null, MISession.CORE); MISession session = createMISession(pgdb, null, MISession.CORE);
return new CSession(session); return new CSession(session);
@ -154,11 +154,11 @@ public class MIPlugin extends Plugin {
* @return ICDISession * @return ICDISession
* @throws IOException * @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) { if (gdb == null || gdb.length() == 0) {
gdb = "gdb"; 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); Process pgdb = ProcessFactory.getFactory().exec(args);
MISession session = createMISession(pgdb, null, MISession.ATTACH); MISession session = createMISession(pgdb, null, MISession.ATTACH);
MIInfo info = null; MIInfo info = null;