Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 134994 Details for
Bug 274323
JDT reports incorrect thread states if breakpoint suspends VM, and listeners votes to resume
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
patch
quiet-suspend.patch (text/plain), 9.34 KB, created by
Darin Wright
on 2009-05-08 13:38:13 EDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Darin Wright
Created:
2009-05-08 13:38:13 EDT
Size:
9.34 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.debug >Index: model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java,v >retrieving revision 1.191 >diff -u -r1.191 JDIThread.java >--- model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java 24 Apr 2009 19:59:40 -0000 1.191 >+++ model/org/eclipse/jdt/internal/debug/core/model/JDIThread.java 8 May 2009 17:37:47 -0000 >@@ -371,6 +371,9 @@ > * @see ISuspendResume#canResume() > */ > public boolean canResume() { >+ if (getJavaDebugTarget().isConsideringBreakpoint()) { >+ return false; >+ } > return isSuspended() && (!isPerformingEvaluation() || isInvokingMethod()) && !isSuspendVoteInProgress(); > } > >@@ -378,6 +381,9 @@ > * @see ISuspendResume#canSuspend() > */ > public boolean canSuspend() { >+ if (getJavaDebugTarget().isConsideringBreakpoint()) { >+ return true; >+ } > return !isSuspended() || (isPerformingEvaluation() && !isInvokingMethod()) || isSuspendVoteInProgress(); > } > >@@ -418,6 +424,9 @@ > */ > protected boolean canStep() { > try { >+ if (getJavaDebugTarget().isConsideringBreakpoint()) { >+ return false; >+ } > return isSuspended() > && (!isPerformingEvaluation() || isInvokingMethod()) > && !isSuspendVoteInProgress() >Index: model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug/model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java,v >retrieving revision 1.140 >diff -u -r1.140 JDIDebugTarget.java >--- model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java 17 Apr 2009 17:02:46 -0000 1.140 >+++ model/org/eclipse/jdt/internal/debug/core/model/JDIDebugTarget.java 8 May 2009 17:37:47 -0000 >@@ -171,6 +171,12 @@ > private boolean fSuspended = true; > > /** >+ * When handling a breakpoint, the VM is quietly suspended and may resume >+ * depending on conditional breakpoints, breakpoint listeners, etc. >+ */ >+ private boolean fConsideringBreakpoint = false; >+ >+ /** > * Whether the VM should be resumed on startup > */ > private boolean fResumeOnStartup = false; >@@ -529,8 +535,13 @@ > * @see ISuspendResume#canResume() > */ > public boolean canResume() { >- return (isSuspended() || canResumeThreads()) >- && isAvailable() && !isPerformingHotCodeReplace(); >+ if (isAvailable()) { >+ if (isConsideringBreakpoint()) { >+ return false; >+ } >+ return (isSuspended() || canResumeThreads()) && !isPerformingHotCodeReplace(); >+ } >+ return false; > } > > /** >@@ -552,15 +563,21 @@ > * @see ISuspendResume#canSuspend() > */ > public boolean canSuspend() { >- if (!isSuspended() && isAvailable()) { >- // only allow suspend if no threads are currently suspended >- IThread[] threads= getThreads(); >- for (int i= 0, numThreads= threads.length; i < numThreads; i++) { >- if (!((JDIThread)threads[i]).canSuspend()) { >- return false; >+ if (isAvailable()) { >+ if (isConsideringBreakpoint()) { >+ // quietly suspended.. still pretend to be running >+ return true; >+ } >+ if (!isSuspended()) { >+ // only allow suspend if no threads are currently suspended >+ IThread[] threads= getThreads(); >+ for (int i= 0, numThreads= threads.length; i < numThreads; i++) { >+ if (!((JDIThread)threads[i]).canSuspend()) { >+ return false; >+ } > } >+ return true; > } >- return true; > } > return false; > } >@@ -950,6 +967,16 @@ > } > > /** >+ * When a VM is suspended it may just be considering a breakpoint - evaluating its condition >+ * and notifying listeners, etc. >+ * >+ * @return whether the VM considering to suspend at a breakpoint >+ */ >+ public boolean isConsideringBreakpoint() { >+ return fConsideringBreakpoint; >+ } >+ >+ /** > * Sets whether this VM is suspended. > * > * @param suspended whether this VM is suspended >@@ -1302,8 +1329,9 @@ > * @param breakpoint the breakpoint that caused the > * suspension > */ >- public void prepareToSuspendByBreakpoint(JavaBreakpoint breakpoint) { >+ protected void prepareToSuspendByBreakpoint(JavaBreakpoint breakpoint) { > setSuspended(true); >+ fConsideringBreakpoint = true; > suspendThreads(); > } > >@@ -1315,6 +1343,7 @@ > * suspension > */ > protected void suspendedByBreakpoint(JavaBreakpoint breakpoint, boolean queueEvent, EventSet set) { >+ fConsideringBreakpoint = false; > if (queueEvent) { > queueSuspendEvent(DebugEvent.BREAKPOINT, set); > } else { >@@ -1329,6 +1358,7 @@ > * suspension > */ > protected void cancelSuspendByBreakpoint(JavaBreakpoint breakpoint) throws DebugException { >+ fConsideringBreakpoint = false; > setSuspended(false); > resumeThreads(); > } >#P org.eclipse.jdt.debug.ui >Index: ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java,v >retrieving revision 1.7 >diff -u -r1.7 JavaThreadContentProvider.java >--- ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java 31 Mar 2009 20:43:07 -0000 1.7 >+++ ui/org/eclipse/jdt/internal/debug/ui/monitors/JavaThreadContentProvider.java 8 May 2009 17:37:49 -0000 >@@ -23,6 +23,7 @@ > import org.eclipse.jdt.debug.core.IJavaDebugTarget; > import org.eclipse.jdt.debug.core.IJavaThread; > import org.eclipse.jdt.debug.ui.JavaDebugUtils; >+import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget; > import org.eclipse.jdt.internal.debug.core.model.JDIThread; > > /** >@@ -119,7 +120,11 @@ > protected boolean hasChildren(Object element, IPresentationContext context, IViewerUpdate monitor) throws CoreException { > if (element instanceof JDIThread) { > JDIThread jThread = (JDIThread) element; >- if (!jThread.getDebugTarget().isSuspended()) { >+ JDIDebugTarget jdt = jThread.getJavaDebugTarget(); >+ if (jdt.isConsideringBreakpoint()) { >+ return false; >+ } >+ if (!jdt.isSuspended()) { > if (jThread.isSuspendVoteInProgress()) { > return false; > } >Index: ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.debug.ui/ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java,v >retrieving revision 1.212 >diff -u -r1.212 JDIModelPresentation.java >--- ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java 20 Feb 2009 20:35:35 -0000 1.212 >+++ ui/org/eclipse/jdt/internal/debug/ui/JDIModelPresentation.java 8 May 2009 17:37:49 -0000 >@@ -64,6 +64,7 @@ > import org.eclipse.jdt.debug.core.IJavaWatchpoint; > import org.eclipse.jdt.internal.debug.core.breakpoints.JavaExceptionBreakpoint; > import org.eclipse.jdt.internal.debug.core.logicalstructures.JDIAllInstancesValue; >+import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget; > import org.eclipse.jdt.internal.debug.core.model.JDIReferenceListEntryVariable; > import org.eclipse.jdt.internal.debug.core.model.JDIReferenceListValue; > import org.eclipse.jdt.internal.debug.core.model.JDIReferenceListVariable; >@@ -318,7 +319,8 @@ > } else if (thread.isStepping()) { > key.append("stepping"); //$NON-NLS-1$ > args = new String[] {thread.getName()}; >- } else if ((thread instanceof JDIThread && ((JDIThread)thread).isSuspendVoteInProgress()) && !thread.getDebugTarget().isSuspended()) { >+ } else if ((thread instanceof JDIThread && (((JDIThread)thread).isSuspendVoteInProgress()) && !thread.getDebugTarget().isSuspended()) >+ || ((JDIDebugTarget)thread.getDebugTarget()).isConsideringBreakpoint()) { > // show running when listener notification is in progress > key.append("running"); //$NON-NLS-1$ > args = new String[] {thread.getName()}; >@@ -423,6 +425,11 @@ > protected String getDebugTargetText(IJavaDebugTarget debugTarget) throws DebugException { > String labelString= debugTarget.getName(); > if (debugTarget.isSuspended()) { >+ if (debugTarget instanceof JDIDebugTarget) { >+ if (((JDIDebugTarget)debugTarget).isConsideringBreakpoint()) { >+ return labelString; >+ } >+ } > labelString += DebugUIMessages.JDIModelPresentation_target_suspended; > } > return labelString; >@@ -669,11 +676,18 @@ > } > if (item instanceof JDIThread) { > JDIThread jt = (JDIThread) item; >- if (jt.getDebugTarget().isSuspended()) { >+ JDIDebugTarget jdt = jt.getJavaDebugTarget(); >+ if (jt.isSuspendVoteInProgress() || jdt.isConsideringBreakpoint()) { >+ return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING); >+ } >+ if (jdt.isSuspended()) { > return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_SUSPENDED); > } >- if (jt.isSuspendVoteInProgress()) { >- return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_THREAD_RUNNING); >+ } >+ if (item instanceof JDIDebugTarget) { >+ JDIDebugTarget jdt = (JDIDebugTarget)item; >+ if (jdt.isConsideringBreakpoint()) { >+ return DebugUITools.getImage(IDebugUIConstants.IMG_OBJS_DEBUG_TARGET); > } > } > if (item instanceof IJavaStackFrame || item instanceof IJavaThread || item instanceof IJavaDebugTarget) {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 274323
: 134994