> **Источник:** https://python-all.ru/3.6/library/debug.html
>
> «Документация Python на русском» – неофициальный перевод официальной документации Python: версии от 2.6 до 3.16, полнотекстовый поиск, английский оригинал рядом с переводом. Эта Markdown-версия страницы предназначена для работы с LLM: вставьте её в ChatGPT, Claude или Cursor.

---

# 27. Отладка и профилирование

Эти библиотеки помогают в разработке на Python: отладчик позволяет пошагово выполнять код, анализировать стек вызовов и устанавливать точки останова и т.д., а профилировщики выполняют код и предоставляют подробные результаты по времени выполнения, что помогает выявить узкие места в программах.

- [27.1. `bdb` – Фреймворк отладчика](https://python-all.ru/3.6/library/bdb.html)
- [27.2. `faulthandler` – Дамп трассировки Python](https://python-all.ru/3.6/library/faulthandler.html)

  - [27.2.1. Дамп трассировки](https://python-all.ru/3.6/library/faulthandler.html#dumping-the-traceback)
  - [27.2.2. Состояние обработчика сбоев](https://python-all.ru/3.6/library/faulthandler.html#fault-handler-state)
  - [27.2.3. Дамп трассировок после тайм-аута](https://python-all.ru/3.6/library/faulthandler.html#dumping-the-tracebacks-after-a-timeout)
  - [27.2.4. Дамп трассировки по пользовательскому сигналу](https://python-all.ru/3.6/library/faulthandler.html#dumping-the-traceback-on-a-user-signal)
  - [27.2.5. Проблема с файловыми дескрипторами](https://python-all.ru/3.6/library/faulthandler.html#issue-with-file-descriptors)
  - [27.2.6. Пример](https://python-all.ru/3.6/library/faulthandler.html#example)
- [27.3. `pdb` – Отладчик Python](https://python-all.ru/3.6/library/pdb.html)

  - [27.3.1. Команды отладчика](https://python-all.ru/3.6/library/pdb.html#debugger-commands)
- [27.4. Профилировщики Python](https://python-all.ru/3.6/library/profile.html)

  - [27.4.1. Введение в профилировщики](https://python-all.ru/3.6/library/profile.html#introduction-to-the-profilers)
  - [27.4.2. Краткое руководство пользователя](https://python-all.ru/3.6/library/profile.html#instant-user-s-manual)
  - [27.4.3. Справочник по модулям `profile` и `cProfile`](https://python-all.ru/3.6/library/profile.html#module-cProfile)
  - [27.4.4. Класс `Stats`](https://python-all.ru/3.6/library/profile.html#the-stats-class)
  - [27.4.5. Что такое детерминированное профилирование?](https://python-all.ru/3.6/library/profile.html#what-is-deterministic-profiling)
  - [27.4.6. Ограничения](https://python-all.ru/3.6/library/profile.html#limitations)
  - [27.4.7. Калибровка](https://python-all.ru/3.6/library/profile.html#calibration)
  - [27.4.8. Использование пользовательского таймера](https://python-all.ru/3.6/library/profile.html#using-a-custom-timer)
- [27.5. `timeit` – Измерение времени выполнения небольших фрагментов кода](https://python-all.ru/3.6/library/timeit.html)

  - [27.5.1. Основные примеры](https://python-all.ru/3.6/library/timeit.html#basic-examples)
  - [27.5.2. Интерфейс Python](https://python-all.ru/3.6/library/timeit.html#python-interface)
  - [27.5.3. Интерфейс командной строки](https://python-all.ru/3.6/library/timeit.html#command-line-interface)
  - [27.5.4. Примеры](https://python-all.ru/3.6/library/timeit.html#examples)
- [27.6. `trace` – Трассировка или отслеживание выполнения инструкций Python](https://python-all.ru/3.6/library/trace.html)

  - [27.6.1. Использование командной строки](https://python-all.ru/3.6/library/trace.html#command-line-usage)

    - [27.6.1.1. Основные параметры](https://python-all.ru/3.6/library/trace.html#main-options)
    - [27.6.1.2. Модификаторы](https://python-all.ru/3.6/library/trace.html#modifiers)
    - [27.6.1.3. Фильтры](https://python-all.ru/3.6/library/trace.html#filters)
  - [27.6.2. Программный интерфейс](https://python-all.ru/3.6/library/trace.html#programmatic-interface)
- [27.7. `tracemalloc` – Трассировка выделений памяти](https://python-all.ru/3.6/library/tracemalloc.html)

  - [27.7.1. Примеры](https://python-all.ru/3.6/library/tracemalloc.html#examples)

    - [27.7.1.1. Отображение топ-10](https://python-all.ru/3.6/library/tracemalloc.html#display-the-top-10)
    - [27.7.1.2. Вычисление различий](https://python-all.ru/3.6/library/tracemalloc.html#compute-differences)
    - [27.7.1.3. Получение трассировки блока памяти](https://python-all.ru/3.6/library/tracemalloc.html#get-the-traceback-of-a-memory-block)
    - [27.7.1.4. Pretty top](https://python-all.ru/3.6/library/tracemalloc.html#pretty-top)
  - [27.7.2. API](https://python-all.ru/3.6/library/tracemalloc.html#api)

    - [27.7.2.1. Функции](https://python-all.ru/3.6/library/tracemalloc.html#functions)
    - [27.7.2.2. DomainFilter](https://python-all.ru/3.6/library/tracemalloc.html#domainfilter)
    - [27.7.2.3. Filter](https://python-all.ru/3.6/library/tracemalloc.html#filter)
    - [27.7.2.4. Frame](https://python-all.ru/3.6/library/tracemalloc.html#frame)
    - [27.7.2.5. Snapshot](https://python-all.ru/3.6/library/tracemalloc.html#snapshot)
    - [27.7.2.6. Statistic](https://python-all.ru/3.6/library/tracemalloc.html#statistic)
    - [27.7.2.7. StatisticDiff](https://python-all.ru/3.6/library/tracemalloc.html#statisticdiff)
    - [27.7.2.8. Trace](https://python-all.ru/3.6/library/tracemalloc.html#trace)
    - [27.7.2.9. Traceback](https://python-all.ru/3.6/library/tracemalloc.html#traceback)
