mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 14:12:10 +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
|
@Override
|
||||||
public boolean canDisassemble() {
|
public boolean canDisassemble() {
|
||||||
return isSuspended();
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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;
|
result.sessionId = fDsfSessionId = dsfSessionId;
|
||||||
|
} else {
|
||||||
|
fDsfSessionId = dsfSessionId;
|
||||||
|
result.sessionId = null;
|
||||||
|
}
|
||||||
if (fServicesTracker != null) {
|
if (fServicesTracker != null) {
|
||||||
fServicesTracker.dispose();
|
fServicesTracker.dispose();
|
||||||
}
|
}
|
||||||
|
@ -242,9 +247,16 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
IFrameDMContext frame= (IFrameDMContext) dmContext;
|
IFrameDMContext frame= (IFrameDMContext) dmContext;
|
||||||
IExecutionDMContext newExeDmc = DMContexts.getAncestorOfType(frame, IExecutionDMContext.class);
|
IExecutionDMContext newExeDmc = DMContexts.getAncestorOfType(frame, IExecutionDMContext.class);
|
||||||
if (newExeDmc != null) {
|
if (newExeDmc != null) {
|
||||||
IDisassemblyDMContext newDisDmc = DMContexts.getAncestorOfType(newExeDmc, IDisassemblyDMContext.class);
|
if (fTargetFrameContext != null) {
|
||||||
IDisassemblyDMContext oldDisDmc = DMContexts.getAncestorOfType(fTargetContext, IDisassemblyDMContext.class);
|
IDisassemblyDMContext newDisDmc = DMContexts.getAncestorOfType(newExeDmc,
|
||||||
|
IDisassemblyDMContext.class);
|
||||||
|
IDisassemblyDMContext oldDisDmc = DMContexts.getAncestorOfType(fTargetContext,
|
||||||
|
IDisassemblyDMContext.class);
|
||||||
result.contextChanged = !newDisDmc.equals(oldDisDmc);
|
result.contextChanged = !newDisDmc.equals(oldDisDmc);
|
||||||
|
} else {
|
||||||
|
// If switching from a thread node to a frame node
|
||||||
|
result.contextChanged = true;
|
||||||
|
}
|
||||||
fTargetContext= newExeDmc;
|
fTargetContext= newExeDmc;
|
||||||
fTargetFrameContext= frame;
|
fTargetFrameContext= frame;
|
||||||
if (!result.contextChanged) {
|
if (!result.contextChanged) {
|
||||||
|
@ -255,10 +267,15 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
fTargetFrameContext = null;
|
fTargetFrameContext = null;
|
||||||
result.contextChanged = true;
|
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()) {
|
} else if (dmContext.equals(fTargetContext) && canDisassemble()) {
|
||||||
result.contextChanged = false;
|
result.contextChanged = false;
|
||||||
result.sessionId = fDsfSessionId;
|
result.sessionId = fDsfSessionId;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
fTargetContext = null;
|
fTargetContext = null;
|
||||||
fTargetFrameContext = null;
|
fTargetFrameContext = null;
|
||||||
|
@ -976,6 +993,9 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void gotoSymbol(final String symbol) {
|
public void gotoSymbol(final String symbol) {
|
||||||
|
if (!hasFrameContext()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
evaluateAddressExpression(symbol, false, new DataRequestMonitor<BigInteger>(getSession().getExecutor(), null) {
|
evaluateAddressExpression(symbol, false, new DataRequestMonitor<BigInteger>(getSession().getExecutor(), null) {
|
||||||
@Override
|
@Override
|
||||||
protected void handleSuccess() {
|
protected void handleSuccess() {
|
||||||
|
@ -997,6 +1017,10 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public BigInteger evaluateAddressExpression(final String symbol, final boolean suppressError) {
|
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>() {
|
Query<BigInteger> query = new Query<BigInteger>() {
|
||||||
@Override
|
@Override
|
||||||
protected void execute(DataRequestMonitor<BigInteger> rm) {
|
protected void execute(DataRequestMonitor<BigInteger> rm) {
|
||||||
|
@ -1293,7 +1317,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
protected boolean canDisassembleContext(IDMContext context) {
|
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
|
@Override
|
||||||
public final void gotoSymbol(final String symbol) {
|
public final void gotoSymbol(final String symbol) {
|
||||||
if (!fActive || fBackend == null || !fBackend.hasFrameContext()) {
|
if (!fActive || fBackend == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
fBackend.gotoSymbol(symbol);
|
fBackend.gotoSymbol(symbol);
|
||||||
|
@ -1525,7 +1525,8 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
||||||
if (!fActive || fUpdatePending || fViewer == null || fDebugSessionId == null) {
|
if (!fActive || fUpdatePending || fViewer == null || fDebugSessionId == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (fBackend == null || !fBackend.hasDebugContext() || !fBackend.canDisassemble() || fFrameAddress == PC_UNKNOWN) {
|
|
||||||
|
if (fBackend == null || !fBackend.hasDebugContext() || !fBackend.canDisassemble()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
StyledText styledText = fViewer.getTextWidget();
|
StyledText styledText = fViewer.getTextWidget();
|
||||||
|
|
Loading…
Add table
Reference in a new issue