aboutsummaryrefslogtreecommitdiffstats
path: root/sources/pyside6/doc/tutorials/debugging
diff options
context:
space:
mode:
Diffstat (limited to 'sources/pyside6/doc/tutorials/debugging')
-rw-r--r--sources/pyside6/doc/tutorials/debugging/mixed_debugging.rst8
-rw-r--r--sources/pyside6/doc/tutorials/debugging/qml_debugging.rst32
-rw-r--r--sources/pyside6/doc/tutorials/debugging/qtcreator/qtcreator.rst30
-rw-r--r--sources/pyside6/doc/tutorials/debugging/vscode/vscode.rst44
4 files changed, 74 insertions, 40 deletions
diff --git a/sources/pyside6/doc/tutorials/debugging/mixed_debugging.rst b/sources/pyside6/doc/tutorials/debugging/mixed_debugging.rst
index 1dff84ac4..85c326347 100644
--- a/sources/pyside6/doc/tutorials/debugging/mixed_debugging.rst
+++ b/sources/pyside6/doc/tutorials/debugging/mixed_debugging.rst
@@ -5,10 +5,10 @@ When debugging PySide code, very often you would also like to debug the
corresponding C++ extension of the PySide module. This is done by attaching your
debugger to the Python interpreter. In this tutorial, we are going to take you
through a comprehensive guide in building Qt 6, using the built Qt 6 to build
-PySide6, and then starting a debugging process in either Qt Creator or VSCode.
+PySide6, and then starting a debugging process in either *Qt Creator* or VSCode.
With VSCode, you should be able to see the combined call stacks for both C++ and
-Python together. With Qt Creator, unfortunately you would only be able to
+Python together. With *Qt Creator*, unfortunately you would only be able to
debug the native C++ code of the PySide module; that is you won't be able to set
breakpoints inside the Python code.
@@ -101,7 +101,7 @@ Build PySide6 using the Qt 6 that you built earlier
----------------------------------------------------
Follow the steps mentioned `Getting Started - Qt for Python
-<https://doc.qt.io/qtforpython/gettingstarted.html>`_
+<https://doc.qt.io/qtforpython/gettingstarted/index.html>`_
You may manually select the modules to install using the ``--module-subset`` cli
argument for `setup.py`. This was my installation script
@@ -116,7 +116,7 @@ It is recommended to use a Python virtual environment rather than installing in
Debugging the process using your preferred IDE
----------------------------------------------
-The following sections guide you through the setup for Qt Creator or VSCode.
+The following sections guide you through the setup for *Qt Creator* or VSCode.
.. toctree::
:glob:
diff --git a/sources/pyside6/doc/tutorials/debugging/qml_debugging.rst b/sources/pyside6/doc/tutorials/debugging/qml_debugging.rst
new file mode 100644
index 000000000..223e608fc
--- /dev/null
+++ b/sources/pyside6/doc/tutorials/debugging/qml_debugging.rst
@@ -0,0 +1,32 @@
+Using Qt Creator's QML Debugger for a PySide6 QML Application
+*************************************************************
+
+Besides the C++ debugger, *Qt Creator* provides a `QML debugger`_ which lets you
+inspect JavaScript code. It works by connecting to a socket server run by the
+``QmlEngine`` instance. The port is passed on the command line. To enable it,
+add the below code to your QML application:
+
+.. code-block:: python
+
+ from argparse import ArgumentParser, RawTextHelpFormatter
+
+ ...
+
+ if __name__ == "__main__":
+ argument_parser = ArgumentParser(...)
+ argument_parser.add_argument("-qmljsdebugger", action="store",
+ help="Enable QML debugging")
+ options = argument_parser.parse_args()
+ if options.qmljsdebugger:
+ QQmlDebuggingEnabler.enableDebugging(True)
+ app = QApplication(sys.argv)
+
+
+For instructions on how to use the QML debugger, see
+`Debugging a Qt Quick Example Application`_.
+
+.. note:: The code should be removed or disabled when shipping the application
+ as it poses a security risk.
+
+.. _`QML debugger`: https://doc.qt.io/qtcreator/creator-debugging-qml.html
+.. _`Debugging a Qt Quick Example Application`: https://doc.qt.io/qtcreator/creator-qml-debugging-example.html
diff --git a/sources/pyside6/doc/tutorials/debugging/qtcreator/qtcreator.rst b/sources/pyside6/doc/tutorials/debugging/qtcreator/qtcreator.rst
index c8c9fb8ae..a78a67fad 100644
--- a/sources/pyside6/doc/tutorials/debugging/qtcreator/qtcreator.rst
+++ b/sources/pyside6/doc/tutorials/debugging/qtcreator/qtcreator.rst
@@ -1,9 +1,9 @@
Debugging PySide with Qt Creator (Linux)
****************************************
-As opposed to VSCode, presently Qt Creator does not support mixed mode debugging.
+As opposed to VSCode, presently *Qt Creator* does not support mixed mode debugging.
However, we can debug the C++ implementation of the corresponding Python PySide
-code. Unlike VSCode, Qt Creator provides a very easy interface to attach GDB to
+code. Unlike VSCode, *Qt Creator* provides a very easy interface to attach GDB to
the Python interpreter. It saves you from doing all the extra configuration
steps, that have to be done with VSCode.
@@ -14,26 +14,26 @@ Here are the steps:
2. Go to Projects -> Run -> Run Configuration -> Add. This is going to open a
new window shown below.
- .. image:: custom_executable_create.png
- :alt: creation of custom executable
- :align: center
+ .. image:: custom_executable_create.png
+ :alt: creation of custom executable
+ :align: center
3. Click on Custom Executable and `Create` a new configuration. Feed in the
-details like shown below.
+ details like shown below.
- .. image:: custom_executable_run_config.png
- :alt: run configuration of custom executable
- :align: center
+ .. image:: custom_executable_run_config.png
+ :alt: run configuration of custom executable
+ :align: center
4. Debug -> Start Debugging -> Start Debugging Without Deployment.
- .. image:: start_debugging_without_deployment.png
- :alt: start debugging without deployment
- :align: center
+ .. image:: start_debugging_without_deployment.png
+ :alt: start debugging without deployment
+ :align: center
You will now hit you breakpoint and can start debugging your code.
- .. image:: breakpoint_cpp.png
- :alt: breakpoint cpp
- :align: center
+.. image:: breakpoint_cpp.png
+ :alt: breakpoint cpp
+ :align: center
diff --git a/sources/pyside6/doc/tutorials/debugging/vscode/vscode.rst b/sources/pyside6/doc/tutorials/debugging/vscode/vscode.rst
index bb91b5b99..b2a527b0e 100644
--- a/sources/pyside6/doc/tutorials/debugging/vscode/vscode.rst
+++ b/sources/pyside6/doc/tutorials/debugging/vscode/vscode.rst
@@ -9,6 +9,8 @@ in a single session. With VSCode you would be able to do the following:
* Put breakpoints in both the Python and the C++ code.
* Step from Python to C++ code and vice versa.
+For Windows, see :ref:`creating_windows_debug_builds`.
+
Let's get started with setting up everything and debugging a Python process.
Setting the Python interpreter
@@ -34,7 +36,7 @@ search for "Python: Select Interpreter".
Creating Configurations in launch.json
--------------------------------------
-Run -> Add Configuration -> Python -> Python File
+``Run -> Add Configuration -> Python -> Python File``
This should create a launch.json file which looks like this:
@@ -143,7 +145,7 @@ Debug The Process
1. Set a breakpoint in the Python code.
-2. Go to `Run And Debug` (Ctrl + Shift + D) and run the "Python: Current File"
+2. Go to ``Run And Debug`` (Ctrl + Shift + D) and run the "Python: Current File"
by clicking the run symbol (green right-arrow). This will hit the breakpoint
and will halt the Python debugger.
@@ -151,40 +153,40 @@ Debug The Process
Current File" to "(gdb) Attach" or "(Windows) Attach". Your setup should now
look like this.
- .. image:: breakpoint_gdb.png
- :alt: breakpoint before attach gdb
- :align: center
+ .. image:: breakpoint_gdb.png
+ :alt: breakpoint before attach gdb
+ :align: center
4. Run "(gdb) Attach" or "(Windows) Attach" and this should ask you for the
processId of the Python process to which you want to attach the C++ debugger.
VSCode also lets you search for the process by its name.
- .. tip:: You can find the processId by running `ps aux | grep python`
+ .. tip:: You can find the processId by running ``ps aux | grep python``
- .. image:: find_process_gdb.png
- :alt: find process vscode
- :align: center
+ .. image:: find_process_gdb.png
+ :alt: find process vscode
+ :align: center
5. VSCode might now ask you for superuser permissions. In that case, type 'y'
and enter your password.
- .. code-block:: bash
+ .. code-block:: bash
- Superuser access is required to attach to a process. Attaching as
- superuser can potentially harm your computer. Do you want to continue?
- [y/N]_
+ Superuser access is required to attach to a process. Attaching as
+ superuser can potentially harm your computer. Do you want to continue?
+ [y/N]_
6. That is it. You should now be able to hit the breakpoints that you have set
on the C++ counterparts.
- .. figure:: audioformat_wrapper.png
- :alt: Breakpoint set on the shiboken wrapper class
- :align: left
+ .. figure:: audioformat_wrapper.png
+ :alt: Breakpoint set on the shiboken wrapper class
+ :align: left
- Breakpoint set on the shiboken wrapper class
+ Breakpoint set on the shiboken wrapper class
- .. figure:: audioformat_cpp.png
- :alt: Breakpoint set on C++ implementation
- :align: left
+ .. figure:: audioformat_cpp.png
+ :alt: Breakpoint set on C++ implementation
+ :align: left
- Breakpoint set on C++ implementation
+ Breakpoint set on C++ implementation