You need to call getBytesFromAddress or getBytesFromOffset, not getBytes().
Hi Eugene,
Thanks a lot for your answer. I tried the following code based on your recommendation:
IAdaptable context = DebugUITools.getDebugContext();
IMemoryBlockRetrievalExtension mem_retrieval = (IMemoryBlockRetrievalExtension)context.getAdapter(IMemoryBlockRetrievalExtension.class);
try {
IMemoryBlock mem_block = mem_retrieval.getMemoryBlock(134533120, 1000);
byte[] bytes = mem_block.getBytes();
} catch (DebugException e) {
e.printStackTrace();
}
However I always get a byte array that is empty (whether the target is running or not). It seems that the memory block I retrieve has always null data. Am I correctly using the context?
If I cannot make this solution work I will take a look at the TCF APIs.
Thanks,
Alexis
Hi Alexis,
You can use IMemoryBlockRetrievalExtension API from the Eclipse platform.
It should work with any debugger. For example:
IMemoryBlockRetrievalExtension mem_retrieval = (IMemoryBlockRetrievalExtension)debug_view_element.getAdapter(IMemoryBlockRetrievalExtension.class);
IMemoryBlock mem_block = mem_retrieval.getMemoryBlock(addr, size);
…
If you need better performance and more options, you can use TCF APIs directly.
See implementation of TCFMemoryBlock.getBytesFromAddress as an example.
Regards,
Eugene
CAUTION: This message has originated from an External Source. Please use proper judgment and caution
when opening attachments, clicking links, or responding to this email.
Hi Everyone,
I am trying to develop an Eclipse plug-in that would allow to retrieve a memory bloc from a TCF target. I want it be generic enough so it is independent from the target hardware. The plug-in would be based on the TCF
plug-in, and capable of retrieving a memory bloc based on the start address and the size. Is there any API provided as part of TCF that I could use from my plug-in?
I have a similar implementation for a GDB server, but I would like to be able to support both “Target Protocol”. For GDB I use DSF, but I am not able to find anything in TCF that would allow to reuse what I did in DSF.
Thanks in advance for your help,
Alexis