---
source: https://iinventedlight.com/library/notes/python-bdb.md
title: "Python bdb: the debugger framework behind breakpoints and pdb"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "PSF License Version 2 (Python Software Foundation); PSF License Version 2 (CPython); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, bdb — Debugger framework; CPython, bdb documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-27
status: published
approved_by: "Cole Withington, 2026-11-27 14:30 PT: \"Yes, publish all of that now\""
checked_on: 2026-11-27
as_of: 2026-11-27
confidence: medium
untested: "Not reproduced (2026-11-27). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-python: python-bdb"
tags: [python, bdb, debugger, breakpoints, pdb]
client: Librarian
sources:
  - id: S1
    title: "bdb — Debugger framework"
    publisher: Python Software Foundation
    url: https://docs.python.org/3/library/bdb.html
    accessed: 2026-11-27
    license: "PSF License Version 2"
  - id: S2
    title: "bdb documentation (source)"
    publisher: CPython
    url: https://raw.githubusercontent.com/python/cpython/main/Doc/library/bdb.rst
    accessed: 2026-11-27
    license: "PSF License Version 2"
---
# Python bdb: the debugger framework behind breakpoints and pdb
**Answer:** The bdb module handles basic debugger functions, like setting breakpoints or managing execution.

## Breakpoints

bdb handles basic debugger functions, including setting breakpoints and managing execution via the debugger.

BdbQuit is the exception the Bdb class raises when the debugger should quit.

Breakpoint implements temporary breakpoints, ignore counts, enabling and disabling, and conditions.

Breakpoints are indexed by number in bpbynumber and by (file, line) pairs in bplist. A single line may have more than one breakpoint.

The file name of a new breakpoint should already be in canonical form.

If funcname is set, a hit is counted on the function's first line. A conditional breakpoint always counts a hit.

Breakpoint methods include deleteMe, enable, disable, bpformat, and bpprint. bpformat was added in version 3.2.

Attributes include file, line, temporary, cond, funcname, enabled, ignore, and hits.

## The Bdb class

Bdb is a generic Python debugger base class. It handles the trace facility, and a derived class should implement user interaction. pdb.Pdb is the standard example.

If given, skip must be an iterable of glob-style module name patterns. Frames from a module whose __name__ matches are not stepped into.

The backend argument is either settrace or monitoring. settrace uses sys.settrace and is the more compatible choice.

The monitoring backend uses sys.monitoring, added in 3.12, and can skip unused events.

The skip parameter arrived in 3.1, and backend arrived in 3.14.

canonic returns a case-normalized absolute path for real files. Names such as <stdin> are left unchanged.

start_trace and stop_trace were added in 3.14 and, with the settrace backend, map to sys.settrace.

## See also

- [python-pdb](https://iinventedlight.com/library/notes/python-pdb/)
- [python-trace](https://iinventedlight.com/library/notes/python-trace/)
- [python-sys-monitoring](https://iinventedlight.com/library/notes/python-sys-monitoring/)

## Claims

- id: C1
  claim: bdb handles basic debugger functions such as breakpoints and execution control.
  source: S1
  evidence: "The bdb module handles basic debugger functions, like setting"

- id: C2
  claim: Breakpoint supports temporary breakpoints, ignore counts, and conditionals.
  source: S2
  evidence: "This class implements temporary breakpoints, ignore counts, disabling"

- id: C3
  claim: Bdb is a generic debugger base class; pdb.Pdb is one derived example.
  source: S1
  evidence: "The Bdb class acts as a generic Python debugger base class"

## Sources

- [S1] bdb — Debugger framework. Python Software Foundation. https://docs.python.org/3/library/bdb.html . License: PSF License Version 2. Accessed 2026-11-27.

- [S2] bdb documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/bdb.rst . License: PSF License Version 2. Accessed 2026-11-27.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, bdb — Debugger framework; CPython, bdb documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
