| Summary: | Impossible to debug python | ||
|---|---|---|---|
| Product: | [Applications] kate | Reporter: | Aario <aario.iran> |
| Component: | application | Assignee: | KWrite Developers <kwrite-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | john.kizer |
| Priority: | NOR | ||
| Version First Reported In: | 25.04.0 | ||
| Target Milestone: | --- | ||
| Platform: | Other | ||
| OS: | Linux | ||
| Latest Commit: | https://invent.kde.org/utilities/kate/-/commit/8af3900eb66fec1084427abd0354727bfbe2ff3e | Version Fixed/Implemented In: | |
| Sentry Crash Report: | |||
|
Description
Aario
2025-06-12 12:15:10 UTC
Possibly something similar to https://bugs.kde.org/show_bug.cgi?id=481691 ? Hello, I've investigated this issue further by compiling Kate from source and tracing the debugger's execution flow. I have submitted a Merge Request (!1797) that resolves the issue by improving the user experience. **Problem Analysis:** The root cause is how the debugger configuration is gathered for DAP-based debuggers like `debugpy`. 1. The `ConfigView::currentDAPTarget()` method in `addons/gdbplugin/configview.cpp` reads the executable path directly from the `m_executable` QLineEdit widget. 2. For interpreted languages like Python, a user often won't have anything in this box, expecting the IDE to use the currently open file. 3. This results in an empty string being passed as the `program` argument to the `DapBackend`, which causes the `debugpy` adapter to exit with the `Error: missing target` message. 4. This backend crash then causes the briefly-enabled debugger UI to immediately become disabled again, creating a very confusing "catch-22" for the user. **Proposed Solution in MR !1797:** My patch fixes this by making the UI much more instructive: 1. **In `configview.cpp`:** The `currentDAPTarget()` method now checks if the executable path is empty. If it is, it displays a `QMessageBox` that clearly instructs the user to set the target path in the debugger settings. It then signals that the launch should be aborted. 2. **In `plugin_kategdb.cpp`:** The `slotDebug()` method now checks for this failure signal from `currentDAPTarget()` and cleanly aborts the launch process before the backend is even started. This approach prevents the confusing backend error and directly guides the user on the correct workflow for configuring a debug target. It makes the behavior clear and intentional. Thank you for your consideration. Git commit 8af3900eb66fec1084427abd0354727bfbe2ff3e by Waqar Ahmed, on behalf of Aario Shahbany.
Committed on 18/07/2025 at 19:43.
Pushed by waqar into branch 'master'.
Debugger: Improve DAP launch to prevent starting without a target
Currently, trying to launch a DAP session (e.g., Python) with an empty
executable path fails with an unhelpful error from the debug adapter,
after temporarily enabling and then disabling the UI.
This patch introduces two changes to create a better user experience:
1. In ConfigView::currentDAPTarget, if the executable path is empty,
a warning dialog is now shown to the user instructing them to set
the target path. The configuration is then invalidated to prevent
the launch from proceeding.
2. In KatePluginGDBView::slotDebug, a check is added to ensure the
configuration is valid before any debugger actions are taken. This
prevents multiple warning dialogs and cleanly aborts the launch.
This makes the behavior more intuitive and guides the user to the
correct configuration step.
Closes #505521
M +13 -3 addons/gdbplugin/configview.cpp
M +1 -1 addons/gdbplugin/configview.h
M +17 -1 addons/gdbplugin/plugin_kategdb.cpp
https://invent.kde.org/utilities/kate/-/commit/8af3900eb66fec1084427abd0354727bfbe2ff3e
|