diff --git a/debug/org.eclipse.cdt.debug.core/ChangeLog b/debug/org.eclipse.cdt.debug.core/ChangeLog
index 37d21e99c1b..7873bc34126 100644
--- a/debug/org.eclipse.cdt.debug.core/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.core/ChangeLog
@@ -1,3 +1,18 @@
+2004-05-27 Mikhail Khodjaiants
+ Display global variables in the Variables view.
+ * CDIDebugModel.java
+ * ICGlobalVariableManager.java: new
+ * IGlobalVariable.java: removed
+ * ICGlobalVariable.java
+ * IExecFileInfo.java
+ * IGlobalVariableDescriptor.java: new
+ * CGlobalVariableManager.java: new
+ * CDebugTarget.java
+ * CGlobalVariable.java
+ * CRegister.java
+ * CStackFrame.java
+ * CVariable.java
+
2004-05-20 Mikhail Khodjaiants
Removed dependencies on the compatibility plugin and replaced deprecated classes and methods.
Warning cleanup.
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 93a2945d8bd..1fdd789ef98 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
@@ -19,14 +19,17 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
import org.eclipse.cdt.debug.core.model.ICAddressBreakpoint;
import org.eclipse.cdt.debug.core.model.ICBreakpoint;
import org.eclipse.cdt.debug.core.model.ICFunctionBreakpoint;
+import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.model.ICLineBreakpoint;
import org.eclipse.cdt.debug.core.model.ICWatchpoint;
+import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
import org.eclipse.cdt.debug.internal.core.breakpoints.CAddressBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CFunctionBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CLineBreakpoint;
import org.eclipse.cdt.debug.internal.core.breakpoints.CWatchpoint;
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
import org.eclipse.cdt.debug.internal.core.model.CExpression;
+import org.eclipse.cdt.debug.internal.core.model.CGlobalVariable;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
@@ -389,4 +392,19 @@ public class CDIDebugModel {
}
return null;
}
+
+ public static ICGlobalVariable createGlobalVariable( IDebugTarget target, IGlobalVariableDescriptor info ) throws DebugException {
+ if ( target != null && target instanceof CDebugTarget ) {
+ ICDIVariableObject vo = null;
+ try {
+ vo = ((CDebugTarget)target).getCDISession().getVariableManager().getGlobalVariableObject( info.getPath().lastSegment(), null, info.getName() );
+ ICDIVariable cdiVariable = ((CDebugTarget)target).getCDISession().getVariableManager().createVariable( vo );
+ return new CGlobalVariable( (CDebugTarget)target, cdiVariable );
+ }
+ catch( CDIException e ) {
+ throw new DebugException( new Status( IStatus.ERROR, getPluginIdentifier(), DebugException.TARGET_REQUEST_FAILED, (vo != null) ? vo.getName() + ": " + e.getMessage() : e.getMessage(), null ) ); //$NON-NLS-1$
+ }
+ }
+ return null;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICGlobalVariableManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICGlobalVariableManager.java
new file mode 100644
index 00000000000..bb7d54bbf2a
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/ICGlobalVariableManager.java
@@ -0,0 +1,48 @@
+/**********************************************************************
+ * Copyright (c) 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;
+
+import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
+import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Manages the collection of global variables added to a debug target.
+ */
+public interface ICGlobalVariableManager {
+
+ /**
+ * Registers with this manager the global variables specified by given descriptors.
+ *
+ * @param descriptors the descriptors of global variables to register with this manager
+ * @throws DebugException
+ */
+ public void addGlobals( IGlobalVariableDescriptor[] descriptors ) throws DebugException;
+
+ /**
+ * Removes specified global variables from this manager.
+ *
+ * @param globals global variables to remove
+ */
+ public void removeGlobals( ICGlobalVariable[] globals );
+
+ /**
+ * Removes all global variables from this manager.
+ */
+ public void removeAllGlobals();
+
+ /**
+ * Returns the array of the global variables descriptors registered with this manager.
+ *
+ * @return the array of the global variables descriptors registered with this manager
+ */
+ public IGlobalVariableDescriptor[] getDescriptors();
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICGlobalVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICGlobalVariable.java
new file mode 100644
index 00000000000..db5d740b271
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/ICGlobalVariable.java
@@ -0,0 +1,18 @@
+/**********************************************************************
+ * Copyright (c) 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.model;
+
+/**
+ * Represents a global C/C++ variable.
+ */
+public interface ICGlobalVariable extends ICVariable {
+ public void dispose();
+}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java
index 677f4f41ac9..b258694f09f 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IExecFileInfo.java
@@ -22,5 +22,5 @@ public interface IExecFileInfo {
public boolean isLittleEndian();
- public IGlobalVariable[] getGlobals() throws DebugException;
+ public IGlobalVariableDescriptor[] getGlobals() throws DebugException;
}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IGlobalVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IGlobalVariableDescriptor.java
similarity index 86%
rename from debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IGlobalVariable.java
rename to debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IGlobalVariableDescriptor.java
index 1b488a9a27f..be5e0fc711b 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IGlobalVariable.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/core/model/IGlobalVariableDescriptor.java
@@ -12,7 +12,7 @@ import org.eclipse.core.runtime.IPath;
*
* @since: Nov 4, 2002
*/
-public interface IGlobalVariable
+public interface IGlobalVariableDescriptor
{
String getName();
IPath getPath();
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CGlobalVariableManager.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CGlobalVariableManager.java
new file mode 100644
index 00000000000..b3aee134f6a
--- /dev/null
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/CGlobalVariableManager.java
@@ -0,0 +1,124 @@
+/**********************************************************************
+ * Copyright (c) 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.internal.core;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import org.eclipse.cdt.debug.core.CDIDebugModel;
+import org.eclipse.cdt.debug.core.CDebugCorePlugin;
+import org.eclipse.cdt.debug.core.ICGlobalVariableManager;
+import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
+import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
+import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
+import org.eclipse.cdt.debug.internal.core.model.CVariable;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+
+/**
+ * Manages all global variables registered with a debug target.
+ */
+public class CGlobalVariableManager implements ICGlobalVariableManager {
+
+ private CDebugTarget fDebugTarget;
+
+ private ArrayList fGlobals = new ArrayList( 10 );
+
+ /**
+ * Constructor for CGlobalVariableManager.
+ */
+ public CGlobalVariableManager( CDebugTarget target ) {
+ super();
+ setDebugTarget( target );
+ }
+
+ protected CDebugTarget getDebugTarget() {
+ return fDebugTarget;
+ }
+
+ private void setDebugTarget( CDebugTarget debugTarget ) {
+ fDebugTarget = debugTarget;
+ }
+
+ public ICGlobalVariable[] getGlobals() {
+ return (ICGlobalVariable[])fGlobals.toArray( new ICGlobalVariable[fGlobals.size()] );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#addGlobals(IGlobalVariableDescriptor[])
+ */
+ public void addGlobals( IGlobalVariableDescriptor[] descriptors ) throws DebugException {
+ MultiStatus ms = new MultiStatus( CDebugCorePlugin.getUniqueIdentifier(), 0, "", null ); //$NON-NLS-1$
+ ArrayList globals = new ArrayList( descriptors.length );
+ for ( int i = 0; i < descriptors.length; ++i ) {
+ try {
+ globals.add( CDIDebugModel.createGlobalVariable( getDebugTarget(), descriptors[i] ) );
+ }
+ catch( DebugException e ) {
+ ms.add( e.getStatus() );
+ }
+ }
+ if ( globals.size() > 0 ) {
+ synchronized( fGlobals ) {
+ fGlobals.addAll( globals );
+ }
+ getDebugTarget().fireChangeEvent( DebugEvent.CONTENT );
+ }
+ if ( !ms.isOK() ) {
+ throw new DebugException( ms );
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#removeGlobals(ICGlobalVariable[])
+ */
+ public void removeGlobals( ICGlobalVariable[] globals ) {
+ synchronized( fGlobals ) {
+ fGlobals.removeAll( Arrays.asList( globals ) );
+ }
+ for ( int i = 0; i < globals.length; ++i ) {
+ globals[i].dispose();
+ }
+ getDebugTarget().fireChangeEvent( DebugEvent.CONTENT );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#removeAllGlobals()
+ */
+ public void removeAllGlobals() {
+ ICGlobalVariable[] globals = new ICGlobalVariable[0];
+ synchronized( fGlobals ) {
+ globals = (ICGlobalVariable[])fGlobals.toArray( new ICGlobalVariable[fGlobals.size()] );
+ fGlobals.clear();
+ }
+ for ( int i = 0; i < globals.length; ++i ) {
+ ((CVariable)globals[i]).dispose();
+ }
+ getDebugTarget().fireChangeEvent( DebugEvent.CONTENT );
+ }
+
+ public void dispose() {
+ Iterator it = fGlobals.iterator();
+ while( it.hasNext() ) {
+ ((ICGlobalVariable)it.next()).dispose();
+ }
+ fGlobals.clear();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.ICGlobalVariableManager#getDescriptors()
+ */
+ public IGlobalVariableDescriptor[] getDescriptors() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+}
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 00163f7a6ce..c8e246fe6dc 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
@@ -20,6 +20,7 @@ import org.eclipse.cdt.core.model.IParent;
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
import org.eclipse.cdt.debug.core.CDebugModel;
import org.eclipse.cdt.debug.core.CDebugUtils;
+import org.eclipse.cdt.debug.core.ICGlobalVariableManager;
import org.eclipse.cdt.debug.core.ICMemoryManager;
import org.eclipse.cdt.debug.core.ICRegisterManager;
import org.eclipse.cdt.debug.core.ICSharedLibraryManager;
@@ -66,7 +67,7 @@ import org.eclipse.cdt.debug.core.model.ICSignal;
import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport;
import org.eclipse.cdt.debug.core.model.IDisassembly;
import org.eclipse.cdt.debug.core.model.IExecFileInfo;
-import org.eclipse.cdt.debug.core.model.IGlobalVariable;
+import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
import org.eclipse.cdt.debug.core.model.IJumpToAddress;
import org.eclipse.cdt.debug.core.model.IJumpToLine;
import org.eclipse.cdt.debug.core.model.IRunToAddress;
@@ -75,6 +76,7 @@ import org.eclipse.cdt.debug.core.model.IState;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.CBreakpointManager;
import org.eclipse.cdt.debug.internal.core.CExpressionTarget;
+import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager;
import org.eclipse.cdt.debug.internal.core.CMemoryManager;
import org.eclipse.cdt.debug.internal.core.CRegisterManager;
import org.eclipse.cdt.debug.internal.core.CSharedLibraryManager;
@@ -250,6 +252,8 @@ public class CDebugTarget extends CDebugElement
private CExpressionTarget fExpressionTarget;
+ private CGlobalVariableManager fGlobalVariableManager;
+
/**
* The suspension thread.
*/
@@ -302,6 +306,7 @@ public class CDebugTarget extends CDebugElement
setSignalManager( new CSignalManager( this ) );
setRegisterManager( new CRegisterManager( this ) );
setBreakpointManager( new CBreakpointManager( this ) );
+ setGlobalVariableManager( new CGlobalVariableManager( this ) );
initialize();
DebugPlugin.getDefault().getLaunchManager().addLaunchListener( this );
DebugPlugin.getDefault().getExpressionManager().addExpressionListener( this );
@@ -997,6 +1002,8 @@ public class CDebugTarget extends CDebugElement
return getRegisterManager();
if ( adapter.equals( CExpressionTarget.class ) )
return getExpressionTarget();
+ if ( adapter.equals( ICGlobalVariableManager.class ) )
+ return getGlobalVariableManager();
if ( adapter.equals( ICDISession.class ) )
return getCDISession();
return super.getAdapter( adapter );
@@ -1226,6 +1233,7 @@ public class CDebugTarget extends CDebugElement
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener( this );
DebugPlugin.getDefault().getExpressionManager().removeExpressionListener( this );
DebugPlugin.getDefault().getLaunchManager().removeLaunchListener( this );
+ disposeGlobalVariableManager();
disposeMemoryManager();
disposeSharedLibraryManager();
disposeSignalManager();
@@ -1988,7 +1996,7 @@ public class CDebugTarget extends CDebugElement
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.IExecFileInfo#getGlobals()
*/
- public IGlobalVariable[] getGlobals() throws DebugException
+ public IGlobalVariableDescriptor[] getGlobals() throws DebugException
{
ArrayList list = new ArrayList();
if ( getExecFile() != null && CoreModel.getDefault().isBinary( getExecFile() ) )
@@ -1999,7 +2007,7 @@ public class CDebugTarget extends CDebugElement
list.addAll( getCFileGlobals( (IParent)cFile ) );
}
}
- return (IGlobalVariable[])list.toArray( new IGlobalVariable[list.size()] );
+ return (IGlobalVariableDescriptor[])list.toArray( new IGlobalVariableDescriptor[list.size()] );
}
private List getCFileGlobals( IParent file ) throws DebugException
@@ -2027,9 +2035,9 @@ public class CDebugTarget extends CDebugElement
return list;
}
- private IGlobalVariable createGlobalVariable( final org.eclipse.cdt.core.model.IVariable var )
+ private IGlobalVariableDescriptor createGlobalVariable( final org.eclipse.cdt.core.model.IVariable var )
{
- return new IGlobalVariable()
+ return new IGlobalVariableDescriptor()
{
public String getName()
{
@@ -2084,6 +2092,10 @@ public class CDebugTarget extends CDebugElement
fRegisterManager.dispose();
}
+ protected void disposeGlobalVariableManager() {
+ fGlobalVariableManager.dispose();
+ }
+
/**
* @see org.eclipse.cdt.debug.core.model.IRunToAddress#canRunToAddress(long)
*/
@@ -2488,4 +2500,12 @@ public class CDebugTarget extends CDebugElement
}
return fExpressionTarget;
}
+
+ protected CGlobalVariableManager getGlobalVariableManager() {
+ return fGlobalVariableManager;
+ }
+
+ private void setGlobalVariableManager( CGlobalVariableManager globalVariableManager ) {
+ fGlobalVariableManager = globalVariableManager;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java
index 2d09c7f93d0..b7e7fd21c56 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CGlobalVariable.java
@@ -8,6 +8,7 @@ import org.eclipse.cdt.debug.core.cdi.model.ICDIObject;
import org.eclipse.cdt.debug.core.cdi.model.ICDIValue;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariable;
import org.eclipse.cdt.debug.core.cdi.model.type.ICDIArrayValue;
+import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IValue;
@@ -17,7 +18,7 @@ import org.eclipse.debug.core.model.IValue;
*
* @since: Oct 2, 2002
*/
-public class CGlobalVariable extends CModificationVariable
+public class CGlobalVariable extends CModificationVariable implements ICGlobalVariable
{
/**
* Constructor for CGlobalVariable.
@@ -37,6 +38,8 @@ public class CGlobalVariable extends CModificationVariable
*/
public IValue getValue() throws DebugException
{
+ if ( !isEnabled() )
+ return fDisabledValue;
if ( fValue == null )
{
ICDIValue cdiValue = getCurrentValue();
@@ -90,4 +93,25 @@ public class CGlobalVariable extends CModificationVariable
}
}
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.internal.core.model.CVariable#dispose()
+ */
+ public void dispose() {
+ if ( getShadow() != null )
+ getShadow().dispose();
+ try {
+ getCDISession().getVariableManager().destroyVariable( getCDIVariable() );
+ }
+ catch( CDIException e ) {
+ }
+ super.dispose();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.cdt.debug.core.model.ICVariable#canEnableDisable()
+ */
+ public boolean canEnableDisable() {
+ return true;
+ }
}
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java
index 8f8f3192a7f..66a811eacd9 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CRegister.java
@@ -69,12 +69,4 @@ public class CRegister extends CGlobalVariable implements IRegister
{
return true;
}
-
- /* (non-Javadoc)
- * @see org.eclipse.cdt.debug.core.model.ICVariable#canEnableDisable()
- */
- public boolean canEnableDisable()
- {
- return false;
- }
}
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 0557da42140..26a643ca315 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
@@ -22,6 +22,7 @@ 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.ICDIStackFrame;
import org.eclipse.cdt.debug.core.cdi.model.ICDIVariableObject;
+import org.eclipse.cdt.debug.core.model.ICGlobalVariable;
import org.eclipse.cdt.debug.core.model.ICStackFrame;
import org.eclipse.cdt.debug.core.model.IRestart;
import org.eclipse.cdt.debug.core.model.IResumeWithoutSignal;
@@ -29,6 +30,7 @@ import org.eclipse.cdt.debug.core.model.IRunToAddress;
import org.eclipse.cdt.debug.core.model.IRunToLine;
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
import org.eclipse.cdt.debug.internal.core.CExpressionTarget;
+import org.eclipse.cdt.debug.internal.core.CGlobalVariableManager;
import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.IRegisterGroup;
@@ -95,8 +97,12 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
* @see org.eclipse.debug.core.model.IStackFrame#getVariables()
*/
public IVariable[] getVariables() throws DebugException {
- List list = getVariables0();
- return (IVariable[])list.toArray( new IVariable[list.size()] );
+ ICGlobalVariable[] globals = getGlobals();
+ List vars = getVariables0();
+ List all = new ArrayList( globals.length + vars.size() );
+ all.addAll( Arrays.asList( globals ) );
+ all.addAll( vars );
+ return (IVariable[])all.toArray( new IVariable[all.size()] );
}
protected synchronized List getVariables0() throws DebugException {
@@ -712,4 +718,12 @@ public class CStackFrame extends CDebugElement implements ICStackFrame, IRestart
CExpressionTarget target = (CExpressionTarget)getDebugTarget().getAdapter( CExpressionTarget.class );
return (target != null) ? target.evaluateExpression( expression ) : null;
}
+
+ private ICGlobalVariable[] getGlobals() {
+ CGlobalVariableManager gvm = ((CDebugTarget)getDebugTarget()).getGlobalVariableManager();
+ if ( gvm != null ) {
+ return gvm.getGlobals();
+ }
+ return new ICGlobalVariable[0];
+ }
}
\ No newline at end of file
diff --git a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
index c1a732005e5..0ae7386dfc7 100644
--- a/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
+++ b/debug/org.eclipse.cdt.debug.core/src/org/eclipse/cdt/debug/internal/core/model/CVariable.java
@@ -350,7 +350,7 @@ public abstract class CVariable extends CDebugElement
* Temporary solution to avoid NPE in VariablesView.
* This is fixed in the Eclipse 2.1.1 Maintenance Build.
*/
- static private IValue fDisabledValue = new IValue()
+ static protected IValue fDisabledValue = new IValue()
{
public String getReferenceTypeName() throws DebugException
{
@@ -559,7 +559,7 @@ public abstract class CVariable extends CDebugElement
return ( fValue instanceof CValue ) ? ((CValue)fValue).getUnderlyingValue() : null;
}
- protected void dispose()
+ public void dispose()
{
if ( fValue != null )
{
@@ -807,7 +807,7 @@ public abstract class CVariable extends CDebugElement
return ( fOriginal != null ) ? fOriginal.getCDIVariable() : null;
}
- private InternalVariable getShadow()
+ protected InternalVariable getShadow()
{
return fShadow;
}
diff --git a/debug/org.eclipse.cdt.debug.ui/ChangeLog b/debug/org.eclipse.cdt.debug.ui/ChangeLog
index 0d8db234c5a..cd52bd0a3ff 100644
--- a/debug/org.eclipse.cdt.debug.ui/ChangeLog
+++ b/debug/org.eclipse.cdt.debug.ui/ChangeLog
@@ -1,3 +1,18 @@
+2004-05-27 Mikhail Khodjaiants
+ Display global variables in the Variables view.
+ * CDebugImages.java
+ * CDTDebugModelPresentation.java
+ * AddGlobalsActionDelegate.java
+ * RemoveAllGlobalsActionDelegate.java: new
+ * RemoveGlobalsActionDelegate.java: new
+ * plugin.properties
+ * plugin.xml
+ * icons/full/dlcl16/rem_all_co.gif: new
+ * icons/full/dlcl16/rem_co.gif: new
+ * icons/full/elcl16/rem_all_co.gif: new
+ * icons/full/elcl16/rem_co.gif: new
+ * icons/full/ovr16/global_ovr.gif: new
+
2004-05-25 Mikhail Khodjaiants
New instructuion pointer images for the Disassembly view.
* icons/full/obj16/inst_ptr_top.gif
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/rem_all_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/rem_all_co.gif
new file mode 100644
index 00000000000..ecd1be56815
Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/rem_all_co.gif differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/rem_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/rem_co.gif
new file mode 100644
index 00000000000..559e462985f
Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/dlcl16/rem_co.gif differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/rem_all_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/rem_all_co.gif
new file mode 100644
index 00000000000..28a3785aaca
Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/rem_all_co.gif differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/rem_co.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/rem_co.gif
new file mode 100644
index 00000000000..2cd9c544436
Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/elcl16/rem_co.gif differ
diff --git a/debug/org.eclipse.cdt.debug.ui/icons/full/ovr16/global_ovr.gif b/debug/org.eclipse.cdt.debug.ui/icons/full/ovr16/global_ovr.gif
new file mode 100644
index 00000000000..e0decd8c653
Binary files /dev/null and b/debug/org.eclipse.cdt.debug.ui/icons/full/ovr16/global_ovr.gif differ
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.properties b/debug/org.eclipse.cdt.debug.ui/plugin.properties
index d499452dce0..a5b718c83c2 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.properties
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.properties
@@ -48,6 +48,10 @@ ShowFullPathsAction.tooltip=Show Full Paths
AddGlobalsAction.label=Add Global Variables...
AddGlobalsAction.tooltip=Add Global Variables
+RemoveGlobalsAction.label=Remove Global Variables
+RemoveGlobalsAction.tooltip=Remove Selected Global Variables
+RemoveAllGlobalsAction.label=Remove All Global Variables
+RemoveAllGlobalsAction.tooltip=Remove All Global Variables
CVariableFormatMenu.label=Format
HexVariableFormatAction.label=Hexadecimal
diff --git a/debug/org.eclipse.cdt.debug.ui/plugin.xml b/debug/org.eclipse.cdt.debug.ui/plugin.xml
index 16d99410474..39da565bf8f 100644
--- a/debug/org.eclipse.cdt.debug.ui/plugin.xml
+++ b/debug/org.eclipse.cdt.debug.ui/plugin.xml
@@ -409,25 +409,6 @@
targetID="org.eclipse.debug.ui.BreakpointView"
id="org.eclipse.cdt.debug.ui.breakpointview.popupMenu">
-
@@ -752,7 +733,7 @@
helpContextId="restore_default_type_action_context"
tooltip="%RestoreDefaultTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate"
- menubarPath="additions"
+ menubarPath="variableGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultTypeActionDelegate">
@@ -768,7 +749,7 @@
helpContextId="cast_to_type_action_context"
tooltip="%CastToTypeAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate"
- menubarPath="additions"
+ menubarPath="variableGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToTypeActionDelegate">
@@ -784,7 +765,7 @@
helpContextId="cast_to_array_action_context"
tooltip="%CastToArrayAction.tooltip"
class="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate"
- menubarPath="additions"
+ menubarPath="variableGroup"
enablesFor="1"
id="org.eclipse.cdt.debug.internal.ui.actions.CastToArrayActionDelegate">
@@ -818,6 +799,50 @@