当前位置: 首页>>代码示例>>Python>>正文


Python pdb.main方法代码示例

本文整理汇总了Python中pdb.main方法的典型用法代码示例。如果您正苦于以下问题:Python pdb.main方法的具体用法?Python pdb.main怎么用?Python pdb.main使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pdb的用法示例。


在下文中一共展示了pdb.main方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _runscript

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def _runscript(self, filename):
        # The script has to run in __main__ namespace (or imports from
        # __main__ will break).
        #
        # So we clear up the __main__ and set several special variables
        # (this gets rid of pdb's globals and cleans old variables on restarts).
        import __main__
        __main__.__dict__.clear()
        __main__.__dict__.update({"__name__"    : "__main__",
                                  "__file__"    : filename,
                                  "__builtins__": __builtins__,
                                 })

        # When bdb sets tracing, a number of call and line events happens
        # BEFORE debugger even reaches user's code (and the exact sequence of
        # events depends on python version). So we take special measures to
        # avoid stopping before we reach the main script (see user_line and
        # user_call for details).
        self._wait_for_mainpyfile = 1
        self.mainpyfile = self.canonic(filename)
        self._user_requested_quit = 0
        statement = 'execfile( "%s")' % filename
        self.run(statement)

# Simplified interface 
开发者ID:glmcdona,项目名称:meddle,代码行数:27,代码来源:pdb.py

示例2: _runscript

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def _runscript(self, filename):
        # The script has to run in __main__ namespace (or imports from
        # __main__ will break).
        #
        # So we clear up the __main__ and set several special variables
        # (this gets rid of pdb's globals and cleans old variables on restarts).
        import __main__
        __main__.__dict__.clear()
        __main__.__dict__.update({"__name__"    : "__main__",
                                  "__file__"    : filename,
                                  "__builtins__": __builtins__,
                                 })

        # When bdb sets tracing, a number of call and line events happens
        # BEFORE debugger even reaches user's code (and the exact sequence of
        # events depends on python version). So we take special measures to
        # avoid stopping before we reach the main script (see user_line and
        # user_call for details).
        self._wait_for_mainpyfile = 1
        self.mainpyfile = self.canonic(filename)
        self._user_requested_quit = 0
        statement = 'execfile(%r)' % filename
        self.run(statement)

# Simplified interface 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:27,代码来源:pdb.py

示例3: do_continue

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def do_continue(self, arg):
        """c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        """
        if not self.nosigint:
            try:
                self._previous_sigint_handler = \
                    signal.signal(signal.SIGINT, self.sigint_handler)
            except ValueError:
                # ValueError happens when do_continue() is invoked from
                # a non-main thread in which case we just continue without
                # SIGINT set. Would printing a message here (once) make
                # sense?
                pass
        self.set_continue()
        return 1 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:18,代码来源:pdb.py

示例4: do_continue

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def do_continue(self, arg):
        """c(ont(inue))
        Continue execution, only stop when a breakpoint is encountered.
        """
        if not self.nosigint:
            try:
                Pdb._previous_sigint_handler = \
                    signal.signal(signal.SIGINT, self.sigint_handler)
            except ValueError:
                # ValueError happens when do_continue() is invoked from
                # a non-main thread in which case we just continue without
                # SIGINT set. Would printing a message here (once) make
                # sense?
                pass
        self.set_continue()
        return 1 
开发者ID:CedricGuillemet,项目名称:Imogen,代码行数:18,代码来源:pdb.py

示例5: _interaction

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def _interaction(self, frame, traceback):
        # Restore the previous signal handler at the Pdb prompt.
        if getattr(pdb.Pdb, '_previous_sigint_handler', None):
            try:
                signal.signal(signal.SIGINT, pdb.Pdb._previous_sigint_handler)
            except ValueError:  # ValueError: signal only works in main thread
                pass
            else:
                pdb.Pdb._previous_sigint_handler = None
        ret = self.setup(frame, traceback)
        if ret:
            # no interaction desired at this time (happens if .pdbrc contains
            # a command like "continue")
            self.forget()
            return
        if self.config.exec_if_unfocused:
            self.exec_if_unfocused()

        # Handle post mortem via main: add exception similar to user_exception.
        if frame is None and traceback:
            exc = sys.exc_info()[:2]
            if exc != (None, None):
                self.curframe.f_locals['__exception__'] = exc

        if not self.sticky:
            self.print_stack_entry(self.stack[self.curindex])
            self.print_hidden_frames_count()

        with self._custom_completer():
            self.config.before_interaction_hook(self)
            # Use _cmdloop on py3 which catches KeyboardInterrupt.
            if hasattr(self, '_cmdloop'):
                self._cmdloop()
            else:
                self.cmdloop()

        self.forget() 
开发者ID:pdbpp,项目名称:pdbpp,代码行数:39,代码来源:pdbpp.py

示例6: do_run

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def do_run(self, arg):
        """Restart program by raising an exception to be caught in the main
        debugger loop.  If arguments were given, set them in sys.argv."""
        if arg:
            import shlex
            argv0 = sys.argv[0:1]
            sys.argv = shlex.split(arg)
            sys.argv[:0] = argv0
        raise Restart 
开发者ID:glmcdona,项目名称:meddle,代码行数:11,代码来源:pdb.py

示例7: do_run

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def do_run(self, arg):
        """run [args...]
        Restart the debugged python program. If a string is supplied
        it is split with "shlex", and the result is used as the new
        sys.argv.  History, breakpoints, actions and debugger options
        are preserved.  "restart" is an alias for "run".
        """
        if arg:
            import shlex
            argv0 = sys.argv[0:1]
            sys.argv = shlex.split(arg)
            sys.argv[:0] = argv0
        # this is caught in the main debugger loop
        raise Restart 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:16,代码来源:pdb.py

示例8: _runscript

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import main [as 别名]
def _runscript(self, filename):
        # The script has to run in __main__ namespace (or imports from
        # __main__ will break).
        #
        # So we clear up the __main__ and set several special variables
        # (this gets rid of pdb's globals and cleans old variables on restarts).
        import __main__
        __main__.__dict__.clear()
        __main__.__dict__.update({"__name__"    : "__main__",
                                  "__file__"    : filename,
                                  "__builtins__": __builtins__,
                                 })

        # When bdb sets tracing, a number of call and line events happens
        # BEFORE debugger even reaches user's code (and the exact sequence of
        # events depends on python version). So we take special measures to
        # avoid stopping before we reach the main script (see user_line and
        # user_call for details).
        self._wait_for_mainpyfile = True
        self.mainpyfile = self.canonic(filename)
        self._user_requested_quit = False
        with open(filename, "rb") as fp:
            statement = "exec(compile(%r, %r, 'exec'))" % \
                        (fp.read(), self.mainpyfile)
        self.run(statement)

# Collect all command help into docstring, if not run with -OO 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:29,代码来源:pdb.py


注:本文中的pdb.main方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。