forked from qt-creator/qt-creator
Doc: Update the docs for the Expressions view in Debug mode
Task-number: QTCREATORBUG-28778 Change-Id: I687fb1bb2ecf6dbc511bffc70a6f9ac00aee6ee9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
Binary file not shown.
Before Width: | Height: | Size: 41 KiB |
BIN
doc/qtcreator/images/qtcreator-debugger-expressions.webp
Normal file
BIN
doc/qtcreator/images/qtcreator-debugger-expressions.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.4 KiB |
Binary file not shown.
After Width: | Height: | Size: 3.9 KiB |
@@ -374,6 +374,35 @@
|
|||||||
function after pressing \key {Shift+F11}, the \uicontrol {Return Value}
|
function after pressing \key {Shift+F11}, the \uicontrol {Return Value}
|
||||||
pane displays the value returned by the function.
|
pane displays the value returned by the function.
|
||||||
|
|
||||||
|
You can expand the view contents to check that your application sets a
|
||||||
|
local value correctly.
|
||||||
|
|
||||||
|
\if defined(qtcreator)
|
||||||
|
\section1 Locals View Actions
|
||||||
|
|
||||||
|
Right-click the \uicontrol Locals view to select the following actions:
|
||||||
|
|
||||||
|
//! [0]
|
||||||
|
\list
|
||||||
|
\li Add and remove expression evaluators
|
||||||
|
\li Change value display format
|
||||||
|
\li Expand and collapse view contents
|
||||||
|
\li Copy view contents or expression values to the clipboard
|
||||||
|
\li Open view contents in an editor
|
||||||
|
\li Open memory editor
|
||||||
|
\li Set data breakpoints
|
||||||
|
\li Use \l{Using Debugging Helpers}{debugging helpers}
|
||||||
|
\li Show tooltips in the \uicontrol Locals view when debugging
|
||||||
|
\li Dereference pointers automatically
|
||||||
|
\li Sort members of classes and structs alphabetically
|
||||||
|
\li Use dynamic object type for display
|
||||||
|
\li Set \l{Debugger Preferences}{debugger preferences}
|
||||||
|
\endlist
|
||||||
|
//! [0]
|
||||||
|
\endif
|
||||||
|
|
||||||
|
\section1 Selecting Object Type for Display
|
||||||
|
|
||||||
When using GDB, you can specify whether the dynamic or the static type of
|
When using GDB, you can specify whether the dynamic or the static type of
|
||||||
objects will be displayed. Select \uicontrol {Use dynamic object type for
|
objects will be displayed. Select \uicontrol {Use dynamic object type for
|
||||||
display} in the context menu. Keep in mind that choosing the dynamic type
|
display} in the context menu. Keep in mind that choosing the dynamic type
|
||||||
@@ -392,45 +421,88 @@
|
|||||||
\title Evaluating Expressions
|
\title Evaluating Expressions
|
||||||
|
|
||||||
To compute values of arithmetic expressions or function calls, use
|
To compute values of arithmetic expressions or function calls, use
|
||||||
expression evaluators in the \uicontrol Expressions view. To insert a new
|
expression evaluators in the \uicontrol Expressions view.
|
||||||
expression evaluator, either double-click on an empty part of the
|
|
||||||
\uicontrol {Expressions} or \uicontrol {Locals} view, or select
|
|
||||||
\uicontrol {Add New Expression Evaluator} from the context menu, or drag and
|
|
||||||
drop an expression from the code editor.
|
|
||||||
|
|
||||||
\image qtcreator-debugger-expressions.png {Expressions view}
|
You can examine static variables that the debuggers don't pick up as
|
||||||
|
\e {local variables}. For example, if you define
|
||||||
|
\c {static int staticVar = 42;} in a source file and then add \c staticVar
|
||||||
|
as an evaluated expression, you should see \e 42 in the view when the
|
||||||
|
debugger stops in the source file.
|
||||||
|
|
||||||
|
\image qtcreator-debugger-expressions.webp {Expressions view}
|
||||||
|
|
||||||
|
\section1 Adding Expression Evaluators
|
||||||
|
|
||||||
|
To add expression evaluators, drag an expression from the code editor
|
||||||
|
to the \uicontrol Expressions view.
|
||||||
|
|
||||||
|
You can also:
|
||||||
|
|
||||||
|
\list
|
||||||
|
\li Double-click in the \uicontrol {Expressions} or
|
||||||
|
\l {Local Variables and Function Parameters}{Locals} view.
|
||||||
|
\li Select \uicontrol {Add New Expression Evaluator} from the context
|
||||||
|
menu.
|
||||||
|
\endlist
|
||||||
|
|
||||||
|
Enter the expression in the \uicontrol {New Evaluated Expression} dialog:
|
||||||
|
|
||||||
|
\image qtcreator-debugger-new-evaluated-expression.webp {New Evaluated Expression dialog}
|
||||||
|
|
||||||
|
\omit
|
||||||
|
## Visible in the context menu, but does not currently work.
|
||||||
|
|
||||||
|
To insert widgets into expression evaluators, select a
|
||||||
|
widget in the debugged application and then select
|
||||||
|
\uicontrol {Select Widget to Add into Expression Evaluator}
|
||||||
|
in the context menu.
|
||||||
|
\endomit
|
||||||
|
|
||||||
|
The set of evaluated expressions is saved in your session.
|
||||||
|
|
||||||
\note Expression evaluators are powerful, but slow down debugger operation
|
\note Expression evaluators are powerful, but slow down debugger operation
|
||||||
significantly. It is advisable to not use them excessively, and to remove
|
significantly. Use them sparingly and remove them when you no longer need
|
||||||
unneeded expression evaluators as soon as possible.
|
them.
|
||||||
|
|
||||||
Expression evaluators are re-evaluated whenever the current frame changes.
|
Expression evaluators are re-evaluated whenever the current frame changes.
|
||||||
Note that functions used in the expressions are called each time, even if
|
The functions used in the expressions are called each time, even if
|
||||||
they have side-effects.
|
they have side-effects.
|
||||||
|
|
||||||
|
\if defined(qtcreator)
|
||||||
|
\section1 Expressions View Actions
|
||||||
|
|
||||||
|
Right-click the \uicontrol Expressions view to select the following actions:
|
||||||
|
|
||||||
|
\include creator-debug-views.qdoc 0
|
||||||
|
\endif
|
||||||
|
|
||||||
|
\section1 JavaScript Expressions
|
||||||
|
|
||||||
The QML debugger can evaluate JavaScript expressions.
|
The QML debugger can evaluate JavaScript expressions.
|
||||||
|
|
||||||
\if defined(qtcreator)
|
\if defined(qtcreator)
|
||||||
|
|
||||||
|
\section1 C and C++ Expressions
|
||||||
|
|
||||||
GDB, LLDB and CDB support the evaluation of simple C and C++ expressions.
|
GDB, LLDB and CDB support the evaluation of simple C and C++ expressions.
|
||||||
Functions can be called only if they are actually compiled into the debugged
|
Functions can be called only if they are actually compiled into the debugged
|
||||||
executable or a library used by the executable. Most notably, inlined
|
executable or a library used by the executable. Inlined
|
||||||
functions such as most \c{operator[]} implementations of standard containers
|
functions such as most \c{operator[]} implementations of standard containers
|
||||||
are typically \e{not} available.
|
are typically \e{not} available.
|
||||||
|
|
||||||
When using GDB or LLDB as backend, a special ranged syntax can be used to
|
When using GDB or LLDB as backend, you can use a special ranged syntax to
|
||||||
display multiple values with one expression. A sub-expression of form
|
display multiple values with one expression. A sub-expression of form
|
||||||
\c{foo[a..b]} is split into a sequence of individually evaluated expressions
|
\c{foo[a..b]} is split into a sequence of individually evaluated expressions
|
||||||
\c{foo[a], ..., foo[b]}.
|
\c{foo[a], ..., foo[b]}.
|
||||||
|
|
||||||
Compound variables of struct or class type are displayed as expandable in
|
You can expand compound variables of struct or class type to show their
|
||||||
the view. Expand entries to show all members. Together with the display of
|
members. As you also see the variable value and type, you can examine and
|
||||||
value and type, you can examine and traverse the low-level layout of object
|
traverse the low-level layout of object data.
|
||||||
data.
|
|
||||||
|
|
||||||
GDB and LLDB, and therefore \QC's debugger, also work for optimized
|
GDB and LLDB, and therefore \QC's debugger, also work for optimized
|
||||||
builds on Linux and \macos. Optimization can lead to re-ordering
|
builds on Linux and \macos. Optimization can lead to re-ordering
|
||||||
of instructions or removal of some local variables, causing the
|
of instructions or removal of some local variables, causing the
|
||||||
\uicontrol {Locals} and \uicontrol {Expressions} view to show
|
\uicontrol {Locals} and \uicontrol {Expressions} views to show
|
||||||
unexpected data.
|
unexpected data.
|
||||||
|
|
||||||
The debug information from GCC does not include enough
|
The debug information from GCC does not include enough
|
||||||
@@ -441,8 +513,6 @@
|
|||||||
\uicontrol {not in scope}. Not all uninitialized objects,
|
\uicontrol {not in scope}. Not all uninitialized objects,
|
||||||
however, can be recognized as such.
|
however, can be recognized as such.
|
||||||
|
|
||||||
\note The set of evaluated expressions is saved in your session.
|
|
||||||
|
|
||||||
\section1 Inspecting Basic Qt Objects
|
\section1 Inspecting Basic Qt Objects
|
||||||
|
|
||||||
The most powerful feature of the debugger is that the \uicontrol {Locals}
|
The most powerful feature of the debugger is that the \uicontrol {Locals}
|
||||||
|
Reference in New Issue
Block a user