8000 gh-89480: Document the gdb helpers by pablogsal · Pull Request #115657 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-89480: Document the gdb helpers #115657

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
Feb 23, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Rewrite the introduction based on Carol's comment
Co-Authored-By: Carol Willing <carolcode@willingconsulting.com>
  • Loading branch information
encukou and willingc committed Feb 23, 2024
commit e646760b73487e9bfc4fd1c8a8df061a63df1b8a
39 changes: 24 additions & 15 deletions Doc/howto/gdb_helpers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,30 @@ Debugging C API extensions and CPython Internals with GDB

.. highlight:: none

If you experience low-level problems such as crashes or deadlocks,
especially when debugging extensions or tinkering with parts of CPython
which are written in C, it can be convenient to use a low-level
debugger such as GDB in order to diagnose and fix the issue.
By default, however, GDB (or any of its front-ends) doesn't know about
high-level information specific to the CPython interpreter, such as which
Python function is currently executing, or what type or value has a given
Python object represented by a standard ``PyObject *`` pointer.
This guide introduces an extenstion that provides this information to GDB.

The guide assumes you are familiar with GDB, and focuses on Python-specific
details.
It is a consolidation of guidance from the CPython
`devguide <https://devguide.python.org>`_ and the
`Python wiki <https://wiki.python.org/moin/DebuggingWithGdb>`_
This document explains how the Python GDB extension, ``python-gdb.py``, can
be used with the GDB debugger to debug CPython extensions and the
CPython interpreter itself.

When debugging low-level problems such as crashes or deadlocks, a low-level
debugger, such as GDB, is useful to diagnose and correct the issue.
By default, GDB (or any of its front-ends) doesn't support high-level
information specific to the CPython interpreter.

The ``python-gdb.py`` extension adds CPython interpreter information to GDB.
The extension helps introspect the stack of currently executing Python functions.
Given a Python object represented by a :c:expr:`PyObject *` pointer,
the extension surfaces the type and value of the object.

Developers who are working on CPython extensions or tinkering with parts
of CPython that are written in C can use this document to learn how to use the
``python-gdb.py`` extension with GDB.

.. note::

This document assumes that you are familiar with the basics of GDB and the
CPython C API. It consolidates guidance from the
`devguide <https://devguide.python.org>`_ and the
`Python wiki <https://wiki.python.org/moin/DebuggingWithGdb>`_.


Prerequisites
Expand Down
0