Lines 42-50
Link Here
|
42 |
* made subject to such option by the copyright holder. |
42 |
* made subject to such option by the copyright holder. |
43 |
*/ |
43 |
*/ |
44 |
|
44 |
|
45 |
package org.netbeans.modules.debugger.jpda.ui.debugging; |
45 |
package org.netbeans.modules.debugger.ui.views.debugging; |
46 |
|
46 |
|
47 |
import java.beans.Customizer; |
|
|
48 |
import java.beans.PropertyChangeEvent; |
47 |
import java.beans.PropertyChangeEvent; |
49 |
import java.beans.PropertyChangeListener; |
48 |
import java.beans.PropertyChangeListener; |
50 |
import java.beans.PropertyChangeSupport; |
49 |
import java.beans.PropertyChangeSupport; |
Lines 55-69
Link Here
|
55 |
import java.util.Map; |
54 |
import java.util.Map; |
56 |
import java.util.Set; |
55 |
import java.util.Set; |
57 |
import java.util.WeakHashMap; |
56 |
import java.util.WeakHashMap; |
|
|
57 |
import org.netbeans.api.debugger.Breakpoint; |
58 |
import org.netbeans.api.debugger.DebuggerEngine; |
58 |
import org.netbeans.api.debugger.DebuggerEngine; |
59 |
import org.netbeans.api.debugger.DebuggerManager; |
59 |
import org.netbeans.api.debugger.DebuggerManager; |
60 |
import org.netbeans.api.debugger.DebuggerManagerAdapter; |
60 |
import org.netbeans.api.debugger.DebuggerManagerAdapter; |
61 |
import org.netbeans.api.debugger.LazyDebuggerManagerListener; |
61 |
import org.netbeans.api.debugger.LazyDebuggerManagerListener; |
62 |
import org.netbeans.api.debugger.jpda.DeadlockDetector; |
|
|
63 |
import org.netbeans.api.debugger.jpda.JPDABreakpoint; |
64 |
import org.netbeans.api.debugger.jpda.JPDADebugger; |
65 |
import org.netbeans.api.debugger.jpda.JPDAThread; |
66 |
import org.netbeans.spi.debugger.DebuggerServiceRegistration; |
62 |
import org.netbeans.spi.debugger.DebuggerServiceRegistration; |
|
|
63 |
import org.netbeans.spi.debugger.ui.DebuggingView.DVSupport; |
64 |
import org.netbeans.spi.debugger.ui.DebuggingView.DVThread; |
67 |
import org.openide.util.Exceptions; |
65 |
import org.openide.util.Exceptions; |
68 |
|
66 |
|
69 |
@DebuggerServiceRegistration(types=LazyDebuggerManagerListener.class) |
67 |
@DebuggerServiceRegistration(types=LazyDebuggerManagerListener.class) |
Lines 73-83
Link Here
|
73 |
private static PropertyChangeSupport pchs = new PropertyChangeSupport(ThreadsListener.class); |
71 |
private static PropertyChangeSupport pchs = new PropertyChangeSupport(ThreadsListener.class); |
74 |
private static final ThreadsPropertyChangeListener tpchl = new ThreadsPropertyChangeListener(); |
72 |
private static final ThreadsPropertyChangeListener tpchl = new ThreadsPropertyChangeListener(); |
75 |
|
73 |
|
76 |
final LinkedList<JPDAThread> currentThreadsHistory = new LinkedList(); |
74 |
final LinkedList<DVThread> currentThreadsHistory = new LinkedList(); |
77 |
final BreakpointHits hits = new BreakpointHits(); |
75 |
final BreakpointHits hits = new BreakpointHits(); |
78 |
private Map<JPDADebugger, DebuggerListener> debuggerToListener = new WeakHashMap<JPDADebugger, DebuggerListener>(); |
76 |
private Map<DVSupport, DebuggerListener> debuggerToListener = new WeakHashMap<DVSupport, DebuggerListener>(); |
79 |
private JPDADebugger currentDebugger = null; |
77 |
private DVSupport currentDebugger = null; |
80 |
private DebuggingView debuggingView; |
78 |
private DebuggingViewComponent debuggingView; |
81 |
|
79 |
|
82 |
/** |
80 |
/** |
83 |
* Constructor for the registry only. |
81 |
* Constructor for the registry only. |
Lines 103-124
Link Here
|
103 |
pchs.removePropertyChangeListener(listener); |
101 |
pchs.removePropertyChangeListener(listener); |
104 |
} |
102 |
} |
105 |
|
103 |
|
106 |
public void setDebuggingView(DebuggingView debuggingView) { |
104 |
public void setDebuggingView(DVSupport dvs, DebuggingViewComponent debuggingView) { |
107 |
this.debuggingView = debuggingView; |
105 |
this.debuggingView = debuggingView; |
108 |
InfoPanel infoPanel = debuggingView.getInfoPanel(); |
106 |
InfoPanel infoPanel = debuggingView.getInfoPanel(); |
109 |
infoPanel.setBreakpointHits(getHits()); |
107 |
infoPanel.setBreakpointHits(dvs, getHits()); |
110 |
} |
108 |
} |
111 |
|
109 |
|
112 |
public synchronized void changeDebugger(JPDADebugger deb) { |
110 |
public synchronized void changeDebugger(DVSupport deb) { |
113 |
if (currentDebugger == deb) { |
111 |
if (currentDebugger == deb) { |
114 |
return; |
112 |
return; |
115 |
} |
113 |
} |
116 |
if (currentDebugger != null) { |
114 |
if (currentDebugger != null) { |
117 |
currentDebugger.getThreadsCollector().removePropertyChangeListener(tpchl); |
115 |
currentDebugger.removePropertyChangeListener(tpchl); |
118 |
} |
116 |
} |
119 |
if (deb != null) { |
117 |
if (deb != null) { |
120 |
deb.getThreadsCollector().addPropertyChangeListener(tpchl); |
118 |
deb.addPropertyChangeListener(tpchl); |
121 |
JPDAThread currThread = deb.getCurrentThread(); |
119 |
DVThread currThread = deb.getCurrentThread(); |
122 |
if (currThread != null) { |
120 |
if (currThread != null) { |
123 |
synchronized(currentThreadsHistory) { |
121 |
synchronized(currentThreadsHistory) { |
124 |
currentThreadsHistory.remove(currThread); |
122 |
currentThreadsHistory.remove(currThread); |
Lines 141-155
Link Here
|
141 |
InfoPanel infoPanel = debuggingView.getInfoPanel(); |
139 |
InfoPanel infoPanel = debuggingView.getInfoPanel(); |
142 |
DebuggerListener listener = debuggerToListener.get(deb); |
140 |
DebuggerListener listener = debuggerToListener.get(deb); |
143 |
if (listener != null) { |
141 |
if (listener != null) { |
144 |
DeadlockDetector detector = deb.getThreadsCollector().getDeadlockDetector(); |
142 |
//DeadlockDetector detector = deb.getThreadsCollector().getDeadlockDetector(); |
145 |
detector.addPropertyChangeListener(this); |
143 |
//detector.addPropertyChangeListener(this); |
146 |
if (detector.getDeadlocks() != null) { |
144 |
if (deb.getDeadlocks() != null) { |
147 |
infoPanel.setShowDeadlock(true); |
145 |
infoPanel.setShowDeadlock(true); |
148 |
} |
146 |
} |
149 |
infoPanel.setShowThreadLocks(listener.lockedThread, listener.lockerThreads); |
147 |
infoPanel.setShowThreadLocks(listener.lockedThread, listener.lockerThreads); |
150 |
infoPanel.setShowStepBrkp(listener.debugger, listener.stepBrkpThread, listener.stepBrkpBreakpoint); |
148 |
infoPanel.setShowStepBrkp(listener.debugger, listener.stepBrkpThread, listener.stepBrkpBreakpoint); |
151 |
} |
149 |
} |
152 |
infoPanel.recomputeMenuItems(getHits()); |
150 |
infoPanel.recomputeMenuItems(deb, getHits()); |
153 |
} else { |
151 |
} else { |
154 |
// Release reference to DebuggingView when there's no debugger. |
152 |
// Release reference to DebuggingView when there's no debugger. |
155 |
debuggingView = null; |
153 |
debuggingView = null; |
Lines 157-166
Link Here
|
157 |
this.currentDebugger = deb; |
155 |
this.currentDebugger = deb; |
158 |
} |
156 |
} |
159 |
|
157 |
|
160 |
public synchronized List<JPDAThread> getCurrentThreadsHistory() { |
158 |
public synchronized List<DVThread> getCurrentThreadsHistory() { |
161 |
synchronized(currentThreadsHistory) { |
159 |
synchronized(currentThreadsHistory) { |
162 |
List<JPDAThread> result = new ArrayList<JPDAThread>(currentThreadsHistory.size()); |
160 |
List<DVThread> result = new ArrayList<DVThread>(currentThreadsHistory.size()); |
163 |
for (JPDAThread thread : currentThreadsHistory) { |
161 |
for (DVThread thread : currentThreadsHistory) { |
164 |
if (thread.isSuspended()) { |
162 |
if (thread.isSuspended()) { |
165 |
result.add(thread); |
163 |
result.add(thread); |
166 |
} |
164 |
} |
Lines 169-185
Link Here
|
169 |
} |
167 |
} |
170 |
} |
168 |
} |
171 |
|
169 |
|
172 |
public synchronized List<JPDAThread> getThreads() { |
170 |
public synchronized List<DVThread> getThreads() { |
173 |
List<JPDAThread> result = new ArrayList<JPDAThread>(); |
171 |
List<DVThread> result = new ArrayList<DVThread>(); |
174 |
for (JPDADebugger debugger : debuggerToListener.keySet()) { |
172 |
for (DVSupport debugger : debuggerToListener.keySet()) { |
175 |
if (debugger != null && debugger.getState() != JPDADebugger.STATE_DISCONNECTED) { |
173 |
if (debugger != null && debugger.getState() != DVSupport.STATE.DISCONNECTED) { |
176 |
result.addAll(debugger.getThreadsCollector().getAllThreads()); |
174 |
result.addAll(debugger.getAllThreads()); |
177 |
} |
175 |
} |
178 |
} |
176 |
} |
179 |
return result; |
177 |
return result; |
180 |
} |
178 |
} |
181 |
|
179 |
|
182 |
private void addBreakpointHit(JPDAThread thread) { |
180 |
private void addBreakpointHit(DVThread thread) { |
183 |
if (thread != null && !hits.contains(thread)) { |
181 |
if (thread != null && !hits.contains(thread)) { |
184 |
// System.out.println("Hit added: " + thread.getName()); |
182 |
// System.out.println("Hit added: " + thread.getName()); |
185 |
hits.add(thread); |
183 |
hits.add(thread); |
Lines 189-195
Link Here
|
189 |
} |
187 |
} |
190 |
} |
188 |
} |
191 |
|
189 |
|
192 |
private void removeBreakpointHit(JPDAThread thread) { |
190 |
private void removeBreakpointHit(DVThread thread) { |
193 |
if (thread != null && hits.contains(thread)) { |
191 |
if (thread != null && hits.contains(thread)) { |
194 |
// System.out.println("Hit removed: " + thread.getName()); |
192 |
// System.out.println("Hit removed: " + thread.getName()); |
195 |
hits.remove(thread); |
193 |
hits.remove(thread); |
Lines 199-207
Link Here
|
199 |
} |
197 |
} |
200 |
} |
198 |
} |
201 |
|
199 |
|
202 |
public synchronized List<JPDAThread> getHits() { |
200 |
public synchronized List<DVThread> getHits() { |
203 |
List<JPDAThread> result = new ArrayList<JPDAThread>(); |
201 |
List<DVThread> result = new ArrayList<DVThread>(); |
204 |
for (JPDAThread thread : hits.getStoppedThreads()) { |
202 |
for (DVThread thread : hits.getStoppedThreads()) { |
205 |
result.add(thread); |
203 |
result.add(thread); |
206 |
} |
204 |
} |
207 |
return result; |
205 |
return result; |
Lines 211-217
Link Here
|
211 |
return hits.size(); |
209 |
return hits.size(); |
212 |
} |
210 |
} |
213 |
|
211 |
|
214 |
public synchronized boolean isBreakpointHit(JPDAThread thread) { |
212 |
public synchronized boolean isBreakpointHit(DVThread thread) { |
215 |
return hits.contains(thread); |
213 |
return hits.contains(thread); |
216 |
} |
214 |
} |
217 |
|
215 |
|
Lines 219-225
Link Here
|
219 |
hits.goToHit(); |
217 |
hits.goToHit(); |
220 |
} |
218 |
} |
221 |
|
219 |
|
222 |
public JPDADebugger getDebugger() { |
220 |
public DVSupport getDVSupport() { |
223 |
return currentDebugger; |
221 |
return currentDebugger; |
224 |
} |
222 |
} |
225 |
|
223 |
|
Lines 230-236
Link Here
|
230 |
|
228 |
|
231 |
@Override |
229 |
@Override |
232 |
public synchronized void engineAdded(DebuggerEngine engine) { |
230 |
public synchronized void engineAdded(DebuggerEngine engine) { |
233 |
JPDADebugger deb = engine.lookupFirst(null, JPDADebugger.class); |
231 |
DVSupport deb = engine.lookupFirst(null, DVSupport.class); |
234 |
if (deb != null) { |
232 |
if (deb != null) { |
235 |
DebuggerListener listener = new DebuggerListener(deb); |
233 |
DebuggerListener listener = new DebuggerListener(deb); |
236 |
debuggerToListener.put(deb, listener); |
234 |
debuggerToListener.put(deb, listener); |
Lines 242-248
Link Here
|
242 |
|
240 |
|
243 |
@Override |
241 |
@Override |
244 |
public synchronized void engineRemoved(DebuggerEngine engine) { |
242 |
public synchronized void engineRemoved(DebuggerEngine engine) { |
245 |
JPDADebugger deb = engine.lookupFirst(null, JPDADebugger.class); |
243 |
DVSupport deb = engine.lookupFirst(null, DVSupport.class); |
246 |
if (deb != null) { |
244 |
if (deb != null) { |
247 |
DebuggerListener listener = debuggerToListener.remove(deb); |
245 |
DebuggerListener listener = debuggerToListener.remove(deb); |
248 |
if (listener != null) { |
246 |
if (listener != null) { |
Lines 260-282
Link Here
|
260 |
|
258 |
|
261 |
class DebuggerListener implements PropertyChangeListener { |
259 |
class DebuggerListener implements PropertyChangeListener { |
262 |
|
260 |
|
263 |
private JPDADebugger debugger; |
261 |
private DVSupport debugger; |
264 |
Set<JPDAThread> threads = new HashSet<JPDAThread>(); |
262 |
Set<DVThread> threads = new HashSet<DVThread>(); |
265 |
List<JPDAThread> lockerThreads; |
263 |
List<DVThread> lockerThreads; |
266 |
JPDAThread lockedThread; |
264 |
DVThread lockedThread; |
267 |
JPDAThread stepBrkpThread; |
265 |
DVThread stepBrkpThread; |
268 |
JPDABreakpoint stepBrkpBreakpoint; |
266 |
Breakpoint stepBrkpBreakpoint; |
269 |
|
267 |
|
270 |
DebuggerListener(JPDADebugger debugger) { |
268 |
DebuggerListener(DVSupport debugger) { |
271 |
this.debugger = debugger; |
269 |
this.debugger = debugger; |
272 |
debugger.addPropertyChangeListener(this); |
270 |
debugger.addPropertyChangeListener(this); |
273 |
List<JPDAThread> allThreads = debugger.getThreadsCollector().getAllThreads(); |
271 |
List<DVThread> allThreads = debugger.getAllThreads(); |
274 |
for (JPDAThread thread : allThreads) { |
272 |
for (DVThread thread : allThreads) { |
275 |
threads.add(thread); |
273 |
threads.add(thread); |
276 |
((Customizer)thread).addPropertyChangeListener(this); |
274 |
thread.addPropertyChangeListener(this); |
277 |
} |
275 |
} |
278 |
DeadlockDetector detector = debugger.getThreadsCollector().getDeadlockDetector(); |
276 |
//DeadlockDetector detector = debugger.getThreadsCollector().getDeadlockDetector(); |
279 |
detector.addPropertyChangeListener(this); |
277 |
//detector.addPropertyChangeListener(this); |
280 |
} |
278 |
} |
281 |
|
279 |
|
282 |
public synchronized void propertyChange(PropertyChangeEvent evt) { |
280 |
public synchronized void propertyChange(PropertyChangeEvent evt) { |
Lines 284-321
Link Here
|
284 |
String propName = evt.getPropertyName(); |
282 |
String propName = evt.getPropertyName(); |
285 |
Object source = evt.getSource(); |
283 |
Object source = evt.getSource(); |
286 |
|
284 |
|
287 |
if (source instanceof JPDADebugger) { |
285 |
if (source instanceof DVSupport) { |
288 |
if (JPDADebugger.PROP_THREAD_STARTED.equals(propName)) { |
286 |
if (DVSupport.PROP_THREAD_STARTED.equals(propName)) { |
289 |
//System.out.println("STARTED: " + evt.getNewValue()); |
287 |
//System.out.println("STARTED: " + evt.getNewValue()); |
290 |
final JPDAThread jpdaThread = (JPDAThread)evt.getNewValue(); |
288 |
final DVThread jpdaThread = (DVThread)evt.getNewValue(); |
291 |
if (threads.add(jpdaThread)) { |
289 |
if (threads.add(jpdaThread)) { |
292 |
((Customizer)jpdaThread).addPropertyChangeListener(this); |
290 |
jpdaThread.addPropertyChangeListener(this); |
293 |
// System.out.println("WATCHED: " + jpdaThread.getName()); |
291 |
// System.out.println("WATCHED: " + jpdaThread.getName()); |
294 |
} |
292 |
} |
295 |
} else if (JPDADebugger.PROP_THREAD_DIED.equals(propName)) { |
293 |
} else if (DVSupport.PROP_THREAD_DIED.equals(propName)) { |
296 |
//System.out.println("DIED: " + evt.getOldValue()); |
294 |
//System.out.println("DIED: " + evt.getOldValue()); |
297 |
JPDAThread jpdaThread = (JPDAThread)evt.getOldValue(); |
295 |
DVThread jpdaThread = (DVThread)evt.getOldValue(); |
298 |
if (threads.remove(jpdaThread)) { |
296 |
if (threads.remove(jpdaThread)) { |
299 |
synchronized(currentThreadsHistory) { |
297 |
synchronized(currentThreadsHistory) { |
300 |
currentThreadsHistory.remove(jpdaThread); |
298 |
currentThreadsHistory.remove(jpdaThread); |
301 |
} |
299 |
} |
302 |
((Customizer)jpdaThread).removePropertyChangeListener(this); |
300 |
jpdaThread.removePropertyChangeListener(this); |
303 |
// System.out.println("RELEASED: " + jpdaThread.getName()); |
301 |
// System.out.println("RELEASED: " + jpdaThread.getName()); |
304 |
} |
302 |
} |
305 |
} else if (JPDADebugger.PROP_CURRENT_THREAD.equals(propName)) { |
303 |
} else if (DVSupport.PROP_CURRENT_THREAD.equals(propName)) { |
306 |
JPDAThread currentThread = debugger.getCurrentThread(); |
304 |
DVThread currentThread = debugger.getCurrentThread(); |
307 |
removeBreakpointHit(currentThread); |
305 |
removeBreakpointHit(currentThread); |
308 |
synchronized(currentThreadsHistory) { |
306 |
synchronized(currentThreadsHistory) { |
309 |
currentThreadsHistory.remove(currentThread); |
307 |
currentThreadsHistory.remove(currentThread); |
310 |
currentThreadsHistory.addFirst(currentThread); |
308 |
currentThreadsHistory.addFirst(currentThread); |
311 |
} |
309 |
} |
312 |
} else if (JPDADebugger.PROP_STATE.equals(propName) && |
310 |
} else if (DVSupport.PROP_STATE.equals(propName) && |
313 |
debugger != null && debugger.getState() == JPDADebugger.STATE_DISCONNECTED) { |
311 |
debugger != null && debugger.getState() == DVSupport.STATE.DISCONNECTED) { |
314 |
unregister(); |
312 |
unregister(); |
|
|
313 |
} else if (DVSupport.PROP_DEADLOCK.equals(propName)) { |
314 |
setShowDeadlock(true); |
315 |
} |
315 |
} |
316 |
} else if (source instanceof JPDAThread) { |
316 |
} else if (source instanceof DVThread) { |
317 |
final JPDAThread thread = (JPDAThread)source; |
317 |
final DVThread thread = (DVThread)source; |
318 |
if (JPDAThread.PROP_BREAKPOINT.equals(propName)) { |
318 |
if (DVThread.PROP_BREAKPOINT.equals(propName)) { |
319 |
// System.out.println("THREAD: " + thread.getName() + ", curr: " + isCurrent(thread) + ", brk: " + isAtBreakpoint(thread)); |
319 |
// System.out.println("THREAD: " + thread.getName() + ", curr: " + isCurrent(thread) + ", brk: " + isAtBreakpoint(thread)); |
320 |
if (!isCurrent(thread)) { |
320 |
if (!isCurrent(thread)) { |
321 |
if (isAtBreakpoint(thread)) { |
321 |
if (isAtBreakpoint(thread)) { |
Lines 329-374
Link Here
|
329 |
if (debugger == currentDebugger && debuggingView != null) { |
329 |
if (debugger == currentDebugger && debuggingView != null) { |
330 |
debuggingView.refreshView(); // [TODO] |
330 |
debuggingView.refreshView(); // [TODO] |
331 |
} |
331 |
} |
332 |
} else if (JPDAThread.PROP_SUSPENDED.equals(propName)) { |
332 |
} else if (DVThread.PROP_SUSPENDED.equals(propName)) { |
333 |
if (!thread.isSuspended()) { |
333 |
if (!thread.isSuspended()) { |
334 |
removeBreakpointHit(thread); |
334 |
removeBreakpointHit(thread); |
335 |
} |
335 |
} |
336 |
if (debugger == currentDebugger && debuggingView != null) { |
336 |
if (debugger == currentDebugger && debuggingView != null) { |
337 |
debuggingView.refreshView(); // [TODO] |
337 |
debuggingView.refreshView(); // [TODO] |
338 |
} |
338 |
} |
339 |
} else if ("lockerThreads".equals(propName)) { // NOI18N |
339 |
} else if (DVThread.PROP_LOCKER_THREADS.equals(propName)) { // NOI18N |
340 |
// Calling List<JPDAThread> getLockerThreads() |
340 |
// Calling List<DVThread> getLockerThreads() |
341 |
List<JPDAThread> currLockerThreads; |
341 |
List<DVThread> currLockerThreads = thread.getLockerThreads(); |
|
|
342 |
/*List<DVThread> currLockerThreads; |
342 |
try { |
343 |
try { |
343 |
java.lang.reflect.Method lockerThreadsMethod = thread.getClass().getMethod("getLockerThreads", new Class[] {}); // NOI18N |
344 |
java.lang.reflect.Method lockerThreadsMethod = thread.getClass().getMethod("getLockerThreads", new Class[] {}); // NOI18N |
344 |
currLockerThreads = (List<JPDAThread>) lockerThreadsMethod.invoke(thread, new Object[] {}); |
345 |
currLockerThreads = (List<DVThread>) lockerThreadsMethod.invoke(thread, new Object[] {}); |
345 |
} catch (Exception ex) { |
346 |
} catch (Exception ex) { |
346 |
Exceptions.printStackTrace(ex); |
347 |
Exceptions.printStackTrace(ex); |
347 |
currLockerThreads = null; |
348 |
currLockerThreads = null; |
348 |
} |
349 |
}*/ |
349 |
setShowThreadLocks(thread, currLockerThreads); |
350 |
setShowThreadLocks(thread, currLockerThreads); |
350 |
} else if ("stepSuspendedByBreakpoint".equals(propName)) { |
351 |
} else if ("stepSuspendedByBreakpoint".equals(propName)) { |
351 |
setShowStepBrkp(thread, (JPDABreakpoint) evt.getNewValue()); |
352 |
setShowStepBrkp(thread, (Breakpoint) evt.getNewValue()); |
352 |
} |
|
|
353 |
} else if (source instanceof DeadlockDetector) { |
354 |
if (DeadlockDetector.PROP_DEADLOCK.equals(propName)) { |
355 |
setShowDeadlock(true); |
356 |
} |
353 |
} |
357 |
} |
354 |
} |
358 |
} |
355 |
} |
359 |
|
356 |
|
360 |
private synchronized void unregister() { |
357 |
private synchronized void unregister() { |
361 |
if (debugger == null) return ; |
358 |
if (debugger == null) return ; |
362 |
for (JPDAThread thread : threads) { |
359 |
for (DVThread thread : threads) { |
363 |
((Customizer) thread).removePropertyChangeListener(this); |
360 |
thread.removePropertyChangeListener(this); |
364 |
} |
361 |
} |
365 |
synchronized(currentThreadsHistory) { |
362 |
synchronized(currentThreadsHistory) { |
366 |
for (JPDAThread thread : threads) { |
363 |
for (DVThread thread : threads) { |
367 |
currentThreadsHistory.remove(thread); |
364 |
currentThreadsHistory.remove(thread); |
368 |
} |
365 |
} |
369 |
} |
366 |
} |
370 |
synchronized(hits) { |
367 |
synchronized(hits) { |
371 |
for (JPDAThread thread : threads) { |
368 |
for (DVThread thread : threads) { |
372 |
removeBreakpointHit(thread); |
369 |
removeBreakpointHit(thread); |
373 |
} |
370 |
} |
374 |
} |
371 |
} |
Lines 378-394
Link Here
|
378 |
stepBrkpThread = null; |
375 |
stepBrkpThread = null; |
379 |
stepBrkpBreakpoint = null; |
376 |
stepBrkpBreakpoint = null; |
380 |
debugger.removePropertyChangeListener(this); |
377 |
debugger.removePropertyChangeListener(this); |
381 |
debugger.getThreadsCollector().getDeadlockDetector().removePropertyChangeListener(this); |
378 |
debugger./*getThreadsCollector().getDeadlockDetector().*/removePropertyChangeListener(this); |
382 |
debugger = null; |
379 |
debugger = null; |
383 |
} |
380 |
} |
384 |
|
381 |
|
385 |
private boolean isCurrent(JPDAThread thread) { |
382 |
private boolean isCurrent(DVThread thread) { |
386 |
return debugger.getCurrentThread() == thread; |
383 |
return debugger.getCurrentThread() == thread; |
387 |
} |
384 |
} |
388 |
|
385 |
|
389 |
private boolean isAtBreakpoint(JPDAThread thread) { |
386 |
private boolean isAtBreakpoint(DVThread thread) { |
390 |
JPDABreakpoint breakpoint = thread.getCurrentBreakpoint(); |
387 |
Breakpoint breakpoint = thread.getCurrentBreakpoint(); |
391 |
return breakpoint != null && !breakpoint.isHidden(); |
388 |
return breakpoint != null;// && !breakpoint.isHidden(); |
392 |
} |
389 |
} |
393 |
|
390 |
|
394 |
private void setShowDeadlock(boolean detected) { |
391 |
private void setShowDeadlock(boolean detected) { |
Lines 397-403
Link Here
|
397 |
} |
394 |
} |
398 |
} |
395 |
} |
399 |
|
396 |
|
400 |
private void setShowThreadLocks(JPDAThread thread, List<JPDAThread> currLockerThreads) { |
397 |
private void setShowThreadLocks(DVThread thread, List<DVThread> currLockerThreads) { |
401 |
lockerThreads = currLockerThreads; |
398 |
lockerThreads = currLockerThreads; |
402 |
lockedThread = thread; |
399 |
lockedThread = thread; |
403 |
if (debugger == currentDebugger && debuggingView != null) { |
400 |
if (debugger == currentDebugger && debuggingView != null) { |
Lines 405-411
Link Here
|
405 |
} |
402 |
} |
406 |
} |
403 |
} |
407 |
|
404 |
|
408 |
private void setShowStepBrkp(JPDAThread thread, JPDABreakpoint breakpoint) { |
405 |
private void setShowStepBrkp(DVThread thread, Breakpoint breakpoint) { |
409 |
stepBrkpThread = thread; |
406 |
stepBrkpThread = thread; |
410 |
stepBrkpBreakpoint = breakpoint; |
407 |
stepBrkpBreakpoint = breakpoint; |
411 |
if (debugger == currentDebugger && debuggingView != null) { |
408 |
if (debugger == currentDebugger && debuggingView != null) { |
Lines 416-437
Link Here
|
416 |
} |
413 |
} |
417 |
|
414 |
|
418 |
static class BreakpointHits { |
415 |
static class BreakpointHits { |
419 |
private Set<JPDAThread> stoppedThreadsSet = new HashSet<JPDAThread>(); |
416 |
private Set<DVThread> stoppedThreadsSet = new HashSet<DVThread>(); |
420 |
private LinkedList<JPDAThread> stoppedThreads = new LinkedList<JPDAThread>(); |
417 |
private LinkedList<DVThread> stoppedThreads = new LinkedList<DVThread>(); |
421 |
|
418 |
|
422 |
public void goToHit() { |
419 |
public void goToHit() { |
423 |
JPDAThread thread; |
420 |
DVThread thread; |
424 |
synchronized (this) { |
421 |
synchronized (this) { |
425 |
thread = stoppedThreads.getLast(); |
422 |
thread = stoppedThreads.getLast(); |
426 |
} |
423 |
} |
427 |
thread.makeCurrent(); |
424 |
thread.makeCurrent(); |
428 |
} |
425 |
} |
429 |
|
426 |
|
430 |
public synchronized boolean contains(JPDAThread thread) { |
427 |
public synchronized boolean contains(DVThread thread) { |
431 |
return stoppedThreadsSet.contains(thread); |
428 |
return stoppedThreadsSet.contains(thread); |
432 |
} |
429 |
} |
433 |
|
430 |
|
434 |
public synchronized boolean add(JPDAThread thread) { |
431 |
public synchronized boolean add(DVThread thread) { |
435 |
if (stoppedThreadsSet.add(thread)) { |
432 |
if (stoppedThreadsSet.add(thread)) { |
436 |
stoppedThreads.addFirst(thread); |
433 |
stoppedThreads.addFirst(thread); |
437 |
return true; |
434 |
return true; |
Lines 439-445
Link Here
|
439 |
return false; |
436 |
return false; |
440 |
} |
437 |
} |
441 |
|
438 |
|
442 |
public synchronized boolean remove(JPDAThread thread) { |
439 |
public synchronized boolean remove(DVThread thread) { |
443 |
if (stoppedThreadsSet.remove(thread)) { |
440 |
if (stoppedThreadsSet.remove(thread)) { |
444 |
stoppedThreads.remove(thread); |
441 |
stoppedThreads.remove(thread); |
445 |
return true; |
442 |
return true; |
Lines 456-463
Link Here
|
456 |
return stoppedThreads.size(); |
453 |
return stoppedThreads.size(); |
457 |
} |
454 |
} |
458 |
|
455 |
|
459 |
private synchronized Iterable<JPDAThread> getStoppedThreads() { |
456 |
private synchronized Iterable<DVThread> getStoppedThreads() { |
460 |
return new ArrayList<JPDAThread>(stoppedThreads); |
457 |
return new ArrayList<DVThread>(stoppedThreads); |
461 |
} |
458 |
} |
462 |
|
459 |
|
463 |
} |
460 |
} |