Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [tcf-dev] Retrieve memory programmatically from a TCF target

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

 

From: tcf-dev-bounces@xxxxxxxxxxx [mailto:tcf-dev-bounces@xxxxxxxxxxx] On Behalf Of Eugene Tarassov
Sent: November 24, 2020 12:29 PM
To: TCF Development
Subject: Re: [tcf-dev] Retrieve memory programmatically from a TCF target

 

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

 

From: tcf-dev-bounces@xxxxxxxxxxx <tcf-dev-bounces@xxxxxxxxxxx> On Behalf Of Alexis Bouffies
Sent: Tuesday, November 24, 2020 5:05 AM
To: tcf-dev@xxxxxxxxxxx
Subject: [tcf-dev] Retrieve memory programmatically from a TCF target

 

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


Back to the top