Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-06-13 18:09:55 +0000
committereutarass2011-06-13 18:09:55 +0000
commit199b8ee7f477bc8dc7c7bfab530f0599bc68f49b (patch)
tree2d39c2b328b5b8deff8b15775d034fa6ac8f55db /plugins/org.eclipse.tm.tcf.debug/src/org
parent76ca170a8bdff8cbd842f05b3aa3980d92193de1 (diff)
downloadorg.eclipse.tcf-199b8ee7f477bc8dc7c7bfab530f0599bc68f49b.tar.gz
org.eclipse.tcf-199b8ee7f477bc8dc7c7bfab530f0599bc68f49b.tar.xz
org.eclipse.tcf-199b8ee7f477bc8dc7c7bfab530f0599bc68f49b.zip
Changes in Memory Map service implementation and UI:
1. Added new notification callback: void (*mapping_changed)(Context * ctx, void * client_data). 2. Manual memory map entries are now associated with full context name (including parent names) to avoid ambiguity. 3. TCF launch configuration now includes "Symbol Files" tab to allow editing of manual map entries as part of the launch configuration. 4. "Debug context" field of the memory map UI changed to combo box to allow a user to see/edit all maps associated with a launch.
Diffstat (limited to 'plugins/org.eclipse.tm.tcf.debug/src/org')
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java39
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java47
2 files changed, 52 insertions, 34 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java
index 8ec283daf..447841f92 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/launch/TCFLaunchDelegate.java
@@ -12,6 +12,7 @@ package org.eclipse.tm.internal.tcf.debug.launch;
import java.io.File;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
@@ -29,7 +30,10 @@ import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
import org.eclipse.tm.internal.tcf.debug.Activator;
import org.eclipse.tm.internal.tcf.debug.model.ITCFConstants;
import org.eclipse.tm.internal.tcf.debug.model.TCFLaunch;
+import org.eclipse.tm.internal.tcf.debug.model.TCFMemoryRegion;
+import org.eclipse.tm.tcf.protocol.JSON;
import org.eclipse.tm.tcf.protocol.Protocol;
+import org.eclipse.tm.tcf.services.IMemoryMap;
import org.eclipse.tm.tcf.services.IPathMap;
import org.eclipse.tm.tcf.util.TCFTask;
@@ -163,6 +167,41 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate {
}
/**
+ * Given value of ATTR_MEMORY_MAP, add lists of TCFMemoryRegion objects into 'maps'.
+ * @param maps - Map object to fill with memory maps.
+ * @param s - value of ATTR_MEMORY_MAP.
+ */
+ @SuppressWarnings("unchecked")
+ public static void parseMemMapsAttribute(Map<String,ArrayList<IMemoryMap.MemoryRegion>> maps, String s) throws Exception {
+ if (s == null || s.length() == 0) return;
+ Collection<Map<String,Object>> list = (Collection<Map<String,Object>>)JSON.parseOne(s.getBytes("UTF-8"));
+ if (list == null) return;
+ for (Map<String,Object> map : list) {
+ String id = (String)map.get(IMemoryMap.PROP_ID);
+ if (id != null) {
+ ArrayList<IMemoryMap.MemoryRegion> l = maps.get(id);
+ if (l == null) {
+ l = new ArrayList<IMemoryMap.MemoryRegion>();
+ maps.put(id, l);
+ }
+ l.add(new TCFMemoryRegion(map));
+ }
+ }
+ }
+
+ /**
+ * Read ATTR_MEMORY_MAP attribute of a launch configuration.
+ * @param maps - Map object to fill with memory maps.
+ * @param cfg - the launch configuration.
+ * @throws Exception
+ */
+ public static void getMemMapsAttribute(Map<String,ArrayList<IMemoryMap.MemoryRegion>> maps,
+ ILaunchConfiguration cfg) throws Exception {
+ String maps_cfg = cfg.getAttribute(ATTR_MEMORY_MAP, (String)null);
+ parseMemMapsAttribute(maps, maps_cfg);
+ }
+
+ /**
* Given project name and program name returns absolute path of the program.
* @param project_name - workspace project name.
* @param program_name - launch program name.
diff --git a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
index 7e8baa3ab..136318291 100644
--- a/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
+++ b/plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java
@@ -35,7 +35,6 @@ import org.eclipse.tm.tcf.protocol.IChannel;
import org.eclipse.tm.tcf.protocol.IPeer;
import org.eclipse.tm.tcf.protocol.IService;
import org.eclipse.tm.tcf.protocol.IToken;
-import org.eclipse.tm.tcf.protocol.JSON;
import org.eclipse.tm.tcf.protocol.Protocol;
import org.eclipse.tm.tcf.services.IFileSystem;
import org.eclipse.tm.tcf.services.IFileSystem.FileSystemException;
@@ -222,6 +221,7 @@ public class TCFLaunch extends Launch {
@Override
void start() throws Exception {
final Runnable done = this;
+ // Check if preloading is supported
mem_map.set("\001", null, new IMemoryMap.DoneSet() {
public void doneSet(IToken token, Exception error) {
try {
@@ -298,32 +298,14 @@ public class TCFLaunch extends Launch {
done.run();
}
- @SuppressWarnings("unchecked")
- private void readMapsConfiguration(HashMap<String,ArrayList<TCFMemoryRegion>> maps, String cfg) throws Exception {
- Collection<Map<String,Object>> list = (Collection<Map<String,Object>>)JSON.parseOne(cfg.getBytes("UTF-8"));
- if (list == null) return;
- for (Map<String,Object> map : list) {
- String id = (String)map.get(IMemoryMap.PROP_ID);
- if (id != null) {
- ArrayList<TCFMemoryRegion> l = maps.get(id);
- if (l == null) {
- l = new ArrayList<TCFMemoryRegion>();
- maps.put(id, l);
- }
- l.add(new TCFMemoryRegion(map));
- }
- }
- }
-
- private void downloadMemoryMaps(ILaunchConfiguration cfg, final Runnable done) throws Exception {
- final String maps_cfg = cfg.getAttribute(TCFLaunchDelegate.ATTR_MEMORY_MAP, "null");
+ private void downloadMemoryMaps(final ILaunchConfiguration cfg, final Runnable done) throws Exception {
final IMemoryMap mmap = channel.getRemoteService(IMemoryMap.class);
if (mmap == null) {
done.run();
return;
}
- final HashMap<String,ArrayList<TCFMemoryRegion>> maps = new HashMap<String,ArrayList<TCFMemoryRegion>>();
- readMapsConfiguration(maps, maps_cfg);
+ final HashMap<String,ArrayList<IMemoryMap.MemoryRegion>> maps = new HashMap<String,ArrayList<IMemoryMap.MemoryRegion>>();
+ TCFLaunchDelegate.getMemMapsAttribute(maps, cfg);
final HashSet<IToken> cmds = new HashSet<IToken>(); // Pending commands
final Runnable done_all = new Runnable() {
boolean launch_done;
@@ -342,19 +324,18 @@ public class TCFLaunch extends Launch {
}
};
for (String id : maps.keySet()) {
- ArrayList<TCFMemoryRegion> map = maps.get(id);
+ ArrayList<IMemoryMap.MemoryRegion> map = maps.get(id);
TCFMemoryRegion[] arr = map.toArray(new TCFMemoryRegion[map.size()]);
cmds.add(mmap.set(id, arr, done_set_mmap));
}
update_memory_maps = new Runnable() {
public void run() {
try {
- String cfg = getLaunchConfiguration().getAttribute(TCFLaunchDelegate.ATTR_MEMORY_MAP, "null");
Set<String> set = new HashSet<String>(maps.keySet());
maps.clear();
- readMapsConfiguration(maps, cfg);
+ TCFLaunchDelegate.getMemMapsAttribute(maps, cfg);
for (String id : maps.keySet()) {
- ArrayList<TCFMemoryRegion> map = maps.get(id);
+ ArrayList<IMemoryMap.MemoryRegion> map = maps.get(id);
TCFMemoryRegion[] arr = map.toArray(new TCFMemoryRegion[map.size()]);
cmds.add(mmap.set(id, arr, done_set_mmap));
}
@@ -372,7 +353,6 @@ public class TCFLaunch extends Launch {
}
private void updateMemoryMapsOnProcessCreation(ILaunchConfiguration cfg, final Runnable done) throws Exception {
- final String maps_cfg = cfg.getAttribute(TCFLaunchDelegate.ATTR_MEMORY_MAP, "null");
final IMemory mem = channel.getRemoteService(IMemory.class);
final IMemoryMap mmap = channel.getRemoteService(IMemoryMap.class);
if (mem == null || mmap == null) {
@@ -380,8 +360,8 @@ public class TCFLaunch extends Launch {
return;
}
final HashSet<String> deleted_maps = new HashSet<String>();
- final HashMap<String,ArrayList<TCFMemoryRegion>> maps = new HashMap<String,ArrayList<TCFMemoryRegion>>();
- readMapsConfiguration(maps, maps_cfg);
+ final HashMap<String,ArrayList<IMemoryMap.MemoryRegion>> maps = new HashMap<String,ArrayList<IMemoryMap.MemoryRegion>>();
+ TCFLaunchDelegate.getMemMapsAttribute(maps, cfg);
final HashSet<String> mems = new HashSet<String>(); // Already processed memory IDs
final HashSet<IToken> cmds = new HashSet<IToken>(); // Pending commands
final HashMap<String,String> mem2map = new HashMap<String,String>();
@@ -409,7 +389,7 @@ public class TCFLaunch extends Launch {
String id = context.getName();
if (id == null) id = context.getID();
if (id != null) {
- ArrayList<TCFMemoryRegion> map = maps.get(id);
+ ArrayList<IMemoryMap.MemoryRegion> map = maps.get(id);
if (map != null) {
TCFMemoryRegion[] arr = map.toArray(new TCFMemoryRegion[map.size()]);
cmds.add(mmap.set(context.getID(), arr, done_set_mmap));
@@ -452,7 +432,7 @@ public class TCFLaunch extends Launch {
if (id == null) id = context.getID();
if (id == null) continue;
if (id.equals(mem2map.get(context.getID()))) continue;
- ArrayList<TCFMemoryRegion> map = maps.get(id);
+ ArrayList<IMemoryMap.MemoryRegion> map = maps.get(id);
if (map == null) continue;
TCFMemoryRegion[] arr = map.toArray(new TCFMemoryRegion[map.size()]);
cmds.add(mmap.set(context.getID(), arr, done_set_mmap));
@@ -465,7 +445,7 @@ public class TCFLaunch extends Launch {
String id = context.getName();
if (id == null) id = context.getID();
if (id == null) continue;
- ArrayList<TCFMemoryRegion> map = maps.get(id);
+ ArrayList<IMemoryMap.MemoryRegion> map = maps.get(id);
if (map == null) continue;
TCFMemoryRegion[] arr = map.toArray(new TCFMemoryRegion[map.size()]);
cmds.add(mmap.set(context.getID(), arr, done_set_mmap));
@@ -478,8 +458,7 @@ public class TCFLaunch extends Launch {
try {
maps.clear();
mems.clear();
- String s = getLaunchConfiguration().getAttribute(TCFLaunchDelegate.ATTR_MEMORY_MAP, "null");
- readMapsConfiguration(maps, s);
+ TCFLaunchDelegate.getMemMapsAttribute(maps, getLaunchConfiguration());
for (String id : mem2map.values()) {
if (maps.get(id) == null) deleted_maps.add(id);
}

Back to the top