1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 18:25:40 +02:00

Bug 309032: Need APIs to support memory pages (add ability for backend to indicate a memory space qualification is necessary)

This commit is contained in:
John Cortell 2010-05-20 15:02:31 +00:00
parent 4a6ea58842
commit 4578a2a5ca
5 changed files with 60 additions and 9 deletions

View file

@ -92,5 +92,12 @@ public interface IMemorySpaceAwareMemoryBlockRetrieval extends IMemoryBlockRetri
* if unable to retrieve the specified memory * if unable to retrieve the specified memory
*/ */
public IMemorySpaceAwareMemoryBlock getMemoryBlock(String expression, Object context, String memorySpaceID) throws DebugException; public IMemorySpaceAwareMemoryBlock getMemoryBlock(String expression, Object context, String memorySpaceID) throws DebugException;
/**
* Return true if creating a memory block with a null memory space ID is NOT
* supported. Some debuggers may not have the ability to infer the memory
* space from an expression, in which case the user should be forced to
* select a memory space when being prompted for a memory location.
*/
public boolean creatingBlockRequiresMemorySpaceID();
} }

View file

@ -473,4 +473,13 @@ public class CMemoryBlockRetrievalExtension extends PlatformObject implements IM
// Nope; use default decoding // Nope; use default decoding
return decodeAddressDefault(str); return decodeAddressDefault(str);
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#creatingBlockRequiresMemorySpaceID()
*/
public boolean creatingBlockRequiresMemorySpaceID() {
// A behavioral control we're not extending to CDI clients, but is being
// extended to DSF ones.
return false;
}
} }

View file

@ -362,4 +362,15 @@ public class GdbMemoryBlockRetrieval extends DsfMemoryBlockRetrieval implements
DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks( blocks.toArray(new IMemoryBlock[blocks.size()])); DebugPlugin.getDefault().getMemoryBlockManager().addMemoryBlocks( blocks.toArray(new IMemoryBlock[blocks.size()]));
} }
} }
/* (non-Javadoc)
* @see org.eclipse.cdt.debug.core.model.provisional.IMemorySpaceAwareMemoryBlockRetrieval#creatingBlockRequiresMemorySpaceID()
*/
public boolean creatingBlockRequiresMemorySpaceID() {
IMemorySpaces memoryPageService = (IMemorySpaces)fMemorySpaceServiceTracker.getService();
if (memoryPageService != null) {
return memoryPageService.creatingBlockRequiresMemorySpaceID();
}
return false;
}
} }

View file

@ -68,12 +68,23 @@ public interface IMemorySpaces extends IDsfService{
String getMemorySpaceId(); String getMemorySpaceId();
String getExpression(); String getExpression();
} }
/** /**
* Provides the memory spaces available in the given context. * Provides the memory spaces available in the given context.
* *
* @param ctx a DM context * @param ctx
* @param rm the asynchronous data request monitor * a DM context
* @param rm
* the asynchronous data request monitor. Returns a collection of
* memory space IDs.
*/ */
void getMemorySpaces(IDMContext context, final DataRequestMonitor<String[]> rm); void getMemorySpaces(IDMContext context, final DataRequestMonitor<String[]> rm);
/**
* Return true if creating a memory block with a null memory space ID is NOT
* supported. Some debuggers may not have the ability to infer the memory
* space from an expression, in which case the user should be forced to
* select a memory space when being prompted for a memory location.
*/
public boolean creatingBlockRequiresMemorySpaceID();
} }

View file

@ -367,11 +367,15 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
} }
private void performGo(boolean inNewTab) { private void performGo(boolean inNewTab) {
// Index zero is the 'auto' (n/a) memory space entry // Index zero is the 'auto' (n/a) memory space entry, unless the backend
// said we need to force a memory space selection
String memorySpace = null; String memorySpace = null;
if (fGotoMemorySpaceControl.isVisible() && (fGotoMemorySpaceControl.getSelectionIndex() != 0)) { if (fGotoMemorySpaceControl.isVisible()) {
memorySpace = fGotoMemorySpaceControl.getText(); memorySpace = fGotoMemorySpaceControl.getText();
assert (memorySpace != null) && (memorySpace.length() > 0); if (memorySpace.equals(NA_MEMORY_SPACE_ID)) {
memorySpace = null;
}
assert (memorySpace == null) || (memorySpace.length() > 0);
} }
String expression = fGotoAddressBar.getExpressionText(); String expression = fGotoAddressBar.getExpressionText();
@ -855,7 +859,16 @@ public class MemoryBrowser extends ViewPart implements IDebugContextListener, IM
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=309032#c50 // https://bugs.eclipse.org/bugs/show_bug.cgi?id=309032#c50
if (memorySpaces.length >= 2) { if (memorySpaces.length >= 2) {
fGotoMemorySpaceControl.setItems(memorySpaces); fGotoMemorySpaceControl.setItems(memorySpaces);
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0); //$NON-NLS-1$ the n/a entry; don't think this needs to be translated
// Add the '----' (N/A) entry unless the retrieval object
// says it requires a memory space ID in all cases
boolean addNA = true;
if (retrieval instanceof IMemorySpaceAwareMemoryBlockRetrieval) {
addNA = !((IMemorySpaceAwareMemoryBlockRetrieval)retrieval).creatingBlockRequiresMemorySpaceID();
}
if (addNA) {
fGotoMemorySpaceControl.add(NA_MEMORY_SPACE_ID, 0);
}
setMemorySpaceControlVisible(true); setMemorySpaceControlVisible(true);
} }
else { else {