summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorLeena Miettinen <riitta-leena.miettinen@qt.io>2023-03-23 16:24:04 +0100
committerLeena Miettinen <riitta-leena.miettinen@qt.io>2023-03-28 10:48:18 +0000
commitfaf8f91b653de56031ee641e6d7d053e522adb20 (patch)
tree2564f27bd803744bf524f0162a2c281fa47fdf0a /doc
parent9af26dd086dd8b17cf9d8eb0ffa4a722831439d9 (diff)
downloadqt-creator-faf8f91b653de56031ee641e6d7d053e522adb20.tar.gz
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>
Diffstat (limited to 'doc')
-rw-r--r--doc/qtcreator/images/qtcreator-debugger-expressions.pngbin42246 -> 0 bytes
-rw-r--r--doc/qtcreator/images/qtcreator-debugger-expressions.webpbin0 -> 1480 bytes
-rw-r--r--doc/qtcreator/images/qtcreator-debugger-new-evaluated-expression.webpbin0 -> 3992 bytes
-rw-r--r--doc/qtcreator/src/debugger/creator-debug-views.qdoc106
4 files changed, 88 insertions, 18 deletions
diff --git a/doc/qtcreator/images/qtcreator-debugger-expressions.png b/doc/qtcreator/images/qtcreator-debugger-expressions.png
deleted file mode 100644
index ef9e972071..0000000000
--- a/doc/qtcreator/images/qtcreator-debugger-expressions.png
+++ /dev/null
Binary files differ
diff --git a/doc/qtcreator/images/qtcreator-debugger-expressions.webp b/doc/qtcreator/images/qtcreator-debugger-expressions.webp
new file mode 100644
index 0000000000..2a14cce5d5
--- /dev/null
+++ b/doc/qtcreator/images/qtcreator-debugger-expressions.webp
Binary files differ
diff --git a/doc/qtcreator/images/qtcreator-debugger-new-evaluated-expression.webp b/doc/qtcreator/images/qtcreator-debugger-new-evaluated-expression.webp
new file mode 100644
index 0000000000..1934a05372
--- /dev/null
+++ b/doc/qtcreator/images/qtcreator-debugger-new-evaluated-expression.webp
Binary files differ
diff --git a/doc/qtcreator/src/debugger/creator-debug-views.qdoc b/doc/qtcreator/src/debugger/creator-debug-views.qdoc
index d1c2adff5f..78ee139e3f 100644
--- a/doc/qtcreator/src/debugger/creator-debug-views.qdoc
+++ b/doc/qtcreator/src/debugger/creator-debug-views.qdoc
@@ -374,6 +374,35 @@
function after pressing \key {Shift+F11}, the \uicontrol {Return Value}
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
objects will be displayed. Select \uicontrol {Use dynamic object type for
display} in the context menu. Keep in mind that choosing the dynamic type
@@ -392,45 +421,88 @@
\title Evaluating Expressions
To compute values of arithmetic expressions or function calls, use
- expression evaluators in the \uicontrol Expressions view. To insert a new
- 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.
+ expression evaluators in the \uicontrol 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}
- \image qtcreator-debugger-expressions.png {Expressions view}
+ \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
- significantly. It is advisable to not use them excessively, and to remove
- unneeded expression evaluators as soon as possible.
+ significantly. Use them sparingly and remove them when you no longer need
+ them.
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.
+ \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.
\if defined(qtcreator)
+
+ \section1 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
- 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
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
\c{foo[a..b]} is split into a sequence of individually evaluated expressions
\c{foo[a], ..., foo[b]}.
- Compound variables of struct or class type are displayed as expandable in
- the view. Expand entries to show all members. Together with the display of
- value and type, you can examine and traverse the low-level layout of object
- data.
+ You can expand compound variables of struct or class type to show their
+ members. As you also see the variable value and type, you can examine and
+ traverse the low-level layout of object data.
GDB and LLDB, and therefore \QC's debugger, also work for optimized
builds on Linux and \macos. Optimization can lead to re-ordering
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.
The debug information from GCC does not include enough
@@ -441,8 +513,6 @@
\uicontrol {not in scope}. Not all uninitialized objects,
however, can be recognized as such.
- \note The set of evaluated expressions is saved in your session.
-
\section1 Inspecting Basic Qt Objects
The most powerful feature of the debugger is that the \uicontrol {Locals}