How to change text on stream group display in CDT eclipse debugger?

I have a CDT based debugger and you want to add some information to the label in the node stream. I want the label surrounded by a red rectangle to display additional information (see screenshot below).

Screen shot

AFAIR, the format string for this label is set in the ThreadVMNode_No_columns__text_format property in the file C:\Users\...\workspace\org.eclipse.cdt.dsf.gdb.ui\src\org\eclipse\cdt\dsf\gdb\internal\ui\viewmodel\launch\MessagesForGdbLaunchVM.properties .

 # {0} - name available, 0=not available/1=available # {1} - name # {2} - ID available, 0=not available/1=available # {3} - ID # {4} - OS Thread ID available, 0=not available/1=available # {5} - OS Thread ID # {6} - Core available, 0=not available/1=available # {7} - Core # {8} - 0=running/1=suspended # {9} - state change reason available, 0=not available/1=available # {10} - state change reason # {11} - state change details available, 0=not available/1=available # {12} - state change details ThreadVMNode_No_columns__text_format={0,choice,0#Thread|1#{1}}{2,choice,0#|1# [{3}]}{4,choice,0#|1# {5}}{6,choice,0#|1# [core: {7}]} ({8,choice,0#Running|1#Suspended}{9,choice,0#|1# : {10}}{11,choice,0#|1# : {12}}) 

This format string is used in the org.eclipse.cdt.dsf.gdb.internal.ui.viewmodel.launch.ThreadVMNode.createLabelProvider() method:

 public class ThreadVMNode extends AbstractThreadVMNode implements IElementLabelProvider, IElementMementoProvider { [...] @Override protected IElementLabelProvider createLabelProvider() { PropertiesBasedLabelProvider provider = new PropertiesBasedLabelProvider(); provider.setColumnInfo( PropertiesBasedLabelProvider.ID_COLUMN_NO_COLUMNS, new LabelColumnInfo(new LabelAttribute[] { // Text is made of the thread name followed by its state and state change reason. new GdbExecutionContextLabelText( MessagesForGdbLaunchVM.ThreadVMNode_No_columns__text_format, new String[] { ExecutionContextLabelText.PROP_NAME_KNOWN, PROP_NAME, ExecutionContextLabelText.PROP_ID_KNOWN, ILaunchVMConstants.PROP_ID, IGdbLaunchVMConstants.PROP_OS_ID_KNOWN, IGdbLaunchVMConstants.PROP_OS_ID, IGdbLaunchVMConstants.PROP_CORES_ID_KNOWN, IGdbLaunchVMConstants.PROP_CORES_ID, ILaunchVMConstants.PROP_IS_SUSPENDED, ExecutionContextLabelText.PROP_STATE_CHANGE_REASON_KNOWN, ILaunchVMConstants.PROP_STATE_CHANGE_REASON, ExecutionContextLabelText.PROP_STATE_CHANGE_DETAILS_KNOWN, ILaunchVMConstants.PROP_STATE_CHANGE_DETAILS}), 

AFAIK, to add new information to the display, you must

  • override the format string MessagesForGdbLaunchVM.properties and
  • add a new row to the array of strings in a call to the GdbExecutionContextLabelText constructor.

What is the best way to do both of these things (it is advisable not to change the code of the main Eclipse / CDT classes)?

Update 1 (09/12/2014 19:56 MSK): I tried to use a custom debug presentation model by adding an extension, but the MyCompanyDebugModelPresentation class is not called anyhwere.

  <extension point="org.eclipse.debug.ui.debugModelPresentations"> <debugModelPresentation class="com.mycompany.internal.debug.ui.model.MyCompanyDebugModelPresentation" id="com.mycompany.internal.debug.ui.model.MyCompanyDebugModelPresentation"> </debugModelPresentation> </extension> 
+5
source share
1 answer

To change the text shown above, you need to change several files and settings, which are shown in the matrix below.

Morphology matrix

You can read this image as follows:

  • In your project, specify the extension point org.eclipse.core.run.adapters (the beginning of the red line) so that it points to
  • your subclass of GdbAdapterFactory .
  • Modify this class to return your subclass of GdbViewModelAdapter , etc.

You go through this chain until you reach the ThreadVMNode class (or your subclass), which determines which values ​​are displayed in the tree.

+1
source

Source: https://habr.com/ru/post/1202423/


All Articles