Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug/src')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java16
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java97
2 files changed, 64 insertions, 49 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java
index 7993267f4..00ae04f60 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFBreakpointsModel.java
@@ -324,11 +324,11 @@ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointMana
m.put(IMarker.MESSAGE, "Breakpoint: " + msg);
Number line = (Number)p.get(IBreakpoints.PROP_LINE);
if (line != null) {
- m.put(IMarker.LINE_NUMBER, Integer.toString(line.intValue() + 1));
+ m.put(IMarker.LINE_NUMBER, new Integer(line.intValue() + 1));
Number column = (Number)p.get(IBreakpoints.PROP_COLUMN);
if (column != null) {
- m.put(IMarker.CHAR_START, column.toString());
- m.put(IMarker.CHAR_END, Integer.toString(column.intValue() + 1));
+ m.put(IMarker.CHAR_START, new Integer(column.intValue()));
+ m.put(IMarker.CHAR_END, new Integer(column.intValue() + 1));
}
}
return m;
@@ -350,13 +350,11 @@ public class TCFBreakpointsModel implements IBreakpointListener, IBreakpointMana
}
if (file != null) {
m.put(IBreakpoints.PROP_FILE, file);
- String line = (String)p.get(IMarker.LINE_NUMBER);
+ Integer line = (Integer)p.get(IMarker.LINE_NUMBER);
if (line != null) {
- m.put(IBreakpoints.PROP_LINE, new Integer(Integer.parseInt(line) - 1));
- String column = (String)p.get(IMarker.CHAR_START);
- if (column != null) {
- m.put(IBreakpoints.PROP_COLUMN, new Integer(column));
- }
+ m.put(IBreakpoints.PROP_LINE, new Integer(line.intValue() - 1));
+ Integer column = (Integer)p.get(IMarker.CHAR_START);
+ if (column != null) m.put(IBreakpoints.PROP_COLUMN, column);
}
}
return m;
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
index 6bacd0c49..7bee2287c 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
@@ -60,6 +60,8 @@ public class TCFLaunch extends Launch {
private TCFBreakpointsStatus breakpoints_status;
private String mode;
private boolean connecting;
+ private boolean disconnected;
+ private boolean shutdown;
private ProcessContext process;
public TCFLaunch(ILaunchConfiguration launchConfiguration, String mode) {
@@ -67,6 +69,7 @@ public class TCFLaunch extends Launch {
}
private void onConnected() {
+ // The method is called when TCF channel is successfully connected.
try {
final Runnable done = new Runnable() {
public void run() {
@@ -93,6 +96,58 @@ public class TCFLaunch extends Launch {
}
}
+ private void onDisconnected(Throwable error) {
+ // The method is called when TCF channel is closed.
+ assert !disconnected;
+ assert !shutdown;
+ this.error = error;
+ breakpoints_status = null;
+ connecting = false;
+ disconnected = true;
+ for (Iterator<Listener> i = listeners.iterator(); i.hasNext();) {
+ i.next().onDisconnected(this);
+ }
+ if (error != null) setError(error);
+ else fireChanged();
+ runShutdownSequence(new Runnable() {
+ public void run() {
+ shutdown = true;
+ if (DebugPlugin.getDefault() != null) fireTerminate();
+ }
+ });
+ }
+
+ private String[] toArgsArray(String file, String cmd) {
+ // Create arguments list from a command line.
+ int i = 0;
+ int l = cmd.length();
+ List<String> arr = new ArrayList<String>();
+ arr.add(file);
+ for (;;) {
+ while (i < l && cmd.charAt(i) == ' ') i++;
+ if (i >= l) break;
+ String s = null;
+ if (cmd.charAt(i) == '"') {
+ i++;
+ StringBuffer bf = new StringBuffer();
+ while (i < l) {
+ char ch = cmd.charAt(i++);
+ if (ch == '"') break;
+ if (ch == '\\' && i < l) ch = cmd.charAt(i++);
+ bf.append(ch);
+ }
+ s = bf.toString();
+ }
+ else {
+ int i0 = i;
+ while (i < l && cmd.charAt(i) != ' ') i++;
+ s = cmd.substring(i0, i);
+ }
+ arr.add(s);
+ }
+ return arr.toArray(new String[arr.size()]);
+ }
+
@SuppressWarnings("unchecked")
protected void runLaunchSequence(final Runnable done) {
try {
@@ -138,48 +193,10 @@ public class TCFLaunch extends Launch {
}
}
- private String[] toArgsArray(String file, String cmd) {
- int i = 0;
- int l = cmd.length();
- List<String> arr = new ArrayList<String>();
- arr.add(file);
- for (;;) {
- while (i < l && cmd.charAt(i) == ' ') i++;
- if (i >= l) break;
- String s = null;
- if (cmd.charAt(i) == '"') {
- i++;
- StringBuffer bf = new StringBuffer();
- while (i < l) {
- char ch = cmd.charAt(i++);
- if (ch == '"') break;
- if (ch == '\\' && i < l) ch = cmd.charAt(i++);
- bf.append(ch);
- }
- s = bf.toString();
- }
- else {
- int i0 = i;
- while (i < l && cmd.charAt(i) != ' ') i++;
- s = cmd.substring(i0, i);
- }
- arr.add(s);
- }
- return arr.toArray(new String[arr.size()]);
+ protected void runShutdownSequence(final Runnable done) {
+ done.run();
}
- private void onDisconnected(Throwable error) {
- this.error = error;
- breakpoints_status = null;
- connecting = false;
- for (Iterator<Listener> i = listeners.iterator(); i.hasNext();) {
- i.next().onDisconnected(this);
- }
- if (error != null) setError(error);
- else fireChanged();
- if (DebugPlugin.getDefault() != null) fireTerminate();
- }
-
/*--------------------------------------------------------------------------------------------*/
public Throwable getError() {

Back to the top