mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-21 16:05:25 +02:00
Bug 353351 - DisassemblyBackendDsf.retrieveFrameAddressInSessionThread()
shows an error message to the user if stack.getFrameData fails.
This commit is contained in:
parent
c1e775df38
commit
cffc23093a
3 changed files with 39 additions and 24 deletions
|
@ -8,12 +8,16 @@
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Freescale Semiconductor - refactoring
|
* Freescale Semiconductor - refactoring
|
||||||
* Patrick Chuong (Texas Instruments) - Bug fix (329682)
|
* Patrick Chuong (Texas Instruments) - Bug 329682
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug 353351
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
|
package org.eclipse.cdt.debug.internal.ui.disassembly.dsf;
|
||||||
|
|
||||||
import java.math.BigInteger;
|
import java.math.BigInteger;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.IStatus;
|
||||||
|
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||||
|
|
||||||
public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend {
|
public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend {
|
||||||
|
|
||||||
protected IDisassemblyPartCallback fCallback;
|
protected IDisassemblyPartCallback fCallback;
|
||||||
|
@ -46,4 +50,17 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default error handler, sub-class can override this method to provide it's own error handling.
|
||||||
|
*
|
||||||
|
* @param status
|
||||||
|
*/
|
||||||
|
protected void handleError(final IStatus status) {
|
||||||
|
fCallback.asyncExec(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, status); //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,8 +9,9 @@
|
||||||
* Wind River Systems - initial API and implementation
|
* Wind River Systems - initial API and implementation
|
||||||
* Freescale Semiconductor - refactoring
|
* Freescale Semiconductor - refactoring
|
||||||
* Patrick Chuong (Texas Instruments) - Bug 323279
|
* Patrick Chuong (Texas Instruments) - Bug 323279
|
||||||
* Patrick Chuong (Texas Instruments) - Bug fix (329682)
|
* Patrick Chuong (Texas Instruments) - Bug 329682
|
||||||
* Patrick Chuong (Texas Instruments) - Bug 328168
|
* Patrick Chuong (Texas Instruments) - Bug 328168
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug 353351
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
|
@ -67,7 +68,6 @@ import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IStatus;
|
import org.eclipse.core.runtime.IStatus;
|
||||||
import org.eclipse.core.runtime.Status;
|
import org.eclipse.core.runtime.Status;
|
||||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
|
||||||
import org.eclipse.jface.text.BadLocationException;
|
import org.eclipse.jface.text.BadLocationException;
|
||||||
import org.eclipse.jface.text.Position;
|
import org.eclipse.jface.text.Position;
|
||||||
|
|
||||||
|
@ -336,11 +336,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
} else {
|
} else {
|
||||||
final IStatus status= getStatus();
|
final IStatus status= getStatus();
|
||||||
if (status != null && !status.isOK()) {
|
if (status != null && !status.isOK()) {
|
||||||
fCallback.asyncExec(new Runnable() {
|
DisassemblyBackendDsf.this.handleError(getStatus());
|
||||||
public void run() {
|
|
||||||
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -967,12 +963,8 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
|
||||||
|
|
||||||
if (!suppressError) {
|
if (!suppressError) {
|
||||||
fCallback.asyncExec(new Runnable() {
|
DisassemblyBackendDsf.this.handleError(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
|
||||||
public void run() {
|
|
||||||
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, //$NON-NLS-1$
|
|
||||||
new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED,
|
|
||||||
DisassemblyMessages.Disassembly_log_error_expression_eval + " (" + e.getMessage() + ")", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
DisassemblyMessages.Disassembly_log_error_expression_eval + " (" + e.getMessage() + ")", null)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
rm.setData(address);
|
rm.setData(address);
|
||||||
|
@ -981,10 +973,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
@Override
|
@Override
|
||||||
protected void handleError() {
|
protected void handleError() {
|
||||||
if (!suppressError) {
|
if (!suppressError) {
|
||||||
fCallback.asyncExec(new Runnable() {
|
DisassemblyBackendDsf.this.handleError(getStatus());
|
||||||
public void run() {
|
|
||||||
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$
|
|
||||||
}});
|
|
||||||
}
|
}
|
||||||
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
|
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
|
||||||
rm.done();
|
rm.done();
|
||||||
|
@ -1043,11 +1032,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
||||||
} else {
|
} else {
|
||||||
final IStatus status= getStatus();
|
final IStatus status= getStatus();
|
||||||
if (status != null && !status.isOK()) {
|
if (status != null && !status.isOK()) {
|
||||||
fCallback.asyncExec(new Runnable() {
|
DisassemblyBackendDsf.this.handleError(getStatus());
|
||||||
public void run() {
|
|
||||||
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
fCallback.setUpdatePending(false);
|
fCallback.setUpdatePending(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,10 +7,13 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Freescale Semiconductor - initial API and implementation
|
* Freescale Semiconductor - initial API and implementation
|
||||||
|
* Patrick Chuong (Texas Instruments) - Bug 353351
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
|
import org.eclipse.cdt.debug.internal.ui.disassembly.dsf.IDisassemblyBackend;
|
||||||
|
import org.eclipse.cdt.dsf.service.DsfSession;
|
||||||
|
import org.eclipse.cdt.dsf.ui.viewmodel.datamodel.IDMVMContext;
|
||||||
import org.eclipse.core.runtime.IAdaptable;
|
import org.eclipse.core.runtime.IAdaptable;
|
||||||
import org.eclipse.core.runtime.IAdapterFactory;
|
import org.eclipse.core.runtime.IAdapterFactory;
|
||||||
|
|
||||||
|
@ -24,6 +27,16 @@ public class DisassemblyBackendDsfFactory implements IAdapterFactory {
|
||||||
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
public Object getAdapter(Object adaptableObject, Class adapterType) {
|
||||||
if (IDisassemblyBackend.class.equals(adapterType)) {
|
if (IDisassemblyBackend.class.equals(adapterType)) {
|
||||||
if (adaptableObject instanceof IAdaptable && DisassemblyBackendDsf.supportsDebugContext_((IAdaptable)adaptableObject)) {
|
if (adaptableObject instanceof IAdaptable && DisassemblyBackendDsf.supportsDebugContext_((IAdaptable)adaptableObject)) {
|
||||||
|
String sessionId = ((IDMVMContext) adaptableObject).getDMContext().getSessionId();
|
||||||
|
DsfSession session = DsfSession.getSession(sessionId);
|
||||||
|
if (session.isActive()) {
|
||||||
|
IAdapterFactory factory = (IAdapterFactory) session.getModelAdapter(IAdapterFactory.class);
|
||||||
|
if (factory != null) {
|
||||||
|
Object adapter = factory.getAdapter(adaptableObject, adapterType);
|
||||||
|
if (adapter != null)
|
||||||
|
return adapter;
|
||||||
|
}
|
||||||
|
}
|
||||||
return new DisassemblyBackendDsf();
|
return new DisassemblyBackendDsf();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue