Jump to: navigation, search




Currently, the Registers view for CDT/GDB shows all registers in a flat list. For targets with a large number of registers this is not very user-friendly. Below is a proposal for a feature that attempts to address this problem.


I propose to add support for pattern-matching within the Expressions view. This would allow users to easily create groups of registers. For example:

$*  would display all registers
$st[0-5]  would show  $st0, $st1 , ... $st5 
$*mm[0-1]  would show any registers ending with mm0 or mm1

Note that CDT's Expressions view already allows the user to examine individual registers, so this feature would only introduce the pattern matching support.

Regular Expressions are very powerful but not always easy to quickly use. I suggest we instead support glob-patterns. Glob-patterns are simpler than full regular experssions, and are the patterns used in command-shell pattern matching ( * ? [] ). They are more user-friendly than regex and would provide enough flexibility for what we are trying to achieve. Details on glob patterns can be found in The Linux Glob man page and in Wikipedia

Below are screenshots of a prototype I have implemented. It needs cleaning-up, but it shows how the feature would be used.

CDT GlobExp2.png

The user would simply type the glob-expression in the "Add new expression" box as she would for any other expression. That pattern will be detected and all matching registers will be shown as children of the glob-expression.

CDT GlobExp1.png

Although this feature is focusing on registers (only expressions starting with $ will allow glob-patterns) it may be a nice enhancement to extend this to other expressions. If that was also supported, a user could do such things as create an expression 'myArray[20-120] to only show a subset of an array; many other examples can be imagined as well. Handling this is more difficult though as we will encounter collision between glob-patterns and standard C/C++ syntax (e.g., *a can either a pattern ending with 'a', or the content of pointer 'a'). However, as a user-friendly enhancement, the prototype does allow for the expression: * In this case, all local variables will be shown in the Expressions view. This gives the Expressions view the ability to behave as the Variables view does.

CDT GlobExp3.png

Furthermore, the user has the ability to clone such an Enhanced Expressions view one or more times, to allow to look at different sets of expressions/registers and position them anywhere on the screen:

CDT GlobExp4.png

The Enhanced Expressions view will also support a comma-separated list of expression within the same entry. This allows the user to use different glob-patterns within the same expression group. Such an expression group can be seen below.

CDT GroupExpr.png

Note that glob-expressions group will be sorted alphabetically for user-friendliness.