Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Fw: [platform-debug-dev] use the Memory View programmatically?


Hi all -

Forwarding an interesting discussion to the mailing list.
Created this enhancement request to track the requirement:

https://bugs.eclipse.org/bugs/show_bug.cgi?id=132903

Thanks...
Samantha


----- Forwarded by Samantha Chan/Toronto/IBM on 03/22/2006 04:46 PM -----
                                                                           
             Samantha                                                      
             Chan/Toronto/IBM                                              
                                                                        To 
             03/17/2006 10:28          "Elin Karasalo"                     
             AM                        <Elin.Karasalo@xxxxxxx>             
                                                                        cc 
                                                                           
                                                                   Subject 
                                       RE: [platform-debug-dev] use the    
                                       Memory View programmatically?       
                                       (Document link: Samantha Chan)      
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           



Hi Elin -

You are correct.  The Add Memory Rendering action and its dialog requires
an active debug context for them to work.  Since there is no selection from
the Debug View, the actions do not work.  (In fact, the add/remove
rendering action from the toolbar is disabled.  The context menu action is
enabled, but does not run properly.)

The Memory View in general expects to have a selection from the Debug View
for it to run properly.  The renderings expects to receive debug events to
update its content in response to changes from its memory block.  I do not
think the view works very well without having a debug context from the
debug view.

Please submit an enhancement request for this.

To tell the Memory View if your data is big endian or little endian, you
need to implement IMemoryBlockExtension.  The IMemoryBlock interface does
not provide the view with the necessary APIs.

What version of Eclipse are you using?

Thanks...
Samantha




                                                                           
             "Elin Karasalo"                                               
             <Elin.Karasalo@en                                             
             ea.se>                                                     To 
                                       Samantha Chan/Toronto/IBM@IBMCA     
             03/17/2006 07:08                                           cc 
             AM                                                            
                                                                   Subject 
                                       RE: [platform-debug-dev] use the    
                                       Memory View programmatically?       
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           




Hello again,

Thank you very much for your reply. It was very helpful.
I can now render a memory block (byte[]) in the Memory View
after invoking an action from another view.

Now, however, I have two more questions:

* The rendering context menu (and toolbar) has the option "Add
Rendering(s)".
  This menu choice does not work for me. If I'm correct this is because
the
  dialog that should pop up, expects a selection from (a thread in) the
Debug View.
  I do not have a connection to the Debug View in my application
  since I just want to render memory from a target, and not debug it,
  neither do I wish to have to involve the Debug View.
  The action works however if I choose to "Toggle Split Pane" and then
push
  the button "Add Renderings(s)". Is there a way to make this action
work
  from the context menu and toolbar without involving the Debug View?

* Also I would like to tell the Memory View whether my memory block data
is
  big endian or little endian. In order to do this, do I need to
implement the
  IMemoryBlockExtension? Or is it possible to just use the IMemoryBlock?



Thanks,
 Elin Karasalo




-----Original Message-----
From: platform-debug-dev-bounces@xxxxxxxxxxx
[mailto:platform-debug-dev-bounces@xxxxxxxxxxx] On Behalf Of Samantha
Chan
Sent: den 15 mars 2006 17:22
To: Eclipse Platform Debug component developers list.
Subject: Re: [platform-debug-dev] use the Memory View programmatically?

Hi Elin -

Do you need to show a rendering in the Memory View? or are you looking
at
creating your own action and creating a memory rendering when your
action
is invoked?

To get the Hex rendering to show up in the Memory View, you need to do
the
following:
   Your debug target must return true when #supportsStorageRetrieval is
   called.  If you are implementing IMemoryBlockExtension, you need to
   implement IMemoryBlockRetrievalExtension in your debug target.
   You need to implement your memory block and return that from your
debug
   target when #getMemoryBlock is called.  If you are implementing
   IMemoryBlockExtension, return your memory block when
   #getExtendedMemoryBlock is called.
   You need to define a memory rendering binding in your plugin.xml.
   Here's an example:

<extension
      point="org.eclipse.debug.ui.memoryRenderings">
   <renderingBindings renderingIds=
"org.eclipse.debug.ui.rendering.raw_memory>
      <enablement>
         <instanceof value="example.package.YourMemoryBlock"/>
      </enablement>
   </renderingBindings>
</extension>

A rendering defines a list of valid memory renderings for your memory
block.  This is must be defined in order to allow the memory rendering
manager to figure out what memory rendering is valid for a certain type
of
memory block.

You should be able to show the Hex rendering for your memory block with
the
above steps.  (i.e. You should be able to add the memory block and see
renderings from the view.)
This is the minimum step to show memory block and the hex rendering in
the
Memory View.

To show the hex rendering in the Memory View programatically, your code
has
done most of it correctly.  I tried out your code.  I did not get null
from
#getContainer.  But since the rendering is not initialized properly, I
got
a null pointer exception when the rendering is added to the container.

IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
  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");

//DO THIS BEFORE ADDING THE RENDERING TO THE CONTAINER
        rendering.init(container, mbe);


        container.addMemoryRendering(rendering); // <-------------
null!!!
       }
       catch ...

I added the init call to the rendering and I was able to use your code
to
add the hex rendering to the Memory View.

Let me know if you still have problems.  Thanks...

Samantha







Back to the top