MCPcopy Index your code
hub / github.com/python/cpython / do_debug

Method do_debug

Lib/pdb.py:2005–2027  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers 1

do_debugMethod · 0.45

Calls 7

_print_invalid_argMethod · 0.95
messageMethod · 0.95
_error_excMethod · 0.95
stop_traceMethod · 0.45
stripMethod · 0.45
start_traceMethod · 0.45

Tested by

no test coverage detected