Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSarika Sinha2019-01-11 04:10:34 -0500
committerSarika Sinha2019-01-11 04:10:34 -0500
commit81520329ffc50539b2668cfbdfa4739974ddd56e (patch)
tree52b1848a435bcbd5f3daa8136deb7fc7ac59c1e6
parent343e367fc843c77c4cbc5ea46093506eb9602a47 (diff)
downloadeclipse.platform.debug-81520329ffc50539b2668cfbdfa4739974ddd56e.tar.gz
eclipse.platform.debug-81520329ffc50539b2668cfbdfa4739974ddd56e.tar.xz
eclipse.platform.debug-81520329ffc50539b2668cfbdfa4739974ddd56e.zip
Bug 538213 - The files in org.eclipse.debug.examples.memory should be
converted to Unix line delimiter Change-Id: I15c097e44d4081635a03ab3b61bda68733c64981
-rw-r--r--org.eclipse.debug.examples.memory/.project68
-rw-r--r--org.eclipse.debug.examples.memory/.settings/org.eclipse.core.runtime.prefs4
-rw-r--r--org.eclipse.debug.examples.memory/.settings/org.eclipse.pde.prefs72
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/MemoryViewSamplePlugin.java274
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegister.java62
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegisterGroup.java140
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleStackFrame.java394
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleThread.java568
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleValue.java138
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleVariable.java178
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java734
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleMemoryUnit.java72
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchConfigurationDelegateEx.java84
-rw-r--r--org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchTabGroup.java72
14 files changed, 1430 insertions, 1430 deletions
diff --git a/org.eclipse.debug.examples.memory/.project b/org.eclipse.debug.examples.memory/.project
index d228d5ac6..f33707338 100644
--- a/org.eclipse.debug.examples.memory/.project
+++ b/org.eclipse.debug.examples.memory/.project
@@ -1,34 +1,34 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.debug.examples.memory</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.debug.examples.memory</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.api.tools.apiAnalysisBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.api.tools.apiAnalysisNature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.debug.examples.memory/.settings/org.eclipse.core.runtime.prefs b/org.eclipse.debug.examples.memory/.settings/org.eclipse.core.runtime.prefs
index c522e1f4a..5a0ad22d2 100644
--- a/org.eclipse.debug.examples.memory/.settings/org.eclipse.core.runtime.prefs
+++ b/org.eclipse.debug.examples.memory/.settings/org.eclipse.core.runtime.prefs
@@ -1,2 +1,2 @@
-eclipse.preferences.version=1
-line.separator=\n
+eclipse.preferences.version=1
+line.separator=\n
diff --git a/org.eclipse.debug.examples.memory/.settings/org.eclipse.pde.prefs b/org.eclipse.debug.examples.memory/.settings/org.eclipse.pde.prefs
index 56e42fa48..94791b4ea 100644
--- a/org.eclipse.debug.examples.memory/.settings/org.eclipse.pde.prefs
+++ b/org.eclipse.debug.examples.memory/.settings/org.eclipse.pde.prefs
@@ -1,36 +1,36 @@
-compilers.f.unresolved-features=1
-compilers.f.unresolved-plugins=1
-compilers.incompatible-environment=1
-compilers.p.build=1
-compilers.p.build.bin.includes=1
-compilers.p.build.encodings=2
-compilers.p.build.java.compiler=2
-compilers.p.build.java.compliance=1
-compilers.p.build.missing.output=1
-compilers.p.build.output.library=1
-compilers.p.build.source.library=1
-compilers.p.build.src.includes=1
-compilers.p.deprecated=2
-compilers.p.discouraged-class=1
-compilers.p.illegal-att-value=0
-compilers.p.internal=1
-compilers.p.matching-pom-version=0
-compilers.p.missing-packages=0
-compilers.p.missing-version-export-package=2
-compilers.p.missing-version-import-package=2
-compilers.p.missing-version-require-bundle=2
-compilers.p.no-required-att=0
-compilers.p.not-externalized-att=0
-compilers.p.unknown-attribute=0
-compilers.p.unknown-class=1
-compilers.p.unknown-element=2
-compilers.p.unknown-identifier=1
-compilers.p.unknown-resource=0
-compilers.p.unresolved-ex-points=0
-compilers.p.unresolved-import=0
-compilers.p.unused-element-or-attribute=1
-compilers.s.create-docs=false
-compilers.s.doc-folder=doc
-compilers.s.open-tags=1
-compilers.use-project=true
-eclipse.preferences.version=1
+compilers.f.unresolved-features=1
+compilers.f.unresolved-plugins=1
+compilers.incompatible-environment=1
+compilers.p.build=1
+compilers.p.build.bin.includes=1
+compilers.p.build.encodings=2
+compilers.p.build.java.compiler=2
+compilers.p.build.java.compliance=1
+compilers.p.build.missing.output=1
+compilers.p.build.output.library=1
+compilers.p.build.source.library=1
+compilers.p.build.src.includes=1
+compilers.p.deprecated=2
+compilers.p.discouraged-class=1
+compilers.p.illegal-att-value=0
+compilers.p.internal=1
+compilers.p.matching-pom-version=0
+compilers.p.missing-packages=0
+compilers.p.missing-version-export-package=2
+compilers.p.missing-version-import-package=2
+compilers.p.missing-version-require-bundle=2
+compilers.p.no-required-att=0
+compilers.p.not-externalized-att=0
+compilers.p.unknown-attribute=0
+compilers.p.unknown-class=1
+compilers.p.unknown-element=2
+compilers.p.unknown-identifier=1
+compilers.p.unknown-resource=0
+compilers.p.unresolved-ex-points=0
+compilers.p.unresolved-import=0
+compilers.p.unused-element-or-attribute=1
+compilers.s.create-docs=false
+compilers.s.doc-folder=doc
+compilers.s.open-tags=1
+compilers.use-project=true
+eclipse.preferences.version=1
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/MemoryViewSamplePlugin.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/MemoryViewSamplePlugin.java
index 45baca15d..9cddf7bdf 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/MemoryViewSamplePlugin.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/MemoryViewSamplePlugin.java
@@ -1,140 +1,140 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory;
-
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.runtime.FileLocator;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class for sample adapter
- */
-public class MemoryViewSamplePlugin extends AbstractUIPlugin {
-
- public static final String PLUGIN_ID = "org.eclipse.debug.examples.memory"; //$NON-NLS-1$
-
- // The shared instance.
- private static MemoryViewSamplePlugin plugin;
-
- // Resource bundle.
- private ResourceBundle resourceBundle;
-
- private final static String ICONS_PATH = "icons/full/";//$NON-NLS-1$
- private final static String PATH_OBJECT = ICONS_PATH + "obj16/"; //Model object icons //$NON-NLS-1$
-
- public final static String IMG_OBJ_HEX_TREE = "IMB_OBJ_HEX_TREE"; //$NON-NLS-1$
- public final static String IMG_OBJ_MEMORY_SEGMENT = "IMG_OBJ_MEMORY_SEGMENT"; //$NON-NLS-1$
- public final static String IMG_OBJ_MEMORY_UNIT = "IMG_OBJ_MEMORY_UNIT"; //$NON-NLS-1$
-
- /**
- * The constructor.
- */
- public MemoryViewSamplePlugin() {
- super();
- plugin = this;
- try {
- resourceBundle = ResourceBundle.getBundle(PLUGIN_ID);
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
- * This method is called upon plug-in activation
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- }
-
- /**
- * Returns the shared instance.
- */
- public static MemoryViewSamplePlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle, or 'key' if not
- * found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = MemoryViewSamplePlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse
- * .jface.resource.ImageRegistry)
- */
- @Override
- protected void initializeImageRegistry(ImageRegistry reg) {
- declareImage(IMG_OBJ_HEX_TREE, PATH_OBJECT + "hex_tree.gif"); //$NON-NLS-1$
- declareImage(IMG_OBJ_MEMORY_SEGMENT, PATH_OBJECT + "memory_segment.gif"); //$NON-NLS-1$
- declareImage(IMG_OBJ_MEMORY_UNIT, PATH_OBJECT + "memory_unit.gif"); //$NON-NLS-1$
- }
-
- /**
- * Declares a workbench image given the path of the image file (relative to
- * the workbench plug-in). This is a helper method that creates the image
- * descriptor and passes it to the main <code>declareImage</code> method.
- *
- * @param symbolicName the symbolic name of the image
- * @param path the path of the image file relative to the base of the
- * workbench plug-ins install directory <code>false</code> if
- * this is not a shared image
- */
- private void declareImage(String key, String path) {
- ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
- Bundle bundle = Platform.getBundle(PLUGIN_ID);
- URL url = null;
- if (bundle != null) {
- url = FileLocator.find(bundle, new Path(path), null);
- if (url != null) {
- desc = ImageDescriptor.createFromURL(url);
- }
- }
- getImageRegistry().put(key, desc);
- }
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory;
+
+import java.net.URL;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class for sample adapter
+ */
+public class MemoryViewSamplePlugin extends AbstractUIPlugin {
+
+ public static final String PLUGIN_ID = "org.eclipse.debug.examples.memory"; //$NON-NLS-1$
+
+ // The shared instance.
+ private static MemoryViewSamplePlugin plugin;
+
+ // Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ private final static String ICONS_PATH = "icons/full/";//$NON-NLS-1$
+ private final static String PATH_OBJECT = ICONS_PATH + "obj16/"; //Model object icons //$NON-NLS-1$
+
+ public final static String IMG_OBJ_HEX_TREE = "IMB_OBJ_HEX_TREE"; //$NON-NLS-1$
+ public final static String IMG_OBJ_MEMORY_SEGMENT = "IMG_OBJ_MEMORY_SEGMENT"; //$NON-NLS-1$
+ public final static String IMG_OBJ_MEMORY_UNIT = "IMG_OBJ_MEMORY_UNIT"; //$NON-NLS-1$
+
+ /**
+ * The constructor.
+ */
+ public MemoryViewSamplePlugin() {
+ super();
+ plugin = this;
+ try {
+ resourceBundle = ResourceBundle.getBundle(PLUGIN_ID);
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static MemoryViewSamplePlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle, or 'key' if not
+ * found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = MemoryViewSamplePlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse
+ * .jface.resource.ImageRegistry)
+ */
+ @Override
+ protected void initializeImageRegistry(ImageRegistry reg) {
+ declareImage(IMG_OBJ_HEX_TREE, PATH_OBJECT + "hex_tree.gif"); //$NON-NLS-1$
+ declareImage(IMG_OBJ_MEMORY_SEGMENT, PATH_OBJECT + "memory_segment.gif"); //$NON-NLS-1$
+ declareImage(IMG_OBJ_MEMORY_UNIT, PATH_OBJECT + "memory_unit.gif"); //$NON-NLS-1$
+ }
+
+ /**
+ * Declares a workbench image given the path of the image file (relative to
+ * the workbench plug-in). This is a helper method that creates the image
+ * descriptor and passes it to the main <code>declareImage</code> method.
+ *
+ * @param symbolicName the symbolic name of the image
+ * @param path the path of the image file relative to the base of the
+ * workbench plug-ins install directory <code>false</code> if
+ * this is not a shared image
+ */
+ private void declareImage(String key, String path) {
+ ImageDescriptor desc = ImageDescriptor.getMissingImageDescriptor();
+ Bundle bundle = Platform.getBundle(PLUGIN_ID);
+ URL url = null;
+ if (bundle != null) {
+ url = FileLocator.find(bundle, new Path(path), null);
+ if (url != null) {
+ desc = ImageDescriptor.createFromURL(url);
+ }
+ }
+ getImageRegistry().put(key, desc);
+ }
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegister.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegister.java
index 0b7bdf79e..7a0203404 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegister.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegister.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.core;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.model.IRegister;
-import org.eclipse.debug.core.model.IRegisterGroup;
-
-public class SampleRegister extends SampleVariable implements IRegister {
-
- private SampleRegisterGroup fGroup;
-
- SampleRegister(SampleStackFrame frame, SampleRegisterGroup group, String name) {
- super(frame, name);
- fGroup = group;
- }
-
- @Override
- public IRegisterGroup getRegisterGroup() throws DebugException {
- return fGroup;
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IRegister;
+import org.eclipse.debug.core.model.IRegisterGroup;
+
+public class SampleRegister extends SampleVariable implements IRegister {
+
+ private SampleRegisterGroup fGroup;
+
+ SampleRegister(SampleStackFrame frame, SampleRegisterGroup group, String name) {
+ super(frame, name);
+ fGroup = group;
+ }
+
+ @Override
+ public IRegisterGroup getRegisterGroup() throws DebugException {
+ return fGroup;
+ }
+
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegisterGroup.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegisterGroup.java
index f8d74dda8..9ad764564 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegisterGroup.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleRegisterGroup.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.debug.examples.internal.memory.core;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.DebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IRegister;
-import org.eclipse.debug.core.model.IRegisterGroup;
-
-public class SampleRegisterGroup extends DebugElement implements IRegisterGroup {
-
- SampleRegister fRegister1;
- SampleRegister fRegister2;
- SampleStackFrame fFrame;
-
- public SampleRegisterGroup(SampleStackFrame frame) {
- super(frame.getDebugTarget());
- fFrame = frame;
- }
-
- @Override
- public String getName() throws DebugException {
- return Messages.SampleRegisterGroup_0;
- }
-
- @Override
- public IRegister[] getRegisters() throws DebugException {
- if (fRegister1 == null) {
- fRegister1 = new SampleRegister(fFrame, this, "eax"); //$NON-NLS-1$
- }
-
- if (fRegister2 == null) {
- fRegister2 = new SampleRegister(fFrame, this, "ebx"); //$NON-NLS-1$
- }
-
- return new IRegister[] { fRegister1, fRegister2 };
- }
-
- @Override
- public boolean hasRegisters() throws DebugException {
- return true;
- }
-
- @Override
- public String getModelIdentifier() {
- return fFrame.getModelIdentifier();
- }
-
- @Override
- public IDebugTarget getDebugTarget() {
- return fFrame.getDebugTarget();
- }
-
- @Override
- public ILaunch getLaunch() {
- return fFrame.getLaunch();
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.examples.internal.memory.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.DebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IRegister;
+import org.eclipse.debug.core.model.IRegisterGroup;
+
+public class SampleRegisterGroup extends DebugElement implements IRegisterGroup {
+
+ SampleRegister fRegister1;
+ SampleRegister fRegister2;
+ SampleStackFrame fFrame;
+
+ public SampleRegisterGroup(SampleStackFrame frame) {
+ super(frame.getDebugTarget());
+ fFrame = frame;
+ }
+
+ @Override
+ public String getName() throws DebugException {
+ return Messages.SampleRegisterGroup_0;
+ }
+
+ @Override
+ public IRegister[] getRegisters() throws DebugException {
+ if (fRegister1 == null) {
+ fRegister1 = new SampleRegister(fFrame, this, "eax"); //$NON-NLS-1$
+ }
+
+ if (fRegister2 == null) {
+ fRegister2 = new SampleRegister(fFrame, this, "ebx"); //$NON-NLS-1$
+ }
+
+ return new IRegister[] { fRegister1, fRegister2 };
+ }
+
+ @Override
+ public boolean hasRegisters() throws DebugException {
+ return true;
+ }
+
+ @Override
+ public String getModelIdentifier() {
+ return fFrame.getModelIdentifier();
+ }
+
+ @Override
+ public IDebugTarget getDebugTarget() {
+ return fFrame.getDebugTarget();
+ }
+
+ @Override
+ public ILaunch getLaunch() {
+ return fFrame.getLaunch();
+ }
+
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleStackFrame.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleStackFrame.java
index bfce6db97..df72a8a81 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleStackFrame.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleStackFrame.java
@@ -1,200 +1,200 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2015 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.core;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.DebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IRegisterGroup;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-import org.eclipse.debug.core.model.IVariable;
-import org.eclipse.osgi.util.NLS;
-
-/**
- *
- *
- */
-public class SampleStackFrame extends DebugElement implements IStackFrame {
-
- private SampleThread fThread;
- private SampleRegisterGroup fRegisterGroup;
- private long timeStamp;
- private String fName;
-
- /**
- * Constructs a SampleStackFrame
- *
- * @param thread
- * @param name
- */
- public SampleStackFrame(SampleThread thread, String name) {
- super(thread.getDebugTarget());
- fThread = thread;
- fName = name;
- timeStamp = System.currentTimeMillis();
- }
-
- @Override
- public IThread getThread() {
- return fThread;
- }
-
- @Override
- public IVariable[] getVariables() throws DebugException {
-
- return new IVariable[] { new SampleVariable(this, "sampleVariable") }; //$NON-NLS-1$
- }
-
- @Override
- public boolean hasVariables() throws DebugException {
- return true;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getAdapter(Class<T> adapter) {
- if (adapter == ILaunch.class) {
- return (T) getLaunch();
- }
- return super.getAdapter(adapter);
- }
-
- @Override
- public int getLineNumber() throws DebugException {
- return 0;
- }
-
- @Override
- public int getCharStart() throws DebugException {
- return 0;
- }
-
- @Override
- public int getCharEnd() throws DebugException {
- return 0;
- }
-
- @Override
- public String getName() throws DebugException {
- return NLS.bind(Messages.SampleStackFrame_0, new Object[] {
- fName, timeStamp });
- }
-
- @Override
- public IRegisterGroup[] getRegisterGroups() throws DebugException {
- if (fRegisterGroup == null) {
- fRegisterGroup = new SampleRegisterGroup(this);
- }
- return new IRegisterGroup[] { fRegisterGroup };
- }
-
- @Override
- public boolean hasRegisterGroups() throws DebugException {
- return true;
- }
-
- @Override
- public String getModelIdentifier() {
- return fThread.getModelIdentifier();
- }
-
- @Override
- public IDebugTarget getDebugTarget() {
- return fThread.getDebugTarget();
- }
-
- @Override
- public ILaunch getLaunch() {
- return fThread.getDebugTarget().getLaunch();
- }
-
- @Override
- public boolean canStepInto() {
- return false;
- }
-
- @Override
- public boolean canStepOver() {
- return fThread.canStepOver();
- }
-
- @Override
- public boolean canStepReturn() {
- return false;
- }
-
- @Override
- public boolean isStepping() {
- return false;
- }
-
- @Override
- public void stepInto() throws DebugException {
-
- }
-
- @Override
- public void stepOver() throws DebugException {
- fThread.stepOver();
- }
-
- @Override
- public void stepReturn() throws DebugException {
-
- }
-
- @Override
- public boolean canResume() {
- return fThread.canResume();
- }
-
- @Override
- public boolean canSuspend() {
- return fThread.canSuspend();
- }
-
- @Override
- public boolean isSuspended() {
- return fThread.isSuspended();
- }
-
- @Override
- public void resume() throws DebugException {
- fThread.resume();
-
- }
-
- @Override
- public void suspend() throws DebugException {
- fThread.suspend();
- }
-
- @Override
- public boolean canTerminate() {
- return fThread.canTerminate();
- }
-
- @Override
- public boolean isTerminated() {
- return fThread.isTerminated();
- }
-
- @Override
- public void terminate() throws DebugException {
- fThread.terminate();
-
- }
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.DebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IRegisterGroup;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ *
+ *
+ */
+public class SampleStackFrame extends DebugElement implements IStackFrame {
+
+ private SampleThread fThread;
+ private SampleRegisterGroup fRegisterGroup;
+ private long timeStamp;
+ private String fName;
+
+ /**
+ * Constructs a SampleStackFrame
+ *
+ * @param thread
+ * @param name
+ */
+ public SampleStackFrame(SampleThread thread, String name) {
+ super(thread.getDebugTarget());
+ fThread = thread;
+ fName = name;
+ timeStamp = System.currentTimeMillis();
+ }
+
+ @Override
+ public IThread getThread() {
+ return fThread;
+ }
+
+ @Override
+ public IVariable[] getVariables() throws DebugException {
+
+ return new IVariable[] { new SampleVariable(this, "sampleVariable") }; //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean hasVariables() throws DebugException {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == ILaunch.class) {
+ return (T) getLaunch();
+ }
+ return super.getAdapter(adapter);
+ }
+
+ @Override
+ public int getLineNumber() throws DebugException {
+ return 0;
+ }
+
+ @Override
+ public int getCharStart() throws DebugException {
+ return 0;
+ }
+
+ @Override
+ public int getCharEnd() throws DebugException {
+ return 0;
+ }
+
+ @Override
+ public String getName() throws DebugException {
+ return NLS.bind(Messages.SampleStackFrame_0, new Object[] {
+ fName, timeStamp });
+ }
+
+ @Override
+ public IRegisterGroup[] getRegisterGroups() throws DebugException {
+ if (fRegisterGroup == null) {
+ fRegisterGroup = new SampleRegisterGroup(this);
+ }
+ return new IRegisterGroup[] { fRegisterGroup };
+ }
+
+ @Override
+ public boolean hasRegisterGroups() throws DebugException {
+ return true;
+ }
+
+ @Override
+ public String getModelIdentifier() {
+ return fThread.getModelIdentifier();
+ }
+
+ @Override
+ public IDebugTarget getDebugTarget() {
+ return fThread.getDebugTarget();
+ }
+
+ @Override
+ public ILaunch getLaunch() {
+ return fThread.getDebugTarget().getLaunch();
+ }
+
+ @Override
+ public boolean canStepInto() {
+ return false;
+ }
+
+ @Override
+ public boolean canStepOver() {
+ return fThread.canStepOver();
+ }
+
+ @Override
+ public boolean canStepReturn() {
+ return false;
+ }
+
+ @Override
+ public boolean isStepping() {
+ return false;
+ }
+
+ @Override
+ public void stepInto() throws DebugException {
+
+ }
+
+ @Override
+ public void stepOver() throws DebugException {
+ fThread.stepOver();
+ }
+
+ @Override
+ public void stepReturn() throws DebugException {
+
+ }
+
+ @Override
+ public boolean canResume() {
+ return fThread.canResume();
+ }
+
+ @Override
+ public boolean canSuspend() {
+ return fThread.canSuspend();
+ }
+
+ @Override
+ public boolean isSuspended() {
+ return fThread.isSuspended();
+ }
+
+ @Override
+ public void resume() throws DebugException {
+ fThread.resume();
+
+ }
+
+ @Override
+ public void suspend() throws DebugException {
+ fThread.suspend();
+ }
+
+ @Override
+ public boolean canTerminate() {
+ return fThread.canTerminate();
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return fThread.isTerminated();
+ }
+
+ @Override
+ public void terminate() throws DebugException {
+ fThread.terminate();
+
+ }
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleThread.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleThread.java
index 0ab12f5db..c95ded988 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleThread.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleThread.java
@@ -1,287 +1,287 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2015 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013, 2015 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.core;
-
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.DebugElement;
-import org.eclipse.debug.core.model.IBreakpoint;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IStackFrame;
-import org.eclipse.debug.core.model.IThread;
-
-/**
- * Abstract Sample Thread
- *
- */
-public class SampleThread extends DebugElement implements IThread {
-
- private SampleDebugTarget fTarget;
-
- /**
- * Constructs SampleThread
- *
- * @param target
- */
- public SampleThread(SampleDebugTarget target) {
- super(target);
- fTarget = target;
- try {
- getStackFrames();
- } catch (DebugException e) {
- e.printStackTrace();
- }
- fireEvent(new DebugEvent(this, DebugEvent.SUSPEND));
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getStackFrames()
- */
- @Override
- public IStackFrame[] getStackFrames() throws DebugException {
- return ((SampleDebugTarget) getDebugTarget()).getEngine().getStackframes(this);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#hasStackFrames()
- */
- @Override
- public boolean hasStackFrames() throws DebugException {
-
- return true;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getPriority()
- */
- @Override
- public int getPriority() throws DebugException {
-
- return 0;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
- */
- @Override
- public IStackFrame getTopStackFrame() throws DebugException {
- return ((SampleDebugTarget) getDebugTarget()).getEngine().getStackframes(this)[0];
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getName()
- */
- @Override
- public String getName() throws DebugException {
- return Messages.SampleThread_0;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
- */
- @Override
- public IBreakpoint[] getBreakpoints() {
-
- return new IBreakpoint[0];
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
- */
- @Override
- public String getModelIdentifier() {
- return fTarget.getModelIdentifier();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
- */
- @Override
- public IDebugTarget getDebugTarget() {
- return fTarget;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
- */
- @Override
- public ILaunch getLaunch() {
- return fTarget.getLaunch();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
- */
- @Override
- public boolean canResume() {
- return fTarget.canResume();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
- */
- @Override
- public boolean canSuspend() {
- return fTarget.canSuspend();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
- */
- @Override
- public boolean isSuspended() {
- return fTarget.isSuspended();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#resume()
- */
- @Override
- public void resume() throws DebugException {
- fTarget.resume();
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
- */
- @Override
- public void suspend() throws DebugException {
- fTarget.suspend();
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepInto()
- */
- @Override
- public boolean canStepInto() {
-
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepOver()
- */
- @Override
- public boolean canStepOver() {
- if (!fTarget.isTerminated()) {
- return true;
- }
-
- return fTarget.isSuspended();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#canStepReturn()
- */
- @Override
- public boolean canStepReturn() {
-
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#isStepping()
- */
- @Override
- public boolean isStepping() {
-
- return false;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepInto()
- */
- @Override
- public void stepInto() throws DebugException {
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepOver()
- */
- @Override
- public void stepOver() throws DebugException {
- fTarget.resume();
- fTarget.suspend();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.IStep#stepReturn()
- */
- @Override
- public void stepReturn() throws DebugException {
-
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
- */
- @Override
- public boolean canTerminate() {
- return fTarget.canTerminate();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
- */
- @Override
- public boolean isTerminated() {
- return fTarget.isTerminated();
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.debug.core.model.ITerminate#terminate()
- */
- @Override
- public void terminate() throws DebugException {
- fTarget.terminate();
-
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public <T> T getAdapter(Class<T> adapter) {
- if (adapter == ILaunch.class) {
- return (T) getLaunch();
- }
- return super.getAdapter(adapter);
- }
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.core;
+
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.DebugElement;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IThread;
+
+/**
+ * Abstract Sample Thread
+ *
+ */
+public class SampleThread extends DebugElement implements IThread {
+
+ private SampleDebugTarget fTarget;
+
+ /**
+ * Constructs SampleThread
+ *
+ * @param target
+ */
+ public SampleThread(SampleDebugTarget target) {
+ super(target);
+ fTarget = target;
+ try {
+ getStackFrames();
+ } catch (DebugException e) {
+ e.printStackTrace();
+ }
+ fireEvent(new DebugEvent(this, DebugEvent.SUSPEND));
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IThread#getStackFrames()
+ */
+ @Override
+ public IStackFrame[] getStackFrames() throws DebugException {
+ return ((SampleDebugTarget) getDebugTarget()).getEngine().getStackframes(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IThread#hasStackFrames()
+ */
+ @Override
+ public boolean hasStackFrames() throws DebugException {
+
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IThread#getPriority()
+ */
+ @Override
+ public int getPriority() throws DebugException {
+
+ return 0;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IThread#getTopStackFrame()
+ */
+ @Override
+ public IStackFrame getTopStackFrame() throws DebugException {
+ return ((SampleDebugTarget) getDebugTarget()).getEngine().getStackframes(this)[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IThread#getName()
+ */
+ @Override
+ public String getName() throws DebugException {
+ return Messages.SampleThread_0;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IThread#getBreakpoints()
+ */
+ @Override
+ public IBreakpoint[] getBreakpoints() {
+
+ return new IBreakpoint[0];
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IDebugElement#getModelIdentifier()
+ */
+ @Override
+ public String getModelIdentifier() {
+ return fTarget.getModelIdentifier();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IDebugElement#getDebugTarget()
+ */
+ @Override
+ public IDebugTarget getDebugTarget() {
+ return fTarget;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IDebugElement#getLaunch()
+ */
+ @Override
+ public ILaunch getLaunch() {
+ return fTarget.getLaunch();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ISuspendResume#canResume()
+ */
+ @Override
+ public boolean canResume() {
+ return fTarget.canResume();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ISuspendResume#canSuspend()
+ */
+ @Override
+ public boolean canSuspend() {
+ return fTarget.canSuspend();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ISuspendResume#isSuspended()
+ */
+ @Override
+ public boolean isSuspended() {
+ return fTarget.isSuspended();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ISuspendResume#resume()
+ */
+ @Override
+ public void resume() throws DebugException {
+ fTarget.resume();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ISuspendResume#suspend()
+ */
+ @Override
+ public void suspend() throws DebugException {
+ fTarget.suspend();
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IStep#canStepInto()
+ */
+ @Override
+ public boolean canStepInto() {
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IStep#canStepOver()
+ */
+ @Override
+ public boolean canStepOver() {
+ if (!fTarget.isTerminated()) {
+ return true;
+ }
+
+ return fTarget.isSuspended();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IStep#canStepReturn()
+ */
+ @Override
+ public boolean canStepReturn() {
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IStep#isStepping()
+ */
+ @Override
+ public boolean isStepping() {
+
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IStep#stepInto()
+ */
+ @Override
+ public void stepInto() throws DebugException {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IStep#stepOver()
+ */
+ @Override
+ public void stepOver() throws DebugException {
+ fTarget.resume();
+ fTarget.suspend();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.IStep#stepReturn()
+ */
+ @Override
+ public void stepReturn() throws DebugException {
+
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ITerminate#canTerminate()
+ */
+ @Override
+ public boolean canTerminate() {
+ return fTarget.canTerminate();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ITerminate#isTerminated()
+ */
+ @Override
+ public boolean isTerminated() {
+ return fTarget.isTerminated();
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.debug.core.model.ITerminate#terminate()
+ */
+ @Override
+ public void terminate() throws DebugException {
+ fTarget.terminate();
+
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public <T> T getAdapter(Class<T> adapter) {
+ if (adapter == ILaunch.class) {
+ return (T) getLaunch();
+ }
+ return super.getAdapter(adapter);
+ }
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleValue.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleValue.java
index b3174937c..2bd079f45 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleValue.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleValue.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.core;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.DebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-
-public class SampleValue extends DebugElement implements IValue {
-
- private SampleVariable fVariable;
-
- public SampleValue(SampleVariable variable) {
- super(variable.getDebugTarget());
- fVariable = variable;
- }
-
- @Override
- public String getReferenceTypeName() throws DebugException {
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public String getValueString() throws DebugException {
- return String.valueOf(System.currentTimeMillis());
- }
-
- @Override
- public boolean isAllocated() throws DebugException {
- return false;
- }
-
- @Override
- public IVariable[] getVariables() throws DebugException {
- return new IVariable[0];
- }
-
- @Override
- public boolean hasVariables() throws DebugException {
- return false;
- }
-
- @Override
- public String getModelIdentifier() {
- return fVariable.getModelIdentifier();
- }
-
- @Override
- public IDebugTarget getDebugTarget() {
- return fVariable.getDebugTarget();
- }
-
- @Override
- public ILaunch getLaunch() {
- return fVariable.getLaunch();
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.DebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+
+public class SampleValue extends DebugElement implements IValue {
+
+ private SampleVariable fVariable;
+
+ public SampleValue(SampleVariable variable) {
+ super(variable.getDebugTarget());
+ fVariable = variable;
+ }
+
+ @Override
+ public String getReferenceTypeName() throws DebugException {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getValueString() throws DebugException {
+ return String.valueOf(System.currentTimeMillis());
+ }
+
+ @Override
+ public boolean isAllocated() throws DebugException {
+ return false;
+ }
+
+ @Override
+ public IVariable[] getVariables() throws DebugException {
+ return new IVariable[0];
+ }
+
+ @Override
+ public boolean hasVariables() throws DebugException {
+ return false;
+ }
+
+ @Override
+ public String getModelIdentifier() {
+ return fVariable.getModelIdentifier();
+ }
+
+ @Override
+ public IDebugTarget getDebugTarget() {
+ return fVariable.getDebugTarget();
+ }
+
+ @Override
+ public ILaunch getLaunch() {
+ return fVariable.getLaunch();
+ }
+
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleVariable.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleVariable.java
index 933558798..261614b91 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleVariable.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/core/SampleVariable.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.core;
-
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.model.DebugElement;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.IValue;
-import org.eclipse.debug.core.model.IVariable;
-
-public class SampleVariable extends DebugElement implements IVariable {
-
- private final SampleStackFrame fFrame;
- private String fName;
-
- SampleVariable(SampleStackFrame frame, String name) {
- super(frame.getDebugTarget());
- fFrame = frame;
- fName = name;
- }
-
- @Override
- public IValue getValue() throws DebugException {
- return new SampleValue(this);
- }
-
- @Override
- public String getName() throws DebugException {
- return fName;
- }
-
- @Override
- public String getReferenceTypeName() throws DebugException {
- return ""; //$NON-NLS-1$
- }
-
- @Override
- public boolean hasValueChanged() throws DebugException {
- return false;
- }
-
- @Override
- public String getModelIdentifier() {
- return fFrame.getModelIdentifier();
- }
-
- @Override
- public IDebugTarget getDebugTarget() {
- return fFrame.getDebugTarget();
- }
-
- @Override
- public ILaunch getLaunch() {
- return fFrame.getLaunch();
- }
-
- @Override
- public void setValue(IValue value) throws DebugException {
-
- }
-
- @Override
- public boolean supportsValueModification() {
- return false;
- }
-
- @Override
- public boolean verifyValue(IValue value) throws DebugException {
- return false;
- }
-
- @Override
- public void setValue(String expression) throws DebugException {
-
- }
-
- @Override
- public boolean verifyValue(String expression) throws DebugException {
- return false;
- }
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.core;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.DebugElement;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+
+public class SampleVariable extends DebugElement implements IVariable {
+
+ private final SampleStackFrame fFrame;
+ private String fName;
+
+ SampleVariable(SampleStackFrame frame, String name) {
+ super(frame.getDebugTarget());
+ fFrame = frame;
+ fName = name;
+ }
+
+ @Override
+ public IValue getValue() throws DebugException {
+ return new SampleValue(this);
+ }
+
+ @Override
+ public String getName() throws DebugException {
+ return fName;
+ }
+
+ @Override
+ public String getReferenceTypeName() throws DebugException {
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean hasValueChanged() throws DebugException {
+ return false;
+ }
+
+ @Override
+ public String getModelIdentifier() {
+ return fFrame.getModelIdentifier();
+ }
+
+ @Override
+ public IDebugTarget getDebugTarget() {
+ return fFrame.getDebugTarget();
+ }
+
+ @Override
+ public ILaunch getLaunch() {
+ return fFrame.getLaunch();
+ }
+
+ @Override
+ public void setValue(IValue value) throws DebugException {
+
+ }
+
+ @Override
+ public boolean supportsValueModification() {
+ return false;
+ }
+
+ @Override
+ public boolean verifyValue(IValue value) throws DebugException {
+ return false;
+ }
+
+ @Override
+ public void setValue(String expression) throws DebugException {
+
+ }
+
+ @Override
+ public boolean verifyValue(String expression) throws DebugException {
+ return false;
+ }
} \ No newline at end of file
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java
index 3b4fb3290..eca5fbf46 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleEngine.java
@@ -1,370 +1,370 @@
-/*******************************************************************************
- * Copyright (c) 2013, 2018 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013, 2018 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.debug.examples.internal.memory.engine;
-
-import java.math.BigInteger;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Random;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.model.MemoryByte;
-import org.eclipse.debug.examples.internal.memory.core.SampleDebugTarget;
-import org.eclipse.debug.examples.internal.memory.core.SampleMemoryBlock;
-import org.eclipse.debug.examples.internal.memory.core.SampleStackFrame;
-import org.eclipse.debug.examples.internal.memory.core.SampleThread;
-
-/**
- * Sample engine for sample deug adapter This engine randomly generates content
- * for a memory block. To get to this engine, call
- * {@link SampleDebugTarget#getEngine()};
- */
-public class SampleEngine {
-
- Random fRandom = new Random();
- byte[] fMemory;
- Hashtable<BigInteger, SampleMemoryUnit> memoryBlockTable;
- Hashtable<String, BigInteger> expressionAddressTable = new Hashtable<>();
- Hashtable<SampleDebugTarget, Object> threadTable = new Hashtable<>();
- Hashtable<SampleThread, Object> stackframeTable = new Hashtable<>();
-
- Random random = new Random();
-
- /**
- * Allow debug adapters to get memory from an address
- *
- * @param address
- * @param length
- * @return memory byte from an address
- * @throws RuntimeException
- */
- synchronized public MemoryByte[] getBytesFromAddress(BigInteger address, long length) throws RuntimeException {
-
- if (memoryBlockTable == null) {
- // create new memoryBlock table
- memoryBlockTable = new Hashtable<>();
- byte[] bytes = new byte[(int) length * getAddressableSize()];
- BigInteger addressKey = address;
-
- random.nextBytes(bytes);
-
- for (int i = 0; i < bytes.length; i = i + getAddressableSize()) {
- addressKey = addressKey.add(BigInteger.valueOf(1));
-
- MemoryByte[] byteUnit = new MemoryByte[getAddressableSize()];
- for (int j = 0; j < getAddressableSize(); j++) {
- MemoryByte oneByte = new MemoryByte(bytes[i + j]);
- oneByte.setBigEndian(isBigEndian(addressKey));
- oneByte.setWritable(isWritable(addressKey));
- oneByte.setReadable(isReadable(addressKey));
- byteUnit[j] = oneByte;
- }
- SampleMemoryUnit unit = new SampleMemoryUnit(byteUnit);
- memoryBlockTable.put(addressKey, unit);
- }
- }
-
- MemoryByte[] returnBytes = new MemoryByte[(int) length * getAddressableSize()];
- BigInteger addressKey;
-
- for (int i = 0; i < returnBytes.length; i = i + getAddressableSize()) {
- addressKey = address.add(BigInteger.valueOf(i / getAddressableSize()));
- SampleMemoryUnit temp = (memoryBlockTable.get(addressKey));
-
- // if memoryBlock does not already exist in the table, generate a
- // value
- if (temp == null) {
- byte[] x = new byte[getAddressableSize()];
- random.nextBytes(x);
- byte flag = 0;
- flag |= MemoryByte.READABLE;
- flag |= MemoryByte.ENDIANESS_KNOWN;
- flag |= MemoryByte.WRITABLE;
-
- MemoryByte[] byteUnit = new MemoryByte[getAddressableSize()];
- for (int j = 0; j < getAddressableSize(); j++) {
- MemoryByte oneByte = new MemoryByte(x[j], flag);
- byteUnit[j] = oneByte;
- byteUnit[j].setBigEndian(isBigEndian(addressKey));
- byteUnit[j].setWritable(isWritable(addressKey));
- byteUnit[j].setReadable(isReadable(addressKey));
- returnBytes[i + j] = oneByte;
- }
- SampleMemoryUnit unit = new SampleMemoryUnit(byteUnit);
- memoryBlockTable.put(addressKey, unit);
-
- } else {
- MemoryByte[] bytes = temp.getBytes();
-
- for (int j = 0; j < bytes.length; j++) {
- MemoryByte oneByte = new MemoryByte(bytes[j].getValue(), bytes[j].getFlags());
- returnBytes[i + j] = oneByte;
- returnBytes[i + j].setBigEndian(isBigEndian(addressKey));
- returnBytes[i + j].setWritable(isWritable(addressKey));
- }
- }
- }
-
- return returnBytes;
- }
-
- /**
- * Run the debuggee
- */
- public void resume() {
- changeValue();
- }
-
- /**
- * Convenience function to cause changes in a memoryBlock block. Changes
- * could result from running the program, changing a variable, etc.
- */
- synchronized public void changeValue() {
- if (memoryBlockTable == null) {
- return;
- }
-
- Enumeration<BigInteger> enumeration = memoryBlockTable.keys();
- long randomChange = random.nextInt(37);
-
- while (randomChange <= 5) {
- randomChange = random.nextInt(37);
- }
-
- while (enumeration.hasMoreElements()) {
- BigInteger key = enumeration.nextElement();
- if (key.remainder(BigInteger.valueOf(randomChange)).equals(BigInteger.valueOf(0))) {
- byte[] x = new byte[getAddressableSize()];
- random.nextBytes(x);
-
- MemoryByte unitBytes[] = new MemoryByte[getAddressableSize()];
- for (int i = 0; i < x.length; i++) {
- MemoryByte oneByte = new MemoryByte();
- oneByte.setValue(x[i]);
- oneByte.setReadable(true);
- oneByte.setChanged(true);
- oneByte.setHistoryKnown(true);
- oneByte.setBigEndian(isBigEndian(key));
- oneByte.setWritable(isWritable(key));
- oneByte.setReadable(isReadable(key));
- unitBytes[i] = oneByte;
- }
-
- SampleMemoryUnit unit = new SampleMemoryUnit(unitBytes);
-
- memoryBlockTable.put(key, unit);
- } else {
- SampleMemoryUnit unit = memoryBlockTable.get(key);
-
- MemoryByte[] bytes = unit.getBytes();
-
- for (int i = 0; i < bytes.length; i++) {
- bytes[i].setChanged(false);
- bytes[i].setHistoryKnown(true);
- }
-
- unit.setBytes(bytes);
-
- memoryBlockTable.put(key, unit);
- }
- }
- }
-
- /**
- * Simulates evaluation of an expression. Given an expression, return ad
- * address
- *
- * @param expression
- * @param evalContext
- * @return the address the expression is evaluated to
- */
- public BigInteger evaluateExpression(String expression, Object evalContext) {
- BigInteger expAddress = expressionAddressTable.get(expression);
- if (expAddress == null) {
- int address = random.nextInt();
-
- // make sure number is positive
- if (address < 0) {
- address = address * -1;
- }
-
- expAddress = BigInteger.valueOf(address);
- expressionAddressTable.put(expression, expAddress);
- }
- return expAddress;
- }
-
- /**
- * Simulates checking if storage retrieval is supported
- *
- * @return if the engine supports storage retrieval
- */
- public boolean supportsStorageRetrieval() {
- return true;
- }
-
- /**
- * Simulates modifying memory using BigInteger as the address
- *
- * @param address
- * @param bytes
- * @throws RuntimeException
- */
- public void setValue(BigInteger address, byte[] bytes) throws RuntimeException {
- BigInteger convertedAddress = address;
-
- for (int i = 0; i < bytes.length; i = i + getAddressableSize()) {
- SampleMemoryUnit unit = memoryBlockTable.get(convertedAddress);
-
- MemoryByte[] unitBytes = unit.getBytes();
- for (int j = 0; j < unitBytes.length; j++) {
- unitBytes[j].setValue(bytes[i + j]);
- unitBytes[j].setChanged(true);
- unitBytes[j].setHistoryKnown(true);
- }
- convertedAddress = convertedAddress.add(BigInteger.valueOf(1));
- }
- }
-
- /**
- * @return addrssablesize of the debuggee
- */
- public int getAddressableSize() {
- return 1;
- }
-
- /**
- * @param address
- * @return true if the debuggee is big endian, false otherwise
- */
- public boolean isBigEndian(BigInteger address) {
- // simulate mixed endianess in a memory block
- // memory before the boundary address is little endian
- // memory after the boundaress is big endian
- BigInteger boundary = new BigInteger("12345678", 16); //$NON-NLS-1$
- if (address.compareTo(boundary) > 0) {
- return true;
- }
- return false;
- }
-
- /**
- * @param address
- * @return true if the address is writable, false otherwise Read only
- * segment: 0xab123456 to 0xab123556
- */
- public boolean isWritable(BigInteger address) {
- BigInteger boundary = new BigInteger("ab123456", 16); //$NON-NLS-1$
- BigInteger boundaryEnd = new BigInteger("ab123556", 16); //$NON-NLS-1$
- if (address.compareTo(boundary) > 0 && address.compareTo(boundaryEnd) < 0) {
- return false;
- }
-
- boundary = new BigInteger("cd123456", 16); //$NON-NLS-1$
- boundaryEnd = new BigInteger("cd123576", 16); //$NON-NLS-1$
- if (address.compareTo(boundary) > 0 && address.compareTo(boundaryEnd) < 0) {
- return false;
- }
-
- return true;
-
- }
-
- /**
- * @param address
- * @return
- */
- public boolean isReadable(BigInteger address) {
- BigInteger boundary = new BigInteger("cd123456", 16); //$NON-NLS-1$
- BigInteger boundaryEnd = new BigInteger("cd123576", 16); //$NON-NLS-1$
- if (address.compareTo(boundary) > 0 && address.compareTo(boundaryEnd) < 0) {
- return false;
- }
- return true;
- }
-
- /**
- * @param target
- * @return
- */
- public SampleThread[] getThreads(SampleDebugTarget target) {
- Object thread = threadTable.get(target);
- if (thread == null) {
- thread = new SampleThread(target);
- threadTable.put(target, thread);
- }
- return new SampleThread[] { (SampleThread) thread };
- }
-
- /**
- * @param thread
- * @return
- */
- public SampleStackFrame[] getStackframes(SampleThread thread) {
- Object stackframes = stackframeTable.get(thread);
- if (stackframes == null) {
- stackframes = createStackframes(thread);
- stackframeTable.put(thread, stackframes);
- }
- return (SampleStackFrame[]) stackframes;
- }
-
- /**
- *
- */
- private SampleStackFrame[] createStackframes(SampleThread thread) {
- SampleStackFrame[] stackframes = new SampleStackFrame[2];
- stackframes[0] = new SampleStackFrame(thread, "Frame1"); //$NON-NLS-1$
- stackframes[1] = new SampleStackFrame(thread, "Frame2"); //$NON-NLS-1$
- return stackframes;
- }
-
- /**
- * @param mb
- * @return true if memory block is to support base address modification,
- * false otherwise
- */
- public boolean suppostsBaseAddressModification(SampleMemoryBlock mb) {
- return false;
- }
-
- /**
- * Sets the base address of this memory block
- *
- * @param mb the memory block to change base address
- * @param address the new base address of the memory block
- * @throws CoreException
- */
- public void setBaseAddress(SampleMemoryBlock mb, BigInteger address) throws CoreException {
- }
-
- /**
- * @param mb
- * @return true if this memory block supports value modification, false
- * otherwise
- * @throws CoreException
- */
- public boolean supportsValueModification(SampleMemoryBlock mb) {
- return true;
- }
-
- /**
- * @return address size of the debuggee
- * @throws CoreException
- */
- public int getAddressSize() throws CoreException {
- return 4;
- }
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.debug.examples.internal.memory.engine;
+
+import java.math.BigInteger;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Random;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.model.MemoryByte;
+import org.eclipse.debug.examples.internal.memory.core.SampleDebugTarget;
+import org.eclipse.debug.examples.internal.memory.core.SampleMemoryBlock;
+import org.eclipse.debug.examples.internal.memory.core.SampleStackFrame;
+import org.eclipse.debug.examples.internal.memory.core.SampleThread;
+
+/**
+ * Sample engine for sample deug adapter This engine randomly generates content
+ * for a memory block. To get to this engine, call
+ * {@link SampleDebugTarget#getEngine()};
+ */
+public class SampleEngine {
+
+ Random fRandom = new Random();
+ byte[] fMemory;
+ Hashtable<BigInteger, SampleMemoryUnit> memoryBlockTable;
+ Hashtable<String, BigInteger> expressionAddressTable = new Hashtable<>();
+ Hashtable<SampleDebugTarget, Object> threadTable = new Hashtable<>();
+ Hashtable<SampleThread, Object> stackframeTable = new Hashtable<>();
+
+ Random random = new Random();
+
+ /**
+ * Allow debug adapters to get memory from an address
+ *
+ * @param address
+ * @param length
+ * @return memory byte from an address
+ * @throws RuntimeException
+ */
+ synchronized public MemoryByte[] getBytesFromAddress(BigInteger address, long length) throws RuntimeException {
+
+ if (memoryBlockTable == null) {
+ // create new memoryBlock table
+ memoryBlockTable = new Hashtable<>();
+ byte[] bytes = new byte[(int) length * getAddressableSize()];
+ BigInteger addressKey = address;
+
+ random.nextBytes(bytes);
+
+ for (int i = 0; i < bytes.length; i = i + getAddressableSize()) {
+ addressKey = addressKey.add(BigInteger.valueOf(1));
+
+ MemoryByte[] byteUnit = new MemoryByte[getAddressableSize()];
+ for (int j = 0; j < getAddressableSize(); j++) {
+ MemoryByte oneByte = new MemoryByte(bytes[i + j]);
+ oneByte.setBigEndian(isBigEndian(addressKey));
+ oneByte.setWritable(isWritable(addressKey));
+ oneByte.setReadable(isReadable(addressKey));
+ byteUnit[j] = oneByte;
+ }
+ SampleMemoryUnit unit = new SampleMemoryUnit(byteUnit);
+ memoryBlockTable.put(addressKey, unit);
+ }
+ }
+
+ MemoryByte[] returnBytes = new MemoryByte[(int) length * getAddressableSize()];
+ BigInteger addressKey;
+
+ for (int i = 0; i < returnBytes.length; i = i + getAddressableSize()) {
+ addressKey = address.add(BigInteger.valueOf(i / getAddressableSize()));
+ SampleMemoryUnit temp = (memoryBlockTable.get(addressKey));
+
+ // if memoryBlock does not already exist in the table, generate a
+ // value
+ if (temp == null) {
+ byte[] x = new byte[getAddressableSize()];
+ random.nextBytes(x);
+ byte flag = 0;
+ flag |= MemoryByte.READABLE;
+ flag |= MemoryByte.ENDIANESS_KNOWN;
+ flag |= MemoryByte.WRITABLE;
+
+ MemoryByte[] byteUnit = new MemoryByte[getAddressableSize()];
+ for (int j = 0; j < getAddressableSize(); j++) {
+ MemoryByte oneByte = new MemoryByte(x[j], flag);
+ byteUnit[j] = oneByte;
+ byteUnit[j].setBigEndian(isBigEndian(addressKey));
+ byteUnit[j].setWritable(isWritable(addressKey));
+ byteUnit[j].setReadable(isReadable(addressKey));
+ returnBytes[i + j] = oneByte;
+ }
+ SampleMemoryUnit unit = new SampleMemoryUnit(byteUnit);
+ memoryBlockTable.put(addressKey, unit);
+
+ } else {
+ MemoryByte[] bytes = temp.getBytes();
+
+ for (int j = 0; j < bytes.length; j++) {
+ MemoryByte oneByte = new MemoryByte(bytes[j].getValue(), bytes[j].getFlags());
+ returnBytes[i + j] = oneByte;
+ returnBytes[i + j].setBigEndian(isBigEndian(addressKey));
+ returnBytes[i + j].setWritable(isWritable(addressKey));
+ }
+ }
+ }
+
+ return returnBytes;
+ }
+
+ /**
+ * Run the debuggee
+ */
+ public void resume() {
+ changeValue();
+ }
+
+ /**
+ * Convenience function to cause changes in a memoryBlock block. Changes
+ * could result from running the program, changing a variable, etc.
+ */
+ synchronized public void changeValue() {
+ if (memoryBlockTable == null) {
+ return;
+ }
+
+ Enumeration<BigInteger> enumeration = memoryBlockTable.keys();
+ long randomChange = random.nextInt(37);
+
+ while (randomChange <= 5) {
+ randomChange = random.nextInt(37);
+ }
+
+ while (enumeration.hasMoreElements()) {
+ BigInteger key = enumeration.nextElement();
+ if (key.remainder(BigInteger.valueOf(randomChange)).equals(BigInteger.valueOf(0))) {
+ byte[] x = new byte[getAddressableSize()];
+ random.nextBytes(x);
+
+ MemoryByte unitBytes[] = new MemoryByte[getAddressableSize()];
+ for (int i = 0; i < x.length; i++) {
+ MemoryByte oneByte = new MemoryByte();
+ oneByte.setValue(x[i]);
+ oneByte.setReadable(true);
+ oneByte.setChanged(true);
+ oneByte.setHistoryKnown(true);
+ oneByte.setBigEndian(isBigEndian(key));
+ oneByte.setWritable(isWritable(key));
+ oneByte.setReadable(isReadable(key));
+ unitBytes[i] = oneByte;
+ }
+
+ SampleMemoryUnit unit = new SampleMemoryUnit(unitBytes);
+
+ memoryBlockTable.put(key, unit);
+ } else {
+ SampleMemoryUnit unit = memoryBlockTable.get(key);
+
+ MemoryByte[] bytes = unit.getBytes();
+
+ for (int i = 0; i < bytes.length; i++) {
+ bytes[i].setChanged(false);
+ bytes[i].setHistoryKnown(true);
+ }
+
+ unit.setBytes(bytes);
+
+ memoryBlockTable.put(key, unit);
+ }
+ }
+ }
+
+ /**
+ * Simulates evaluation of an expression. Given an expression, return ad
+ * address
+ *
+ * @param expression
+ * @param evalContext
+ * @return the address the expression is evaluated to
+ */
+ public BigInteger evaluateExpression(String expression, Object evalContext) {
+ BigInteger expAddress = expressionAddressTable.get(expression);
+ if (expAddress == null) {
+ int address = random.nextInt();
+
+ // make sure number is positive
+ if (address < 0) {
+ address = address * -1;
+ }
+
+ expAddress = BigInteger.valueOf(address);
+ expressionAddressTable.put(expression, expAddress);
+ }
+ return expAddress;
+ }
+
+ /**
+ * Simulates checking if storage retrieval is supported
+ *
+ * @return if the engine supports storage retrieval
+ */
+ public boolean supportsStorageRetrieval() {
+ return true;
+ }
+
+ /**
+ * Simulates modifying memory using BigInteger as the address
+ *
+ * @param address
+ * @param bytes
+ * @throws RuntimeException
+ */
+ public void setValue(BigInteger address, byte[] bytes) throws RuntimeException {
+ BigInteger convertedAddress = address;
+
+ for (int i = 0; i < bytes.length; i = i + getAddressableSize()) {
+ SampleMemoryUnit unit = memoryBlockTable.get(convertedAddress);
+
+ MemoryByte[] unitBytes = unit.getBytes();
+ for (int j = 0; j < unitBytes.length; j++) {
+ unitBytes[j].setValue(bytes[i + j]);
+ unitBytes[j].setChanged(true);
+ unitBytes[j].setHistoryKnown(true);
+ }
+ convertedAddress = convertedAddress.add(BigInteger.valueOf(1));
+ }
+ }
+
+ /**
+ * @return addrssablesize of the debuggee
+ */
+ public int getAddressableSize() {
+ return 1;
+ }
+
+ /**
+ * @param address
+ * @return true if the debuggee is big endian, false otherwise
+ */
+ public boolean isBigEndian(BigInteger address) {
+ // simulate mixed endianess in a memory block
+ // memory before the boundary address is little endian
+ // memory after the boundaress is big endian
+ BigInteger boundary = new BigInteger("12345678", 16); //$NON-NLS-1$
+ if (address.compareTo(boundary) > 0) {
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * @param address
+ * @return true if the address is writable, false otherwise Read only
+ * segment: 0xab123456 to 0xab123556
+ */
+ public boolean isWritable(BigInteger address) {
+ BigInteger boundary = new BigInteger("ab123456", 16); //$NON-NLS-1$
+ BigInteger boundaryEnd = new BigInteger("ab123556", 16); //$NON-NLS-1$
+ if (address.compareTo(boundary) > 0 && address.compareTo(boundaryEnd) < 0) {
+ return false;
+ }
+
+ boundary = new BigInteger("cd123456", 16); //$NON-NLS-1$
+ boundaryEnd = new BigInteger("cd123576", 16); //$NON-NLS-1$
+ if (address.compareTo(boundary) > 0 && address.compareTo(boundaryEnd) < 0) {
+ return false;
+ }
+
+ return true;
+
+ }
+
+ /**
+ * @param address
+ * @return
+ */
+ public boolean isReadable(BigInteger address) {
+ BigInteger boundary = new BigInteger("cd123456", 16); //$NON-NLS-1$
+ BigInteger boundaryEnd = new BigInteger("cd123576", 16); //$NON-NLS-1$
+ if (address.compareTo(boundary) > 0 && address.compareTo(boundaryEnd) < 0) {
+ return false;
+ }
+ return true;
+ }
+
+ /**
+ * @param target
+ * @return
+ */
+ public SampleThread[] getThreads(SampleDebugTarget target) {
+ Object thread = threadTable.get(target);
+ if (thread == null) {
+ thread = new SampleThread(target);
+ threadTable.put(target, thread);
+ }
+ return new SampleThread[] { (SampleThread) thread };
+ }
+
+ /**
+ * @param thread
+ * @return
+ */
+ public SampleStackFrame[] getStackframes(SampleThread thread) {
+ Object stackframes = stackframeTable.get(thread);
+ if (stackframes == null) {
+ stackframes = createStackframes(thread);
+ stackframeTable.put(thread, stackframes);
+ }
+ return (SampleStackFrame[]) stackframes;
+ }
+
+ /**
+ *
+ */
+ private SampleStackFrame[] createStackframes(SampleThread thread) {
+ SampleStackFrame[] stackframes = new SampleStackFrame[2];
+ stackframes[0] = new SampleStackFrame(thread, "Frame1"); //$NON-NLS-1$
+ stackframes[1] = new SampleStackFrame(thread, "Frame2"); //$NON-NLS-1$
+ return stackframes;
+ }
+
+ /**
+ * @param mb
+ * @return true if memory block is to support base address modification,
+ * false otherwise
+ */
+ public boolean suppostsBaseAddressModification(SampleMemoryBlock mb) {
+ return false;
+ }
+
+ /**
+ * Sets the base address of this memory block
+ *
+ * @param mb the memory block to change base address
+ * @param address the new base address of the memory block
+ * @throws CoreException
+ */
+ public void setBaseAddress(SampleMemoryBlock mb, BigInteger address) throws CoreException {
+ }
+
+ /**
+ * @param mb
+ * @return true if this memory block supports value modification, false
+ * otherwise
+ * @throws CoreException
+ */
+ public boolean supportsValueModification(SampleMemoryBlock mb) {
+ return true;
+ }
+
+ /**
+ * @return address size of the debuggee
+ * @throws CoreException
+ */
+ public int getAddressSize() throws CoreException {
+ return 4;
+ }
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleMemoryUnit.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleMemoryUnit.java
index bc8810e84..6e2b874ab 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleMemoryUnit.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/engine/SampleMemoryUnit.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.engine;
-
-import org.eclipse.debug.core.model.MemoryByte;
-
-/**
- * For testing addressable size > 1. Group each addressable unit in a MemoryByte
- * array.
- *
- */
-public class SampleMemoryUnit {
-
- MemoryByte[] fBytes;
-
- public SampleMemoryUnit(MemoryByte[] bytes) {
- fBytes = bytes;
- }
-
- public MemoryByte[] getBytes() {
- return fBytes;
- }
-
- public void setBytes(MemoryByte[] bytes) {
- fBytes = bytes;
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.engine;
+
+import org.eclipse.debug.core.model.MemoryByte;
+
+/**
+ * For testing addressable size > 1. Group each addressable unit in a MemoryByte
+ * array.
+ *
+ */
+public class SampleMemoryUnit {
+
+ MemoryByte[] fBytes;
+
+ public SampleMemoryUnit(MemoryByte[] bytes) {
+ fBytes = bytes;
+ }
+
+ public MemoryByte[] getBytes() {
+ return fBytes;
+ }
+
+ public void setBytes(MemoryByte[] bytes) {
+ fBytes = bytes;
+ }
+
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchConfigurationDelegateEx.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchConfigurationDelegateEx.java
index bce264eaf..e9c3da601 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchConfigurationDelegateEx.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchConfigurationDelegateEx.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.launchconfig;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.IDebugTarget;
-import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
-import org.eclipse.debug.examples.internal.memory.core.SampleDebugTarget;
-
-/**
- * Sample Launch configuraiton delegate For creating the debug target that
- * supports IMemoryBlockExtension
- * */
-public class SampleLaunchConfigurationDelegateEx extends LaunchConfigurationDelegate {
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.
- * eclipse.debug.core.ILaunchConfiguration, java.lang.String,
- * org.eclipse.debug.core.ILaunch,
- * org.eclipse.core.runtime.IProgressMonitor)
- */
- @Override
- public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- IDebugTarget target = new SampleDebugTarget(launch);
- launch.addDebugTarget(target);
-
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.launchconfig;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
+import org.eclipse.debug.examples.internal.memory.core.SampleDebugTarget;
+
+/**
+ * Sample Launch configuraiton delegate For creating the debug target that
+ * supports IMemoryBlockExtension
+ * */
+public class SampleLaunchConfigurationDelegateEx extends LaunchConfigurationDelegate {
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.debug.core.model.ILaunchConfigurationDelegate#launch(org.
+ * eclipse.debug.core.ILaunchConfiguration, java.lang.String,
+ * org.eclipse.debug.core.ILaunch,
+ * org.eclipse.core.runtime.IProgressMonitor)
+ */
+ @Override
+ public void launch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ IDebugTarget target = new SampleDebugTarget(launch);
+ launch.addDebugTarget(target);
+
+ }
+
+}
diff --git a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchTabGroup.java b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchTabGroup.java
index 18b95e87b..97c34a51f 100644
--- a/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchTabGroup.java
+++ b/org.eclipse.debug.examples.memory/src/org/eclipse/debug/examples/internal/memory/launchconfig/SampleLaunchTabGroup.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2013 IBM Corporation and others.
+/*******************************************************************************
+ * Copyright (c) 2013 IBM Corporation and others.
*
- * This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License 2.0
- * which accompanies this distribution, and is available at
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.debug.examples.internal.memory.launchconfig;
-
-import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
-import org.eclipse.debug.ui.CommonTab;
-import org.eclipse.debug.ui.ILaunchConfigurationDialog;
-import org.eclipse.debug.ui.ILaunchConfigurationTab;
-
-/**
- * Sample launch tab group
- */
-public class SampleLaunchTabGroup extends AbstractLaunchConfigurationTabGroup {
-
- /*
- * (non-Javadoc)
- * @see
- * org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse
- * .debug.ui.ILaunchConfigurationDialog, java.lang.String)
- */
- @Override
- public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
- ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[1];
- tabs[0] = new CommonTab();
- setTabs(tabs);
- }
-
-}
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.debug.examples.internal.memory.launchconfig;
+
+import org.eclipse.debug.ui.AbstractLaunchConfigurationTabGroup;
+import org.eclipse.debug.ui.CommonTab;
+import org.eclipse.debug.ui.ILaunchConfigurationDialog;
+import org.eclipse.debug.ui.ILaunchConfigurationTab;
+
+/**
+ * Sample launch tab group
+ */
+public class SampleLaunchTabGroup extends AbstractLaunchConfigurationTabGroup {
+
+ /*
+ * (non-Javadoc)
+ * @see
+ * org.eclipse.debug.ui.ILaunchConfigurationTabGroup#createTabs(org.eclipse
+ * .debug.ui.ILaunchConfigurationDialog, java.lang.String)
+ */
+ @Override
+ public void createTabs(ILaunchConfigurationDialog dialog, String mode) {
+ ILaunchConfigurationTab[] tabs = new ILaunchConfigurationTab[1];
+ tabs[0] = new CommonTab();
+ setTabs(tabs);
+ }
+
+}

Back to the top