Bug fixes and new wrapper for prefs access.
diff --git a/org.eclipse.cdt.debug.edc.tests/src/org/eclipse/cdt/debug/edc/system/tests/K9SystemView.java b/org.eclipse.cdt.debug.edc.tests/src/org/eclipse/cdt/debug/edc/system/tests/K9SystemView.java
index 4614f99..e006f96 100644
--- a/org.eclipse.cdt.debug.edc.tests/src/org/eclipse/cdt/debug/edc/system/tests/K9SystemView.java
+++ b/org.eclipse.cdt.debug.edc.tests/src/org/eclipse/cdt/debug/edc/system/tests/K9SystemView.java
@@ -16,6 +16,7 @@
 import java.util.Map;
 import java.util.Random;
 
+import org.eclipse.cdt.debug.edc.internal.EDCDebugger;
 import org.eclipse.cdt.debug.edc.internal.ui.views.ISystemVMContainer;
 import org.eclipse.cdt.debug.edc.internal.ui.views.SystemDMContainer;
 import org.eclipse.cdt.debug.edc.internal.ui.views.SystemDataModel;
@@ -26,7 +27,6 @@
 import org.eclipse.cdt.internal.ui.util.StringMatcher;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.debug.internal.ui.viewers.model.provisional.PresentationContext;
 import org.eclipse.swt.widgets.Composite;
 
@@ -238,7 +238,7 @@
 	@Override
 	public void createPartControl(Composite parent) {
 		setRefreshInterval(5000);		
-		setPrefsNode(InstanceScope.INSTANCE.getNode(EDCTestPlugin.PLUGIN_ID));
+		setPrefsNode(EDCDebugger.getPrefs(EDCTestPlugin.PLUGIN_ID));
 		setPresentationContext(new PresentationContext(VIEW_ID));
 		setDataModel(new K9DataModel());
 		setViewModel(new K9ViewModel());
diff --git a/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/TraceView.java b/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/TraceView.java
index 20aedf7..d64ce8c 100644
--- a/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/TraceView.java
+++ b/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/TraceView.java
@@ -23,8 +23,8 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.eclipse.cdt.debug.edc.internal.EDCDebugger;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.IToolBarManager;
@@ -287,7 +287,7 @@
 	}
 
 	private Preferences getViewPreferences() {
-		return InstanceScope.INSTANCE.getNode(EDCDebugUI.PLUGIN_ID);
+		return EDCDebugger.getPrefs(EDCDebugUI.PLUGIN_ID);
 	}
 
 	@Override
diff --git a/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleCustomFormattingCommandHandler.java b/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleCustomFormattingCommandHandler.java
index 3079238..daed0c0 100644
--- a/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleCustomFormattingCommandHandler.java
+++ b/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleCustomFormattingCommandHandler.java
@@ -23,7 +23,6 @@
 import org.eclipse.core.commands.State;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
 import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
 import org.eclipse.debug.ui.AbstractDebugView;
@@ -67,7 +66,7 @@
 		Command command = event.getCommand();
 		boolean enabled = HandlerUtil.toggleCommandState(command);
 		FormatExtensionManager.instance().setEnabled(!enabled );
-		IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+		IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 		scope.putBoolean(FormatExtensionManager.VARIABLE_FORMATS_ENABLED, !enabled);
 		try {
 			scope.flush();
diff --git a/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleShowAllVariablesCommandHandler.java b/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleShowAllVariablesCommandHandler.java
index 38523cb..fa608a0 100644
--- a/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleShowAllVariablesCommandHandler.java
+++ b/org.eclipse.cdt.debug.edc.ui/src/org/eclipse/cdt/debug/edc/internal/ui/actions/ToggleShowAllVariablesCommandHandler.java
@@ -21,7 +21,6 @@
 import org.eclipse.core.commands.ExecutionException;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
 import org.eclipse.debug.internal.ui.viewers.model.provisional.TreeModelViewer;
 import org.eclipse.debug.ui.AbstractDebugView;
@@ -43,7 +42,7 @@
 		// Note: toggleCommandState() returns the state before it is toggled
 		boolean enabled = !HandlerUtil.toggleCommandState(command);
 
-		IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+		IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 		scope.putBoolean(IEDCSymbols.SHOW_ALL_VARIABLES_ENABLED, enabled);
 		try {
 			scope.flush();
diff --git a/org.eclipse.cdt.debug.edc.windows.ui/src/org/eclipse/cdt/debug/edc/internal/windows/ui/WindowsSystemView.java b/org.eclipse.cdt.debug.edc.windows.ui/src/org/eclipse/cdt/debug/edc/internal/windows/ui/WindowsSystemView.java
index 9b85132..779ae2f 100644
--- a/org.eclipse.cdt.debug.edc.windows.ui/src/org/eclipse/cdt/debug/edc/internal/windows/ui/WindowsSystemView.java
+++ b/org.eclipse.cdt.debug.edc.windows.ui/src/org/eclipse/cdt/debug/edc/internal/windows/ui/WindowsSystemView.java
@@ -34,7 +34,6 @@
 import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.debug.core.ILaunchConfigurationType;
@@ -194,7 +193,7 @@
 	@Override
 	public void createPartControl(Composite parent) {
 		setPresentationContext(new PresentationContext(VIEW_ID));
-		setPrefsNode(InstanceScope.INSTANCE.getNode(WindowsDebuggerUI.PLUGIN_ID));
+		setPrefsNode(EDCDebugger.getPrefs(WindowsDebuggerUI.PLUGIN_ID));
 		setDataModel(new WindowsDataModel());
 		setViewModel(new WindowsViewModel());
 		getViewModel().buildViewModel();
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/formatter/AbstractStringFormatter.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/formatter/AbstractStringFormatter.java
index d4ac10f..68f7089 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/formatter/AbstractStringFormatter.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/formatter/AbstractStringFormatter.java
@@ -11,6 +11,7 @@
 package org.eclipse.cdt.debug.edc.formatter;
 
 import org.eclipse.cdt.core.IAddress;
+import org.eclipse.cdt.debug.edc.internal.EDCDebugger;
 import org.eclipse.cdt.debug.edc.internal.symbols.IArrayBoundType;
 import org.eclipse.cdt.debug.edc.internal.symbols.IArrayType;
 import org.eclipse.cdt.debug.edc.services.IEDCExpression;
@@ -21,7 +22,6 @@
 import org.eclipse.cdt.dsf.debug.service.IExpressions.IExpressionDMContext;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 
 /**
  * Base class for string formatters.
@@ -115,7 +115,7 @@
 	 * @return size in characters
 	 */
 	protected int getMaximumLength() {
-		IEclipsePreferences scope = InstanceScope.INSTANCE.getNode("org.eclipse.debug.ui");
+		IEclipsePreferences scope = EDCDebugger.getPrefs("org.eclipse.debug.ui");
 		return scope.getInt("org.eclipse.debug.ui.max_detail_length", 256);
 	}
 	
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCApplication.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCApplication.java
index 6920e72..7d97c15 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCApplication.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCApplication.java
@@ -12,7 +12,6 @@
 
 import org.eclipse.cdt.scripting.ScriptingPlugin;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.internal.core.IInternalDebugCoreConstants;
 import org.eclipse.equinox.app.IApplication;
@@ -27,10 +26,10 @@
 		
 		running = true;
 	
-	 	IEclipsePreferences prefs = InstanceScope.INSTANCE.getNode(ScriptingPlugin.PLUGIN_ID);
+	 	IEclipsePreferences prefs = EDCDebugger.getPrefs(ScriptingPlugin.PLUGIN_ID);
 	 	prefs.putBoolean(ScriptingPlugin.SCRIPTING_ENABLED, true);
 
-	 	prefs = InstanceScope.INSTANCE.getNode(DebugPlugin.getUniqueIdentifier());
+	 	prefs = EDCDebugger.getPrefs(DebugPlugin.getUniqueIdentifier());
 	 	prefs.putBoolean(IInternalDebugCoreConstants.PREF_ENABLE_STATUS_HANDLERS, false);
 
 	 	ScriptingPlugin.getBundleContext();
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCDebugger.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCDebugger.java
index 5494bc0..2fd0805 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCDebugger.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/EDCDebugger.java
@@ -17,10 +17,13 @@
 import org.eclipse.cdt.debug.edc.tcf.extension.services.LoggingProxy;
 import org.eclipse.cdt.debug.edc.tcf.extension.services.SettingsProxy;
 import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
+import org.eclipse.cdt.scripting.ScriptingPlugin;
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Plugin;
 import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.debug.core.DebugException;
 import org.eclipse.osgi.service.debug.DebugOptions;
 import org.eclipse.osgi.service.debug.DebugTrace;
@@ -246,4 +249,9 @@
 		}
 		return cache;
 	}
+	
+	public static IEclipsePreferences getPrefs(String qualifier)
+	{
+	 	return InstanceScope.INSTANCE.getNode(qualifier);
+	}
 }
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/formatter/FormatExtensionManager.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/formatter/FormatExtensionManager.java
index f18648f..f08a945 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/formatter/FormatExtensionManager.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/formatter/FormatExtensionManager.java
@@ -24,7 +24,6 @@
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.Platform;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 
 /**
  * Manages format extensions
@@ -102,7 +101,7 @@
 	private FormatExtensionManager(IVariableFormatProviderChooser chooser) {
 		readProviders();
 		setFormatProviderChooser(chooser);
-		IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+		IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 		enabled = scope.getBoolean(VARIABLE_FORMATS_ENABLED, FormatExtensionManager.VARIABLE_FORMATS_ENABLED_DEFAULT);
 	}
 
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/BreakpointAttributeTranslator.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/BreakpointAttributeTranslator.java
index 8419e9d..4c1f78d 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/BreakpointAttributeTranslator.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/BreakpointAttributeTranslator.java
@@ -22,11 +22,11 @@
 import org.eclipse.cdt.debug.core.model.ICWatchpoint;
 import org.eclipse.cdt.debug.edc.internal.EDCDebugger;
 import org.eclipse.cdt.debug.edc.internal.EDCTrace;
-import org.eclipse.cdt.debug.edc.internal.services.dsf.Modules.ModuleDMC;
 import org.eclipse.cdt.debug.edc.internal.symbols.InvalidVariableLocation;
 import org.eclipse.cdt.debug.edc.launch.EDCLaunch;
 import org.eclipse.cdt.debug.edc.services.IEDCExpression;
 import org.eclipse.cdt.debug.edc.services.ITargetEnvironment;
+import org.eclipse.cdt.debug.edc.services.Stack;
 import org.eclipse.cdt.debug.edc.symbols.ILineEntryProvider.ILineAddresses;
 import org.eclipse.cdt.debug.edc.symbols.IType;
 import org.eclipse.cdt.debug.edc.symbols.IVariableLocation;
@@ -53,9 +53,6 @@
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.model.IBreakpoint;
 
-//trying to avoid dependence on the ui, even the core debug UI
-//import org.eclipse.debug.ui.DebugUITools;
-
 public class BreakpointAttributeTranslator implements IBreakpointAttributeTranslator2 {
 
 	private DsfServicesTracker	dsfServicesTracker;
@@ -208,7 +205,7 @@
 			return;
 		}
 
-		final ModuleDMC module = (ModuleDMC) context;
+		final Modules.ModuleDMC module = (Modules.ModuleDMC)context;
 
 		Map<String, Object> oneBPAttr;
 		if (breakpoint instanceof ICWatchpoint) {
@@ -218,72 +215,52 @@
 				drm.setStatus(
 						new Status(IStatus.ERROR, EDCDebugger.PLUGIN_ID,
 								MessageFormat.format(
-										EDCServicesMessages.BPAttrTranslator_WatchptNoExprService,
+										EDCServicesMessages
+										.BPAttrTranslator_WatchptNoExprService,
 										wpExpr)));
 				drm.done();
 			} else {
-				IEDCExpression exprDMC = (IEDCExpression)expressions.createExpression(module, wpExpr);
+				IEDCExpression exprDMC
+				  = (IEDCExpression)expressions.createExpression(module, wpExpr);
 				exprDMC.evaluateExpression();
 				IVariableLocation varLoc = exprDMC.getEvaluatedLocation();
-// the following depends upon org.eclipse.debug.ui to get the current stackFrame;
-// not certain that creating a ui dependency is exactly kosher in this situation.
-//				if (varLoc == null || varLoc instanceof InvalidVariableLocation) {
-//				    IAdaptable adaptable = DebugUITools.getDebugContext();
-//				    if (adaptable == null) {
-//						drm.setStatus(
-//								new Status(IStatus.ERROR, EDCDebugger.PLUGIN_ID,
-//										MessageFormat.format(
-//												EDCServicesMessages.BPAttrTranslator_WatchptNoContext,
-//												wpExpr)));
-//						drm.done();
-//						return;
-//				    }	
-//					StackFrameDMC frame = (StackFrameDMC)adaptable.getAdapter(StackFrameDMC.class);
-//					if (frame == null) {
-//						drm.setStatus(
-//								new Status(IStatus.ERROR, EDCDebugger.PLUGIN_ID,
-//										MessageFormat.format(
-//												EDCServicesMessages.BPAttrTranslator_WatchptNoContext,
-//												wpExpr)));
-//						drm.done();
-//						return;		// message is ready, need to skip all setStatus() calls below
-//					}
-//					exprDMC = (IEDCExpression)expressions.createExpression(frame, wpExpr);
-//					exprDMC.evaluateExpression();
-//					varLoc = exprDMC.getEvaluatedLocation();
-//				}
-				if (varLoc == null || varLoc instanceof InvalidVariableLocation) {
+				IAddress wpAddr;
+				if (varLoc == null || varLoc instanceof InvalidVariableLocation
+						|| (wpAddr = varLoc.getAddress()) == null) {
 					drm.setStatus(
 							new Status(IStatus.WARNING, EDCDebugger.PLUGIN_ID,
 									   MessageFormat.format(
-											   EDCServicesMessages.BPAttrTranslator_WatchptLocationInvalid,
+											   EDCServicesMessages
+											   .BPAttrTranslator_WatchptLocationInvalid,
 											   wpExpr, module.getName())));
 				} else {
-					try {
-						IAddress wpAddr = varLoc.getAddress();
-						if (wpAddr == null)
-							throw new CoreException(null);
-						String wpAddrString = wpAddr.toString(16);
-						if (module.containsAddress(wpAddr)) {
-							IType exprType = TypeUtils.getStrippedType(exprDMC.getEvaluatedType());
-							Map<String,Object> wpAttr = new HashMap<String, Object>(attributes);
-							wpAttr.put(Breakpoints.RUNTIME_ADDRESS, wpAddrString);
-							wpAttr.put(CWatchpoint.RANGE, exprType.getByteSize());
-							targetBPAttrs.add(wpAttr);
-							drm.setData(targetBPAttrs);
-						} else {
-							drm.setStatus(
-									new Status(IStatus.WARNING, EDCDebugger.PLUGIN_ID,
-											   MessageFormat.format(
-													   EDCServicesMessages.BPAttrTranslator_WatchptNotInModule,
-													   wpExpr, wpAddrString, module.getName())));
-						}
-					} catch (CoreException e) {
+					boolean wpValidForModule = module.containsAddress(wpAddr);
+					if (!wpValidForModule
+							&& varLoc.getContext() instanceof Stack.StackFrameDMC) {
+						Stack.StackFrameDMC frame
+						  = (Stack.StackFrameDMC)varLoc.getContext();
+						wpValidForModule = module == frame.getModule();
+					}
+
+					String wpAddrString = wpAddr.toString(16);
+					// used in both parts of "if (...) {...} else {...}" below
+
+					if (wpValidForModule) {
+						IType exprType
+						  = TypeUtils.getStrippedType(exprDMC.getEvaluatedType());
+						Map<String,Object> wpAttr
+						  = new HashMap<String, Object>(attributes);
+						wpAttr.put(Breakpoints.RUNTIME_ADDRESS, wpAddrString);
+						wpAttr.put(CWatchpoint.RANGE, exprType.getByteSize());
+						targetBPAttrs.add(wpAttr);
+						drm.setData(targetBPAttrs);
+					} else {
 						drm.setStatus(
-								new Status(IStatus.ERROR, EDCDebugger.PLUGIN_ID,
+								new Status(IStatus.WARNING, EDCDebugger.PLUGIN_ID,
 										   MessageFormat.format(
-												   EDCServicesMessages.BPAttrTranslator_WatchptCoreExceptionGettingAddr,
-												   wpExpr, e.getLocalizedMessage())));
+												   EDCServicesMessages
+												   .BPAttrTranslator_WatchptNotInModule,
+												   wpExpr, wpAddrString, module.getName())));
 					}
 				}
 				drm.done();
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Breakpoints.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Breakpoints.java
index acf8034..a41918a 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Breakpoints.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Breakpoints.java
@@ -774,6 +774,7 @@
 
 				if (usesTCFBreakpointService()) {
 					final Map<String, Object> tcfProperties = new HashMap<String, Object>();
+
 					tcfProperties.put(TCF_BP_ACCESSMODE, TCF_BP_ACCESSMODE_EXECUTE);
 					tcfProperties.put(TCF_BP_ID, Long.toString(id));
 					tcfProperties.put(TCF_BP_ENABLED, true);
@@ -781,13 +782,15 @@
 					tcfProperties.put(TCF_BP_LOCATION, address.toString());
 					tcfProperties.put(TCF_BP_CONTEXTIDS, getTcfContextIDs(exeDMC));
 
+					ITargetEnvironment te = getTargetEnvironmentService();
+					te.updateBreakpointProperties(exeDMC, address, tcfProperties);
+
 					transferOptionalTcfProperties(allProps, tcfProperties);
 
 					// save the separated TCF properties as a property
 					// set amongst the regular properties; makes them
 					// easy to pass as a set when calling the agent's add()
 					allProps.put(TCF_PROPERTIES, tcfProperties);
-					getTargetEnvironmentService().updateBreakpointProperties(exeDMC, address, allProps);
 
 					drm.setData(new BreakpointDMData(id, bp_dmc, bp_addrs, allProps));
 					drm.done();
@@ -857,10 +860,12 @@
 
 					tcfProperties.put(TCF_BP_CONTEXTIDS, getTcfContextIDs(dmc));
 
+					ITargetEnvironment te = getTargetEnvironmentService();
+					te.updateBreakpointProperties(dmc, address, tcfProperties);
+
 					transferOptionalTcfProperties(allProps, tcfProperties);
 
 					allProps.put(TCF_PROPERTIES, tcfProperties);
-					getTargetEnvironmentService().updateBreakpointProperties(dmc, address, allProps);
 
 					drm.setData(new BreakpointDMData(id, bp_dmc, bp_addrs, allProps));
 				} else { // generic software watchpoint?  i don't think so, tim!
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.java
index 14aa020..52d1e35 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.java
@@ -33,8 +33,6 @@
 
 	public static String BPAttrTranslator_BkptAddressNotInModule;
 
-	public static String BPAttrTranslator_WatchptCoreExceptionGettingAddr;
-
 	public static String BPAttrTranslator_WatchptLocationInvalid;
 
 	public static String BPAttrTranslator_WatchptNoContext;
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.properties b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.properties
index dab568e..29f43cd 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.properties
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/EDCServicesMessages.properties
@@ -18,7 +18,6 @@
 Disassembly_NoDisassemblerYet=No disassembler is available yet.
 
 BPAttrTranslator_BkptAddressNotInModule=Address breakpoint at {0} does not fall in the module [{1}].
-BPAttrTranslator_WatchptCoreExceptionGettingAddr=CoreException thrown acquiring address for expression "{0}": {1}
 BPAttrTranslator_WatchptLocationInvalid=Cannot get address for expression "{0}" in module [{1}].
 BPAttrTranslator_WatchptNoContext=Cannot evaluate expression "{0}"; context unavailable.
 BPAttrTranslator_WatchptNoExprService=Cannot evaluate expression "{0}"; EDC Expression service unavailable.
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Expressions.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Expressions.java
index 0ac5c73..2e9319a 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Expressions.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/services/dsf/Expressions.java
@@ -96,34 +96,38 @@
 		private String valueString;
 
 		public BaseEDCExpressionDMC(IDMContext parent, String expression, String name) {
-			super(Expressions.this, new IDMContext[] { parent }, name, ((IEDCDMContext)parent).getID() + "." + name); //$NON-NLS-1$
+			// use the full expression in the id as their hashcode is based on
+			// id, so they must be unique
+			super(Expressions.this, new IDMContext[] { parent }, name,
+				  ((IEDCDMContext)parent).getID() + '.' + expression);
 			this.expression = expression;
 			frame = DMContexts.getAncestorOfType(parent, StackFrameDMC.class);
-			TypeEngine typeEngine;
-			if (frame != null) {
-				typeEngine = frame.getTypeEngine();
-				engine = new ASTEvaluationEngine(getEDCServicesTracker(), frame, typeEngine);
-			} else if (parent instanceof ModuleDMC) {
+			engine = initEngine(parent);
+		}
+
+		private ASTEvaluationEngine initEngine(IDMContext parent) {
+			if (frame != null)
+				return new ASTEvaluationEngine(getEDCServicesTracker(), frame,
+												frame.getTypeEngine());
+
+			if (parent instanceof ModuleDMC) {
 				IEDCSymbolReader edcSymbolReader = ((ModuleDMC)parent).getSymbolReader();
 				if (edcSymbolReader instanceof EDCSymbolReader) {
 					IDebugInfoProvider debugInfoProvider
 					  = ((EDCSymbolReader)edcSymbolReader).getDebugInfoProvider();
-					typeEngine = new TypeEngine(getTargetEnvironmentService(), debugInfoProvider);
-					engine = new ASTEvaluationEngine(getEDCServicesTracker(), parent, typeEngine);
-				} else {
-					typeEngine = null;
-					engine = null;
+					TypeEngine typeEngine
+					  = new TypeEngine(getTargetEnvironmentService(), debugInfoProvider);
+					return new ASTEvaluationEngine(getEDCServicesTracker(), parent, typeEngine);
 				}
-			} else {
-				typeEngine = null;
-				engine = null;
 			}
+
+			return null;
 		}
-		
+
 		public BaseEDCExpressionDMC(IDMContext parent, String expression) {
 			this(parent, expression, expression);
 		}
-		
+
 		/* (non-Javadoc)
 		 * @see org.eclipse.cdt.debug.edc.services.DMContext#toString()
 		 */
@@ -131,7 +135,7 @@
 		public String toString() {
 			return getExpression();
 		}
-		
+
 		/* (non-Javadoc)
 		 * @see org.eclipse.cdt.debug.edc.internal.services.dsf.IEDCExpression#getFrame()
 		 */
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/snapshot/Album.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/snapshot/Album.java
index 30fa634..41bac9e 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/snapshot/Album.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/snapshot/Album.java
@@ -67,7 +67,6 @@
 import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.sourcelookup.ISourceContainer;
 import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
@@ -980,7 +979,7 @@
 	}
 
 	public static void setVariableCaptureDepth(int newSetting) {
-		IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+		IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 		scope.putInt(PREF_VARIABLE_CAPTURE_DEPTH, newSetting);
 		try {
 			scope.flush();
@@ -995,7 +994,7 @@
 	}
 
 	public static void setPlaySnapshotInterval(int delayInMilliseconds) {
-		IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+		IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 		scope.putInt(PLAY_SNAPSHOT_DELAY_TIME, delayInMilliseconds);
 		try {
 			scope.flush();
@@ -1010,7 +1009,7 @@
 	}
 
 	public static void setSnapshotCreationControl(String newSetting) {
-		IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+		IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 		scope.put(PREF_CREATION_CONTROL, newSetting);
 		try {
 			scope.flush();
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/Variable.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/Variable.java
index 1c631f0..a2faabd 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/Variable.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/Variable.java
@@ -113,7 +113,21 @@
 		if (scope != null) {
 			builder.append(", "); //$NON-NLS-1$
 			builder.append("scope="); //$NON-NLS-1$
-			builder.append(scope.getName());
+			String sname = scope.getName();
+			if (sname.length() == 0) {
+				for (IScope parent = scope.getParent()
+						; parent != null
+						; parent = parent.getParent())
+					if ((sname = parent.getName()).length() != 0)
+						break;
+				if (sname.length() != 0) {
+					sname += "()"; //$NON-NLS-1$
+					if (scope instanceof LexicalBlockScope)
+						sname += "{.lexBlk.}"; //$NON-NLS-1$
+				} else
+					sname = "{." + scope.getClass().getSimpleName() + ".}";
+			}
+			builder.append(sname);
 		}
 		builder.append("]"); //$NON-NLS-1$
 		return builder.toString();
diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/dwarf/DwarfDebugInfoProvider.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/dwarf/DwarfDebugInfoProvider.java
index 0ee68a0..ffbbbc6 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/dwarf/DwarfDebugInfoProvider.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/internal/symbols/dwarf/DwarfDebugInfoProvider.java
@@ -613,26 +613,32 @@
 	}

 	

 	// list of compilation units per source file 

-	protected HashMap<IPath, List<ICompileUnitScope>> compileUnitsPerFile = new HashMap<IPath, List<ICompileUnitScope>>();

+	protected HashMap<IPath, List<ICompileUnitScope>> compileUnitsPerFile

+	  = new HashMap<IPath, List<ICompileUnitScope>>();

 	

 	// list of compile units in .debug_info order

-	protected ArrayList<DwarfCompileUnit> compileUnits = new ArrayList<DwarfCompileUnit>();

+	protected ArrayList<DwarfCompileUnit> compileUnits

+	  = new ArrayList<DwarfCompileUnit>();

 

 	// list of compile units with code (non-zero high address), sorted by low address

-	protected ArrayList<DwarfCompileUnit> sortedCompileUnitsWithCode = new ArrayList<DwarfCompileUnit>();

+	protected ArrayList<DwarfCompileUnit> sortedCompileUnitsWithCode

+	  = new ArrayList<DwarfCompileUnit>();

 

 	// function and type declarations can be referenced by offsets relative to

 	// the compile unit or to the entire .debug_info section. therefore we keep

 	// maps by .debug_info offset, and for compile unit relative offsets, we

 	// just add the compile unit offset into the .debug_info section.

-	protected Map<Long, AttributeList> functionsByOffset = new HashMap<Long, AttributeList>();

-	protected Map<Long, IType> typesByOffset = Collections.synchronizedMap(new HashMap<Long, IType>());

+	protected Map<Long, AttributeList> functionsByOffset

+	  = new HashMap<Long, AttributeList>();

+	protected Map<Long, IType> typesByOffset

+	  = Collections.synchronizedMap(new HashMap<Long, IType>());

 	// These references may eventually become pointless so weak reference them

 	protected Map<Long, IForwardTypeReference> referenceTypesByOffset

 	  = Collections.synchronizedMap(new WeakHashMap<Long, IForwardTypeReference>());

 

 	// for casting to a type, keep certain types by name

-	protected Map<String, List<IType>> typesByName = new HashMap<String, List<IType>>();

+	protected Map<String, List<IType>> typesByName

+	  = new HashMap<String, List<IType>>();

 	// for casting to a type, track whether the cast name includes an aggregate designator

 	enum TypeAggregate { Class, Struct, Union, None };

 

@@ -640,24 +646,40 @@
 	protected Map<Long, Scope> scopesByOffset = new HashMap<Long, Scope>();

 	

 	// entry points for CUs in the .debug_info section, used to dynamically parse CUs as needed 

-	protected TreeMap<Long, CompilationUnitHeader> debugOffsetsToCompileUnits = new TreeMap<Long, CompilationUnitHeader>();

+	protected TreeMap<Long, CompilationUnitHeader>

+	  debugOffsetsToCompileUnits = new TreeMap<Long, CompilationUnitHeader>();

 	

-	// forward references for tags we have not parsed yet.  (These will go into typesByOffset once handled)

-	//Map<Long, ForwardDwarfDefinition> forwardDwarfDefinitions = new HashMap<Long, ForwardDwarfDefinition>();

+	// forward references for tags we have not parsed yet.

+// (These will go into typesByOffset once handled)

+//	Map<Long, ForwardDwarfDefinition> forwardDwarfDefinitions

+//	  = new HashMap<Long, ForwardDwarfDefinition>();

 	

 	// these are just for faster lookups

-	protected Map<String, List<IFunctionScope>> functionsByName = new HashMap<String, List<IFunctionScope>>();

-	protected Map<String, List<IVariable>> variablesByName = new HashMap<String, List<IVariable>>();

-	protected Map<String, List<PublicNameInfo>> publicFunctions = new HashMap<String, List<PublicNameInfo>>();

-	protected Map<String, List<PublicNameInfo>> publicVariables = new HashMap<String, List<PublicNameInfo>>();

+	protected Map<String, List<IFunctionScope>> functionsByName

+	  = new HashMap<String, List<IFunctionScope>>();

+	protected Map<String, List<PublicNameInfo>> publicFunctions

+	  = new HashMap<String, List<PublicNameInfo>>();

+	protected Map<String, List<PublicNameInfo>> publicVariables

+	  = new HashMap<String, List<PublicNameInfo>>();

+	protected Map<String, List<IVariable>> variablesByName

+	  = new HashMap<String, List<IVariable>>();

+

+	private List<IVariable> getCachedVariablesByName(String name,

+			boolean globalsOnly) {

+		List<IVariable> v = variablesByName.get(name);

+		return (v != null && globalsOnly) ? new ArrayList<IVariable>(v) : v;

+	}

 

 	// abbreviation tables (lists of abbrev entries), mapped by .debug_abbrev offset

-	protected Map<Integer, Map<Long, AbbreviationEntry>> abbreviationMaps = new HashMap<Integer, Map<Long, AbbreviationEntry>>();

+	protected Map<Integer, Map<Long, AbbreviationEntry>> abbreviationMaps

+	  = new HashMap<Integer, Map<Long, AbbreviationEntry>>();

 

 	// mapping of PC range to frame description entries

-	protected TreeMap<IRangeList.Entry, FrameDescriptionEntry> frameDescEntries = new TreeMap<IRangeList.Entry, FrameDescriptionEntry>();

+	protected TreeMap<IRangeList.Entry, FrameDescriptionEntry> frameDescEntries

+	  = new TreeMap<IRangeList.Entry, FrameDescriptionEntry>();

 	// mapping of CIE offsets to parsed common info entries

-	protected Map<Long, CommonInformationEntry> commonInfoEntries = new HashMap<Long, CommonInformationEntry>();

+	protected Map<Long, CommonInformationEntry> commonInfoEntries

+	  = new HashMap<Long, CommonInformationEntry>();

 	

 	

 	protected Set<String> referencedFiles = new HashSet<String>();

@@ -938,18 +960,20 @@
 					}

 				} else {

 					// not a public name, so parse all compilation units looking for variables

-					if (!globalsOnly)

+					if (globalsOnly)

+						ensureParsedForGlobalVariables();

+					else

 						ensureParsedForVariables();

 				}

 			}

-	

-			result = variablesByName.get(name);

+

+			result = getCachedVariablesByName(name, globalsOnly);

 	

 			// check against unqualified name because RVCT 2.x did not include namespace

 			// info for globals that are inside namespaces

 			if (result == null && baseNameStart != -1)

-				result = variablesByName.get(baseName);

-				

+				result = getCachedVariablesByName(baseName, globalsOnly);

+

 			if (result == null)

 				return new ArrayList<IVariable>(0);

 		}

diff --git a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/services/Stack.java b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/services/Stack.java
index e5e9d8c..b1b0f76 100644
--- a/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/services/Stack.java
+++ b/org.eclipse.cdt.debug.edc/src/org/eclipse/cdt/debug/edc/services/Stack.java
@@ -72,7 +72,6 @@
 import org.eclipse.core.runtime.Path;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.InstanceScope;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.w3c.dom.NodeList;
@@ -794,13 +793,13 @@
 			// may need to refresh the locals list because "Show All Variables"
 			// toggle has changed
 		    if (showAllVariablesEnabled == null) {
-				IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+				IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 		    	showAllVariablesEnabled = scope.getBoolean(IEDCSymbols.SHOW_ALL_VARIABLES_ENABLED, false);
 		    }
 
 			boolean enabled = showAllVariablesEnabled.booleanValue();
 			if (locals != null) {
-				IEclipsePreferences scope = InstanceScope.INSTANCE.getNode(EDCDebugger.PLUGIN_ID);
+				IEclipsePreferences scope = EDCDebugger.getPrefs(EDCDebugger.PLUGIN_ID);
 				enabled = scope.getBoolean(IEDCSymbols.SHOW_ALL_VARIABLES_ENABLED, showAllVariablesEnabled);
 			}