|
Lines 17-22
Link Here
|
| 17 |
|
17 |
|
| 18 |
import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage; |
18 |
import org.eclipse.cdt.debug.ui.AbstractCDebuggerPage; |
| 19 |
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; |
19 |
import org.eclipse.cdt.dsf.gdb.IGDBLaunchConfigurationConstants; |
|
|
20 |
import org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin; |
| 20 |
import org.eclipse.cdt.utils.ui.controls.ControlFactory; |
21 |
import org.eclipse.cdt.utils.ui.controls.ControlFactory; |
| 21 |
import org.eclipse.core.runtime.CoreException; |
22 |
import org.eclipse.core.runtime.CoreException; |
| 22 |
import org.eclipse.debug.core.ILaunchConfiguration; |
23 |
import org.eclipse.debug.core.ILaunchConfiguration; |
|
Lines 36-41
Link Here
|
| 36 |
import org.eclipse.swt.widgets.TabFolder; |
37 |
import org.eclipse.swt.widgets.TabFolder; |
| 37 |
import org.eclipse.swt.widgets.TabItem; |
38 |
import org.eclipse.swt.widgets.TabItem; |
| 38 |
import org.eclipse.swt.widgets.Text; |
39 |
import org.eclipse.swt.widgets.Text; |
|
|
40 |
import org.eclipse.ui.PlatformUI; |
| 39 |
|
41 |
|
| 40 |
/** |
42 |
/** |
| 41 |
* The dynamic tab for gdb-based debugger implementations. |
43 |
* The dynamic tab for gdb-based debugger implementations. |
|
Lines 47-52
Link Here
|
| 47 |
protected Text fGDBInitText; |
49 |
protected Text fGDBInitText; |
| 48 |
protected Button fNonStopCheckBox; |
50 |
protected Button fNonStopCheckBox; |
| 49 |
protected Button fReverseCheckBox; |
51 |
protected Button fReverseCheckBox; |
|
|
52 |
protected Button fUpdateThreadlistOnSuspend; |
| 50 |
|
53 |
|
| 51 |
private IMILaunchConfigurationComponent fSolibBlock; |
54 |
private IMILaunchConfigurationComponent fSolibBlock; |
| 52 |
private boolean fIsInitializing = false; |
55 |
private boolean fIsInitializing = false; |
|
Lines 71-76
Link Here
|
| 71 |
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); |
74 |
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); |
| 72 |
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
75 |
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
| 73 |
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); |
76 |
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); |
|
|
77 |
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, |
| 78 |
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT); |
| 74 |
|
79 |
|
| 75 |
if (fSolibBlock != null) |
80 |
if (fSolibBlock != null) |
| 76 |
fSolibBlock.setDefaults(configuration); |
81 |
fSolibBlock.setDefaults(configuration); |
|
Lines 90-135
Link Here
|
| 90 |
return valid; |
95 |
return valid; |
| 91 |
} |
96 |
} |
| 92 |
|
97 |
|
| 93 |
public void initializeFrom(ILaunchConfiguration configuration) { |
98 |
/** utility method to cut down on clutter */ |
| 94 |
setInitializing(true); |
99 |
private String getStringAttr(ILaunchConfiguration config, String attributeName, String defaultValue) { |
| 95 |
String gdbCommand = IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT; |
100 |
try { |
| 96 |
String gdbInit = IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT; |
101 |
return config.getAttribute(attributeName, defaultValue); |
| 97 |
boolean nonStopMode = IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT; |
|
|
| 98 |
boolean reverseEnabled = IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT; |
| 99 |
|
| 100 |
try { |
| 101 |
gdbCommand = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, |
| 102 |
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); |
| 103 |
} |
| 104 |
catch(CoreException e) { |
| 105 |
} |
| 106 |
try { |
| 107 |
gdbInit = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, |
| 108 |
IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); |
| 109 |
} |
102 |
} |
| 110 |
catch(CoreException e) { |
103 |
catch (CoreException exc) { |
|
|
104 |
return defaultValue; |
| 111 |
} |
105 |
} |
| 112 |
|
106 |
} |
| 113 |
try { |
107 |
/** utility method to cut down on clutter */ |
| 114 |
nonStopMode = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, |
108 |
private boolean getBooleanAttr(ILaunchConfiguration config, String attributeName, boolean defaultValue) { |
| 115 |
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); |
109 |
try { |
|
|
110 |
return config.getAttribute(attributeName, defaultValue); |
| 116 |
} |
111 |
} |
| 117 |
catch(CoreException e) { |
112 |
catch (CoreException exc) { |
|
|
113 |
return defaultValue; |
| 118 |
} |
114 |
} |
|
|
115 |
} |
| 116 |
|
| 117 |
public void initializeFrom(ILaunchConfiguration configuration) { |
| 118 |
setInitializing(true); |
| 119 |
String gdbCommand = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUG_NAME, |
| 120 |
IGDBLaunchConfigurationConstants.DEBUGGER_DEBUG_NAME_DEFAULT); |
| 121 |
String gdbInit = getStringAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_GDB_INIT, |
| 122 |
IGDBLaunchConfigurationConstants.DEBUGGER_GDB_INIT_DEFAULT); |
| 123 |
boolean nonStopMode = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_NON_STOP, |
| 124 |
IGDBLaunchConfigurationConstants.DEBUGGER_NON_STOP_DEFAULT); |
| 125 |
boolean reverseEnabled = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
| 126 |
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); |
| 127 |
boolean updateThreadsOnSuspend = getBooleanAttr(configuration, IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, |
| 128 |
IGDBLaunchConfigurationConstants.DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND_DEFAULT); |
| 119 |
|
129 |
|
| 120 |
try { |
|
|
| 121 |
reverseEnabled = configuration.getAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
| 122 |
IGDBLaunchConfigurationConstants.DEBUGGER_REVERSE_DEFAULT); |
| 123 |
} |
| 124 |
catch(CoreException e) { |
| 125 |
} |
| 126 |
|
| 127 |
if (fSolibBlock != null) |
130 |
if (fSolibBlock != null) |
| 128 |
fSolibBlock.initializeFrom(configuration); |
131 |
fSolibBlock.initializeFrom(configuration); |
| 129 |
fGDBCommandText.setText(gdbCommand); |
132 |
fGDBCommandText.setText(gdbCommand); |
| 130 |
fGDBInitText.setText(gdbInit); |
133 |
fGDBInitText.setText(gdbInit); |
| 131 |
fNonStopCheckBox.setSelection(nonStopMode); |
134 |
fNonStopCheckBox.setSelection(nonStopMode); |
| 132 |
fReverseCheckBox.setSelection(reverseEnabled); |
135 |
fReverseCheckBox.setSelection(reverseEnabled); |
|
|
136 |
fUpdateThreadlistOnSuspend.setSelection(updateThreadsOnSuspend); |
| 133 |
|
137 |
|
| 134 |
setInitializing(false); |
138 |
setInitializing(false); |
| 135 |
} |
139 |
} |
|
Lines 143-148
Link Here
|
| 143 |
fNonStopCheckBox.getSelection()); |
147 |
fNonStopCheckBox.getSelection()); |
| 144 |
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
148 |
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_REVERSE, |
| 145 |
fReverseCheckBox.getSelection()); |
149 |
fReverseCheckBox.getSelection()); |
|
|
150 |
configuration.setAttribute(IGDBLaunchConfigurationConstants.ATTR_DEBUGGER_UPDATE_THREADLIST_ON_SUSPEND, |
| 151 |
fUpdateThreadlistOnSuspend.getSelection()); |
| 146 |
|
152 |
|
| 147 |
if (fSolibBlock != null) |
153 |
if (fSolibBlock != null) |
| 148 |
fSolibBlock.performApply(configuration); |
154 |
fSolibBlock.performApply(configuration); |
|
Lines 284-315
Link Here
|
| 284 |
|
290 |
|
| 285 |
// TODO: Ideally, this field should be disabled if the back-end doesn't support non-stop debugging |
291 |
// TODO: Ideally, this field should be disabled if the back-end doesn't support non-stop debugging |
| 286 |
// TODO: Find a way to determine if non-stop is supported (i.e. find the GDB version) then grey out the check box if necessary |
292 |
// TODO: Find a way to determine if non-stop is supported (i.e. find the GDB version) then grey out the check box if necessary |
| 287 |
fNonStopCheckBox = ControlFactory.createCheckBox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.nonstop_mode")); //$NON-NLS-1$ |
293 |
fNonStopCheckBox = addCheckbox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.nonstop_mode")); //$NON-NLS-1$ |
| 288 |
fNonStopCheckBox.addSelectionListener( new SelectionAdapter() { |
|
|
| 289 |
@Override |
| 290 |
public void widgetSelected(SelectionEvent e) { |
| 291 |
updateLaunchConfigurationDialog(); |
| 292 |
} |
| 293 |
}); |
| 294 |
|
294 |
|
| 295 |
// TODO: Ideally, this field should be disabled if the back-end doesn't support reverse debugging |
295 |
// TODO: Ideally, this field should be disabled if the back-end doesn't support reverse debugging |
| 296 |
// TODO: Find a way to determine if reverse is supported (i.e. find the GDB version) then grey out the check box if necessary |
296 |
// TODO: Find a way to determine if reverse is supported (i.e. find the GDB version) then grey out the check box if necessary |
| 297 |
fReverseCheckBox = ControlFactory.createCheckBox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debugging")); //$NON-NLS-1$ |
297 |
fReverseCheckBox = addCheckbox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.reverse_Debugging")); //$NON-NLS-1$ |
| 298 |
fReverseCheckBox.addSelectionListener( new SelectionAdapter() { |
|
|
| 299 |
@Override |
| 300 |
public void widgetSelected(SelectionEvent e) { |
| 301 |
updateLaunchConfigurationDialog(); |
| 302 |
} |
| 303 |
}); |
| 304 |
|
298 |
|
| 305 |
|
299 |
fUpdateThreadlistOnSuspend = addCheckbox(subComp, LaunchUIMessages.getString("GDBDebuggerPage.update_thread_list_on_suspend")); //$NON-NLS-1$ |
| 306 |
// fit options one per line |
300 |
// This checkbox needs an explanation. Attach context help to it. |
| 307 |
gd = new GridData(); |
301 |
PlatformUI.getWorkbench().getHelpSystem().setHelp(fUpdateThreadlistOnSuspend, GdbUIPlugin.PLUGIN_ID + ".update_threadlist_button_context"); //$NON-NLS-1$ |
| 308 |
gd.horizontalSpan = 3; |
|
|
| 309 |
fNonStopCheckBox.setLayoutData(gd); |
| 310 |
gd = new GridData(); |
| 311 |
gd.horizontalSpan = 3; |
| 312 |
fReverseCheckBox.setLayoutData(gd); |
| 313 |
} |
302 |
} |
| 314 |
|
303 |
|
| 315 |
public void createSolibTab(TabFolder tabFolder) { |
304 |
public void createSolibTab(TabFolder tabFolder) { |
|
Lines 323-328
Link Here
|
| 323 |
((Observable)fSolibBlock).addObserver(this); |
312 |
((Observable)fSolibBlock).addObserver(this); |
| 324 |
} |
313 |
} |
| 325 |
|
314 |
|
|
|
315 |
/** Used to add a checkbox to the tab. Each checkbox has its own line. */ |
| 316 |
private Button addCheckbox(Composite parent, String label) { |
| 317 |
Button button = ControlFactory.createCheckBox(parent, label); |
| 318 |
button .addSelectionListener(new SelectionAdapter() { |
| 319 |
@Override |
| 320 |
public void widgetSelected(SelectionEvent e) { |
| 321 |
updateLaunchConfigurationDialog(); |
| 322 |
} |
| 323 |
}); |
| 324 |
GridData gd = new GridData(); |
| 325 |
gd.horizontalSpan = 3; |
| 326 |
button.setLayoutData(gd); |
| 327 |
|
| 328 |
return button; |
| 329 |
} |
| 330 |
|
| 326 |
/* |
331 |
/* |
| 327 |
* (non-Javadoc) |
332 |
* (non-Javadoc) |
| 328 |
* |
333 |
* |