diff options
4 files changed, 73 insertions, 4 deletions
diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java index a51f7a05d..f3577d06a 100644 --- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java +++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/internal/services/remote/MemoryProxy.java @@ -205,6 +205,18 @@ public class MemoryProxy implements IMemory { return (Number)props.get(PROP_START_BOUND); } + public int getAddressableUnitSize() { + Number n = (Number)props.get(PROP_ADDRESSABLE_UNIT_SIZE); + if (n == null) return 1; + return n.intValue(); + } + + public int getDefaultWordSize() { + Number n = (Number)props.get(PROP_DEFAULT_WORD_SIZE); + if (n == null) return 0; + return n.intValue(); + } + public Map<String, Object> getProperties() { return props; } diff --git a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IMemory.java b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IMemory.java index 58fdccfac..ae52ea525 100644 --- a/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IMemory.java +++ b/plugins/org.eclipse.tcf.core/src/org/eclipse/tcf/services/IMemory.java @@ -20,6 +20,10 @@ import org.eclipse.tcf.protocol.IToken; /** * IMemory service provides basic operations to read/write memory on a target. * + * The service represents memory addresses in number of bytes, regardless of actual addressable unit size. + * Clients can translate between byte and word addresses using value of "AddressableUnitSize". + * Byte is 8 bits. + * * @noimplement This interface is not intended to be implemented by clients. */ public interface IMemory extends IService { @@ -38,7 +42,9 @@ public interface IMemory extends IService { PROP_NAME = "Name", /** String, name of the context, can be used for UI purposes */ PROP_START_BOUND = "StartBound", /** Number, lowest address (inclusive) which is valid for the context */ PROP_END_BOUND = "EndBound", /** Number, highest address (inclusive) which is valid for the context */ - PROP_ACCESS_TYPES = "AccessTypes"; /** Array of String, the access types allowed for this context */ + PROP_ACCESS_TYPES = "AccessTypes", /** Array of String, the access types allowed for this context */ + PROP_ADDRESSABLE_UNIT_SIZE = "AddressableUnitSize", /** Number, addressable unit size in number of bytes */ + PROP_DEFAULT_WORD_SIZE = "DefaultWordSize"; /** Number, default word size in number of bytes */ /** * Values of "AccessTypes". @@ -184,6 +190,22 @@ public interface IMemory extends IService { Collection<String> getAccessTypes(); /** + * Get this memory context's addressable unit size in number of bytes. + * The addressable size indicates the minimum number of bytes that + * can be retrieved as a single unit. + * @return addressable unit size in bytes. + */ + int getAddressableUnitSize(); + + /** + * Get default word size in number of bytes. + * The size is supposed to be used as the default memory view word representation. + * Returns zero is word size is unknown. + * @return word size in bytes. + */ + int getDefaultWordSize(); + + /** * Get context properties. * @return all available context properties. */ diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFNodePropertySource.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFNodePropertySource.java index 9df910a84..55aeaf853 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFNodePropertySource.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/adapters/TCFNodePropertySource.java @@ -37,6 +37,7 @@ import org.eclipse.tcf.protocol.IChannel; import org.eclipse.tcf.protocol.JSON; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.services.IExpressions; +import org.eclipse.tcf.services.IMemory; import org.eclipse.tcf.services.IRegisters; import org.eclipse.tcf.services.IRunControl; import org.eclipse.tcf.services.IStackTrace; @@ -245,10 +246,22 @@ public class TCFNodePropertySource implements IPropertySource { } private void getExecContextDescriptors(TCFNodeExecContext exe_node) { + TCFDataCache<IMemory.MemoryContext> mem_cache = exe_node.getMemoryContext(); TCFDataCache<IRunControl.RunControlContext> ctx_cache = exe_node.getRunContext(); TCFDataCache<TCFContextState> state_cache = exe_node.getState(); TCFDataCache<MemoryRegion[]> mem_map_cache = exe_node.getMemoryMap(); - if (!validateAll(ctx_cache, state_cache, mem_map_cache)) return; + if (!validateAll(mem_cache, ctx_cache, state_cache, mem_map_cache)) return; + IMemory.MemoryContext mem = mem_cache.getData(); + if (mem != null) { + Map<String,Object> props = mem.getProperties(); + for (String key : props.keySet()) { + Object value = props.get(key); + if (value instanceof Number) { + value = toHexAddrString((Number)value); + } + addDescriptor("Memory", key, value); + } + } IRunControl.RunControlContext ctx = ctx_cache.getData(); if (ctx != null) { Map<String,Object> props = ctx.getProperties(); diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFMemoryBlockRetrieval.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFMemoryBlockRetrieval.java index ea6e4f46d..0e85aa80d 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFMemoryBlockRetrieval.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/model/TCFMemoryBlockRetrieval.java @@ -256,8 +256,30 @@ class TCFMemoryBlockRetrieval implements IMemoryBlockRetrievalExtension { @Override public int getAddressableSize() throws DebugException { - // TODO: support for addressable size other then 1 byte - return 1; + return new TCFDebugTask<Integer>(exec_ctx.getChannel()) { + @Override + public void run() { + if (exec_ctx.isDisposed()) { + error("Context is disposed"); + } + else { + TCFDataCache<IMemory.MemoryContext> cache = exec_ctx.getMemoryContext(); + if (!cache.validate(this)) return; + if (cache.getError() != null) { + error(cache.getError()); + } + else { + IMemory.MemoryContext mem = cache.getData(); + if (mem == null) { + error("Context does not provide memory access"); + } + else { + done(mem.getAddressableUnitSize()); + } + } + } + } + }.getD(); } @Override |