From 838acedf5904bfc4d10fb61c9d8a99737f7d9d8b Mon Sep 17 00:00:00 2001 From: Alain Magloire Date: Mon, 25 Apr 2005 19:11:19 +0000 Subject: [PATCH] 2005-04-25 Alain Magloire Changes to the CDI interface. + cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java + cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java + cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java + cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java + cdi/org/eclipse/cdt/debug/core/cdi/ICDLocator.java * cdi/org/eclipse/cdt/debug/core/cdi/ICDLocation.java + cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java + cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java + cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreapoint.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDBreakpointManagement.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java * src/org/eclipse/cdt/debug/core/CDIDebugModel.java * src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java * src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java * src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java --- debug/org.eclipse.cdt.debug.core/ChangeLog | 22 +++++ .../debug/core/cdi/ICDIAddressLocation.java | 30 ++++++ .../cdt/debug/core/cdi/ICDIFileLocation.java | 24 +++++ .../debug/core/cdi/ICDIFunctionLocation.java | 29 ++++++ .../cdt/debug/core/cdi/ICDILineLocation.java | 28 ++++++ .../cdt/debug/core/cdi/ICDILocation.java | 37 +------- .../cdt/debug/core/cdi/ICDILocator.java | 19 ++++ .../core/cdi/model/ICDIAddressBreakpoint.java | 21 +++++ .../debug/core/cdi/model/ICDIBreakpoint.java | 8 +- .../cdi/model/ICDIBreakpointManagement.java | 91 +++++++++++++++++-- .../cdi/model/ICDIFunctionBreakpoint.java | 21 +++++ .../core/cdi/model/ICDILineBreakpoint.java | 20 ++++ .../cdi/model/ICDILocationBreakpoint.java | 15 ++- .../debug/core/cdi/model/ICDIStackFrame.java | 4 +- .../cdt/debug/core/cdi/model/ICDITarget.java | 16 +++- .../eclipse/cdt/debug/core/CDIDebugModel.java | 2 +- .../internal/core/CBreakpointManager.java | 60 +++++++----- .../internal/core/model/CDebugTarget.java | 24 +++-- .../internal/core/model/CStackFrame.java | 32 +++---- 19 files changed, 392 insertions(+), 111 deletions(-) create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocator.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java create mode 100644 debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog index 8b75e55a4e8..71416382bcc 100644 --- a/debug/org.eclipse.cdt.debug.core/ChangeLog +++ b/debug/org.eclipse.cdt.debug.core/ChangeLog @@ -1,3 +1,25 @@ +2005-04-25 Alain Magloire + Changes to the CDI interface. + + cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java + + cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java + + cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java + + cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java + + cdi/org/eclipse/cdt/debug/core/cdi/ICDLocator.java + * cdi/org/eclipse/cdt/debug/core/cdi/ICDLocation.java + + cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java + + cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java + + cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java + * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreapoint.java + * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDBreakpointManagement.java + * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java + * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java + * cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java + + * src/org/eclipse/cdt/debug/core/CDIDebugModel.java + * src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java + * src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java + * src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java + 2005-04-21 Mikhail Khodjaiants Restoring the session manager. * CDebugCorePlugin.java diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java new file mode 100644 index 00000000000..1b270d70282 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIAddressLocation.java @@ -0,0 +1,30 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi; + +import java.math.BigInteger; + +/** + * + * Represents a line location in the debuggable program. + * + */ +public interface ICDIAddressLocation extends ICDILocation { + + /** + * Returns the address of this location. + * + * @return BigInteger - the address of this location + */ + BigInteger getAddress(); + +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java new file mode 100644 index 00000000000..52c8ded7de0 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFileLocation.java @@ -0,0 +1,24 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi; + +public interface ICDIFileLocation extends ICDILocation { + + /** + * Returns the source file of this location or null + * if the source file is unknown. + * + * @return the source file of this location + */ + String getFile(); + +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java new file mode 100644 index 00000000000..363c27c4496 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDIFunctionLocation.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi; + +/** + * + * Represents a file:function location in the debuggable program. + * + */ +public interface ICDIFunctionLocation extends ICDIFileLocation { + + /** + * Returns the function of this location or null + * if the function is unknown. + * + * @return the function of this location + */ + String getFunction(); + +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java new file mode 100644 index 00000000000..a351ba7c045 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILineLocation.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi; + +/** + * + * Represents a file:line location in the debuggable program. + * + */ +public interface ICDILineLocation extends ICDIFileLocation { + + /** + * Returns the line number of this location or 0 + * if the line number is unknown. + * + * @return the line number of this location + */ + int getLineNumber(); +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java index 3a7fb868e41..a7c588ba1f5 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocation.java @@ -10,50 +10,15 @@ *******************************************************************************/ package org.eclipse.cdt.debug.core.cdi; -import java.math.BigInteger; - /** * * Represents a location in the debuggable program. * - * @since Jul 9, 2002 */ public interface ICDILocation { /** - * Returns the address of this location. - * - * @return the address of this location - */ - BigInteger getAddress(); - - /** - * Returns the source file of this location or null - * if the source file is unknown. - * - * @return the source file of this location - */ - String getFile(); - - /** - * Returns the function of this location or null - * if the function is unknown. - * - * @return the function of this location - */ - String getFunction(); - - /** - * Returns the line number of this location or null - * if the line number is unknown. - * - * @return the line number of this location - */ - int getLineNumber(); - - /** - * Return true if the both location refers to the same - * place. + * Return true if both locations refer to the same place. */ boolean equals(ICDILocation location); diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocator.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocator.java new file mode 100644 index 00000000000..71fd193420b --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/ICDILocator.java @@ -0,0 +1,19 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi; + +/** + * Locator contains information file:function:line:Address + */ +public interface ICDILocator extends ICDIFileLocation, ICDILineLocation, ICDIFunctionLocation, ICDIAddressLocation { + +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java new file mode 100644 index 00000000000..94c8471512d --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIAddressBreakpoint.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi.model; + +/** + * + * Represents an address breakpoint. + * + */ +public interface ICDIAddressBreakpoint extends ICDILocationBreakpoint { + +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint.java index c6ce8cbd967..d04fd7beed2 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpoint.java @@ -21,7 +21,9 @@ import org.eclipse.cdt.debug.core.cdi.ICDICondition; * basic functionality for the location breakpoints, watchpoints, * and catchpoints. * - * @see ICDILocationBreakpoint + * @see ICDILineBreakpoint + * @see ICDIFunctionBreakpoint + * @see ICDIAddressBreakpoint * @see ICDIWatchpoint * @see ICDICatchpoint * @@ -62,7 +64,7 @@ public interface ICDIBreakpoint extends ICDIObject { * @param enabled - whether this breakpoint should be enabled * @throws CDIException if this method fails. Reasons include: */ - void setEnabled( boolean enabled ) throws CDIException; + void setEnabled(boolean enabled) throws CDIException; /** * Returns the condition of this breakpoint or null @@ -79,6 +81,6 @@ public interface ICDIBreakpoint extends ICDIObject { * @param the condition to set * @throws CDIException if this method fails. Reasons include: */ - void setCondition( ICDICondition condition ) throws CDIException; + void setCondition(ICDICondition condition) throws CDIException; } diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement.java index 4300da609e3..bb5b6867568 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIBreakpointManagement.java @@ -12,27 +12,100 @@ package org.eclipse.cdt.debug.core.cdi.model; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; import org.eclipse.cdt.debug.core.cdi.ICDICondition; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; +import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; +import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; /** * Breapoints action on the Target. - * */ public interface ICDIBreakpointManagement { - ICDIBreakpoint[] getBreakpoints() throws CDIException; - - ICDILocationBreakpoint setLocationBreakpoint(int type, ICDILocation location, + /** + * Set a line breakpoint. + * + * @param type + * @param location + * @param condition + * @param deferred + * @return + * @throws CDIException + */ + ICDILineBreakpoint setLineBreakpoint(int type, ICDILineLocation location, + ICDICondition condition, boolean deferred) throws CDIException; + + /** + * Set a function breakpoint. + * + * @param type + * @param location + * @param condition + * @param deferred + * @return + * @throws CDIException + */ + ICDIFunctionBreakpoint setFunctionBreakpoint(int type, ICDIFunctionLocation location, + ICDICondition condition, boolean deferred) throws CDIException; + + /** + * Set an address Breakpoint + * + * @param type + * @param location + * @param condition + * @param deferred + * @return + * @throws CDIException + */ + ICDIAddressBreakpoint setAddressBreakpoint(int type, ICDIAddressLocation location, ICDICondition condition, boolean deferred) throws CDIException; + /** + * Set a watchpoint. + * + * @param type + * @param watchType + * @param expression + * @param condition + * @return + * @throws CDIException + */ ICDIWatchpoint setWatchpoint(int type, int watchType, String expression, ICDICondition condition) throws CDIException; - void deleteBreakpoints(ICDIBreakpoint[] breakpoints) throws CDIException; - - void deleteAllBreakpoints() throws CDIException; - + /** + * Set an exception point. + * + * @param clazz + * @param stopOnThrow + * @param stopOnCatch + * @return + * @throws CDIException + */ ICDIExceptionpoint setExceptionBreakpoint(String clazz, boolean stopOnThrow, boolean stopOnCatch) throws CDIException; + /** + * Return all the breakpoints + * + * @return + * @throws CDIException + */ + ICDIBreakpoint[] getBreakpoints() throws CDIException; + + /** + * Remove the breakpoints + * @param breakpoints + * @throws CDIException + */ + void deleteBreakpoints(ICDIBreakpoint[] breakpoints) throws CDIException; + + /** + * Remove all the breakpoints + * + * @throws CDIException + */ + void deleteAllBreakpoints() throws CDIException; + + } diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java new file mode 100644 index 00000000000..9fa09de1fe8 --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIFunctionBreakpoint.java @@ -0,0 +1,21 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi.model; + +/** + * + * Represents a function breakpoint. + * + */ +public interface ICDIFunctionBreakpoint extends ICDILocationBreakpoint { + +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java new file mode 100644 index 00000000000..11d8379ee6c --- /dev/null +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILineBreakpoint.java @@ -0,0 +1,20 @@ +/******************************************************************************* + * Copyright (c) 2000, 2004 QNX Software Systems and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Common Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/cpl-v10.html + * + * Contributors: + * QNX Software Systems - Initial API and implementation + *******************************************************************************/ + +package org.eclipse.cdt.debug.core.cdi.model; + +/** + * + * Represents a line breakpoint. + * + */ +public interface ICDILineBreakpoint extends ICDILocationBreakpoint { +} diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java index f6e6e432e78..971ab1f1d02 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDILocationBreakpoint.java @@ -11,21 +11,18 @@ package org.eclipse.cdt.debug.core.cdi.model; -import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; +import org.eclipse.cdt.debug.core.cdi.ICDILocator; /** * - * Represents a line, function or address breakpoint. + * Abstract class returning location of breakpoint: file, line, function, address. * - * @since Jul 9, 2002 */ public interface ICDILocationBreakpoint extends ICDIBreakpoint { + /** - * Returns the location of this breakpoint. - * - * @return the location of this breakpoint - * @throws CDIException if this method fails. Reasons include: + * Returns the location of the breakpoint. + * @return ICDILocator */ - ICDILocation getLocation() throws CDIException; + ICDILocator getLocator(); } diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java index 410001d8cff..05bfc1b1817 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDIStackFrame.java @@ -12,7 +12,7 @@ package org.eclipse.cdt.debug.core.cdi.model; import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; +import org.eclipse.cdt.debug.core.cdi.ICDILocator; /** * @@ -30,7 +30,7 @@ public interface ICDIStackFrame extends ICDIExecuteStepReturn, ICDIObject { * * @return the location of the instruction pointer */ - ICDILocation getLocation(); + ICDILocator getLocator(); /** * Returns the visible variables in this stack frame. An empty diff --git a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java index 2545abded2f..cad980cfa8d 100644 --- a/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java +++ b/debug/org.eclipse.cdt.debug.core/cdi/org/eclipse/cdt/debug/core/cdi/model/ICDITarget.java @@ -14,7 +14,10 @@ package org.eclipse.cdt.debug.core.cdi.model; import java.math.BigInteger; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; import org.eclipse.cdt.debug.core.cdi.ICDICondition; +import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; +import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDISessionObject; @@ -221,13 +224,18 @@ public interface ICDITarget extends ICDIThreadGroup, ICDIExpressionManagement, ICDICondition createCondition(int ignoreCount, String expression, String[] threadIds); /** - * Returns a ICDILocation + * Returns a ICDILineLocation */ - ICDILocation createLocation(String file, String function, int line); + ICDILineLocation createLineLocation(String file, int line); /** - * Returns a ICDILocation + * Returns a ICDIFunctionLocation */ - ICDILocation createLocation(BigInteger address); + ICDIFunctionLocation createFunctionLocation(String file, String function); + + /** + * Returns a ICDIAddressLocation + */ + ICDIAddressLocation createAddressLocation(BigInteger address); } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java index fb205fcdbd2..0e3c2992f7d 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/CDIDebugModel.java @@ -434,7 +434,7 @@ public class CDIDebugModel { } protected static void stopInMain( CDebugTarget target ) throws DebugException { - ICDILocation location = target.getCDITarget().createLocation( "", "main", 0 ); //$NON-NLS-1$ //$NON-NLS-2$ + ICDILocation location = target.getCDITarget().createFunctionLocation( "", "main" ); //$NON-NLS-1$ //$NON-NLS-2$ try { target.setInternalTemporaryBreakpoint( location ); } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java index 432d6c76657..6a3cff6daa6 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CBreakpointManager.java @@ -22,8 +22,12 @@ import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.CDIDebugModel; import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; import org.eclipse.cdt.debug.core.cdi.ICDICondition; +import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; +import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation; +import org.eclipse.cdt.debug.core.cdi.ICDILocator; import org.eclipse.cdt.debug.core.cdi.event.ICDIChangedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDICreatedEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIDestroyedEvent; @@ -276,17 +280,13 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent if ( breakpoint != null ) { ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint ); if ( cdiBreakpoint instanceof ICDILocationBreakpoint ) { - try { - ICDILocation location = ((ICDILocationBreakpoint)cdiBreakpoint).getLocation(); - if ( location != null ) { - IAddressFactory factory = getDebugTarget().getAddressFactory(); - BigInteger address = location.getAddress(); - if ( address != null ) - return factory.createAddress( address ); - } - } - catch( CDIException e ) { - } + ICDILocator locator = ((ICDILocationBreakpoint)cdiBreakpoint).getLocator(); + if ( locator != null ) { + IAddressFactory factory = getDebugTarget().getAddressFactory(); + BigInteger address = locator.getAddress(); + if ( address != null ) + return factory.createAddress( address ); + } } } return fDebugTarget.getAddressFactory().getZero(); @@ -519,7 +519,17 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent synchronized ( getBreakpointMap() ) { ICDIBreakpoint cdiBreakpoint = getBreakpointMap().getCDIBreakpoint( breakpoint ); if ( cdiBreakpoint == null ) { - cdiBreakpoint = target.setLocationBreakpoint( ICDIBreakpoint.REGULAR, location, condition, true ); + if ( location instanceof ICDILineLocation ) { + cdiBreakpoint = target.setLineBreakpoint( ICDIBreakpoint.REGULAR, + (ICDILineLocation)location, condition, true ); + } else if ( location instanceof ICDIFunctionLocation ) { + cdiBreakpoint = target.setFunctionBreakpoint( ICDIBreakpoint.REGULAR, + (ICDIFunctionLocation)location, condition, true ); + } else if ( location instanceof ICDIAddressLocation ) { + cdiBreakpoint = target.setAddressBreakpoint( ICDIBreakpoint.REGULAR, + (ICDIAddressLocation)location, condition, true ); + + } if ( !enabled ) { cdiBreakpoint.setEnabled( false ); } @@ -538,8 +548,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent final ICDITarget cdiTarget = getCDITarget(); String function = breakpoint.getFunction(); String fileName = breakpoint.getFileName(); - int lineNumber = breakpoint.getLineNumber(); - final ICDILocation location = cdiTarget.createLocation( fileName, function, lineNumber ); + final ICDIFunctionLocation location = cdiTarget.createFunctionLocation( fileName, function ); final ICDICondition condition = createCondition( breakpoint ); setLocationBreakpointOnTarget( breakpoint, cdiTarget, location, condition, enabled ); } @@ -549,7 +558,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent final ICDITarget cdiTarget = getCDITarget(); String address = breakpoint.getAddress(); if ( address.startsWith( "0x" ) ) { //$NON-NLS-1$ - final ICDILocation location = cdiTarget.createLocation( new BigInteger ( breakpoint.getAddress().substring( 2 ), 16 ) ); + final ICDIAddressLocation location = cdiTarget.createAddressLocation( new BigInteger ( breakpoint.getAddress().substring( 2 ), 16 ) ); final ICDICondition condition = createCondition( breakpoint ); setLocationBreakpointOnTarget( breakpoint, cdiTarget, location, condition, enabled ); } @@ -560,7 +569,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent ICDITarget cdiTarget = getCDITarget(); String handle = breakpoint.getSourceHandle(); IPath path = convertPath( handle ); - ICDILocation location = cdiTarget.createLocation( path.toPortableString(), null, breakpoint.getLineNumber() ); + ICDILineLocation location = cdiTarget.createLineLocation( path.toPortableString(), breakpoint.getLineNumber() ); ICDICondition condition = createCondition( breakpoint ); setLocationBreakpointOnTarget( breakpoint, cdiTarget, location, condition, enabled ); } @@ -616,16 +625,17 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent private ICLineBreakpoint createLocationBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) { ICLineBreakpoint breakpoint = null; try { - if ( !isEmpty( cdiBreakpoint.getLocation().getFile() ) ) { + ICDILocator location = cdiBreakpoint.getLocator(); + if ( !isEmpty( location.getFile() ) ) { ISourceLocator locator = getSourceLocator(); if ( locator instanceof ICSourceLocator || locator instanceof CSourceLookupDirector ) { - String sourceHandle = cdiBreakpoint.getLocation().getFile(); + String sourceHandle = location.getFile(); IResource resource = getProject(); Object sourceElement = null; if ( locator instanceof ICSourceLocator ) - sourceElement = ((ICSourceLocator)locator).findSourceElement( cdiBreakpoint.getLocation().getFile() ); + sourceElement = ((ICSourceLocator)locator).findSourceElement( location.getFile() ); else - sourceElement = ((CSourceLookupDirector)locator).getSourceElement( cdiBreakpoint.getLocation().getFile() ); + sourceElement = ((CSourceLookupDirector)locator).getSourceElement( location.getFile() ); if ( sourceElement instanceof IFile || sourceElement instanceof IStorage ) { sourceHandle = ( sourceElement instanceof IFile ) ? ((IFile)sourceElement).getLocation().toOSString() : ((IStorage)sourceElement).getFullPath().toOSString(); resource = ( sourceElement instanceof IFile ) ? (IResource)sourceElement : ResourcesPlugin.getWorkspace().getRoot(); @@ -639,10 +649,10 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent // } } } - else if ( !isEmpty( cdiBreakpoint.getLocation().getFunction() ) ) { + else if ( !isEmpty( location.getFunction() ) ) { breakpoint = createFunctionBreakpoint( cdiBreakpoint ); } - else if ( !cdiBreakpoint.getLocation().getAddress().equals( BigInteger.ZERO ) ) { + else if ( !location.getAddress().equals( BigInteger.ZERO ) ) { breakpoint = createAddressBreakpoint( cdiBreakpoint ); } } @@ -656,7 +666,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent private ICLineBreakpoint createLineBreakpoint( String sourceHandle, IResource resource, ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { ICLineBreakpoint breakpoint = CDIDebugModel.createLineBreakpoint( sourceHandle, resource, - cdiBreakpoint.getLocation().getLineNumber(), + cdiBreakpoint.getLocator().getLineNumber(), cdiBreakpoint.isEnabled(), cdiBreakpoint.getCondition().getIgnoreCount(), cdiBreakpoint.getCondition().getExpression(), @@ -671,7 +681,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent String sourceHandle = execFile.toOSString(); ICFunctionBreakpoint breakpoint = CDIDebugModel.createFunctionBreakpoint( sourceHandle, getProject(), - cdiBreakpoint.getLocation().getFunction(), + cdiBreakpoint.getLocator().getFunction(), -1, -1, -1, @@ -687,7 +697,7 @@ public class CBreakpointManager implements IBreakpointManagerListener, ICDIEvent private ICAddressBreakpoint createAddressBreakpoint( ICDILocationBreakpoint cdiBreakpoint ) throws CDIException, CoreException { IPath execFile = getExecFilePath(); String sourceHandle = execFile.toOSString(); - IAddress address = getDebugTarget().getAddressFactory().createAddress( cdiBreakpoint.getLocation().getAddress() ); + IAddress address = getDebugTarget().getAddressFactory().createAddress( cdiBreakpoint.getLocator().getAddress() ); ICAddressBreakpoint breakpoint = CDIDebugModel.createAddressBreakpoint( sourceHandle, getProject(), address, diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java index 71ff6b6b9cb..ab446abab51 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CDebugTarget.java @@ -27,9 +27,12 @@ import org.eclipse.cdt.debug.core.CDebugUtils; import org.eclipse.cdt.debug.core.ICGlobalVariableManager; import org.eclipse.cdt.debug.core.ICRegisterManager; import org.eclipse.cdt.debug.core.cdi.CDIException; +import org.eclipse.cdt.debug.core.cdi.ICDIAddressLocation; import org.eclipse.cdt.debug.core.cdi.ICDIBreakpointHit; import org.eclipse.cdt.debug.core.cdi.ICDIEndSteppingRange; import org.eclipse.cdt.debug.core.cdi.ICDIErrorInfo; +import org.eclipse.cdt.debug.core.cdi.ICDIFunctionLocation; +import org.eclipse.cdt.debug.core.cdi.ICDILineLocation; import org.eclipse.cdt.debug.core.cdi.ICDILocation; import org.eclipse.cdt.debug.core.cdi.ICDISession; import org.eclipse.cdt.debug.core.cdi.ICDISessionConfiguration; @@ -897,7 +900,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv return; } changeState( CDebugElementState.RESTARTING ); - ICDILocation location = getCDITarget().createLocation( "", "main", 0 ); //$NON-NLS-1$ //$NON-NLS-2$ + ICDILocation location = getCDITarget().createFunctionLocation( "", "main" ); //$NON-NLS-1$ //$NON-NLS-2$ setInternalTemporaryBreakpoint( location ); try { getCDITarget().restart(); @@ -1260,7 +1263,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv public void setInternalTemporaryBreakpoint( ICDILocation location ) throws DebugException { try { - getCDITarget().setLocationBreakpoint( ICDIBreakpoint.TEMPORARY, location, null, false ); + if (location instanceof ICDIFunctionLocation) { + getCDITarget().setFunctionBreakpoint( ICDIBreakpoint.TEMPORARY, (ICDIFunctionLocation)location, null, false ); + } else if (location instanceof ICDILineLocation) { + getCDITarget().setLineBreakpoint( ICDIBreakpoint.TEMPORARY, (ICDILineLocation)location, null, false ); + } else if (location instanceof ICDIAddressLocation) { + getCDITarget().setAddressBreakpoint( ICDIBreakpoint.TEMPORARY, (ICDIAddressLocation)location, null, false ); + } else { + // ??? + targetRequestFailed("not_a_location", null); //$NON-NLS-1$ + } } catch( CDIException e ) { targetRequestFailed( e.getMessage(), null ); @@ -1284,7 +1296,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv if ( skipBreakpoints ) { getBreakpointManager().skipBreakpoints( true ); } - ICDILocation location = getCDITarget().createLocation( fileName, null, lineNumber ); + ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber ); try { getCDITarget().stepUntil( location ); } @@ -1442,7 +1454,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv if ( skipBreakpoints ) { getBreakpointManager().skipBreakpoints( true ); } - ICDILocation location = getCDITarget().createLocation( new BigInteger( address.toString() ) ); + ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) ); try { getCDITarget().stepUntil( location ); } @@ -1509,7 +1521,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv public void jumpToLine( String fileName, int lineNumber ) throws DebugException { if ( !canJumpToLine( fileName, lineNumber ) ) return; - ICDILocation location = getCDITarget().createLocation( fileName, null, lineNumber ); + ICDILocation location = getCDITarget().createLineLocation( fileName, lineNumber ); try { getCDITarget().resume( location ); } @@ -1532,7 +1544,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv public void jumpToAddress( IAddress address ) throws DebugException { if ( !canJumpToAddress( address ) ) return; - ICDILocation location = getCDITarget().createLocation( new BigInteger( address.toString() ) ); + ICDILocation location = getCDITarget().createAddressLocation( new BigInteger( address.toString() ) ); try { getCDITarget().resume( location ); } diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java index 6e2074a61ec..491a7170cca 100644 --- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java +++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CStackFrame.java @@ -20,7 +20,7 @@ import java.util.List; import org.eclipse.cdt.core.IAddress; import org.eclipse.cdt.core.IAddressFactory; import org.eclipse.cdt.debug.core.cdi.CDIException; -import org.eclipse.cdt.debug.core.cdi.ICDILocation; +import org.eclipse.cdt.debug.core.cdi.ICDILocator; import org.eclipse.cdt.debug.core.cdi.event.ICDIEvent; import org.eclipse.cdt.debug.core.cdi.event.ICDIEventListener; import org.eclipse.cdt.debug.core.cdi.model.ICDIExpression; @@ -182,8 +182,8 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart ISourceLocator locator = ((CDebugTarget)getDebugTarget()).getSourceLocator(); if ( locator != null && locator instanceof IAdaptable && ((IAdaptable)locator).getAdapter( ICSourceLocator.class ) != null ) return ((ICSourceLocator)((IAdaptable)locator).getAdapter( ICSourceLocator.class )).getLineNumber( this ); - if ( getCDIStackFrame() != null && getCDIStackFrame().getLocation() != null ) - return getCDIStackFrame().getLocation().getLineNumber(); + if ( getCDIStackFrame() != null && getCDIStackFrame().getLocator() != null ) + return getCDIStackFrame().getLocator().getLineNumber(); } return -1; } @@ -206,16 +206,16 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart * @see org.eclipse.debug.core.model.IStackFrame#getName() */ public String getName() throws DebugException { - ICDILocation location = getCDIStackFrame().getLocation(); + ICDILocator locator = getCDIStackFrame().getLocator(); String func = ""; //$NON-NLS-1$ String file = ""; //$NON-NLS-1$ String line = ""; //$NON-NLS-1$ - if ( location.getFunction() != null && location.getFunction().trim().length() > 0 ) - func += location.getFunction() + "() "; //$NON-NLS-1$ - if ( location.getFile() != null && location.getFile().trim().length() > 0 ) { - file = location.getFile(); - if ( location.getLineNumber() != 0 ) { - line = NumberFormat.getInstance().format( new Integer( location.getLineNumber() ) ); + if ( locator.getFunction() != null && locator.getFunction().trim().length() > 0 ) + func += locator.getFunction() + "() "; //$NON-NLS-1$ + if ( locator.getFile() != null && locator.getFile().trim().length() > 0 ) { + file = locator.getFile(); + if ( locator.getLineNumber() != 0 ) { + line = NumberFormat.getInstance().format( new Integer( locator.getLineNumber() ) ); } } else { @@ -432,8 +432,8 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart protected static boolean equalFrame( ICDIStackFrame frameOne, ICDIStackFrame frameTwo ) { if ( frameOne == null || frameTwo == null ) return false; - ICDILocation loc1 = frameOne.getLocation(); - ICDILocation loc2 = frameTwo.getLocation(); + ICDILocator loc1 = frameOne.getLocator(); + ICDILocator loc2 = frameTwo.getLocator(); if ( loc1 == null || loc2 == null ) return false; if ( loc1.getFile() != null && loc1.getFile().length() > 0 && loc2.getFile() != null && loc2.getFile().length() > 0 && loc1.getFile().equals( loc2.getFile() ) ) { @@ -565,21 +565,21 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart */ public IAddress getAddress() { IAddressFactory factory = ((CDebugTarget)getDebugTarget()).getAddressFactory(); - return factory.createAddress( getCDIStackFrame().getLocation().getAddress() ); + return factory.createAddress( getCDIStackFrame().getLocator().getAddress() ); } /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFile() */ public String getFile() { - return getCDIStackFrame().getLocation().getFile(); + return getCDIStackFrame().getLocator().getFile(); } /* (non-Javadoc) * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFunction() */ public String getFunction() { - return getCDIStackFrame().getLocation().getFunction(); + return getCDIStackFrame().getLocator().getFunction(); } /* (non-Javadoc) @@ -593,7 +593,7 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart * @see org.eclipse.cdt.debug.core.model.ICStackFrame#getFrameLineNumber() */ public int getFrameLineNumber() { - return getCDIStackFrame().getLocation().getLineNumber(); + return getCDIStackFrame().getLocator().getLineNumber(); } protected synchronized void preserve() {