Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » use Memory View programmatically
use Memory View programmatically [message #165792] Mon, 13 March 2006 10:43 Go to next message
Eclipse UserFriend
Hello,

I have a question about how to use the Memory View in Eclipse
programmatically.
I want to read/display memory for a given address using the Memory View.

So far I have been following the advice given in the Bugzilla Bug 87374:

>To programatically open the memory view:
>
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView
>("org.eclipse.debug.ui.MemoryView");
>
>To add memory blocks to the view, you need to add memory blocks to the
>memory
>block manager:
>
> DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBl ocks(new
>IMemoryBlock[] {memoryBlocks});
>
>In addition to persisting the memory blocks, you may also want to persist
>the
>renderings that are opened. You will need to persist the rendering id and
>id
>of the containers in which a rendering is hosted.
>
>IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow
>().getActivePage().showView("org.eclipse.debug.ui.memoryview ");
>IMemoryRenderingSite memoryView = (IMemoryRenderingSite)part;
>IMemoryRenderingContainer container =
>memoryView.getContainer("containerId");
>IMemoryRendering[] renderings = container.getRenderings[];
>
>When restoring the renderings, you will need to create the rendering, and
>add
>the rendering to the appropriate container within the memory view.
>
>To create a rendering:
>
>IMemoryRenderingType renderingType = DebugUITools.getMemoryRenderingManager
>().getRenderingType("rendeirng id");
>IMemoryRendering rendering = renderingType.createRendering();
>
>Then to add the rendering to the Memory View:
>
>IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow
>().getActivePage().showView("org.eclipse.debug.ui.memoryview ");
>IMemoryRenderingSite memoryView = (IMemoryRenderingSite)part;
>IMemoryRenderingContainer container =
>memoryView.getContainer("containerId");
>container.addMemoryRendering(rendering);
>
>Hope this helps...
>Samantha


If my IMemoryBlock implementation is correctly implemented and I have added
it with
DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBl ocks(),
wouldn't that be enough to render it with the default "raw" memory renderer?

I could not get this to work, so I tried adding a memory renderer to a
memory rendering container,
but I can not get hold of a non-null container. What default memory
rendering containers are available?

My code so far looks like this (the container = null):


IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
if (page != null)
{
try
{
IViewPart view =
page.showView("org.eclipse.debug.ui.MemoryView");

IMemoryRenderingSite memoryView = (IMemoryRenderingSite) view;
MemoryBlockExtentsion mbe = new MemoryBlockExtentsion(new
DummyDebugTarget(), 0);
DebugPlugin.getDefault().getMemoryBlockManager().
addMemoryBlocks(new IMemoryBlock[] {mbe});

IMemoryRenderingType renderingType =
DebugUITools.getMemoryRenderingManager().
getRenderingType("org.eclipse.debug.ui.rendering.raw_memory ");
IMemoryRendering rendering = renderingType.createRendering();

IMemoryRenderingContainer container = memoryView.getContainer(
DebugUIPlugin.getUniqueIdentifier() +
".MemoryView.RenderingViewPane.1");
container.addMemoryRendering(rendering); // <-------------
null!!!
}
catch ...


In summary, what are the minimal steps required in order to display a block
of memory in the Memory View?


- Elin Karasalo
Re: use Memory View programmatically [message #165801 is a reply to message #165792] Mon, 13 March 2006 11:10 Go to previous message
Eclipse UserFriend
Originally posted by: mikhailk.qnx.com

Try to post this message to the eclipse-debug-dev@eclipse.org mailing list.

"Elin Karasalo" <elka@enea.se> wrote in message
news:dv4434$d9p$1@utils.eclipse.org...
> Hello,
>
> I have a question about how to use the Memory View in Eclipse
> programmatically.
> I want to read/display memory for a given address using the Memory View.
>
> So far I have been following the advice given in the Bugzilla Bug 87374:
>
>>To programatically open the memory view:
>>
>> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage().showView
>>("org.eclipse.debug.ui.MemoryView");
>>
>>To add memory blocks to the view, you need to add memory blocks to the
>>memory
>>block manager:
>>
>> DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBl ocks(new
>>IMemoryBlock[] {memoryBlocks});
>>
>>In addition to persisting the memory blocks, you may also want to persist
>>the
>>renderings that are opened. You will need to persist the rendering id and
>>id
>>of the containers in which a rendering is hosted.
>>
>>IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow
>>().getActivePage().showView("org.eclipse.debug.ui.memoryview ");
>>IMemoryRenderingSite memoryView = (IMemoryRenderingSite)part;
>>IMemoryRenderingContainer container =
>>memoryView.getContainer("containerId");
>>IMemoryRendering[] renderings = container.getRenderings[];
>>
>>When restoring the renderings, you will need to create the rendering, and
>>add
>>the rendering to the appropriate container within the memory view.
>>
>>To create a rendering:
>>
>>IMemoryRenderingType renderingType =
>>DebugUITools.getMemoryRenderingManager
>>().getRenderingType("rendeirng id");
>>IMemoryRendering rendering = renderingType.createRendering();
>>
>>Then to add the rendering to the Memory View:
>>
>>IViewPart part = PlatformUI.getWorkbench().getActiveWorkbenchWindow
>>().getActivePage().showView("org.eclipse.debug.ui.memoryview ");
>>IMemoryRenderingSite memoryView = (IMemoryRenderingSite)part;
>>IMemoryRenderingContainer container =
>>memoryView.getContainer("containerId");
>>container.addMemoryRendering(rendering);
>>
>>Hope this helps...
>>Samantha
>
>
> If my IMemoryBlock implementation is correctly implemented and I have
> added it with
> DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBl ocks(),
> wouldn't that be enough to render it with the default "raw" memory
> renderer?
>
> I could not get this to work, so I tried adding a memory renderer to a
> memory rendering container,
> but I can not get hold of a non-null container. What default memory
> rendering containers are available?
>
> My code so far looks like this (the container = null):
>
>
> IWorkbenchPage page =
> PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActi vePage();
> if (page != null)
> {
> try
> {
> IViewPart view =
> page.showView("org.eclipse.debug.ui.MemoryView");
>
> IMemoryRenderingSite memoryView = (IMemoryRenderingSite) view;
> MemoryBlockExtentsion mbe = new MemoryBlockExtentsion(new
> DummyDebugTarget(), 0);
> DebugPlugin.getDefault().getMemoryBlockManager().
> addMemoryBlocks(new IMemoryBlock[] {mbe});
>
> IMemoryRenderingType renderingType =
> DebugUITools.getMemoryRenderingManager().
>
> getRenderingType("org.eclipse.debug.ui.rendering.raw_memory ");
> IMemoryRendering rendering = renderingType.createRendering();
>
> IMemoryRenderingContainer container = memoryView.getContainer(
> DebugUIPlugin.getUniqueIdentifier() +
> ".MemoryView.RenderingViewPane.1");
> container.addMemoryRendering(rendering); // <-------------
> null!!!
> }
> catch ...
>
>
> In summary, what are the minimal steps required in order to display a
> block of memory in the Memory View?
>
>
> - Elin Karasalo
>
Previous Topic:what is wrong when debugging
Next Topic:CDT error parser doesnŽt understand wrapped messages
Goto Forum:
  


Current Time: Thu Jul 17 06:13:28 EDT 2025

Powered by FUDForum. Page generated in 0.53833 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top