mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-20 23:45:23 +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:
|
||||
* Wind River Systems - initial API and implementation
|
||||
* 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;
|
||||
|
||||
import java.math.BigInteger;
|
||||
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
|
||||
public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend {
|
||||
|
||||
protected IDisassemblyPartCallback fCallback;
|
||||
|
@ -46,4 +50,17 @@ public abstract class AbstractDisassemblyBackend implements IDisassemblyBackend
|
|||
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
|
||||
* Freescale Semiconductor - refactoring
|
||||
* 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 353351
|
||||
*******************************************************************************/
|
||||
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.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.jface.dialogs.ErrorDialog;
|
||||
import org.eclipse.jface.text.BadLocationException;
|
||||
import org.eclipse.jface.text.Position;
|
||||
|
||||
|
@ -336,11 +336,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
} else {
|
||||
final IStatus status= getStatus();
|
||||
if (status != null && !status.isOK()) {
|
||||
fCallback.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
DisassemblyBackendDsf.this.handleError(getStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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$
|
||||
|
||||
if (!suppressError) {
|
||||
fCallback.asyncExec(new Runnable() {
|
||||
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$
|
||||
}});
|
||||
DisassemblyBackendDsf.this.handleError(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$
|
||||
}
|
||||
}
|
||||
rm.setData(address);
|
||||
|
@ -981,10 +973,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
@Override
|
||||
protected void handleError() {
|
||||
if (!suppressError) {
|
||||
fCallback.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$
|
||||
}});
|
||||
DisassemblyBackendDsf.this.handleError(getStatus());
|
||||
}
|
||||
rm.setStatus(new Status(IStatus.ERROR, DsfUIPlugin.PLUGIN_ID, IDsfStatusConstants.REQUEST_FAILED, "", null)); //$NON-NLS-1$
|
||||
rm.done();
|
||||
|
@ -1043,11 +1032,7 @@ public class DisassemblyBackendDsf extends AbstractDisassemblyBackend implements
|
|||
} else {
|
||||
final IStatus status= getStatus();
|
||||
if (status != null && !status.isOK()) {
|
||||
fCallback.asyncExec(new Runnable() {
|
||||
public void run() {
|
||||
ErrorDialog.openError(fCallback.getSite().getShell(), "Error", null, getStatus()); //$NON-NLS-1$
|
||||
}
|
||||
});
|
||||
DisassemblyBackendDsf.this.handleError(getStatus());
|
||||
}
|
||||
fCallback.setUpdatePending(false);
|
||||
}
|
||||
|
|
|
@ -7,10 +7,13 @@
|
|||
*
|
||||
* Contributors:
|
||||
* Freescale Semiconductor - initial API and implementation
|
||||
* Patrick Chuong (Texas Instruments) - Bug 353351
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.dsf.debug.internal.ui.disassembly;
|
||||
|
||||
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.IAdapterFactory;
|
||||
|
||||
|
@ -22,8 +25,18 @@ public class DisassemblyBackendDsfFactory implements IAdapterFactory {
|
|||
|
||||
@SuppressWarnings("rawtypes")
|
||||
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)) {
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue