Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-debug-dev] How to input a string as arg of MI command?

> 
> You should use the "org.eclipse.cdt.debug.core.CDebugger" extension point to
> provide your own implementation of "exec-run".
> Openning an input dialog is not a good idea.

To elaborate, Eclipse has a strong separation between Core vs UI.
The MI plugin including any of the *.core plugins may not be run within the context
of the UI thread.  So to do what you want, you need to wrap the code
in a runnable, something like:

Runnable uiTask = new Runnable() {
   // some code.
   // InputDialog dialog = new InputDialog(shell, "Label Dialog:", "Enter
..
}
PlatformUI.getWorkbench().getDisplay().asynExec(uiTask);

If not you will have funky errors like:
"Illegal access to SWT..."
NPE
etc ...

But ... it's not the good approach 8-), see mikhail's comments below
on a better approach.

> If you need to pass additional
> parameters to your debug session you should use the launch configuration
> dialog. CDT provides the "org.eclipse.cdt.debug.ui.CDebuggerPage" extension
> point that allows users to customize the "Debugger" page of the launch
> configuration dialog.
> 
> ----- Original Message ----- 
> From: "Felix Yuan" <bigbrain_cn@xxxxxxx>
> To: <cdt-debug-dev@xxxxxxxxxxx>
> Sent: Tuesday, March 23, 2004 8:13 AM
> Subject: [cdt-debug-dev] How to input a string as arg of MI command?
> 
> 
> > Hi,
> >
> > The MI interface of My debugger is similar to the one of gdb, so I can use
> > my debugger to replace gdb.
> >
> > But there are something different. One is that my -exec-run has a
> argument.
> > So I want to use an InputDialog to get a string from user. I noticed that
> > when Target.restart() was called, a MIExecRun was created and posted to
> > MISession. I inserted some code to get a string via an InputDialog before
> > the command was created.
> > The source is:
> >
> > try {
> >     Shell shell = new Shell();
> >     InputDialog dialog = new InputDialog(shell, "Label Dialog:", "Enter
> the
> > Label to start", null, null);
> >     dialog.open();
> >     String startLabel = dialog.getValue();
> > }
> > catch(Exception e){
> >     e.printStackTrace();
> > }
> >
> > But when I ran Run-time Workbench, the following error was displayed:
> > Exception occurred during launch
> > Reason:
> >  Error within Debug UI:
> >
> > I set a breakpoint before my code, but it seemed that it was not
> encountered
> > before the error occurred.
> >
> > Please tell me how to use InputDialog in cdt.debug. Or is there another
> good
> > way to get a string from user when debugging?
> >
> > Thanks in advance.
> >
> > Sincerely yours,
> >
> > Felix
> >
> > _______________________________________________
> > cdt-debug-dev mailing list
> > cdt-debug-dev@xxxxxxxxxxx
> > http://dev.eclipse.org/mailman/listinfo/cdt-debug-dev
> >
> 
> _______________________________________________
> cdt-debug-dev mailing list
> cdt-debug-dev@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/cdt-debug-dev
> 


-- 
au revoir, alain
----
Aussi haut que l'on soit assis, on est toujours assis que sur son cul !!!



Back to the top