Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreutarass2011-01-27 20:46:13 +0000
committereutarass2011-01-27 20:46:13 +0000
commit1e288b9f9172b0777172fb44b546fd6ca0fa69f2 (patch)
treef6e3320911e8f172fe815b1f2363f0ac840d653a
parent22e0233e4ee8a1f4fec74bd123df0d3d05513956 (diff)
downloadorg.eclipse.tcf-1e288b9f9172b0777172fb44b546fd6ca0fa69f2.tar.gz
org.eclipse.tcf-1e288b9f9172b0777172fb44b546fd6ca0fa69f2.tar.xz
org.eclipse.tcf-1e288b9f9172b0777172fb44b546fd6ca0fa69f2.zip
TCF Debugger: changed Memory Map dialog code to allow editing of manually configured memory map regions
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapDialog.java22
-rw-r--r--plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapItemDialog.java30
-rw-r--r--plugins/org.eclipse.tm.tcf.debug/src/org/eclipse/tm/internal/tcf/debug/model/TCFLaunch.java1
3 files changed, 31 insertions, 22 deletions
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapDialog.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapDialog.java
index 501f436d4..f71c91949 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapDialog.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapDialog.java
@@ -311,16 +311,15 @@ class MemoryMapDialog extends Dialog {
button_add.addSelectionListener(sel_adapter = new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- Map<String,Object> attrs = new HashMap<String,Object>();
+ Map<String,Object> props = new HashMap<String,Object>();
Image image = ImageCache.getImage(ImageCache.IMG_MEMORY_MAP);
- if (new MemoryMapItemDialog(getShell(), image, attrs, true).open() == OK) {
- if (mem_map_id != null) attrs.put(TCFLaunch.PROP_MMAP_ID, mem_map_id);
+ if (new MemoryMapItemDialog(getShell(), image, props, true).open() == OK) {
+ if (mem_map_id != null) props.put(TCFLaunch.PROP_MMAP_ID, mem_map_id);
IMemoryMap.MemoryRegion[] arr = new IMemoryMap.MemoryRegion[cur_map.length + 1];
System.arraycopy(cur_map, 0, arr, 0, cur_map.length);
- TCFMemoryRegion r = new TCFMemoryRegion(attrs);
+ TCFMemoryRegion r = new TCFMemoryRegion(props);
arr[cur_map.length] = r;
- Arrays.sort(arr);
- cur_map = arr;
+ Arrays.sort(cur_map = arr);
table_viewer.refresh();
}
}
@@ -338,8 +337,17 @@ class MemoryMapDialog extends Dialog {
IMemoryMap.MemoryRegion r = (IMemoryMap.MemoryRegion)((IStructuredSelection)
table_viewer.getSelection()).getFirstElement();
if (r == null) return;
+ Map<String,Object> props = r.getProperties();
+ boolean enable_editing = props.get(TCFLaunch.PROP_MMAP_ID) != null;
+ if (enable_editing) props = new HashMap<String,Object>(props);
Image image = ImageCache.getImage(ImageCache.IMG_MEMORY_MAP);
- new MemoryMapItemDialog(getShell(), image, r.getProperties(), false).open();
+ if (new MemoryMapItemDialog(getShell(), image, props, enable_editing).open() == OK && enable_editing) {
+ int i = 0;
+ while (cur_map[i] != r) i++;
+ cur_map[i] = new TCFMemoryRegion(props);
+ Arrays.sort(cur_map);
+ table_viewer.refresh();
+ }
}
});
final MenuItem item_edit = new MenuItem(menu, SWT.PUSH);
diff --git a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapItemDialog.java b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapItemDialog.java
index da7854467..a0f4cc207 100644
--- a/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapItemDialog.java
+++ b/plugins/org.eclipse.tm.tcf.debug.ui/src/org/eclipse/tm/internal/tcf/debug/ui/commands/MemoryMapItemDialog.java
@@ -36,7 +36,7 @@ import org.eclipse.tm.tcf.services.IMemoryMap;
class MemoryMapItemDialog extends Dialog {
- private final Map<String,Object> attrs;
+ private final Map<String,Object> props;
private final boolean enable_editing;
private final Image image;
@@ -48,10 +48,10 @@ class MemoryMapItemDialog extends Dialog {
private Button wr_button;
private Button ex_button;
- MemoryMapItemDialog(Shell parent, Image image, Map<String,Object> attrs, boolean enable_editing) {
+ MemoryMapItemDialog(Shell parent, Image image, Map<String,Object> props, boolean enable_editing) {
super(parent);
this.image = image;
- this.attrs = attrs;
+ this.props = props;
this.enable_editing = enable_editing;
}
@@ -216,12 +216,12 @@ class MemoryMapItemDialog extends Dialog {
}
private void setData() {
- setText(addr_text, toHex((Number)attrs.get(IMemoryMap.PROP_ADDRESS)));
- setText(size_text, toHex((Number)attrs.get(IMemoryMap.PROP_SIZE)));
- setText(offset_text, toHex((Number)attrs.get(IMemoryMap.PROP_OFFSET)));
- setText(file_text, (String)attrs.get(IMemoryMap.PROP_FILE_NAME));
+ setText(addr_text, toHex((Number)props.get(IMemoryMap.PROP_ADDRESS)));
+ setText(size_text, toHex((Number)props.get(IMemoryMap.PROP_SIZE)));
+ setText(offset_text, toHex((Number)props.get(IMemoryMap.PROP_OFFSET)));
+ setText(file_text, (String)props.get(IMemoryMap.PROP_FILE_NAME));
int flags = 0;
- Number n = (Number)attrs.get(IMemoryMap.PROP_FLAGS);
+ Number n = (Number)props.get(IMemoryMap.PROP_FLAGS);
if (n != null) flags = n.intValue();
rd_button.setSelection((flags & IMemoryMap.FLAG_READ) != 0);
wr_button.setSelection((flags & IMemoryMap.FLAG_WRITE) != 0);
@@ -232,23 +232,23 @@ class MemoryMapItemDialog extends Dialog {
private void getNumber(Text text, String key) {
String s = text.getText().trim();
if (s == null || s.length() == 0) {
- attrs.remove(key);
+ props.remove(key);
}
else if (s.startsWith("0x")) {
- attrs.put(key, new BigInteger(s.substring(2), 16));
+ props.put(key, new BigInteger(s.substring(2), 16));
}
else {
- attrs.put(key, new BigInteger(s));
+ props.put(key, new BigInteger(s));
}
}
private void getText(Text text, String key) {
String s = text.getText().trim();
if (s == null || s.length() == 0) {
- attrs.remove(key);
+ props.remove(key);
}
else {
- attrs.put(key, s);
+ props.put(key, s);
}
}
@@ -261,7 +261,7 @@ class MemoryMapItemDialog extends Dialog {
if (rd_button.getSelection()) flags |= IMemoryMap.FLAG_READ;
if (wr_button.getSelection()) flags |= IMemoryMap.FLAG_WRITE;
if (ex_button.getSelection()) flags |= IMemoryMap.FLAG_EXECUTE;
- attrs.put(IMemoryMap.PROP_FLAGS, flags);
+ props.put(IMemoryMap.PROP_FLAGS, flags);
}
private void updateButtons() {
@@ -271,7 +271,7 @@ class MemoryMapItemDialog extends Dialog {
@Override
protected void okPressed() {
- getData();
+ if (enable_editing) getData();
super.okPressed();
}
}
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 511eb31ac..8901a6b8d 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
@@ -100,6 +100,7 @@ public class TCFLaunch extends Launch {
}
}
+ /** Memory map attribute: memory context ID */
public static final String PROP_MMAP_ID = "ID";
private static final Collection<LaunchListener> listeners = new ArrayList<LaunchListener>();

Back to the top