.. -*- mode: ReST -*- .. _debug: ========= Debugging ========= .. contents:: Contents This :ref:`package` provides utilities to help with debugging memory allocations, function timing, stack traces, capturing signals, and pyparsing DSLs. ------- Mallocs ------- Utilities for measuring memory usage. See :class:`MallocTool `, :func:`LogDel `, and :class:`LogDestruction`. .. include:: __examples/malloc_ex.py :code: python Results in: .. include:: __examples/malloc_result.txt :literal: ------ Timing ------ See :class:`TimeCtx` and :class:`TimeDec`. The first is a context manager timer, the second wraps it into a decorator. .. include:: __examples/timectx_ex.py :code: python .. include:: __examples/timedec_ex.py :code: python Results in something like:: Timed: basic took 10.005232 seconds ------ Traces ------ See :class:`TraceContext` and its utility classes :class:`TraceObj` and :class:`TraceWriter`. .. include:: __examples/tracectx_ex.py :code: python ---------- Tracebacks ---------- See :class:`TracebackFactory`. A Simple way of creating a traceback of frames, using item access to allow a slice of available frames. .. include:: __examples/traceback_ex.py :code: python ------- Signals ------- See :class:`SignalHandler` and it's default :class:`NullHandler`. ``SignalHandler`` traps SIGINT signals and handles them, rather than exit the program. As `SignalHandler` is a a context manager, allows: .. include:: __examples/signal_ex.py :code: python --------- Debuggers --------- See :class:`RunningDebugger`. ------------- DSL Debugging ------------- :class:`PyParsingDebuggerControl`.