Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] displaying instructions and instructions histories in Eclipse: support needed in handling UI events and issue a gdb command

@cdt-devers if anyone else has some ideas in this area please share them here. Zied's been doing lots of work on GDB in areas that are probably of lots of value to many CDT adopters so let's see if we can support them in getting these improvements integrated into CDT!

Hi Zied,

Please find some answers inline below.


~~~
Jonah Graham
Kichwa Coders
www.kichwacoders.com


On Tue, 17 May 2022 at 19:22, Zied Guermazi <zied.guermazi@xxxxxxxxx> wrote:
Hi,

currently I am extending the cdt-dsf to implement the gdb commands for handling instructions and functions call histories, and parsing and getting their outputs.

I added two buttons and two basic views (see orange indications in following picture). and I can successfully display the instructions and functions calls histories when the user clicks on the buttons in the menu bar.

now I would like to add actions so that when the user clicks on a line in the function call history list,  a command is issued to gdb, get executed, and then the editor goes to the related line in the source code (similar to what happens when the user selects a stack frame in the debug view, or when the program halts in a breakpoint)

I added a class: public class FunctionsCallHistoryView extends AbstractDebugView implements IViewerUpdateListener, IDebugContextListener, IModelChangedListener

and registered a DoubleClickListener, public void doubleClick(DoubleClickEvent event) where I am identifying the clicked line extracting the record number and calling

// execute record goto record command
GdbGoToRecordCommand cmd = new GdbGoToRecordCommand(fFunctionsCallHistoryModel.getSession());

cmd.setRecordNumber(recordNumber);

cmd.execute(null);  //how to prepare a IDebugCommandRequest request ?


I have two issues with this implementation:

- how to prepare a IDebugCommandRequest request object?


I don't think you want to use IDebugCommandRequest - one of the tricky parts of DSF is that it is very different than Eclipse standard debug model. The DSF Tutorial tries to introduce the concepts here (there is a warning "Flexible Hierarchy is still a provisional API in Eclipse Platform 3.4." technically still true but the API hasn't changed in years). I also did a tutorial session many years ago that may be useful for background.
 

- Ideally this shall be executed asynchronously to the UI, is there a mean to achieve it?


All of DSF is very asynchronous by design and all operations run in non-UI thread. As long as you don't wait for results in the UI thread on non-UI thread you get such async behaviour.

A good model for your work may be TraceControlView. Specifically you can look at command with ID org.eclipse.cdt.dsf.gdb.ui.command.selectNextTraceRecord and how it is called from TraceControlView (see org.eclipse.cdt.dsf.gdb.internal.ui.tracepoints.TraceControlView.createFrameLine(...).new SelectionAdapter() {...}.widgetSelected(SelectionEvent)) - the same command is also contributed to the toolbar of the view, search for toolbar:org.eclipse.cdt.dsf.gdb.ui.tracecontrol.view?after=additions in org.eclipse.cdt.dsf.gdb.ui/plugin.xml
 


On success, I would like a also to fire an event about the change done in the program counter so that the debug view and the source code refresh themself with the proper new PC, line of code and stack frame. is there any guidance/examples for achieving it?

can you please support me here?


You can force a full refresh of all views with ICommandControlService.flushAllCachesAndRefresh(RequestMonitor) - or you can issue more narrow refreshes if you know which services have data changes.
 
I hope that is a good start for you

Jonah




Kind Regards
Zied Guermazi


_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
To unsubscribe from this list, visit https://www.eclipse.org/mailman/listinfo/cdt-dev

Back to the top