From 1821764512d06914862089d0d0e96c79a7fa59b7 Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Fri, 25 Apr 2003 20:50:26 +0000 Subject: [PATCH] do not call "info program" for attach session --- .../eclipse/cdt/debug/mi/core/MIInferior.java | 29 ++++++++++++------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIInferior.java b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIInferior.java index 5aae0e8482d..be2e4c4abdb 100644 --- a/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIInferior.java +++ b/debug/org.eclipse.cdt.debug.mi.core/src/org/eclipse/cdt/debug/mi/core/MIInferior.java @@ -191,7 +191,7 @@ public class MIInferior extends Process { } catch (InterruptedException e) { } } - if (isRunning() && inferiorPid != 0) { + if (isRunning() && inferiorPid > 0) { // lets try something else. gdbSpawner.raise(inferiorPid, gdbSpawner.INT); } @@ -275,7 +275,7 @@ public class MIInferior extends Process { if (pty != null) { if (in != null) { try { - in.close(); + in.close(); } catch (IOException e) { //e.printStackTrace(); } @@ -310,15 +310,22 @@ public class MIInferior extends Process { public void update() { if (inferiorPid == 0) { - // Try to discover the pid - CommandFactory factory = session.getCommandFactory(); - MIInfoProgram prog = factory.createMIInfoProgram(); - try { - session.postCommand(prog); - MIInfoProgramInfo info = prog.getMIInfoProgramInfo(); - inferiorPid = info.getPID(); - } catch (MIException e) { - // no rethrown. + // Do not try this on attach session. + if (!isConnected()) { + // Try to discover the pid + CommandFactory factory = session.getCommandFactory(); + MIInfoProgram prog = factory.createMIInfoProgram(); + try { + session.postCommand(prog); + MIInfoProgramInfo info = prog.getMIInfoProgramInfo(); + inferiorPid = info.getPID(); + } catch (MIException e) { + // no rethrown. + } + } + // We fail permantely. + if (inferiorPid == 0) { + inferiorPid = -1; } } }