Skip to main content
Jump to: navigation, search


< CDT‎ | Archive
Revision as of 15:20, 8 February 2013 by (Talk | contribs) (New page: == Debug == === Enhanced Expressions === The Expressions view has been extended to allow the user to manually create ''enhanced-expressions''. ''Enhanced-expressions'' define a set of ...)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


Enhanced Expressions

The Expressions view has been extended to allow the user to manually create enhanced-expressions. Enhanced-expressions define a set of expressions which can be easily described using glob-pattern matching. The user specifies an enhanced-expression by prefixing it with '='. For example:

  • pattern-matched sorted groups of local variables, where the symbols * [] ? can be used e.g.,
=v?r     -- Will show local variables starting with a 'v' and ending with 'r' with a single character in between
=*       -- Will show all local variables of the selected stack frame in sorted order (the '=' is optional for this expression, i.e., '*')
=*x      -- Will show local variables ending with 'x'
  • array ranges including glob-expressions
=array[30-40]        -- Will show array elements from 30 to 40
=array[1-5,20,30-31] -- Will show array elements from 1 to 5, 20 and 30 to 31
=array?[1-5]         -- Will show array elements from 1 to 5 for any array starting with 'array' followed by a single character
  • pattern-matched sorted registers groups, where the symbols * [] ? can be used e.g.,
=$e?x     -- Will show all registers starting with 'e' and ending with 'x' with a single character in between
=$*       -- Will show all registers (the '=' is optional for this expression, i.e., '$*')
=$*x      -- Will show registers ending with 'x'
=$st[3-5] -- Will show registers $st3, $st4, $st5
  • semi-colon-separated, individually sorted groups of expressions, e.g,
var1; var2 -- Will create a group containing both var1 and var2 
$eax; var1 -- Will show a group containing register $eax and variable var1
var1; $e*  -- Will show a group containing variable var1 as well as all registers starting with 'e'

This feature allows to quickly define multiple expressions that interest the user. Because groups are created from these special expressions, they can be collapsed when uninteresting and re-expanded later, without having to be re-entered by the user.

CDT GroupExpr.png

Note that the comma (,) is not allowed as a group separator as it is used within valid expressions that use templates (e.g., ((((((class std::_Vector_base<int, std::allocator<int> >) v))._M_impl))._M_start)).

OS Resources View

CDT has a new view called "OS Resources". This view will display different information about the resources of the operating system. For example, it can give a list of all processes running on the target. The view will display the information as provided by GDB.

CDT OSResources.png

As of writing, GDB supported the following information:

Processes             - Listing of all processes
Process groups        - Listing of all process groups
Threads               - Listing of all threads
File descriptors      - Listing of all file descriptors
Sockets               - Listing of all internet-domain sockets
Shared-memory regions - Listing of all shared-memory regions
Semaphores            - Listing of all semaphores
Message queues        - Listing of all message queues
Kernel modules        - Listing of all loaded kernel modules


  • For performance reasons, the view is not automatically refreshed. Press the Refresh button on the the view toolbar to fetch the latest information. Hovering over this Refresh button will display the time at which the information was last obtained.
  • Columns can be re-sized.
  • Columns can be removed or added using the view menu.
  • Entries can be ordered by column by pressing on the column header.
  • When doing debugging of a remote target, the information in the view pertains to the remote target.

This feature requires GDB 7.5 and higher. Furthermore, as of GDB 7.5, this feature only works for Linux.

Breakpoint Filtering

The CDT has enhanced the standard behavior of the "Show Breakpoints Supported by Selected Target" option of the Breakpoints view. Using this option with the CDT will now only show breakpoints that are actually applicable to the current debug session. Therefore, when debugging a C/C++ application, the user will not be bothered with the breakpoints set in the code of an another C/C++ application.


For backwards-compatibility, a preference is provided to revert this new behavior to the original one. The original behavior of this option is to have the Breakpoints view show all breakpoints that are of the same type as the current debug session. For example, if debugging Java, only Java breakpoints would be shown, and if debugging C/C++ only C/C++ breakpoints would be shown. This preference can be found under "C/C++ -> Debug -> GDB -> Use aggressive breakpoint filtering".

Enhanced GDB console support

CDT is being improved to update its views with any change made to GDB by the user from the GDB console. Updates are being added gradually and the final goal is to allow the user to perform any command from the GDB console, and have CDT stay synchronized with the changes.

Breakpoints, watchpoints and tracepoints

Breakpoints, watchpoints or tracepoints set from the GDB console are now shown in the Breakpoints view. All breakpoint related GDB commands are supported and synchronized with the UI. No support for catchpoints yet. This feature requires GDB 7.4 or higher.

Memory and variables

Memory and variables modified from the GDB console are now updated in the Memory, Memory Browser, Variables and Expressions views. This feature requires GDB 7.6 or higher.

Reverse debugging state

CDT will now properly update the status of reverse debugging if its state is modified through the GDB console. This feature requires GDB 7.6 or higher.

Breakpoint actions to control reverse debugging

It's now possible to control the enabling, disabling and toggling of the reverse debugging mode, through breakpoint actions. The reverse debugging mode can be useful to debug, but has a significant performance cost when enabled. Using the new breakpoint action to enable the reverse debug mode, one can program a breakpoint to enable that mode in the vicinity of the suspected source code. That way, until that point is reached, no performance impacts are felt.

To use this feature, right-click on a breakpoint and select "Breakpoint Properties". Then in the left page, chose "Actions". Then click "New". In the new dialog, select the Action Type "Reverse Debug Action". Then chose if the action should enable, disable or toggle the reverse debug mode. Finally chose a name for the action. When done, click "Ok"


The newly created action will appear in the list of available actions, that can be attached to any breakpoint To attach it to the current breakpoint, click on "Attach".


Note: For the reverse debug breakpoint actions to work, reverse debugging must be available in the current debug session. For instance, it will not work if "non-stop" mode is active.

Debugging multiple processes within one debug session

Debugging a new executable in the same debug session has been improved for GDB versions starting from 7.2. "Debug New Executable" action has been added to the context menu of the Debug view.

CDT DebugNewExecutableMenu.png

The dialog for specifying an executable to debug for local sessions has been changed.

CDT NewExecutableDialog Local.png

The ability to debug a remote executable using gdbserver has been added.

CDT NewExecutableDialog Remote.png

Back to the top