Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/dsf
diff options
context:
space:
mode:
authorJonah Graham2017-07-28 11:00:49 +0000
committerJonah Graham2017-07-28 11:00:49 +0000
commit07a9aa05432dc0436d7b89d75effcdac8d31094c (patch)
tree0f18e5fd92275ba0e51dc9d18e4d2a933d235f82 /dsf
parent7f3b2120fe80c5b81a932d3f864e564a43a04e24 (diff)
downloadorg.eclipse.cdt-07a9aa05432dc0436d7b89d75effcdac8d31094c.tar.gz
org.eclipse.cdt-07a9aa05432dc0436d7b89d75effcdac8d31094c.tar.xz
org.eclipse.cdt-07a9aa05432dc0436d7b89d75effcdac8d31094c.zip
Bug 520245: Avoid writing launch files with no changes
On shutdown of a debug session the launch files are written, often (normally) with no changes. This commit prevents unneeded deltas on the launch files and prevents a lot of the callbacks of launch configurations changing. This also ameliorates the case in Bug 500988. Change-Id: Iddbd9c5c5695dcd2d255cbc761a48316fa5acbb1
Diffstat (limited to 'dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/model/DsfMemoryBlockRetrieval.java23
1 files changed, 17 insertions, 6 deletions
diff --git a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/model/DsfMemoryBlockRetrieval.java b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/model/DsfMemoryBlockRetrieval.java
index c324522748c..fde1d55d18e 100644
--- a/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/model/DsfMemoryBlockRetrieval.java
+++ b/dsf/org.eclipse.cdt.dsf/src/org/eclipse/cdt/dsf/debug/model/DsfMemoryBlockRetrieval.java
@@ -17,6 +17,7 @@ package org.eclipse.cdt.dsf.debug.model;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+import java.util.Objects;
import java.util.concurrent.ExecutionException;
import org.eclipse.cdt.dsf.concurrent.DataRequestMonitor;
@@ -77,6 +78,7 @@ import org.w3c.dom.NodeList;
*/
public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBlockRetrievalExtension
{
+ private static final String DEFAULT_ATTR_DEBUGGER_MEMORY_BLOCKS_VALUE = ""; //$NON-NLS-1$
private final String fModelId;
private final DsfSession fSession;
private final DsfExecutor fExecutor;
@@ -213,7 +215,8 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
*/
public void initialize(final IMemoryDMContext memoryCtx) {
try {
- final String memento = fLaunchConfig.getAttribute(ATTR_DEBUGGER_MEMORY_BLOCKS, ""); //$NON-NLS-1$
+ final String memento = fLaunchConfig.getAttribute(ATTR_DEBUGGER_MEMORY_BLOCKS,
+ DEFAULT_ATTR_DEBUGGER_MEMORY_BLOCKS_VALUE);
if (memento != null && memento.trim().length() != 0) {
// Submit the runnable to install the monitors on dispatch thread.
getExecutor().submit(new Runnable() {
@@ -281,11 +284,19 @@ public class DsfMemoryBlockRetrieval extends PlatformObject implements IMemoryBl
public void saveMemoryBlocks() {
try {
ILaunchConfigurationWorkingCopy wc = fLaunchConfig.getWorkingCopy();
- wc.setAttribute(ATTR_DEBUGGER_MEMORY_BLOCKS, getMemento());
- wc.doSave();
- }
- catch( CoreException e ) {
- DsfPlugin.getDefault().getLog().log(e.getStatus());
+ String newValue = getMemento();
+ String oldValue = DEFAULT_ATTR_DEBUGGER_MEMORY_BLOCKS_VALUE;
+ try {
+ oldValue = wc.getAttribute(ATTR_DEBUGGER_MEMORY_BLOCKS, DEFAULT_ATTR_DEBUGGER_MEMORY_BLOCKS_VALUE);
+ } catch (CoreException e) {
+ // ignored, treat as default
+ }
+ if (!Objects.equals(oldValue, newValue)) {
+ wc.setAttribute(ATTR_DEBUGGER_MEMORY_BLOCKS, newValue);
+ wc.doSave();
+ }
+ } catch (CoreException e) {
+ DsfPlugin.getDefault().getLog().log(e.getStatus());
}
}

Back to the top