Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] Timeouts for GDB/MI commands (Was: [DSF] Making Sequence more robust)

> Hi, 
> I started working on implementing this change, and it worked fine in
> general.
> I had two issues remaining that I would like your help with:
> 1- I wanted to add a preference to enable/disable timeout and set
> The timer, instead of hardcoding this info in the code.
> I added the preferences to
> org.eclipse.cdt.dsf.gdb.internal.ui.preferences.GdbDebugPreferencePage
> And want to use them in GDBControl. which is in 
> org.eclipse.cdt.dsf.gdb
> The code that is used to perform such operation is as follows:
> timeout = 
> Platform.getPreferencesService().getInt(GdbPlugin.PLUGIN_ID, 
> IGdbDebugPreferenceConstants.PREF_TIMEOUT, 30, null);
> This uses the core plugin ID while the preference page stores
> preferences
> in the UI plugin preference store.
> I see this code used in many places, e.g.:
> org.eclipse.cdt.dsf.gdb.service.GDBProcesses.eventDispatched(I
> ExitedDMEv
> ent)
> When I added ".ui" to GdbPlugin.PLUGIN_ID it worked in my case, but I
> don't think
> this is a correct approach, and I don't understand how it 
> works in other
> places in CDT.
> Any clues?

As part of Bug 348159 the DSF-GDB preference store was moved from
the dsf.gdb.ui plugin to the dsf.gdb plugin.  This is because
we needed to have the preference store initialize without
requiring the user of the UI plugin.

In GdbUIPlugin.getPreferenceStore(), we return the store of the
dsf.gdb plugin, which is why things still work if you add

> 2- I initially added the code in GDBControl as suggested, but 
> found out
> that 
> GDBControl_7_0 is the one I should use for most cases.
> Is it correct to add the command listener in GDBControl_7_0?

GDBControl is used for GDB < 7.0
GDBControl_7_0 for GDB 7.0 and 7.1
GDBControl_7_2 (which extends GDBControl_7_0) for GDB >= 7.2

When adding a new feature, you have to decide to which GDB
version the feature apply, and add it to the proper class,
or create a new class if it only applies to a new GDB
(e.g., creating GDBControl_7_3, if the feature applies to
GDB >= 7.3).

In this case, the timeout applies to all GDB versions
I believe (although a different default timeout value could
make sense for different GDBs).
You can add the feature in both GDBControl_7_0 and GDBControl
or directly in AbstractMIControl which is a base class for
all others.


Back to the top