mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +02:00
Bug 510879: Remove requirement for suspended context in Disassembly View
Allow disassembled code to be displayed even while a running thread is selected. Switching from a suspended to a live thread does not clear the view. To initially get the disassembled code, a suspended context is required. Move the check for a frame context to the backend, allowing extenders to provide custom symbol lookup by overriding DisassemblyBackendDsf#evaluateAddressExpression. Overriding this method to provide custom lookup also allows fetching disassembled code from a live thread. Edit: Make Disassembly message consistent so that prior to selecting a suspended context the view shows 'No Debug Context'. After selecting a suspended context disassembly is shown for all nodes except launch. Change-Id: I42c54b179b5dacc16f7a5e04a83ddb973ccc6dde Signed-off-by: Stephen Flynn <stephen.flynn@dell.com>
This commit is contained in:
parent
e082f06a70
commit
18ce8d099f
3 changed files with 35 additions and 10 deletions
|
@ -80,7 +80,7 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
|
|||
|
||||
@Override
|
||||
public boolean canDisassemble() {
|
||||
return isSuspended();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -214,8 +214,13 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Ensures the view will display 'No Debug Context'
|
||||
if (fTargetFrameContext != null) {
|
||||
result.sessionId = fDsfSessionId = dsfSessionId;
|
||||
} else {
|
||||
fDsfSessionId = dsfSessionId;
|
||||
result.sessionId = null;
|
||||
}
|
||||
if (fServicesTracker != null) {
|
||||
fServicesTracker.dispose();
|
||||
}
|
||||
|
@ -242,9 +247,16 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
IFrameDMContext frame= (IFrameDMContext) dmContext;
|
||||
IExecutionDMContext newExeDmc = DMContexts.getAncestorOfType(frame, IExecutionDMContext.class);
|
||||
if (newExeDmc != null) {
|
||||
IDisassemblyDMContext newDisDmc = DMContexts.getAncestorOfType(newExeDmc, IDisassemblyDMContext.class);
|
||||
IDisassemblyDMContext oldDisDmc = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
|
||||
if (fTargetFrameContext != null) {
|
||||
IDisassemblyDMContext newDisDmc = DMContexts.getAncestorOfType(newExeDmc,
|
||||
IDisassemblyDMContext.class);
|
||||
IDisassemblyDMContext oldDisDmc = DMContexts.getAncestorOfType(fTargetContext,
|
||||
IDisassemblyDMContext.class);
|
||||
result.contextChanged = !newDisDmc.equals(oldDisDmc);
|
||||
} else {
|
||||
// If switching from a thread node to a frame node
|
||||
result.contextChanged = true;
|
||||
}
|
||||
fTargetContext= newExeDmc;
|
||||
fTargetFrameContext= frame;
|
||||
if (!result.contextChanged) {
|
||||
|
@ -255,10 +267,15 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
fTargetFrameContext = null;
|
||||
result.contextChanged = true;
|
||||
}
|
||||
} else if (dmContext instanceof IExecutionDMContext) {
|
||||
// When switching to and between thread and application nodes.
|
||||
result.sessionId = null;
|
||||
result.contextChanged = false;
|
||||
fTargetContext = (IExecutionDMContext) dmContext;
|
||||
fTargetFrameContext = null;
|
||||
} else if (dmContext.equals(fTargetContext) && canDisassemble()) {
|
||||
result.contextChanged = false;
|
||||
result.sessionId = fDsfSessionId;
|
||||
|
||||
} else {
|
||||
fTargetContext = null;
|
||||
fTargetFrameContext = null;
|
||||
|
@ -976,6 +993,9 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
*/
|
||||
@Override
|
||||
public void gotoSymbol(final String symbol) {
|
||||
if (!hasFrameContext()) {
|
||||
return;
|
||||
}
|
||||
evaluateAddressExpression(symbol, false, new DataRequestMonitor<BigInteger>(getSession().getExecutor(), null) {
|
||||
@Override
|
||||
protected void handleSuccess() {
|
||||
|
@ -997,6 +1017,10 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
*/
|
||||
@Override
|
||||
public BigInteger evaluateAddressExpression(final String symbol, final boolean suppressError) {
|
||||
// Without a suspended context, using the expressions service is pointless.
|
||||
if (!hasFrameContext()) {
|
||||
return null;
|
||||
}
|
||||
Query<BigInteger> query = new Query<BigInteger>() {
|
||||
@Override
|
||||
protected void execute(DataRequestMonitor<BigInteger> rm) {
|
||||
|
@ -1293,7 +1317,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
* @return
|
||||
*/
|
||||
protected boolean canDisassembleContext(IDMContext context) {
|
||||
return context instanceof IFrameDMContext;
|
||||
return DMContexts.getAncestorOfType(context, IExecutionDMContext.class) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1448,7 +1448,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
*/
|
||||
@Override
|
||||
public final void gotoSymbol(final String symbol) {
|
||||
if (!fActive || fBackend == null || !fBackend.hasFrameContext()) {
|
||||
if (!fActive || fBackend == null) {
|
||||
return;
|
||||
}
|
||||
fBackend.gotoSymbol(symbol);
|
||||
|
@ -1525,7 +1525,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
if (!fActive || fUpdatePending || fViewer == null || fDebugSessionId == null) {
|
||||
return;
|
||||
}
|
||||
if (fBackend == null || !fBackend.hasDebugContext() || !fBackend.canDisassemble() || fFrameAddress == PC_UNKNOWN) {
|
||||
|
||||
if (fBackend == null || !fBackend.hasDebugContext() || !fBackend.canDisassemble()) {
|
||||
return;
|
||||
}
|
||||
StyledText styledText = fViewer.getTextWidget();
|
||||
|
|
Loading…
Add table
Reference in a new issue