Can the cdt.debug.mi plugins be used standalone [message #193221] |
Wed, 13 June 2007 07:01  |
Eclipse User |
|
|
|
Originally posted by: F.Brosnan.pilz.ie
Hello,
I'm in a project which is looking at supporting a couple of new process
control languages. We have no debug environment. So I'm looking at
translating
each language to a C/C++ code and using the CDT debug classes to provide a
way of running/
debugging the code. But I would like to hide the CDT from the user so he
doesn't know that this is the mechanism.
Ideally I'd like the executable to exist outside the workspace and just use
the cdt mi classes to drive an interactive gdb session and just pass the
results back to a gui that would translate this to the user language
positions
etc ..
Is it possible to use the org.eclipse.cdt.debug.mi.core plugins standalone
to drive an
external program compiled using g++ that may exist outside of a CDT
project
I've got eclipse 3.2.1 and MinGW 5.0.2 Toolset
What I tried is the following
//Hard coded constants about where the test harness is.
String gdbCommand = "gdb";
String miVersion = "mi2";
String executable =
" C:\\runtime-New_configuration(9)\\TestHarness\\TestHarness.e xe ";
String workingdir = "C:\\eclipse-SDK-3.2.1-win32\\eclipse\\";
String gdbinit = ".gdbinit";
try
{
dsession = MIPlugin.getDefault().createCSession(gdbCommand,
miVersion,
new
File(executable),
new
File(workingdir),
gdbinit,
new
SubProgressMonitor(monitor, 8));
and this can start my session but when I try to look for events like
breakpoint reached I never get this triggered even though I do get the
running event to
tell me the process is started. Mayby I've not supplied enough information
for gdb to be able to contact me.
I have got a scheme to work by subclassing the AbstractCLaunchDelegate
and coding a new launch delegate.
I use the following call.
dsession = debugConfig.createDebugger().createDebuggerSession(launch,
exeFile,
new SubProgressMonitor(monitor, 8));
And this all works but you have to create a C or C++ project to hold the
intermediate code. i.e. you need the cdt ui part. This was felt to expose
the
user to the CDT implementation too much so Ideally I'd like a lower entry
point
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ++++++++++++++++
Can anyone help or has anyone tried to do something like this in past ?
I think it'd be really great if possible because then you would have a
generic
gdb/mi library that could be used independant of eclipse.
Best Regards Frank Bosnan
|
|
|
Re: Can the cdt.debug.mi plugins be used standalone [message #194146 is a reply to message #193221] |
Wed, 27 June 2007 11:35  |
Eclipse User |
|
|
|
Originally posted by: F.Brosnan.pilz.ie
Got this working.
Trick seemed to be to extend from an existing debugger
and copy and tailor there methods.
I think I was not doing enough by just creating the C session.
Probably rookie stuff for CDT experts but I'll put in answer in case
anyone else needs a started on writing there own debugger as a front end
to gdb/mi primitives.
public class TestHarnessGDBDebugger extends GDBCDIDebugger
{
ILaunch fLaunch;
....
public Session createDefaultLaunchSession() throws CoreException {
//Hard Codings
String TestHarnessConstantGDB =
TestHarnessConfiguration.GDBDebuggerName;
String TestHarnessConstantMIVERSION =
TestHarnessConfiguration.MIVersion;
String TestHarnessConstantWORKINGDIRPATH =
TestHarnessConfiguration.TestHarnessPath;
File TestHarnessWorkingDir = new
File(TestHarnessConstantWORKINGDIRPATH);
String TestHarnessConstantGDBINIT =
TestHarnessConfiguration.GDBINIT;
String TestHarnessConstantEXECUTABLEPATH =
TestHarnessConfiguration.TestHarnessExecutablePath;
File TestHarnessExecutable = new
File(TestHarnessConstantEXECUTABLEPATH);
//Hard Codings
Session session = null;
boolean failed = false;
try {
//session = MIPlugin.getDefault().createCSession(gdb,
miVersion, exe.getPath().toFile(), cwd, gdbinit, monitor);
session =
MIPlugin.getDefault().createCSession(TestHarnessConstantGDB,
TestHarnessConstantMIVERSION,
TestHarnessExecutable,
TestHarnessWorkingDir,
TestHarnessConstantGDBINIT,
new
NullProgressMonitor());
return session;
} catch (Exception e) {
// Catch all wrap them up and rethrow
failed = true;
if (e instanceof CoreException) {
throw (CoreException)e;
}
throw newCoreException(e);
} finally {
if (failed) {
if (session != null) {
try {
session.terminate();
} catch (Exception ex) {
// ignore the exception here.
}
}
}
}
}
}
|
|
|
Powered by
FUDForum. Page generated in 0.06307 seconds