Dynamic Tracing

Notes

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
{"cc_re__cc_re__cc_by_sa_3_0": ["t:;\" id=\"bug-report-button\" onclick=\"WIKIDOT.page.listeners.pageBugReport(event)\">Report a bug</a>\n    &nbsp;|\n    <a href=\"javascript:;\" id=\"abuse-report-button\" onclick=\"WIKIDOT.page.listeners.flagPageObjectionable(event)\">Flag as objectionable</a>\n</div>\nPowered by <a href=\"http://www.wikidot.com\">Wikidot.com</a> \n            </div>\n            \n                <div id=\"license-area\" class=\"license-area\">\n                    Unless otherwise stated, the content of this page is licensed under <a rel=\"license\" href=\"http://creativecommons.org/licenses/by-sa/3.0/\">Creative Commons Attribution-ShareAlike 3.0 License</a>\n                </div>\n            \n            \n            \n\n\n\n            <div id=\"extrac-div-1\"><span></span></div><div id=\"extrac-div-2\"><span></span></div><div id=\"extrac-div-3\"><span></span></div>\n            \n            \n            \n            \n                \n            \n        </div>\n        \n    </div>\n<!-- These extra divs/spans may be used as catch-alls to add extra imagery. -->\n<div id=\"extra-div-1\"><span></span></div><d"]}