1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-24 01:15:29 +02:00

Bug 576291 - Add preference for suspend timeout

- Adding preference in GDB preference page

Change-Id: Ic179ddd4f15eb02f8de479ca095cc2ec19818c6b
Signed-off-by: Umair Sair <umair_sair@hotmail.com>
This commit is contained in:
Umair Sair 2021-09-27 22:58:16 +05:00
parent ad4d444823
commit 68c67b20a4
11 changed files with 65 additions and 19 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.ui;singleton:=true
Bundle-Version: 2.7.200.qualifier
Bundle-Version: 2.7.300.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,

View file

@ -630,6 +630,13 @@ public class GdbDebugPreferencePage extends FieldEditorPreferencePage implements
group2.setLayout(groupLayout);
group2.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
final IntegerFieldEditor suspendTimeout = new IntegerFieldEditor(
IGdbDebugPreferenceConstants.PREF_SUSPEND_TIMEOUT_VALUE,
MessagesForPreferences.GdbDebugPreferencePage_suspendTimeout_label, group2);
suspendTimeout.setValidRange(5, Integer.MAX_VALUE);
suspendTimeout.fillIntoGrid(group2, 3);
addField(suspendTimeout);
BooleanFieldEditor boolField = new BooleanFieldEditor(IGdbDebugPreferenceConstants.PREF_AUTO_TERMINATE_GDB,
MessagesForPreferences.GdbDebugPreferencePage_autoTerminateGdb_label, group2);

View file

@ -83,6 +83,8 @@ class MessagesForPreferences extends NLS {
public static String GdbDebugPreferencePage_remoteTimeout_label;
public static String GdbDebugPreferencePage_remoteTimeout_tooltip;
public static String GdbDebugPreferencePage_suspendTimeout_label;
static {
// initialize resource bundle
NLS.initializeMessages(MessagesForPreferences.class.getName(), MessagesForPreferences.class);

View file

@ -73,3 +73,5 @@ GdbConsolePreferencePage_BufferLines = Console buffer lines:
GdbDebugPreferencePage_remoteTimeout_label=Remote timeout (seconds):
GdbDebugPreferencePage_remoteTimeout_tooltip=Default timeout for the remote target to respond. If unchecked, uses GDB default value. See GDB's help for "set remotetimeout num".
GdbDebugPreferencePage_suspendTimeout_label=Suspend timeout (seconds):

View file

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<component id="org.eclipse.cdt.dsf.gdb" version="2">
<resource path="src/org/eclipse/cdt/dsf/gdb/IGdbDebugPreferenceConstants.java" type="org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants">
<filter id="403767336">
<message_arguments>
<message_argument value="org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants"/>
<message_argument value="PREF_SUSPEND_TIMEOUT_VALUE"/>
</message_arguments>
</filter>
<filter id="403767336">
<message_arguments>
<message_argument value="org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants"/>
<message_argument value="SUSPEND_TIMEOUT_VALUE_DEFAULT"/>
</message_arguments>
</filter>
</resource>
</component>

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb;singleton:=true
Bundle-Version: 6.4.200.qualifier
Bundle-Version: 6.5.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.GdbPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,

View file

@ -247,4 +247,18 @@ public interface IGdbDebugPreferenceConstants {
* @since 5.5
*/
public static final String PREF_DEFAULT_REMOTE_TIMEOUT_VALUE = "defaultRemoteTimeoutValue"; //$NON-NLS-1$
/**
* The value of suspend timeout
*
* @since 6.5
*/
public static final String PREF_SUSPEND_TIMEOUT_VALUE = "suspendTimeoutValue"; //$NON-NLS-1$
/**
* Default value of {@link #PREF_SUSPEND_TIMEOUT_VALUE}
*
* @since 6.5
*/
public static final int SUSPEND_TIMEOUT_VALUE_DEFAULT = 10;
}

View file

@ -71,5 +71,7 @@ public class GdbPreferenceInitializer extends AbstractPreferenceInitializer {
IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_ENABLED_DEFAULT);
node.put(IGdbDebugPreferenceConstants.PREF_DEFAULT_REMOTE_TIMEOUT_VALUE,
IGDBLaunchConfigurationConstants.DEBUGGER_REMOTE_TIMEOUT_VALUE_DEFAULT);
node.putInt(IGdbDebugPreferenceConstants.PREF_SUSPEND_TIMEOUT_VALUE,
IGdbDebugPreferenceConstants.SUSPEND_TIMEOUT_VALUE_DEFAULT);
}
}

View file

@ -37,6 +37,7 @@ import org.eclipse.cdt.dsf.concurrent.IDsfStatusConstants;
import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.concurrent.Sequence;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.launching.GdbLaunch;
import org.eclipse.cdt.dsf.gdb.launching.LaunchUtils;
@ -55,6 +56,7 @@ import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
@ -818,17 +820,15 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
* backend, and the current job will indicate this in the request monitor.
*
* The specified timeout is used to indicate how many milliseconds this job
* should wait for. INTERRUPT_TIMEOUT_DEFAULT indicates to use the default
* of 5 seconds. The default is also use if the timeout value is 0 or
* should wait for. Default timeout is provided by preference
* {@code IGdbDebugPreferenceConstants.PREF_SUSPEND_TIMEOUT_VALUE}.
* The default is also used if the timeout value is 0 or
* negative.
*
* @since 3.0
*/
protected class MonitorInterruptJob extends Job {
// Bug 310274. Until we have a preference to configure timeouts,
// we need a large enough default timeout to accommodate slow
// remote sessions.
private final static int TIMEOUT_DEFAULT_VALUE = 5000;
private final RequestMonitor fRequestMonitor;
public MonitorInterruptJob(int timeout, RequestMonitor rm) {
@ -837,7 +837,9 @@ public class GDBBackend extends AbstractDsfService implements IGDBBackend, IMIBa
fRequestMonitor = rm;
if (timeout == INTERRUPT_TIMEOUT_DEFAULT || timeout <= 0) {
timeout = TIMEOUT_DEFAULT_VALUE; // default of 5 seconds
timeout = 1000 * Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_SUSPEND_TIMEOUT_VALUE,
IGdbDebugPreferenceConstants.SUSPEND_TIMEOUT_VALUE_DEFAULT, null);
}
schedule(timeout);

View file

@ -67,6 +67,7 @@ import org.eclipse.cdt.dsf.debug.service.IStack.IFrameDMContext;
import org.eclipse.cdt.dsf.debug.service.command.ICommand;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlShutdownDMEvent;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.gdb.internal.service.command.events.MITracepointSelectedEvent;
import org.eclipse.cdt.dsf.gdb.internal.service.control.StepIntoSelectionActiveOperation;
@ -109,6 +110,7 @@ import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.debug.core.DebugException;
@ -636,10 +638,6 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService
* @since 4.5
*/
protected class MonitorSuspendJob extends Job {
// Bug 310274. Until we have a preference to configure timeouts,
// we need a large enough default timeout to accommodate slow
// remote sessions.
private final static int TIMEOUT_DEFAULT_VALUE = 5000;
private final RequestMonitor fRequestMonitor;
private final IMIExecutionDMContext fThread;
@ -651,7 +649,9 @@ public class GDBRunControl_7_0_NS extends AbstractDsfService
fRequestMonitor = rm;
if (timeout <= 0) {
timeout = TIMEOUT_DEFAULT_VALUE; // default of 5 seconds
timeout = 1000 * Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_SUSPEND_TIMEOUT_VALUE,
IGdbDebugPreferenceConstants.SUSPEND_TIMEOUT_VALUE_DEFAULT, null);
}
// Register to listen for the stopped event

View file

@ -23,6 +23,7 @@ import org.eclipse.cdt.dsf.concurrent.ImmediateRequestMonitor;
import org.eclipse.cdt.dsf.concurrent.RequestMonitor;
import org.eclipse.cdt.dsf.datamodel.DMContexts;
import org.eclipse.cdt.dsf.debug.service.command.ICommandControlService.ICommandControlDMContext;
import org.eclipse.cdt.dsf.gdb.IGdbDebugPreferenceConstants;
import org.eclipse.cdt.dsf.gdb.internal.GdbPlugin;
import org.eclipse.cdt.dsf.mi.service.IMICommandControl;
import org.eclipse.cdt.dsf.mi.service.IMIExecutionDMContext;
@ -37,6 +38,7 @@ import org.eclipse.cdt.dsf.service.DsfServiceEventHandler;
import org.eclipse.cdt.dsf.service.DsfSession;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
@ -301,10 +303,6 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
}
protected class MonitorSuspendJob extends Job {
// Bug 310274. Until we have a preference to configure timeouts,
// we need a large enough default timeout to accommodate slow
// remote sessions.
private final static int TIMEOUT_DEFAULT_VALUE = 5000;
private final RequestMonitor fRequestMonitor;
@ -314,7 +312,9 @@ public class GDBRunControl_7_12 extends GDBRunControl_7_10 {
fRequestMonitor = rm;
if (timeout <= 0) {
timeout = TIMEOUT_DEFAULT_VALUE; // default of 5 seconds
timeout = 1000 * Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID,
IGdbDebugPreferenceConstants.PREF_SUSPEND_TIMEOUT_VALUE,
IGdbDebugPreferenceConstants.SUSPEND_TIMEOUT_VALUE_DEFAULT, null);
}
// Register to listen for the stopped event