debug code Enter a recursive debugger that steps through the code argument (which is an arbitrary expression or statement to be executed in the current environment).
(self, arg)
| 2003 | return Pdb(self.completekey, self.stdin, self.stdout) |
| 2004 | |
| 2005 | def do_debug(self, arg): |
| 2006 | """debug code |
| 2007 | |
| 2008 | Enter a recursive debugger that steps through the code |
| 2009 | argument (which is an arbitrary expression or statement to be |
| 2010 | executed in the current environment). |
| 2011 | """ |
| 2012 | if not arg: |
| 2013 | self._print_invalid_arg(arg) |
| 2014 | return |
| 2015 | self.stop_trace() |
| 2016 | globals = self.curframe.f_globals |
| 2017 | locals = self.curframe.f_locals |
| 2018 | p = self._create_recursive_debugger() |
| 2019 | p.prompt = "(%s) " % self.prompt.strip() |
| 2020 | self.message("ENTERING RECURSIVE DEBUGGER") |
| 2021 | try: |
| 2022 | sys.call_tracing(p.run, (arg, globals, locals)) |
| 2023 | except Exception: |
| 2024 | self._error_exc() |
| 2025 | self.message("LEAVING RECURSIVE DEBUGGER") |
| 2026 | self.start_trace() |
| 2027 | self.lastcmd = p.lastcmd |
| 2028 | |
| 2029 | complete_debug = _complete_expression |
| 2030 |
no test coverage detected