1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 09:25:31 +02:00

save the PID when attaching.

This commit is contained in:
Alain Magloire 2004-02-18 03:51:06 +00:00
parent 7c2f688b9a
commit 45d013d253
3 changed files with 24 additions and 8 deletions

View file

@ -1,3 +1,11 @@
2004-02-17 Alain Magloire
If we attach save the PID for later
for example to be able to suspend.
* src/org/eclipse/cdt/debug/mi/core/MIInferior.java
* src/org/eclipse/cdt/debug/mi/core/MIPlugin.java
2004-02-11 Alain Magloire
Use String.endsWith("(gdb)") to detect the prompt.

View file

@ -46,7 +46,7 @@ public class MIInferior extends Process {
PipedOutputStream errPiped;
PTY pty;
int inferiorPid;
int inferiorPID;
MIInferior(MISession mi, PTY p) {
session = mi;
@ -200,9 +200,9 @@ public class MIInferior extends Process {
} catch (InterruptedException e) {
}
}
if ((state == RUNNING) && inferiorPid > 0) {
if ((state == RUNNING) && getInferiorPID() > 0) {
// lets try something else.
gdbSpawner.raise(inferiorPid, gdbSpawner.INT);
gdbSpawner.raise(getInferiorPID(), gdbSpawner.INT);
for (int i = 0;(state == RUNNING) && i < 5; i++) {
try {
wait(1000);
@ -315,7 +315,8 @@ public class MIInferior extends Process {
}
public void update() {
if (inferiorPid == 0) {
if (getInferiorPID() == 0) {
int pid = 0;
// Do not try this on attach session.
if (!isConnected()) {
// Try to discover the pid
@ -324,15 +325,21 @@ public class MIInferior extends Process {
try {
session.postCommand(prog);
MIInfoProgramInfo info = prog.getMIInfoProgramInfo();
inferiorPid = info.getPID();
pid = info.getPID();
} catch (MIException e) {
// no rethrown.
}
}
// We fail permantely.
if (inferiorPid == 0) {
inferiorPid = -1;
}
setInferiorPID((pid == 0) ? -1: pid);
}
}
public void setInferiorPID(int pid) {
inferiorPID = pid;
}
public int getInferiorPID() {
return inferiorPID;
}
}

View file

@ -274,6 +274,7 @@ public class MIPlugin extends Plugin {
if (info == null) {
throw new MIException("No answer");
}
session.getMIInferior().setInferiorPID(pid);
}
} catch (MIException e) {
pgdb.destroy();