mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 14:42:11 +02:00
[Bug 304563] Memory Browser: address space awareness
This commit is contained in:
parent
742e7dfe92
commit
cafa75507d
1 changed files with 53 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2009 Wind River Systems, Inc. and others.
|
* Copyright (c) 2009-2010 Wind River Systems, Inc. and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,6 +7,7 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
|
||||||
|
* Ted R Williams (Mentor Graphics, Inc.) - address space enhancements
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.ui.memory.memorybrowser;
|
package org.eclipse.cdt.debug.ui.memory.memorybrowser;
|
||||||
|
@ -81,6 +82,7 @@ import org.eclipse.swt.graphics.Color;
|
||||||
import org.eclipse.swt.layout.FormAttachment;
|
import org.eclipse.swt.layout.FormAttachment;
|
||||||
import org.eclipse.swt.layout.FormData;
|
import org.eclipse.swt.layout.FormData;
|
||||||
import org.eclipse.swt.layout.FormLayout;
|
import org.eclipse.swt.layout.FormLayout;
|
||||||
|
import org.eclipse.swt.widgets.Combo;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.Control;
|
import org.eclipse.swt.widgets.Control;
|
||||||
import org.eclipse.swt.widgets.Display;
|
import org.eclipse.swt.widgets.Display;
|
||||||
|
@ -117,6 +119,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
private HashMap<Object,CTabFolder> fContextFolders = new HashMap<Object,CTabFolder> ();
|
private HashMap<Object,CTabFolder> fContextFolders = new HashMap<Object,CTabFolder> ();
|
||||||
private GoToAddressBarWidget fGotoAddressBar;
|
private GoToAddressBarWidget fGotoAddressBar;
|
||||||
private Control fGotoAddressBarControl;
|
private Control fGotoAddressBarControl;
|
||||||
|
private Combo fGotoAddressSpaceControl;
|
||||||
private Label fUnsupportedLabel;
|
private Label fUnsupportedLabel;
|
||||||
private Composite fMainComposite;
|
private Composite fMainComposite;
|
||||||
private String defaultRenderingTypeId = null;
|
private String defaultRenderingTypeId = null;
|
||||||
|
@ -128,6 +131,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
private final static String KEY_MEMORY_BLOCK = "MEMORY"; //$NON-NLS-1$
|
private final static String KEY_MEMORY_BLOCK = "MEMORY"; //$NON-NLS-1$
|
||||||
private final static String KEY_RETRIEVAL = "RETRIEVAL"; //$NON-NLS-1$
|
private final static String KEY_RETRIEVAL = "RETRIEVAL"; //$NON-NLS-1$
|
||||||
private final static String KEY_CONTAINER = "CONTAINER"; //$NON-NLS-1$
|
private final static String KEY_CONTAINER = "CONTAINER"; //$NON-NLS-1$
|
||||||
|
private final static String KEY_ADDRESS_SPACE_PREFIXES = "ADDRESSSPACEPREFIXES"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static final String PREF_DEFAULT_RENDERING = "org.eclipse.cdt.debug.ui.memory.memorybrowser.defaultRendering"; //$NON-NLS-1$
|
public static final String PREF_DEFAULT_RENDERING = "org.eclipse.cdt.debug.ui.memory.memorybrowser.defaultRendering"; //$NON-NLS-1$
|
||||||
|
|
||||||
|
@ -173,6 +177,8 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
layout.spacing = 0;
|
layout.spacing = 0;
|
||||||
fMainComposite.setLayout(layout);
|
fMainComposite.setLayout(layout);
|
||||||
|
|
||||||
|
fGotoAddressSpaceControl = new Combo(fMainComposite, SWT.DROP_DOWN | SWT.READ_ONLY);
|
||||||
|
|
||||||
fGotoAddressBar = new GoToAddressBarWidget();
|
fGotoAddressBar = new GoToAddressBarWidget();
|
||||||
fGotoAddressBarControl = fGotoAddressBar.createControl(fMainComposite);
|
fGotoAddressBarControl = fGotoAddressBar.createControl(fMainComposite);
|
||||||
|
|
||||||
|
@ -197,9 +203,10 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
FormData data = new FormData();
|
FormData data = new FormData();
|
||||||
data.top = new FormAttachment(0);
|
data.top = new FormAttachment(0);
|
||||||
data.left = new FormAttachment(0);
|
data.left = new FormAttachment(fGotoAddressSpaceControl);
|
||||||
data.right = new FormAttachment(100);
|
data.right = new FormAttachment(100);
|
||||||
fGotoAddressBarControl.setLayoutData(data);
|
fGotoAddressBarControl.setLayoutData(data);
|
||||||
|
|
||||||
|
@ -312,6 +319,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
{
|
{
|
||||||
fStackLayout.topControl = fUnsupportedLabel;
|
fStackLayout.topControl = fUnsupportedLabel;
|
||||||
fGotoAddressBarControl.setVisible(false);
|
fGotoAddressBarControl.setVisible(false);
|
||||||
|
fGotoAddressSpaceControl.setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void performGo(boolean inNewTab)
|
private void performGo(boolean inNewTab)
|
||||||
|
@ -337,7 +345,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
}
|
}
|
||||||
|
|
||||||
final IRepositionableMemoryRendering rendering = (IRepositionableMemoryRendering) activeFolder.getSelection().getData(KEY_RENDERING);
|
final IRepositionableMemoryRendering rendering = (IRepositionableMemoryRendering) activeFolder.getSelection().getData(KEY_RENDERING);
|
||||||
final String gotoExpression = expression;
|
final String gotoExpression = getAddressSpacePrefix() + expression;
|
||||||
|
|
||||||
if(retrieval instanceof IMemoryBlockRetrievalExtension)
|
if(retrieval instanceof IMemoryBlockRetrievalExtension)
|
||||||
{
|
{
|
||||||
|
@ -365,6 +373,16 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getAddressSpacePrefix()
|
||||||
|
{
|
||||||
|
String prefixes[] = (String[]) fGotoAddressSpaceControl.getData(KEY_ADDRESS_SPACE_PREFIXES);
|
||||||
|
if(prefixes.length > 0)
|
||||||
|
{
|
||||||
|
return prefixes[fGotoAddressSpaceControl.getSelectionIndex()];
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
// MemoryBrowser.FailedToGoToAddressTitle=Unable to Go To specified address
|
// MemoryBrowser.FailedToGoToAddressTitle=Unable to Go To specified address
|
||||||
// MemoryBrowser.UnableToEvaluateAddress
|
// MemoryBrowser.UnableToEvaluateAddress
|
||||||
|
|
||||||
|
@ -387,6 +405,28 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
tab.setText(label);
|
tab.setText(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* fetch memory spaces for a given IMemoryBlockRetrieval
|
||||||
|
* @param retrieval memory block retrieval.
|
||||||
|
* @return two arrays, the first containing memory space mnemonics, the second containing associated expression prefixes
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String[][] getAddressSpaces(IMemoryBlockRetrieval retrieval)
|
||||||
|
{
|
||||||
|
// would like to avoid using reflection, but necessary interface additions should live in platform to avoid introducing dependencies.
|
||||||
|
|
||||||
|
String[][] addressSpaceTitles = new String[0][0];
|
||||||
|
try {
|
||||||
|
Method m = retrieval.getClass().getMethod("getAddressSpaces", new Class[0]); //$NON-NLS-1$
|
||||||
|
if(m != null)
|
||||||
|
addressSpaceTitles = (String[][]) m.invoke(retrieval, new Object[0]);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
return addressSpaceTitles;
|
||||||
|
}
|
||||||
|
|
||||||
private CTabFolder createTabFolder(Composite parent)
|
private CTabFolder createTabFolder(Composite parent)
|
||||||
{
|
{
|
||||||
final CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT);
|
final CTabFolder folder = new CTabFolder(parent, SWT.NO_REDRAW_RESIZE | SWT.NO_TRIM | SWT.FLAT);
|
||||||
|
@ -560,6 +600,15 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
if(retrieval != null && launch != null && !launch.isTerminated())
|
if(retrieval != null && launch != null && !launch.isTerminated())
|
||||||
{
|
{
|
||||||
fGotoAddressBarControl.setVisible(true);
|
fGotoAddressBarControl.setVisible(true);
|
||||||
|
String addressSpaces[][] = getAddressSpaces(retrieval);
|
||||||
|
if(addressSpaces[0].length > 0)
|
||||||
|
{
|
||||||
|
fGotoAddressSpaceControl.setVisible(true);
|
||||||
|
fGotoAddressSpaceControl.setItems(addressSpaces[0]);
|
||||||
|
fGotoAddressSpaceControl.setData(KEY_ADDRESS_SPACE_PREFIXES, addressSpaces[1]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fGotoAddressSpaceControl.setVisible(false);
|
||||||
CTabFolder tabFolder = getTabFolder(retrieval);
|
CTabFolder tabFolder = getTabFolder(retrieval);
|
||||||
if(tabFolder != null)
|
if(tabFolder != null)
|
||||||
{
|
{
|
||||||
|
@ -591,6 +640,7 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
|
||||||
{
|
{
|
||||||
handleUnsupportedSelection();
|
handleUnsupportedSelection();
|
||||||
}
|
}
|
||||||
|
fGotoAddressSpaceControl.pack(true);
|
||||||
fStackLayout.topControl.getParent().layout(true);
|
fStackLayout.topControl.getParent().layout(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue