Dynamic Tracing


We may have potential garbage collection problems, as we'll be storing references to all function call inputs and outputs. We may unintentionally crash programs that work OK without tracing, because of OOM errors.

That may no longer be the case after implementing proper serialization that doesn't reference application objects.

Essential modules and functions

  • inspect.getargvalues

A tuple of four things is returned: (args, varargs, varkw, locals). 'args' is a list of the argument names (it may contain nested lists). 'varargs' and 'varkw' are the names of the * and ** arguments or None. 'locals' is the locals dictionary of the given frame.

  • traceback.extract_stack

Each item in the list is a quadruple (filename, line number, function name, text), and the entries are in order from oldest to newest stack frame.

Examples and tutorials

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License