Bug 2381839 - "Easier Python Debugging" in gdb is not so easy
Summary: "Easier Python Debugging" in gdb is not so easy
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: python3.13
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Charalampos Stratakis
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-07-17 22:26 UTC by Elliott Sales de Andrade
Modified: 2026-07-03 00:55 UTC (History)
5 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2026-06-12 09:46:13 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github python cpython pull 143371 0 None Merged gh-142095: Use thread local frame info in `py-bt` and `py-bt-full` when available 2026-05-20 12:09:36 UTC

Description Elliott Sales de Andrade 2025-07-17 22:26:47 UTC
Way back in Fedora 13, the "Easier Python Debugging" change [1] was implemented. According to the original change, you must install python{,3}-debuginfo to gain access to the `py-*` commands.

In past times, this made sense, as you needed `python3-debuginfo` to get debug symbols. However, in modern times, gdb supports debuginfod and will automatically download symbols it needs. This makes the full package less relevant. Thus it would be more convenient if the gdb scripts were moved to somewhere that would be more normally installed, such as python3-devel.

Secondly, if you run this on `python3`, you get nothing useful:
```
(gdb) py-bt
Traceback (most recent call first):
  <built-in method __getattr__ of PyCapsule object at remote 0x7fff82ffeca0>
  (unable to read python frame information)
  <optimized out>
  (unable to read python frame information)
  (unable to read python frame information)
  <optimized out>
  (unable to read python frame information)
  <optimized out>
  (unable to read python frame information)
  (unable to read python frame information)
  <optimized out>
  (unable to read python frame information)
  <optimized out>
  (unable to read python frame information)
```

You actually have to run on `python3-debug` to get the gdb script to read frames correctly:
```
(gdb) py-bt
Traceback (most recent call first):
  <built-in method __getattr__ of PyCapsule object at remote 0x7fff82945b70>
  File "<frozen importlib._bootstrap>", line 782, in _init_module_attrs
  File "<frozen importlib._bootstrap>", line 819, in module_from_spec
  File "<frozen importlib._bootstrap>", line 921, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  <built-in method __import__ of module object at remote 0x7ffff73baed0>
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1415, in _handle_fromlist
  File "/usr/lib64/python3.13/site-packages/matplotlib/__init__.py", line 249, in _check_versions
    from . import ft2font  # noqa: F401
  File "/usr/lib64/python3.13/site-packages/matplotlib/__init__.py", line 264, in <module>
    _check_versions()
  ...
```

This was not mentioned on the Change proposal page, so I assume it wasn't necessary then. I don't know what changed to break this, but it would be nice if that were automatically handled, or the script printed a warning to use the debug build instead.


Version-Release number of selected component (if applicable):
python3-3.13.5-1.fc42.x86_64


Additional info:
[1] https://fedoraproject.org/wiki/Features/EasierPythonDebugging

Comment 1 Miro Hrončok 2025-07-18 12:45:48 UTC
> it would be more convenient if the gdb scripts were moved to somewhere that would be more normally installed, such as python3-devel

I agree.

> or the script printed a warning to use the debug build instead.

If it's possible to do that, I don't see why not.

Comment 2 Victor Stinner 2025-09-10 12:16:05 UTC
You're correct that python3-debug program should be used to debug a Python application with gdb.

> This was not mentioned on the Change proposal page, so I assume it wasn't necessary then. I don't know what changed to break this, but it would be nice if that were automatically handled, or the script printed a warning to use the debug build instead.

The python3 program is highly optimized (gcc -O3, LTO, PGO) which makes gdb unable to rebuild the backtrace, retrieve function arguments and local variables. You can get a longer explanation in the following article:

https://developers.redhat.com/articles/2021/09/08/debugging-python-c-extensions-gdb#red_hat_contributions_to_the_python_debug_build

Comment 3 Miro Hrončok 2025-10-22 12:12:42 UTC
We haven't addressed this yet, but it's still part of our backlog.

Comment 4 Fedora Release Engineering 2026-05-06 13:35:01 UTC
This message is a reminder that Fedora Linux 42 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora Linux 42 on 2026-05-13.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
'version' of '42'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, change the 'version' 
to a later Fedora Linux version. Note that the version field may be hidden.
Click the "Show advanced fields" button if you do not see it.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora Linux 42 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora Linux, you are encouraged to change the 'version' to a later version
prior to this bug being closed.

Comment 5 Miro Hrončok 2026-05-20 12:09:37 UTC
https://github.com/python/cpython/pull/143371 should help with the "(unable to read python frame information)" problem.

Next up, move the files from python3-debuginfo to python3-libs.

Comment 6 Fedora Update System 2026-06-12 07:46:13 UTC
FEDORA-2026-80fd7efde6 (python3.15-3.15.0~b2-3.fc45) has been submitted as an update to Fedora 45.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-80fd7efde6

Comment 7 Fedora Update System 2026-06-12 09:46:13 UTC
FEDORA-2026-80fd7efde6 (python3.15-3.15.0~b2-3.fc45) has been pushed to the Fedora 45 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 8 Fedora Update System 2026-06-12 16:33:46 UTC
FEDORA-2026-415d3f18e9 (python3.15-3.15.0~b2-3.fc43) has been submitted as an update to Fedora 43.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-415d3f18e9

Comment 9 Fedora Update System 2026-06-12 16:34:04 UTC
FEDORA-2026-c8aa303707 (python3.15-3.15.0~b2-3.fc44) has been submitted as an update to Fedora 44.
https://bodhi.fedoraproject.org/updates/FEDORA-2026-c8aa303707

Comment 10 Fedora Update System 2026-06-13 01:43:44 UTC
FEDORA-2026-415d3f18e9 has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-415d3f18e9`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-415d3f18e9

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 11 Fedora Update System 2026-06-13 01:56:08 UTC
FEDORA-2026-c8aa303707 has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-c8aa303707`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-c8aa303707

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 12 Fedora Update System 2026-06-17 08:31:18 UTC
FEDORA-2026-42562b0e19 has been pushed to the Fedora 43 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-42562b0e19`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-42562b0e19

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 13 Fedora Update System 2026-06-18 04:58:54 UTC
FEDORA-2026-417b28c48a has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-417b28c48a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-417b28c48a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Fedora Update System 2026-06-25 16:24:18 UTC
FEDORA-2026-42562b0e19 (python3.15-3.15.0~b2-5.fc43) has been pushed to the Fedora 43 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 15 Fedora Update System 2026-06-25 16:31:09 UTC
FEDORA-2026-5ab61f768a has been pushed to the Fedora 44 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2026-5ab61f768a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2026-5ab61f768a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2026-07-03 00:55:39 UTC
FEDORA-2026-5ab61f768a (python3.15-3.15.0~b3-1.fc44) has been pushed to the Fedora 44 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.