Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2022-03-09 20:51:42 +0000
committerEugene Tarassov2022-03-09 20:51:42 +0000
commit3c88a885920fdbe4a7b0a604e103b7889bc4bbb4 (patch)
treebe615f18de668b7d3fccaded204beb6e017442a4
parentac59a24201e0543b3dbecc0a1efa32b723647109 (diff)
downloadorg.eclipse.tcf-3c88a885920fdbe4a7b0a604e103b7889bc4bbb4.tar.gz
org.eclipse.tcf-3c88a885920fdbe4a7b0a604e103b7889bc4bbb4.tar.xz
org.eclipse.tcf-3c88a885920fdbe4a7b0a604e103b7889bc4bbb4.zip
TCF Debugger: improved thread synchronization in the Breakpoints Model
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLocalAgent.java6
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java32
2 files changed, 26 insertions, 12 deletions
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLocalAgent.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLocalAgent.java
index c611584b2..c74b9ff2c 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLocalAgent.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLocalAgent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2009, 2012 Wind River Systems, Inc. and others.
+ * Copyright (c) 2009-2022 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -60,9 +60,7 @@ public class TCFLocalAgent {
String arch = System.getProperty("os.arch");
if (arch.equals("x86")) arch = "i386";
if (arch.equals("i686")) arch = "i386";
- if (os.startsWith("Windows")) {
- os = "Windows";
- }
+ if (os.startsWith("Windows")) os = "Windows";
if (os.equals("Linux")) os = "GNU/Linux";
return os + "/" + arch;
}
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java
index 1980cab8c..d7cbdd0a7 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFBreakpointsModel.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 Wind River Systems, Inc. and others.
+ * Copyright (c) 2007-2022 Wind River Systems, Inc. and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
@@ -107,6 +107,7 @@ public class TCFBreakpointsModel {
protected final String marker_id;
private final String marker_file;
private final String marker_type;
+ private boolean exec_done;
IBreakpoints service;
IBreakpoints.DoneCommand done;
@@ -124,15 +125,25 @@ public class TCFBreakpointsModel {
}
synchronized void exec() throws InterruptedException {
+ assert !exec_done;
assert !Protocol.isDispatchThread();
if (marker_id != null) {
Protocol.invokeLater(this);
- wait();
+ while (!exec_done) wait();
}
}
+ private synchronized void exec_done() {
+ exec_done = true;
+ BreakpointUpdate.this.notify();
+ }
+
+ @Override
public void run() {
- if (disposed) return;
+ if (disposed) {
+ exec_done();
+ return;
+ }
if (removed) id2bp.remove(marker_id);
else id2bp.put(marker_id, breakpoint);
if (is_local) {
@@ -150,9 +161,7 @@ public class TCFBreakpointsModel {
}
Protocol.sync(new Runnable() {
public void run() {
- synchronized (BreakpointUpdate.this) {
- BreakpointUpdate.this.notify();
- }
+ exec_done();
}
});
};
@@ -265,7 +274,13 @@ public class TCFBreakpointsModel {
if (map.isEmpty()) return;
Runnable r = new Runnable() {
public void run() {
- if (disposed) return;
+ if (disposed) {
+ synchronized (map) {
+ map.clear();
+ map.notify();
+ return;
+ }
+ }
for (final IChannel channel : channels.keySet()) {
IBreakpoints service = channel.getRemoteService(IBreakpoints.class);
Set<String> ids = new HashSet<String>();
@@ -288,6 +303,7 @@ public class TCFBreakpointsModel {
Protocol.sync(new Runnable() {
public void run() {
synchronized (map) {
+ map.clear();
map.notify();
}
}
@@ -297,7 +313,7 @@ public class TCFBreakpointsModel {
synchronized (map) {
assert !Protocol.isDispatchThread();
Protocol.invokeLater(r);
- map.wait();
+ while (!map.isEmpty()) map.wait();
}
}
catch (Throwable x) {

Back to the top