mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 22:52:11 +02:00
Fix for 221224: debugger mi target locking problems
Patch contributed by Alena Laskavaia <elaskavaia@qnx.com>
This commit is contained in:
parent
8d07be5f20
commit
da521c277c
7 changed files with 235 additions and 308 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
* Alena Laskavaia (QNX) - Bug 221224
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
@ -184,7 +185,7 @@ public class ExpressionManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
|
@ -203,12 +204,9 @@ public class ExpressionManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Giuseppe Montalto, STMicroelectronics - bug 174988
|
* Giuseppe Montalto, STMicroelectronics - bug 174988
|
||||||
|
* Alena Laskavaia (QNX) - Bug 221224
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
@ -255,7 +256,7 @@ public class RegisterManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
|
@ -271,12 +272,9 @@ public class RegisterManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -284,7 +282,7 @@ public class RegisterManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
|
@ -301,12 +299,9 @@ public class RegisterManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
* Alena Laskavaia (QNX) - Bug 221224
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
@ -424,18 +425,15 @@ public class SourceManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
return getDetailTypeName(target, variable);
|
return getDetailTypeName(target, variable);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public String getDetailTypeName(Target target, String typename) throws CDIException {
|
public String getDetailTypeName(Target target, String typename) throws CDIException {
|
||||||
|
@ -465,18 +463,15 @@ public class SourceManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
return getTypeName(target, variable);
|
return getTypeName(target, variable);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Alena Laskavaia (QNX) - Bug 197986
|
* Alena Laskavaia (QNX) - Bug 197986, Bug 221224
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi;
|
package org.eclipse.cdt.debug.mi.core.cdi;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
|
@ -194,15 +194,12 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
MISession miSession = target.getMISession();
|
MISession miSession = target.getMISession();
|
||||||
RxThread rxThread = miSession.getRxThread();
|
RxThread rxThread = miSession.getRxThread();
|
||||||
rxThread.setEnableConsole(true);
|
rxThread.setEnableConsole(true);
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.VariableManager.Unknown_type")); //$NON-NLS-1$
|
||||||
|
@ -374,7 +371,7 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)argDesc.getTarget();
|
Target target = (Target)argDesc.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(stack.getThread(), false);
|
target.setCurrentThread(stack.getThread(), false);
|
||||||
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
||||||
|
@ -394,12 +391,9 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return argument;
|
return argument;
|
||||||
|
@ -410,7 +404,7 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
|
@ -440,12 +434,9 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
|
return (ICDIArgumentDescriptor[]) argObjects.toArray(new ICDIArgumentDescriptor[0]);
|
||||||
}
|
}
|
||||||
|
@ -506,7 +497,7 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)frame.getTarget();
|
Target target = (Target)frame.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
((Thread)frame.getThread()).setCurrentStackFrame(frame, false);
|
||||||
|
@ -529,13 +520,10 @@ public class VariableManager extends Manager {
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
|
return (ICDILocalVariableDescriptor[]) varObjects.toArray(new ICDILocalVariableDescriptor[0]);
|
||||||
}
|
}
|
||||||
|
@ -552,7 +540,7 @@ public class VariableManager extends Manager {
|
||||||
Target target = (Target)varDesc.getTarget();
|
Target target = (Target)varDesc.getTarget();
|
||||||
Thread currentThread = (Thread)target.getCurrentThread();
|
Thread currentThread = (Thread)target.getCurrentThread();
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(stack.getThread(), false);
|
target.setCurrentThread(stack.getThread(), false);
|
||||||
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
((Thread)stack.getThread()).setCurrentStackFrame(stack, false);
|
||||||
|
@ -572,12 +560,9 @@ public class VariableManager extends Manager {
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
target.setCurrentThread(currentThread, false);
|
||||||
target.setCurrentThread(currentThread, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
}
|
||||||
} finally {
|
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return local;
|
return local;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -8,6 +8,7 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Ken Ryall (Nokia) - 175532 support the address to source location API
|
* Ken Ryall (Nokia) - 175532 support the address to source location API
|
||||||
|
* Alena Laskavaia (QNX) - Bug 221224
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
|
@ -100,45 +101,6 @@ import org.eclipse.cdt.debug.mi.core.output.MIThreadSelectInfo;
|
||||||
*/
|
*/
|
||||||
public class Target extends SessionObject implements ICDITarget, ICDIBreakpointManagement2, ICDIAddressToSource, ICDIMemorySpaceManagement {
|
public class Target extends SessionObject implements ICDITarget, ICDIBreakpointManagement2, ICDIAddressToSource, ICDIMemorySpaceManagement {
|
||||||
|
|
||||||
public class Lock {
|
|
||||||
|
|
||||||
java.lang.Thread heldBy;
|
|
||||||
int count;
|
|
||||||
|
|
||||||
public Lock() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void aquire() {
|
|
||||||
if (heldBy == null || heldBy == java.lang.Thread.currentThread()) {
|
|
||||||
heldBy = java.lang.Thread.currentThread();
|
|
||||||
count++;
|
|
||||||
} else {
|
|
||||||
while (true) {
|
|
||||||
try {
|
|
||||||
wait();
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
}
|
|
||||||
if (heldBy == null) {
|
|
||||||
heldBy = java.lang.Thread.currentThread();
|
|
||||||
count++;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public synchronized void release() {
|
|
||||||
if (heldBy == null || heldBy != java.lang.Thread.currentThread()) {
|
|
||||||
throw new IllegalStateException("Thread does not own lock");
|
|
||||||
}
|
|
||||||
if(--count == 0) {
|
|
||||||
heldBy = null;
|
|
||||||
notifyAll();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MISession miSession;
|
MISession miSession;
|
||||||
ICDITargetConfiguration fConfiguration;
|
ICDITargetConfiguration fConfiguration;
|
||||||
Thread[] noThreads = new Thread[0];
|
Thread[] noThreads = new Thread[0];
|
||||||
|
@ -147,7 +109,7 @@ public class Target extends SessionObject implements ICDITarget, ICDIBreakpointM
|
||||||
String fEndian = null;
|
String fEndian = null;
|
||||||
boolean suspended = true;
|
boolean suspended = true;
|
||||||
boolean deferBreakpoints = true;
|
boolean deferBreakpoints = true;
|
||||||
Lock lock = new Lock();
|
final private Object lock = new Object();
|
||||||
|
|
||||||
final static String CODE_MEMORY_SPACE = "code"; //$NON-NLS-1$
|
final static String CODE_MEMORY_SPACE = "code"; //$NON-NLS-1$
|
||||||
final static String DATA_MEMORY_SPACE = "data"; //$NON-NLS-1$
|
final static String DATA_MEMORY_SPACE = "data"; //$NON-NLS-1$
|
||||||
|
@ -158,13 +120,37 @@ public class Target extends SessionObject implements ICDITarget, ICDIBreakpointM
|
||||||
currentThreads = noThreads;
|
currentThreads = noThreads;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void lockTarget() {
|
/**
|
||||||
lock.aquire();
|
* Return lock object for target. Replacement for <code>lockTarget</code> and
|
||||||
}
|
* <code>releaseTarget</code> methods.
|
||||||
|
* <p>
|
||||||
public void releaseTarget() {
|
* Use as synchronization object:
|
||||||
lock.release();
|
* </p>
|
||||||
|
* new code:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* synchronized (target.getLock()) {
|
||||||
|
* ...
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* old code:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* target.lockTarget();
|
||||||
|
* try {
|
||||||
|
* ...
|
||||||
|
* } finally {
|
||||||
|
* target.releaseTarget();
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
* @since 5.0
|
||||||
|
*/
|
||||||
|
public Object getLock() {
|
||||||
|
return lock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public MISession getMISession() {
|
public MISession getMISession() {
|
||||||
return miSession;
|
return miSession;
|
||||||
|
@ -271,15 +257,14 @@ public class Target extends SessionObject implements ICDITarget, ICDIBreakpointM
|
||||||
// If we use "info threads" in getCThreads() this
|
// If we use "info threads" in getCThreads() this
|
||||||
// will be overwritten. However if we use -stack-list-threads
|
// will be overwritten. However if we use -stack-list-threads
|
||||||
// it does not provide to the current thread
|
// it does not provide to the current thread
|
||||||
lockTarget();
|
synchronized (lock) {
|
||||||
try {
|
try {
|
||||||
// get the new Threads.
|
// get the new Threads.
|
||||||
currentThreadId = newThreadId;
|
currentThreadId = newThreadId;
|
||||||
currentThreads = getCThreads();
|
currentThreads = getCThreads();
|
||||||
} catch (CDIException e) {
|
} catch (CDIException e) {
|
||||||
currentThreads = noThreads;
|
currentThreads = noThreads;
|
||||||
} finally {
|
}
|
||||||
releaseTarget();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fire CreatedEvent for new threads.
|
// Fire CreatedEvent for new threads.
|
||||||
|
@ -338,57 +323,56 @@ public class Target extends SessionObject implements ICDITarget, ICDIBreakpointM
|
||||||
*/
|
*/
|
||||||
public Thread[] getCThreads() throws CDIException {
|
public Thread[] getCThreads() throws CDIException {
|
||||||
Thread[] cthreads = noThreads;
|
Thread[] cthreads = noThreads;
|
||||||
try {
|
synchronized (lock) {
|
||||||
lockTarget();
|
|
||||||
RxThread rxThread = miSession.getRxThread();
|
RxThread rxThread = miSession.getRxThread();
|
||||||
rxThread.setEnableConsole(false);
|
rxThread.setEnableConsole(false);
|
||||||
CommandFactory factory = miSession.getCommandFactory();
|
try {
|
||||||
CLIInfoThreads tids = factory.createCLIInfoThreads();
|
CommandFactory factory = miSession.getCommandFactory();
|
||||||
// HACK/FIXME: gdb/mi thread-list-ids does not
|
CLIInfoThreads tids = factory.createCLIInfoThreads();
|
||||||
// show any newly create thread, we workaround by
|
// HACK/FIXME: gdb/mi thread-list-ids does not
|
||||||
// issuing "info threads" instead.
|
// show any newly create thread, we workaround by
|
||||||
// MIThreadListIds tids = factory.createMIThreadListIds();
|
// issuing "info threads" instead.
|
||||||
// MIThreadListIdsInfo info = tids.getMIThreadListIdsInfo();
|
// MIThreadListIds tids = factory.createMIThreadListIds();
|
||||||
miSession.postCommand(tids);
|
// MIThreadListIdsInfo info = tids.getMIThreadListIdsInfo();
|
||||||
CLIInfoThreadsInfo info = tids.getMIInfoThreadsInfo();
|
miSession.postCommand(tids);
|
||||||
int[] ids;
|
CLIInfoThreadsInfo info = tids.getMIInfoThreadsInfo();
|
||||||
String[] names;
|
int[] ids;
|
||||||
if (info == null) {
|
String[] names;
|
||||||
ids = new int[0];
|
if (info == null) {
|
||||||
names = new String[0];
|
ids = new int[0];
|
||||||
} else {
|
names = new String[0];
|
||||||
ids = info.getThreadIds();
|
} else {
|
||||||
names = info.getThreadNames();
|
ids = info.getThreadIds();
|
||||||
currentThreadId = info.getCurrentThread();
|
names = info.getThreadNames();
|
||||||
}
|
currentThreadId = info.getCurrentThread();
|
||||||
if (ids != null && ids.length > 0) {
|
}
|
||||||
cthreads = new Thread[ids.length];
|
if (ids != null && ids.length > 0) {
|
||||||
// Ok that means it is a multiThreaded.
|
cthreads = new Thread[ids.length];
|
||||||
if (names != null && names.length == ids.length) {
|
// Ok that means it is a multiThreaded.
|
||||||
for (int i = 0; i < ids.length; i++) {
|
if (names != null && names.length == ids.length) {
|
||||||
cthreads[i] = new Thread(this, ids[i], names[i]);
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
cthreads[i] = new Thread(this, ids[i], names[i]);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int i = 0; i < ids.length; i++) {
|
||||||
|
cthreads[i] = new Thread(this, ids[i]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < ids.length; i++) {
|
// Provide a dummy.
|
||||||
cthreads[i] = new Thread(this, ids[i]);
|
cthreads = new Thread[]{new Thread(this, 0)};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
// FIX: When attaching there is no thread selected
|
||||||
// Provide a dummy.
|
// We will choose the first one as a workaround.
|
||||||
cthreads = new Thread[]{new Thread(this, 0)};
|
if (currentThreadId == 0 && cthreads.length > 0) {
|
||||||
|
setCurrentThread(cthreads[0], false);
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
// Do not throw anything in this case.
|
||||||
|
throw new CDIException(e.getMessage());
|
||||||
|
} finally {
|
||||||
|
rxThread.setEnableConsole(true);
|
||||||
}
|
}
|
||||||
// FIX: When attaching there is no thread selected
|
|
||||||
// We will choose the first one as a workaround.
|
|
||||||
if (currentThreadId == 0 && cthreads.length > 0) {
|
|
||||||
setCurrentThread(cthreads[0], false);
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
// Do not throw anything in this case.
|
|
||||||
throw new CDIException(e.getMessage());
|
|
||||||
} finally {
|
|
||||||
RxThread rxThread = miSession.getRxThread();
|
|
||||||
rxThread.setEnableConsole(true);
|
|
||||||
releaseTarget();
|
|
||||||
}
|
}
|
||||||
return cthreads;
|
return cthreads;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2007 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
* Alena Laskavaia (QNX) - Bug 221224
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
|
@ -109,32 +110,29 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
currentFrames = new ArrayList();
|
currentFrames = new ArrayList();
|
||||||
Target target = (Target)getTarget();
|
Target target = (Target)getTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = target.getCurrentThread();
|
||||||
target.lockTarget();
|
synchronized (target.getLock()) {
|
||||||
try {
|
|
||||||
target.setCurrentThread(this, false);
|
|
||||||
MISession mi = target.getMISession();
|
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
|
||||||
MIStackListFrames frames = factory.createMIStackListFrames();
|
|
||||||
mi.postCommand(frames);
|
|
||||||
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
|
||||||
if (info == null) {
|
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
MIFrame[] miFrames = info.getMIFrames();
|
|
||||||
for (int i = 0; i < miFrames.length; i++) {
|
|
||||||
currentFrames.add(new StackFrame(this, miFrames[i], depth - miFrames[i].getLevel()));
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
//throw new CDIException(e.getMessage());
|
|
||||||
//System.out.println(e);
|
|
||||||
} catch (CDIException e) {
|
|
||||||
//throw e;
|
|
||||||
//System.out.println(e);
|
|
||||||
} finally {
|
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(this, false);
|
||||||
|
MISession mi = target.getMISession();
|
||||||
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
|
MIStackListFrames frames = factory.createMIStackListFrames();
|
||||||
|
mi.postCommand(frames);
|
||||||
|
MIStackListFramesInfo info = frames.getMIStackListFramesInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
MIFrame[] miFrames = info.getMIFrames();
|
||||||
|
for (int i = 0; i < miFrames.length; i++) {
|
||||||
|
currentFrames.add(new StackFrame(this, miFrames[i], depth - miFrames[i].getLevel()));
|
||||||
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
//throw new CDIException(e.getMessage());
|
||||||
|
//System.out.println(e);
|
||||||
|
} catch (CDIException e) {
|
||||||
|
//throw e;
|
||||||
|
//System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
target.releaseTarget();
|
target.setCurrentThread(currentThread, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// assign the currentFrame if it was not done yet.
|
// assign the currentFrame if it was not done yet.
|
||||||
|
@ -157,45 +155,39 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
if (stackdepth == 0) {
|
if (stackdepth == 0) {
|
||||||
Target target = (Target)getTarget();
|
Target target = (Target)getTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = target.getCurrentThread();
|
||||||
target.lockTarget();
|
synchronized (target.getLock()) {
|
||||||
try {
|
|
||||||
target.setCurrentThread(this, false);
|
|
||||||
MISession mi = target.getMISession();
|
|
||||||
CommandFactory factory = mi.getCommandFactory();
|
|
||||||
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
|
||||||
mi.postCommand(depth);
|
|
||||||
MIStackInfoDepthInfo info = null;
|
|
||||||
try {
|
try {
|
||||||
// Catch the first exception gdb can recover the second time.
|
target.setCurrentThread(this, false);
|
||||||
info = depth.getMIStackInfoDepthInfo();
|
MISession mi = target.getMISession();
|
||||||
if (info == null) {
|
CommandFactory factory = mi.getCommandFactory();
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
MIStackInfoDepth depth = factory.createMIStackInfoDepth();
|
||||||
}
|
|
||||||
stackdepth = info.getDepth();
|
|
||||||
} catch (MIException e) {
|
|
||||||
// First try fails, retry. gdb patches up the corrupt frame
|
|
||||||
// so retry should give us a frame count that is safe.
|
|
||||||
depth = factory.createMIStackInfoDepth();
|
|
||||||
mi.postCommand(depth);
|
mi.postCommand(depth);
|
||||||
info = depth.getMIStackInfoDepthInfo();
|
MIStackInfoDepthInfo info = null;
|
||||||
if (info == null) {
|
try {
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
// Catch the first exception gdb can recover the second time.
|
||||||
|
info = depth.getMIStackInfoDepthInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
stackdepth = info.getDepth();
|
||||||
|
} catch (MIException e) {
|
||||||
|
// First try fails, retry. gdb patches up the corrupt frame
|
||||||
|
// so retry should give us a frame count that is safe.
|
||||||
|
depth = factory.createMIStackInfoDepth();
|
||||||
|
mi.postCommand(depth);
|
||||||
|
info = depth.getMIStackInfoDepthInfo();
|
||||||
|
if (info == null) {
|
||||||
|
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
stackdepth = info.getDepth();
|
||||||
|
if (stackdepth > 0) {
|
||||||
|
stackdepth--;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
stackdepth = info.getDepth();
|
} catch (MIException e) {
|
||||||
if (stackdepth > 0) {
|
throw new MI2CDIException(e);
|
||||||
stackdepth--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (MIException e) {
|
|
||||||
throw new MI2CDIException(e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
|
||||||
} catch (MI2CDIException e) {
|
|
||||||
target.releaseTarget();
|
|
||||||
throw e;
|
|
||||||
} finally {
|
} finally {
|
||||||
target.releaseTarget();
|
target.setCurrentThread(currentThread, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -210,7 +202,7 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
currentFrames = new ArrayList();
|
currentFrames = new ArrayList();
|
||||||
Target target = (Target) getTarget();
|
Target target = (Target) getTarget();
|
||||||
ICDIThread currentThread = target.getCurrentThread();
|
ICDIThread currentThread = target.getCurrentThread();
|
||||||
target.lockTarget();
|
synchronized (target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(this, false);
|
target.setCurrentThread(this, false);
|
||||||
int depth = getStackFrameCount();
|
int depth = getStackFrameCount();
|
||||||
|
@ -243,11 +235,8 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
//throw e;
|
//throw e;
|
||||||
//System.out.println(e);
|
//System.out.println(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
|
||||||
target.setCurrentThread(currentThread, false);
|
target.setCurrentThread(currentThread, false);
|
||||||
} finally {
|
}
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// take time to assign the currentFrame, if it is in the set
|
// take time to assign the currentFrame, if it is in the set
|
||||||
if (currentFrame == null) {
|
if (currentFrame == null) {
|
||||||
|
@ -294,34 +283,33 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
int miLevel = getStackFrameCount() - frameLevel;
|
int miLevel = getStackFrameCount() - frameLevel;
|
||||||
MIStackSelectFrame frame = factory.createMIStackSelectFrame(miLevel);
|
MIStackSelectFrame frame = factory.createMIStackSelectFrame(miLevel);
|
||||||
// Set ourself as the current thread first.
|
// Set ourself as the current thread first.
|
||||||
target.lockTarget();
|
synchronized (target.getLock()) {
|
||||||
try {
|
try {
|
||||||
target.setCurrentThread(this, doUpdate);
|
target.setCurrentThread(this, doUpdate);
|
||||||
mi.postCommand(frame);
|
mi.postCommand(frame);
|
||||||
MIInfo info = frame.getMIInfo();
|
MIInfo info = frame.getMIInfo();
|
||||||
if (info == null) {
|
if (info == null) {
|
||||||
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
throw new CDIException(CdiResources.getString("cdi.Common.No_answer")); //$NON-NLS-1$
|
||||||
}
|
|
||||||
currentFrame = stackframe;
|
|
||||||
// Resetting stackframe may change the value of
|
|
||||||
// some variables like registers. Call an update()
|
|
||||||
// To generate changeEvents.
|
|
||||||
if (doUpdate) {
|
|
||||||
Session session = (Session) target.getSession();
|
|
||||||
RegisterManager regMgr = session.getRegisterManager();
|
|
||||||
if (regMgr.isAutoUpdate()) {
|
|
||||||
regMgr.update(target);
|
|
||||||
}
|
}
|
||||||
VariableManager varMgr = session.getVariableManager();
|
currentFrame = stackframe;
|
||||||
if (varMgr.isAutoUpdate()) {
|
// Resetting stackframe may change the value of
|
||||||
varMgr.update(target);
|
// some variables like registers. Call an update()
|
||||||
|
// To generate changeEvents.
|
||||||
|
if (doUpdate) {
|
||||||
|
Session session = (Session) target.getSession();
|
||||||
|
RegisterManager regMgr = session.getRegisterManager();
|
||||||
|
if (regMgr.isAutoUpdate()) {
|
||||||
|
regMgr.update(target);
|
||||||
|
}
|
||||||
|
VariableManager varMgr = session.getVariableManager();
|
||||||
|
if (varMgr.isAutoUpdate()) {
|
||||||
|
varMgr.update(target);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (MIException e) {
|
||||||
|
throw new MI2CDIException(e);
|
||||||
}
|
}
|
||||||
} catch (MIException e) {
|
}
|
||||||
throw new MI2CDIException(e);
|
|
||||||
} finally {
|
|
||||||
target.releaseTarget();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -335,12 +323,10 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepInto(int)
|
||||||
*/
|
*/
|
||||||
public void stepInto(int count) throws CDIException {
|
public void stepInto(int count) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().stepInto(count);
|
target.stepInto(count);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,12 +341,10 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepIntoInstruction(int)
|
||||||
*/
|
*/
|
||||||
public void stepIntoInstruction(int count) throws CDIException {
|
public void stepIntoInstruction(int count) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().stepIntoInstruction(count);
|
target.stepIntoInstruction(count);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,12 +359,10 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOver(int)
|
||||||
*/
|
*/
|
||||||
public void stepOver(int count) throws CDIException {
|
public void stepOver(int count) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().stepOver(count);
|
target.stepOver(count);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,12 +377,10 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepOverInstruction(int)
|
||||||
*/
|
*/
|
||||||
public void stepOverInstruction(int count) throws CDIException {
|
public void stepOverInstruction(int count) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().stepOverInstruction(count);
|
target.stepOverInstruction(count);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,12 +402,10 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteStep#stepUntil(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
||||||
*/
|
*/
|
||||||
public void stepUntil(ICDILocation location) throws CDIException {
|
public void stepUntil(ICDILocation location) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().stepUntil(location);
|
target.stepUntil(location);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -457,24 +435,20 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public void resume(boolean passSignal) throws CDIException {
|
public void resume(boolean passSignal) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().resume(passSignal);
|
target.resume(passSignal);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.ICDILocation)
|
||||||
*/
|
*/
|
||||||
public void resume(ICDILocation location) throws CDIException {
|
public void resume(ICDILocation location) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().resume(location);
|
target.resume(location);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -482,12 +456,10 @@ public class Thread extends CObject implements ICDIThread {
|
||||||
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal)
|
* @see org.eclipse.cdt.debug.core.cdi.model.ICDIExecuteResume#resume(org.eclipse.cdt.debug.core.cdi.model.ICDISignal)
|
||||||
*/
|
*/
|
||||||
public void resume(ICDISignal signal) throws CDIException {
|
public void resume(ICDISignal signal) throws CDIException {
|
||||||
((Target)getTarget()).lockTarget();
|
Target target = (Target)getTarget();
|
||||||
try {
|
synchronized(target.getLock()) {
|
||||||
((Target)getTarget()).setCurrentThread(this);
|
target.setCurrentThread(this);
|
||||||
getTarget().resume(signal);
|
target.resume(signal);
|
||||||
} finally {
|
|
||||||
((Target)getTarget()).releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2000, 2006 QNX Software Systems and others.
|
* Copyright (c) 2000, 2008 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
* Alena Laskavaia (QNX) - Bug 221224
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
package org.eclipse.cdt.debug.mi.core.cdi.model;
|
||||||
|
|
||||||
|
@ -240,7 +241,7 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
||||||
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
StackFrame currentFrame = currentThread.getCurrentStackFrame();
|
||||||
StackFrame frame = (StackFrame)getStackFrame();
|
StackFrame frame = (StackFrame)getStackFrame();
|
||||||
Thread thread = (Thread)getThread();
|
Thread thread = (Thread)getThread();
|
||||||
target.lockTarget();
|
synchronized(target.getLock()) {
|
||||||
try {
|
try {
|
||||||
if (frame != null) {
|
if (frame != null) {
|
||||||
target.setCurrentThread(frame.getThread(), false);
|
target.setCurrentThread(frame.getThread(), false);
|
||||||
|
@ -261,17 +262,14 @@ public abstract class VariableDescriptor extends CObject implements ICDIVariable
|
||||||
} catch (MIException e) {
|
} catch (MIException e) {
|
||||||
throw new MI2CDIException(e);
|
throw new MI2CDIException(e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
if (frame != null) {
|
||||||
if (frame != null) {
|
target.setCurrentThread(currentThread, false);
|
||||||
target.setCurrentThread(currentThread, false);
|
currentThread.setCurrentStackFrame(currentFrame, false);
|
||||||
currentThread.setCurrentStackFrame(currentFrame, false);
|
} else if (thread != null) {
|
||||||
} else if (thread != null) {
|
target.setCurrentThread(currentThread, false);
|
||||||
target.setCurrentThread(currentThread, false);
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
target.releaseTarget();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sizeof != null) {
|
if (sizeof != null) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue