Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/dsf
diff options
context:
space:
mode:
authorStephen Flynn2017-03-21 12:47:15 +0000
committerStephen Flynn2017-04-05 19:08:35 +0000
commit18ce8d099f4849d9c44e6ad7bc5f0658c5e7c8fc (patch)
treec88707526b9f3eaaf0153d45ba057aff13f9e00a /dsf
parente082f06a702fe091c3a2666d83749b276bca35de (diff)
downloadorg.eclipse.cdt-18ce8d099f4849d9c44e6ad7bc5f0658c5e7c8fc.tar.gz
org.eclipse.cdt-18ce8d099f4849d9c44e6ad7bc5f0658c5e7c8fc.tar.xz
org.eclipse.cdt-18ce8d099f4849d9c44e6ad7bc5f0658c5e7c8fc.zip
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>
Diffstat (limited to 'dsf')
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java38
-rw-r--r--dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java5
2 files changed, 34 insertions, 9 deletions
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java
index fc5e50650a6..cf71de4363c 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyBackendDsf.java
@@ -214,8 +214,13 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
}
}
}
-
- result.sessionId = fDsfSessionId = dsfSessionId;
+ // 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);
- result.contextChanged = !newDisDmc.equals(oldDisDmc);
+ 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;
}
/**
diff --git a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
index fd166fa323f..822f89330c7 100644
--- a/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
+++ b/dsf/org.eclipse.cdt.dsf.ui/src/org/eclipse/cdt/dsf/debug/internal/ui/disassembly/DisassemblyPart.java
@@ -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();

Back to the top