On this page
  1. bdb.Bdb
  2. Import
  3. Signature & Overview
  4. Methods & Attributes
  5. Usage
  6. Gotchas
  7. REPL Inspect

bdb.Bdb

Up: bdb | Next: bdb.BdbQuit
Rel: bdb.BdbQuit, bdb.Breakpoint
Ref: docs.python.org — bdb.Bdb
Tags: #public #python3 #stdlib #bdb


Import

import bdb
from bdb import Bdb

Signature & Overview

bdb.Bdb(skip=None, backend='settrace')

Generic Python debugger base class.

Methods & Attributes

Usage

import bdb

class Tracer(bdb.Bdb):
    def __init__(self):
        super().__init__()
        self.seen = []
    def user_call(self, frame, args):
        self.seen.append(frame.f_code.co_name)

tr = Tracer()
assert tr.runcall(lambda: 42) == 42 and "<lambda>" in tr.seen

Gotchas

REPL Inspect

from bdb import Bdb
help(Bdb)

Linked from

Related notes