forked from qt-creator/qt-creator
Doc: Edit "Evaluating Expressions"
- Add some information about what users can see in the Expressions view. - Add debugger backend limitations. - Add subtitles. - Move the list of context menu commands to the end. Fixes: QTCREATORBUG-31953 Change-Id: I11aafde8eaebe888981611fc201a693add7de051 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -462,15 +462,19 @@
|
|||||||
|
|
||||||
\brief Compute values of arithmetic expressions or function calls.
|
\brief Compute values of arithmetic expressions or function calls.
|
||||||
|
|
||||||
To compute values of arithmetic expressions or function calls, use
|
To access global data that is not visible in the
|
||||||
|
\l {Local Variables and Function Parameters}{Locals} view or to compute
|
||||||
|
values of arithmetic expressions or function calls, use
|
||||||
expression evaluators in the \uicontrol Expressions view.
|
expression evaluators in the \uicontrol Expressions view.
|
||||||
|
|
||||||
You can examine static variables that the debuggers don't pick up as
|
For example, if you define
|
||||||
\e {local variables}. For example, if you define
|
|
||||||
\c {static int staticVar = 42;} in a source file and then add \c staticVar
|
\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
|
as an evaluated expression, you should see \e 42 in the view when the
|
||||||
debugger stops in the source file.
|
debugger stops in the source file.
|
||||||
|
|
||||||
|
You can also use Expression Evaluators as shortcuts to items that are
|
||||||
|
nested deeply in the locals tree.
|
||||||
|
|
||||||
\image qtcreator-debugger-expressions.webp {Expressions view}
|
\image qtcreator-debugger-expressions.webp {Expressions view}
|
||||||
|
|
||||||
\section1 Adding Expression Evaluators
|
\section1 Adding Expression Evaluators
|
||||||
@@ -481,8 +485,8 @@
|
|||||||
You can also:
|
You can also:
|
||||||
|
|
||||||
\list
|
\list
|
||||||
\li Double-click in the \uicontrol {Expressions} or
|
\li Double-click in the \uicontrol {Expressions} or \uicontrol {Locals}
|
||||||
\l {Local Variables and Function Parameters}{Locals} view.
|
view.
|
||||||
\li Select \uicontrol {Add New Expression Evaluator} from the context
|
\li Select \uicontrol {Add New Expression Evaluator} from the context
|
||||||
menu.
|
menu.
|
||||||
\endlist
|
\endlist
|
||||||
@@ -502,21 +506,12 @@
|
|||||||
|
|
||||||
The set of evaluated expressions is saved in your session.
|
The set of evaluated expressions is saved in your session.
|
||||||
|
|
||||||
\note Expression evaluators are powerful, but slow down debugger operation
|
|
||||||
significantly. Use them sparingly and remove them when you no longer need
|
|
||||||
them.
|
|
||||||
|
|
||||||
Expression evaluators are re-evaluated whenever the current frame changes.
|
Expression evaluators are re-evaluated whenever the current frame changes.
|
||||||
The 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)
|
\note Evaluating expressions is slow, so remove expression evaluators after
|
||||||
\section1 Expressions View Actions
|
use.
|
||||||
|
|
||||||
Right-click the \uicontrol Expressions view to select the following actions:
|
|
||||||
|
|
||||||
\include creator-debug-views.qdoc 0
|
|
||||||
\endif
|
|
||||||
|
|
||||||
\section1 JavaScript Expressions
|
\section1 JavaScript Expressions
|
||||||
|
|
||||||
@@ -526,27 +521,46 @@
|
|||||||
|
|
||||||
\section1 C and C++ Expressions
|
\section1 C and C++ Expressions
|
||||||
|
|
||||||
GDB, LLDB and CDB support the evaluation of simple C and C++ expressions.
|
CDB, GDB, and LLDB support the evaluation of simple C and C++ expressions,
|
||||||
|
such as arithmetic expressions made of simple values and pointers.
|
||||||
|
|
||||||
|
Depending on the backend and concrete location, some function calls
|
||||||
|
can be evaluated. CDB is the most limited backend in this respect.
|
||||||
|
|
||||||
|
\section2 Function Calls
|
||||||
|
|
||||||
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. 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.
|
||||||
|
|
||||||
|
\note When an expression has a function call, anything can happen, including
|
||||||
|
corruption of the application's state, or using the application's permission
|
||||||
|
to perform arbitrary actions.
|
||||||
|
|
||||||
|
\section2 Ranged Syntax
|
||||||
|
|
||||||
When using GDB or LLDB as backend, you can use a special ranged syntax 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]}.
|
||||||
|
|
||||||
|
\section2 Compound Variables
|
||||||
|
|
||||||
You can expand compound variables of struct or class type to show their
|
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
|
members. As you also see the variable value and type, you can examine and
|
||||||
traverse the low-level layout of object data.
|
traverse the low-level layout of object data.
|
||||||
|
|
||||||
|
\section2 Optimized Builds
|
||||||
|
|
||||||
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} views to show
|
\uicontrol {Locals} and \uicontrol {Expressions} views to show
|
||||||
unexpected data.
|
unexpected data.
|
||||||
|
|
||||||
|
\section2 GCC
|
||||||
|
|
||||||
The debug information from GCC does not include enough
|
The debug information from GCC does not include enough
|
||||||
information about the time when a variable is initialized.
|
information about the time when a variable is initialized.
|
||||||
Therefore, \QC can not tell whether the contents of a local
|
Therefore, \QC can not tell whether the contents of a local
|
||||||
@@ -555,6 +569,12 @@
|
|||||||
\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.
|
||||||
|
|
||||||
|
\section1 Expressions View Actions
|
||||||
|
|
||||||
|
Right-click the \uicontrol Expressions view to select the following actions:
|
||||||
|
|
||||||
|
\include creator-debug-views.qdoc 0
|
||||||
|
|
||||||
\sa {Debug}{How To: Debug}, {Debugging}, {Debuggers}, {Debugger}
|
\sa {Debug}{How To: Debug}, {Debugging}, {Debuggers}, {Debugger}
|
||||||
\endif
|
\endif
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user