mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-23 06:32:10 +02:00
Bug 118894: Allow stopping at other locations other than main(). Applied patch from Ken Ryall (Nokia).
This commit is contained in:
parent
037c32a015
commit
f96f4300b0
6 changed files with 69 additions and 8 deletions
|
@ -1,3 +1,9 @@
|
|||
2006-01-29 Mikhail Khodjaiants
|
||||
Bug 118894: Allow stopping at other locations other than main().
|
||||
Applied patch from Ken Ryall (Nokia).
|
||||
* ICDTLaunchConfigurationConstants.java
|
||||
* CDebugTarget.java
|
||||
|
||||
2006-01-23 Mikhail Khodjaiants
|
||||
Bug 119683: long messages during launch cause gdb to timeout, launch to fail.
|
||||
New "createSession" method accepts File instead of IBinaryObject.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.core;
|
||||
|
||||
|
@ -104,6 +105,12 @@ public interface ICDTLaunchConfigurationConstants {
|
|||
*/
|
||||
public static final String ATTR_DEBUGGER_STOP_AT_MAIN = CDT_LAUNCH_ID + ".DEBUGGER_STOP_AT_MAIN"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute key. The value is a String specifying
|
||||
* the symbol to use for the main breakpoint.
|
||||
*/
|
||||
public static final String ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL = CDT_LAUNCH_ID + ".DEBUGGER_STOP_AT_MAIN_SYMBOL"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute key. The value is a String specifying
|
||||
* the register groups memento.
|
||||
|
@ -172,6 +179,12 @@ public interface ICDTLaunchConfigurationConstants {
|
|||
*/
|
||||
public static boolean DEBUGGER_STOP_AT_MAIN_DEFAULT = true;
|
||||
|
||||
/**
|
||||
* Launch configuration attribute value. The key is
|
||||
* DEBUGGER_STOP_AT_MAIN_SYMBOL.
|
||||
*/
|
||||
public static String DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT = "main"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* Launch configuration attribute value. The key is
|
||||
* ATTR_DEBUGGER_START_MODE. Startup debugger running the program.
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.debug.internal.core.model;
|
||||
|
||||
|
@ -25,6 +26,7 @@ import org.eclipse.cdt.debug.core.CDIDebugModel;
|
|||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||
import org.eclipse.cdt.debug.core.CDebugUtils;
|
||||
import org.eclipse.cdt.debug.core.DebugCoreMessages;
|
||||
import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
||||
import org.eclipse.cdt.debug.core.ICDebugConstants;
|
||||
import org.eclipse.cdt.debug.core.ICGlobalVariableManager;
|
||||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
|
@ -864,9 +866,16 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
|||
if ( !canRestart() ) {
|
||||
return;
|
||||
}
|
||||
changeState( CDebugElementState.RESTARTING );
|
||||
ICDILocation location = getCDITarget().createFunctionLocation( "", "main" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||
try {
|
||||
mainSymbol = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||
}
|
||||
catch( CoreException e ) {
|
||||
requestFailed( e.getMessage(), e );
|
||||
}
|
||||
ICDILocation location = getCDITarget().createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$
|
||||
setInternalTemporaryBreakpoint( location );
|
||||
changeState( CDebugElementState.RESTARTING );
|
||||
try {
|
||||
getCDITarget().restart();
|
||||
}
|
||||
|
@ -1691,11 +1700,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
|||
}
|
||||
|
||||
protected void stopInMain() throws DebugException {
|
||||
ICDILocation location = getCDITarget().createFunctionLocation( "", "main" ); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
String mainSymbol = new String( ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||
try {
|
||||
mainSymbol = getLaunch().getLaunchConfiguration().getAttribute( ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT );
|
||||
ICDILocation location = getCDITarget().createFunctionLocation( "", mainSymbol ); //$NON-NLS-1$
|
||||
setInternalTemporaryBreakpoint( location );
|
||||
}
|
||||
catch( DebugException e ) {
|
||||
catch( CoreException e ) {
|
||||
String message = MessageFormat.format( DebugCoreMessages.getString( "CDebugModel.0" ), new String[]{ e.getStatus().getMessage() } ); //$NON-NLS-1$
|
||||
IStatus newStatus = new Status( IStatus.WARNING, e.getStatus().getPlugin(), ICDebugInternalConstants.STATUS_CODE_QUESTION, message, null );
|
||||
if ( !CDebugUtils.question( newStatus, this ) ) {
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
2006-01-29 Mikhail Khodjaiants
|
||||
Bug 118894: Allow stopping at other locations other than main().
|
||||
Applied patch from Ken Ryall (Nokia).
|
||||
* LaunchMessages.properties
|
||||
* CDebuggerTab.java
|
||||
|
||||
2006-01-25 Mikhail Khodjaiants
|
||||
Reversing changes made to fix bug 107571. The fix for bug 119683 covers this problem too.
|
||||
Inferior process shouldn't be shown as a part of the attach session.
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
# Contributors:
|
||||
# QNX Software Systems - Initial API and implementation
|
||||
# Monta Vista - Joanne Woo - Bug 87556
|
||||
# Nokia - Ken Ryall - Bug 118894
|
||||
###############################################################################
|
||||
|
||||
AbstractCLaunchDelegate.Debugger_not_installed=CDT Debugger not installed
|
||||
|
@ -94,8 +95,9 @@ CMainTab.UseTerminal=Connect process input && output to a terminal.
|
|||
CMainTab.Program_is_not_a_recongnized_executable=Program is not a recognized executable.
|
||||
|
||||
CDebuggerTab.Advanced_Options_Dialog_Title=Advanced Options
|
||||
CDebuggerTab.Stop_at_main_on_startup=Stop at main() on startup
|
||||
CDebuggerTab.Stop_at_main_on_startup=Stop on startup at:
|
||||
CDebuggerTab.Automatically_track_values_of=Automatically track the values of
|
||||
CDebuggerTab.Stop_on_startup_at_can_not_be_empty=The "Stop on startup at" field can not be empty.
|
||||
CDebuggerTab.Debugger_Options=Debugger Options
|
||||
CDebuggerTab.Mode_not_supported=Mode ''{0}'' is not supported by selected debugger
|
||||
CDebuggerTab.Advanced=Advanced...
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
*
|
||||
* Contributors:
|
||||
* QNX Software Systems - Initial API and implementation
|
||||
* Ken Ryall (Nokia) - https://bugs.eclipse.org/bugs/show_bug.cgi?id=118894
|
||||
*******************************************************************************/
|
||||
package org.eclipse.cdt.launch.ui;
|
||||
|
||||
|
@ -37,6 +38,8 @@ import org.eclipse.debug.core.ILaunchConfiguration;
|
|||
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.ModifyEvent;
|
||||
import org.eclipse.swt.events.ModifyListener;
|
||||
import org.eclipse.swt.events.SelectionAdapter;
|
||||
import org.eclipse.swt.events.SelectionEvent;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
|
@ -46,6 +49,7 @@ import org.eclipse.swt.widgets.Composite;
|
|||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Group;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
|
||||
public class CDebuggerTab extends AbstractCDebuggerTab {
|
||||
|
||||
|
@ -119,6 +123,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
|
||||
protected Button fAdvancedButton;
|
||||
protected Button fStopInMain;
|
||||
protected Text fStopInMainSymbol;
|
||||
protected Button fAttachButton;
|
||||
|
||||
private Map fAdvancedAttributes = new HashMap(5);
|
||||
|
@ -221,8 +226,8 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_ATTACH);
|
||||
} else {
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN, fStopInMain.getSelection());
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL, fStopInMainSymbol.getText());
|
||||
config.setAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_START_MODE, ICDTLaunchConfigurationConstants.DEBUGGER_MODE_RUN);
|
||||
}
|
||||
applyAdvancedAttributes(config);
|
||||
}
|
||||
|
@ -239,6 +244,11 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
setErrorMessage(MessageFormat.format(LaunchMessages.getString("CDebuggerTab.Mode_not_supported"), new String[]{mode})); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
String mainSymbol = fStopInMainSymbol.getText().trim();
|
||||
if (fStopInMain.getSelection() && mainSymbol.length() == 0) {
|
||||
setErrorMessage( LaunchMessages.getString("CDebuggerTab.Stop_on_startup_at_can_not_be_empty")); //$NON-NLS-1$
|
||||
return false;
|
||||
}
|
||||
if (super.isValid(config) == false) {
|
||||
return false;
|
||||
}
|
||||
|
@ -329,7 +339,7 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
|
||||
protected void createOptionsComposite(Composite parent) {
|
||||
Composite optionsComp = new Composite(parent, SWT.NONE);
|
||||
int numberOfColumns = (fAttachMode) ? 1 : 2;
|
||||
int numberOfColumns = (fAttachMode) ? 1 : 3;
|
||||
GridLayout layout = new GridLayout( numberOfColumns, false );
|
||||
optionsComp.setLayout( layout );
|
||||
optionsComp.setLayoutData( new GridData( GridData.BEGINNING, GridData.CENTER, true, false, 1, 1 ) );
|
||||
|
@ -338,6 +348,16 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
fStopInMain.addSelectionListener(new SelectionAdapter() {
|
||||
|
||||
public void widgetSelected(SelectionEvent e) {
|
||||
fStopInMainSymbol.setEnabled(fStopInMain.getSelection());
|
||||
update();
|
||||
}
|
||||
});
|
||||
fStopInMainSymbol = new Text(optionsComp, SWT.SINGLE | SWT.BORDER);
|
||||
final GridData gridData = new GridData(GridData.FILL, GridData.CENTER, false, false);
|
||||
gridData.widthHint = 100;
|
||||
fStopInMainSymbol.setLayoutData(gridData);
|
||||
fStopInMainSymbol.addModifyListener(new ModifyListener() {
|
||||
public void modifyText(ModifyEvent evt) {
|
||||
update();
|
||||
}
|
||||
});
|
||||
|
@ -408,6 +428,9 @@ public class CDebuggerTab extends AbstractCDebuggerTab {
|
|||
if (!fAttachMode) {
|
||||
fStopInMain.setSelection(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_DEFAULT));
|
||||
fStopInMainSymbol.setText(config.getAttribute(ICDTLaunchConfigurationConstants.ATTR_DEBUGGER_STOP_AT_MAIN_SYMBOL,
|
||||
ICDTLaunchConfigurationConstants.DEBUGGER_STOP_AT_MAIN_SYMBOL_DEFAULT));
|
||||
fStopInMainSymbol.setEnabled(fStopInMain.getSelection());
|
||||
}
|
||||
initializeAdvancedAttributes(config);
|
||||
} catch (CoreException e) {
|
||||
|
|
Loading…
Add table
Reference in a new issue