Skip to content

Conversation

@colesbury
Copy link
Contributor

@colesbury colesbury commented Jan 2, 2026

In optimized and -Og builds, arguments and local variables are frequently unavailable in gdb. This makes py-bt fail to print anything useful. Use the PyThreadState* pointers _Py_tss_gilstate and Py_tss_tstate to find the interpreter frame if we can't get the frame from the _PyEval_EvalFrameDefault call.

@colesbury colesbury requested a review from vstinner January 2, 2026 19:50
@colesbury colesbury changed the title gh-142941: Use thread local frame info in py-bt and py-bt-full when available gh-142095: Use thread local frame info in py-bt and py-bt-full when available Jan 2, 2026
@colesbury colesbury added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 2, 2026
@bedevere-bot

This comment was marked as outdated.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 2, 2026
@colesbury colesbury added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 3, 2026
@bedevere-bot

This comment was marked as outdated.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 3, 2026
@colesbury colesbury added the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 5, 2026
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by @colesbury for commit a44b2a7 🤖

Results will be shown at:

https://buildbot.python.org/all/#/grid?branch=refs%2Fpull%2F143371%2Fmerge

If you want to schedule another build, you need to add the 🔨 test-with-buildbots label again.

@bedevere-bot bedevere-bot removed the 🔨 test-with-buildbots Test PR w/ buildbots; report in status section label Jan 5, 2026
@colesbury colesbury marked this pull request as ready for review January 5, 2026 17:54
@cielavenir
Copy link

ooo

thank you so much 😭

$ gdb python3
GNU gdb (Debian 16.3-1) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from python3...
Reading symbols from /usr/lib/debug/.build-id/22/c2082c4e6b2d096ae773dc6902a9465c23c213.debug...
(gdb) r
Starting program: /usr/bin/python3 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Python 3.13.5 (main, Jun 25 2025, 18:55:22) [GCC 14.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
    Program received signal SIGINT, Interrupt.
                                              __internal_syscall_cancel (a1=140737349371808, a2=1, a3=a3@entry=100, a4=a4@entry=0, a5=a5@entry=0, a6=a6@entry=0, nr=7) at ./nptl/cancellation.c:44
warning: 44	./nptl/cancellation.c: No such file or directory
(gdb) py-bt
Traceback (most recent call first):
  File "/usr/lib/python3.13/_pyrepl/unix_console.py", line 432, in wait
    or bool(self.pollob.poll(timeout))
  File "/usr/lib/python3.13/_pyrepl/reader.py", line 705, in handle1
    self.console.wait(100)
  File "/usr/lib/python3.13/_pyrepl/reader.py", line 750, in readline
    self.handle1()
  File "/usr/lib/python3.13/_pyrepl/readline.py", line 389, in multiline_input
    return reader.readline()
  File "/usr/lib/python3.13/_pyrepl/simple_interact.py", line 146, in run_multiline_interactive_console
    statement = multiline_input(more_lines, ps1, ps2)
  File "/usr/lib/python3.13/_pyrepl/main.py", line 59, in interactive_console
    run_multiline_interactive_console(console)
  File "/usr/lib/python3.13/_pyrepl/__main__.py", line 10, in <module>
    __pyrepl_interactive_console()
  <built-in method exec of module object at remote 0x7ffff7b91850>
  File "<frozen runpy>", line 88, in _run_code
  File "<frozen runpy>", line 198, in _run_module_as_main

colesbury and others added 4 commits January 7, 2026 13:08
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
Co-authored-by: Victor Stinner <vstinner@python.org>
@colesbury colesbury requested a review from vstinner January 7, 2026 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants