[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [cdt-debug-dev] Can a plugin stop CDT from issuing "run"?
|
Hi Oyvind,
You can always redefine the GDB run command to do nothing like this:
define run
end
Then CDT will not complain anymore ;)
Here is a simple class that could be used for this purpose (and to
define custom GDB macros):
package com.xyz.cdt.debug.mi.core.command;
import org.eclipse.cdt.debug.mi.core.command.CLICommand;
/*
* define <name>
* <body>
* end
*/
public class MIUserCommand extends CLICommand
{
public MIUserCommand(String name, String body)
{
super("define " + name + "\n" +
((body == null) ? "" : (body.endsWith("\n") ? body : body +
"\n")) +
"end");
}
}
Make your own GDBDebugger class that implements
org.eclipse.cdt.debug.core.ICDebugger or extends
org.eclipse.cdt.debug.mi.core.GDBDebugger and add the following lines:
// Redefine the "run" command to do nothing.
cmd = new MIUserCommand("run", null);
mi.postCommand(cmd);
info = cmd.getMIInfo();
if (info == null)
{
throw new MIException("No answer");
}
In this GDBDebugger class you can also issue commands for connecting to
the target and any other initial setup that is necessary. If you
subclass any of the commands in the
org.eclipse.cdt.debug.mi.core.command package, remember to create your
own org.eclipse.cdt.debug.mi.core.command.CommandFactory subclass and
override the corresponding factory methods and install it in your
GDBDEbugger class like this:
session.getMISession().setCommandFactory(new XYZCommandFactory());
If you need to pass parameters to your GDBDebugger class you can add your
GDBDebuggerPage class (see
org.eclipse.cdt.debug.mi.internal.ui.GDBDebuggerPage for reference) that
extends org.eclipse.debug.ui.AbstractLaunchConfigurationTab and
associate it with your GDBDebugger class.
In this way, you can control the startup sequence for your particular
GDB and collect the necessary additional parameters from the launch
configuration dialog GUI.
Regards,
Stefan
Øyvind Harboe wrote:
You can copy all launcher classes to your plugin. The launcher uses the
static methods in the "CDebugModel" class to create a debug target.
Create your own class with similar methods and use it instead of
"CDebugModel".
To disable "restart" use the "setConfiguration" method of ICDISession
to replace the default configuration by your own. You can override the
"supportsRestart" method of the default configuration.
Perhaps I don't speak enough CDT to understand what you are suggesting,
but I can't see how this is a meaningful alternative to what I do today.
It seems like it is more difficult, more work and I wouldn't get your
bug-fixes to CDT GDB automatically, as I do with my current approach.
Today I copy the entire CDT + delete a couple of lines of code and
occasinally do a Team->Update + recompile. Mostly a team->update +
recompile is all I need to do.
If you fix a bug/add a feature in Eclipse CDT GDB support, my plugin
must immediately take advantage of your improvement.
Perhaps my plugin has no raison d'etre, but my "fleeting vain attempts"
at submitting patches to the GDB CDT support didn't fly.