mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-07 17:56:01 +02:00
Bug 81353, option to view disassembly when stopped in a location with no source.
This commit is contained in:
parent
c5c666a8b6
commit
1bf06a9d31
4 changed files with 98 additions and 18 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2004, 2006 QNX Software Systems and others.
|
* Copyright (c) 2004, 2006, 2007 QNX Software Systems and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -7,8 +7,9 @@
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* QNX Software Systems - Initial API and implementation
|
* QNX Software Systems - Initial API and implementation
|
||||||
* Nokia - Added support for AbsoluteSourceContainer( 159833 )
|
* Ken Ryall (Nokia) - Added support for AbsoluteSourceContainer( 159833 )
|
||||||
* Nokia - Added support for CSourceNotFoundElement ( 167305 )
|
* Ken Ryall (Nokia) - Added support for CSourceNotFoundElement ( 167305 )
|
||||||
|
* Ken Ryall (Nokia) - Option to open disassembly view when no source ( 81353 )
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
package org.eclipse.cdt.debug.internal.core.sourcelookup;
|
||||||
|
|
||||||
|
@ -69,7 +70,12 @@ public class CSourceLookupParticipant extends AbstractSourceLookupParticipant {
|
||||||
if ( frame != null ) {
|
if ( frame != null ) {
|
||||||
name = frame.getFile().trim();
|
name = frame.getFile().trim();
|
||||||
if ( name == null || name.length() == 0 )
|
if ( name == null || name.length() == 0 )
|
||||||
return new Object[] { gfNoSource };
|
{
|
||||||
|
if (object instanceof IDebugElement)
|
||||||
|
return new Object[] { new CSourceNotFoundElement( (IDebugElement) object ) };
|
||||||
|
else
|
||||||
|
return new Object[] { gfNoSource };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ( object instanceof String ) {
|
else if ( object instanceof String ) {
|
||||||
|
|
|
@ -2,7 +2,7 @@ Manifest-Version: 1.0
|
||||||
Bundle-ManifestVersion: 2
|
Bundle-ManifestVersion: 2
|
||||||
Bundle-Name: %pluginName
|
Bundle-Name: %pluginName
|
||||||
Bundle-SymbolicName: org.eclipse.cdt.debug.ui; singleton:=true
|
Bundle-SymbolicName: org.eclipse.cdt.debug.ui; singleton:=true
|
||||||
Bundle-Version: 4.0.0.qualifier
|
Bundle-Version: 4.0.1.qualifier
|
||||||
Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin
|
Bundle-Activator: org.eclipse.cdt.debug.ui.CDebugUIPlugin
|
||||||
Bundle-Vendor: %providerName
|
Bundle-Vendor: %providerName
|
||||||
Bundle-Localization: plugin
|
Bundle-Localization: plugin
|
||||||
|
|
|
@ -6,7 +6,8 @@
|
||||||
* http://www.eclipse.org/legal/epl-v10.html
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
*
|
*
|
||||||
* Contributors:
|
* Contributors:
|
||||||
* Nokia - initial API and implementation
|
* Ken Ryall (Nokia) - initial API and implementation
|
||||||
|
* Ken Ryall (Nokia) - Option to open disassembly view when no source ( 81353 )
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
|
|
||||||
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
|
package org.eclipse.cdt.debug.internal.ui.sourcelookup;
|
||||||
|
@ -20,6 +21,8 @@ import org.eclipse.cdt.debug.core.sourcelookup.MappingSourceContainer;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.CSourceNotFoundElement;
|
||||||
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
|
import org.eclipse.cdt.debug.internal.core.sourcelookup.MapEntrySourceContainer;
|
||||||
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
import org.eclipse.cdt.debug.internal.ui.ICDebugHelpContextIds;
|
||||||
|
import org.eclipse.cdt.debug.ui.ICDebugUIConstants;
|
||||||
|
import org.eclipse.cdt.ui.CUIPlugin;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
import org.eclipse.core.runtime.Path;
|
||||||
|
@ -33,6 +36,7 @@ import org.eclipse.debug.core.model.ISourceLocator;
|
||||||
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
|
||||||
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
import org.eclipse.debug.core.sourcelookup.ISourceContainer;
|
||||||
import org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor;
|
import org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditor;
|
||||||
|
import org.eclipse.debug.ui.sourcelookup.CommonSourceNotFoundEditorInput;
|
||||||
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
|
import org.eclipse.debug.ui.sourcelookup.ISourceDisplay;
|
||||||
import org.eclipse.swt.SWT;
|
import org.eclipse.swt.SWT;
|
||||||
import org.eclipse.swt.events.SelectionAdapter;
|
import org.eclipse.swt.events.SelectionAdapter;
|
||||||
|
@ -42,7 +46,7 @@ import org.eclipse.swt.widgets.Button;
|
||||||
import org.eclipse.swt.widgets.Composite;
|
import org.eclipse.swt.widgets.Composite;
|
||||||
import org.eclipse.swt.widgets.FileDialog;
|
import org.eclipse.swt.widgets.FileDialog;
|
||||||
import org.eclipse.ui.IEditorInput;
|
import org.eclipse.ui.IEditorInput;
|
||||||
import org.eclipse.ui.IEditorSite;
|
import org.eclipse.ui.IViewReference;
|
||||||
import org.eclipse.ui.IWorkbenchPage;
|
import org.eclipse.ui.IWorkbenchPage;
|
||||||
import org.eclipse.ui.PartInitException;
|
import org.eclipse.ui.PartInitException;
|
||||||
import org.eclipse.ui.PlatformUI;
|
import org.eclipse.ui.PlatformUI;
|
||||||
|
@ -60,6 +64,12 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
private ILaunch launch;
|
private ILaunch launch;
|
||||||
private IDebugElement context;
|
private IDebugElement context;
|
||||||
|
|
||||||
|
private Button disassemblyButton;
|
||||||
|
|
||||||
|
private Button locateFileButton;
|
||||||
|
|
||||||
|
private Button editLookupButton;
|
||||||
|
|
||||||
public CSourceNotFoundEditor() {
|
public CSourceNotFoundEditor() {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
|
@ -69,9 +79,10 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ICDebugHelpContextIds.SOURCE_NOT_FOUND);
|
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, ICDebugHelpContextIds.SOURCE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void init(IEditorSite site, IEditorInput input) throws PartInitException {
|
public void setInput(IEditorInput input) {
|
||||||
super.init(site, input);
|
if (input instanceof CommonSourceNotFoundEditorInput)
|
||||||
Object artifact = this.getArtifact();
|
{
|
||||||
|
Object artifact = ((CommonSourceNotFoundEditorInput)input).getArtifact();
|
||||||
if (artifact instanceof CSourceNotFoundElement)
|
if (artifact instanceof CSourceNotFoundElement)
|
||||||
{
|
{
|
||||||
CSourceNotFoundElement element = (CSourceNotFoundElement) artifact;
|
CSourceNotFoundElement element = (CSourceNotFoundElement) artifact;
|
||||||
|
@ -81,31 +92,90 @@ public class CSourceNotFoundEditor extends CommonSourceNotFoundEditor {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
missingFile = ""; //$NON-NLS-1$
|
missingFile = ""; //$NON-NLS-1$
|
||||||
|
}
|
||||||
|
super.setInput(input);
|
||||||
|
syncButtons();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void syncButtons() {
|
||||||
|
|
||||||
|
if (locateFileButton != null)
|
||||||
|
locateFileButton.setVisible(missingFile.length() > 0);
|
||||||
|
if (editLookupButton != null)
|
||||||
|
editLookupButton.setVisible(missingFile.length() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected String getText() {
|
protected String getText() {
|
||||||
if (missingFile.length() > 0) {
|
if (missingFile.length() > 0) {
|
||||||
return MessageFormat.format(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.0" ), new String[] { missingFile }); //$NON-NLS-1$
|
return MessageFormat.format(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.0" ), new String[] { missingFile }); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
return super.getText();
|
else {
|
||||||
|
if (context == null)
|
||||||
|
return super.getText();
|
||||||
|
return MessageFormat.format(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.3" ), new String[] { context.toString() }); //$NON-NLS-1$
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void createButtons(Composite parent) {
|
protected void createButtons(Composite parent) {
|
||||||
if (missingFile.length() > 0) {
|
|
||||||
|
|
||||||
|
{
|
||||||
GridData data;
|
GridData data;
|
||||||
Button button = new Button(parent, SWT.PUSH);
|
disassemblyButton = new Button(parent, SWT.PUSH);
|
||||||
data = new GridData();
|
data = new GridData();
|
||||||
data.grabExcessHorizontalSpace = false;
|
data.grabExcessHorizontalSpace = false;
|
||||||
data.grabExcessVerticalSpace = false;
|
data.grabExcessVerticalSpace = false;
|
||||||
button.setLayoutData(data);
|
disassemblyButton.setLayoutData(data);
|
||||||
button.setText(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.1" )); //$NON-NLS-1$
|
disassemblyButton.setText(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.4" )); //$NON-NLS-1$
|
||||||
button.addSelectionListener(new SelectionAdapter() {
|
disassemblyButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
|
viewDisassembly();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
GridData data;
|
||||||
|
locateFileButton = new Button(parent, SWT.PUSH);
|
||||||
|
data = new GridData();
|
||||||
|
data.grabExcessHorizontalSpace = false;
|
||||||
|
data.grabExcessVerticalSpace = false;
|
||||||
|
locateFileButton.setLayoutData(data);
|
||||||
|
locateFileButton.setText(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.1" )); //$NON-NLS-1$
|
||||||
|
locateFileButton.addSelectionListener(new SelectionAdapter() {
|
||||||
public void widgetSelected(SelectionEvent evt) {
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
locateFile();
|
locateFile();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
super.createButtons(parent);
|
|
||||||
|
{
|
||||||
|
GridData data;
|
||||||
|
editLookupButton = new Button(parent, SWT.PUSH);
|
||||||
|
data = new GridData();
|
||||||
|
data.grabExcessHorizontalSpace = false;
|
||||||
|
data.grabExcessVerticalSpace = false;
|
||||||
|
editLookupButton.setLayoutData(data);
|
||||||
|
editLookupButton.setText(SourceLookupUIMessages.getString( "CSourceNotFoundEditor.5" ));
|
||||||
|
editLookupButton.addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent evt) {
|
||||||
|
editSourceLookupPath();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
syncButtons();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void viewDisassembly() {
|
||||||
|
IWorkbenchPage page = CUIPlugin.getActivePage();
|
||||||
|
if (page != null) {
|
||||||
|
try {
|
||||||
|
page.showView(ICDebugUIConstants.ID_DISASSEMBLY_VIEW);
|
||||||
|
} catch (PartInitException e) {}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSourceMapping(IPath missingPath, IPath newSourcePath) throws CoreException {
|
private void addSourceMapping(IPath missingPath, IPath newSourcePath) throws CoreException {
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
#
|
#
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# QNX Software Systems - initial API and implementation
|
# QNX Software Systems - initial API and implementation
|
||||||
# Nokia - Added support for CSourceNotFoundElement ( 167305 )
|
# Ken Ryall (Nokia) - Added support for CSourceNotFoundElement ( 167305 )
|
||||||
|
# Ken Ryall (Nokia) - Option to open disassembly view when no source ( 81353 )
|
||||||
###############################################################################
|
###############################################################################
|
||||||
AddContainerAction.0=&Add...
|
AddContainerAction.0=&Add...
|
||||||
AddSourceContainerDialog.0=Add Source
|
AddSourceContainerDialog.0=Add Source
|
||||||
|
@ -38,3 +39,6 @@ UpAction.0=U&p
|
||||||
CSourceNotFoundEditor.0=Can''t find a source file at \"{0}\" \nLocate the file or edit the source lookup path to include its location.
|
CSourceNotFoundEditor.0=Can''t find a source file at \"{0}\" \nLocate the file or edit the source lookup path to include its location.
|
||||||
CSourceNotFoundEditor.1=Locate File...
|
CSourceNotFoundEditor.1=Locate File...
|
||||||
CSourceNotFoundEditor.2=Missing Source File
|
CSourceNotFoundEditor.2=Missing Source File
|
||||||
|
CSourceNotFoundEditor.3=No source available for \"{0}\" \n
|
||||||
|
CSourceNotFoundEditor.4=View Disassembly...
|
||||||
|
CSourceNotFoundEditor.5=Edit Source Lookup Path...
|
||||||
|
|
Loading…
Add table
Reference in a new issue