mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
DebuggerContext command is started only when corresponding thread is really suspended, removed some redundant checks, inserted some if (LOF.isDebugEnabled())
This commit is contained in:
@@ -177,7 +177,9 @@ public class DebugProcessEvents extends DebugProcessImpl {
|
||||
EventQueue eventQueue = myVmProxy.eventQueue();
|
||||
while (!isStopped()) {
|
||||
try {
|
||||
LOG.debug("Listening events");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Listening events");
|
||||
}
|
||||
final EventSet eventSet = eventQueue.remove();
|
||||
|
||||
if (LOG.isDebugEnabled()) {
|
||||
|
||||
@@ -199,7 +199,9 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma
|
||||
finally {
|
||||
final WorkerThread thread = (WorkerThread)Thread.currentThread();
|
||||
|
||||
LOG.debug("Switching back to " + thread);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Switching back to " + thread);
|
||||
}
|
||||
|
||||
super.invokeAndWait(new DebuggerCommandImpl() {
|
||||
protected void action() throws Exception {
|
||||
@@ -207,7 +209,9 @@ public class DebuggerManagerThreadImpl extends InvokeAndWaitThread<DebuggerComma
|
||||
}
|
||||
|
||||
protected void commandCancelled() {
|
||||
LOG.debug("Event queue was closed, killing thread");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Event queue was closed, killing thread");
|
||||
}
|
||||
thread.interrupt();
|
||||
}
|
||||
}, NORMAL_PRIORITY);
|
||||
|
||||
@@ -42,7 +42,9 @@ public class SuspendManagerImpl implements SuspendManager {
|
||||
public SuspendContextImpl pushSuspendContext(final int suspendPolicy, int nVotes) {
|
||||
SuspendContextImpl suspendContext = new SuspendContextImpl(myDebugProcess, suspendPolicy, nVotes, null) {
|
||||
protected void resumeImpl() {
|
||||
LOG.debug("Start resuming...");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Start resuming...");
|
||||
}
|
||||
myDebugProcess.logThreads();
|
||||
switch(getSuspendPolicy()) {
|
||||
case EventRequest.SUSPEND_ALL:
|
||||
@@ -61,7 +63,9 @@ public class SuspendManagerImpl implements SuspendManager {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
LOG.debug("VM resumed ");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("VM resumed ");
|
||||
}
|
||||
break;
|
||||
case EventRequest.SUSPEND_EVENT_THREAD:
|
||||
getThread().resume();
|
||||
@@ -70,7 +74,9 @@ public class SuspendManagerImpl implements SuspendManager {
|
||||
}
|
||||
break;
|
||||
case EventRequest.SUSPEND_NONE:
|
||||
LOG.debug("None resumed");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("None resumed");
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (LOG.isDebugEnabled()) {
|
||||
@@ -105,7 +111,9 @@ public class SuspendManagerImpl implements SuspendManager {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
LOG.debug("Set resumed ");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Set resumed ");
|
||||
}
|
||||
myDebugProcess.logThreads();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -25,15 +25,21 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
|
||||
myDebuggerContext = debuggerContext;
|
||||
}
|
||||
|
||||
public DebuggerContextImpl getDebuggerContext() {
|
||||
public final DebuggerContextImpl getDebuggerContext() {
|
||||
return myDebuggerContext;
|
||||
}
|
||||
|
||||
public final void contextAction() throws Exception {
|
||||
SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
|
||||
Set<SuspendContextImpl> suspendingContexts = SuspendManagerUtil.getSuspendingContexts(suspendManager, myDebuggerContext.getThreadProxy());
|
||||
|
||||
if(suspendingContexts.isEmpty()) {
|
||||
final SuspendManager suspendManager = myDebuggerContext.getDebugProcess().getSuspendManager();
|
||||
final boolean isSuspended = suspendManager.isSuspended(myDebuggerContext.getThreadProxy());
|
||||
if(isSuspended) {
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Context thread " + getSuspendContext().getThread());
|
||||
LOG.debug("Debug thread" + myDebuggerContext.getThreadProxy());
|
||||
}
|
||||
threadAction();
|
||||
}
|
||||
else {
|
||||
SuspendContextImpl threadContext = SuspendManagerUtil.findContextByThread(suspendManager, myDebuggerContext.getThreadProxy());
|
||||
if(threadContext != null) {
|
||||
SuspendManagerUtil.postponeCommand(threadContext, this);
|
||||
@@ -42,11 +48,6 @@ public abstract class DebuggerContextCommandImpl extends SuspendContextCommandIm
|
||||
notifyCancelled();
|
||||
}
|
||||
}
|
||||
else {
|
||||
LOG.debug("Context thread " + getSuspendContext().getThread());
|
||||
LOG.debug("Debug thread" + myDebuggerContext.getThreadProxy());
|
||||
threadAction();
|
||||
}
|
||||
}
|
||||
|
||||
abstract public void threadAction ();
|
||||
|
||||
@@ -40,7 +40,9 @@ public class EventQueue<E> {
|
||||
}
|
||||
|
||||
public void close(){
|
||||
LOG.debug("events closed");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("events closed");
|
||||
}
|
||||
myIsClosed = true;
|
||||
synchronized(myEvents) {
|
||||
myEvents.notifyAll();
|
||||
|
||||
@@ -118,7 +118,9 @@ public abstract class InvokeThread<E> {
|
||||
protected void switchToThread(WorkerThread newWorkerThread) {
|
||||
LOG.assertTrue(Thread.currentThread() instanceof WorkerThread);
|
||||
myWorkerThread = newWorkerThread;
|
||||
LOG.debug("Closing " + Thread.currentThread() + " new thread = " + newWorkerThread);
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Closing " + Thread.currentThread() + " new thread = " + newWorkerThread);
|
||||
}
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
|
||||
@@ -128,6 +130,8 @@ public abstract class InvokeThread<E> {
|
||||
|
||||
public void close() {
|
||||
myEvents.close();
|
||||
LOG.debug("Closing evaluation");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("Closing evaluation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -109,9 +109,13 @@ public class VirtualMachineProxyImpl implements JdiTimer, VirtualMachineProxy {
|
||||
public void resume() {
|
||||
DebuggerManagerThreadImpl.assertIsManagerThread();
|
||||
clearCaches();
|
||||
LOG.debug("before resume VM");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("before resume VM");
|
||||
}
|
||||
myVirtualMachine.resume();
|
||||
LOG.debug("VM resumed");
|
||||
if (LOG.isDebugEnabled()) {
|
||||
LOG.debug("VM resumed");
|
||||
}
|
||||
//logThreads();
|
||||
}
|
||||
|
||||
|
||||
@@ -173,15 +173,9 @@ public class FramePanel extends DebuggerPanel implements DataProvider{
|
||||
}
|
||||
|
||||
private class RefreshFramePanelCommand extends DebuggerContextCommandImpl {
|
||||
private final DebuggerContextImpl myDebuggerContext;
|
||||
|
||||
public RefreshFramePanelCommand() {
|
||||
super(getContext());
|
||||
myDebuggerContext = getContext();
|
||||
}
|
||||
|
||||
public DebuggerContextImpl getDebuggerContext() {
|
||||
return myDebuggerContext;
|
||||
}
|
||||
|
||||
private java.util.List<ThreadDescriptorImpl> getThreadList() {
|
||||
|
||||
@@ -320,10 +320,6 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
myDebuggerContext = context;
|
||||
}
|
||||
|
||||
public DebuggerContextImpl getDebuggerContext() {
|
||||
return myDebuggerContext;
|
||||
}
|
||||
|
||||
public void threadAction() {
|
||||
|
||||
}
|
||||
@@ -532,7 +528,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
try {
|
||||
StackFrameDescriptorImpl stackDescriptor = (StackFrameDescriptorImpl)getNode().getDescriptor();
|
||||
StackFrameProxyImpl frame = stackDescriptor.getStackFrame();
|
||||
if(!getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(frame.threadProxy())) return;
|
||||
//if(!getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(frame.threadProxy())) return;
|
||||
|
||||
LOG.assertTrue(frame.threadProxy().isSuspended());
|
||||
|
||||
@@ -575,7 +571,7 @@ public abstract class DebuggerTree extends DebuggerTreeBase implements DataProvi
|
||||
public void threadAction() {
|
||||
ThreadDescriptorImpl threadDescriptor = ((ThreadDescriptorImpl)getNode().getDescriptor());
|
||||
ThreadReferenceProxyImpl threadProxy = threadDescriptor.getThreadReference();
|
||||
if (!threadProxy.isCollected() && getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(threadProxy)) {
|
||||
if (!threadProxy.isCollected() /*&& getDebuggerContext().getDebugProcess().getSuspendManager().isSuspended(threadProxy)*/) {
|
||||
int status = threadProxy.status();
|
||||
if (!(status == ThreadReference.THREAD_STATUS_UNKNOWN) &&
|
||||
!(status == ThreadReference.THREAD_STATUS_NOT_STARTED) &&
|
||||
|
||||
Reference in New Issue
Block a user