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


Python pdb.interaction方法代码示例

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


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

示例1: bp_commands

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def bp_commands(self,frame):
        """Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise."""
        # self.currentbp is set in bdb in Bdb.break_here if a breakpoint was hit
        if getattr(self, "currentbp", False) and \
               self.currentbp in self.commands:
            currentbp = self.currentbp
            self.currentbp = 0
            lastcmd_back = self.lastcmd
            self.setup(frame, None)
            for line in self.commands[currentbp]:
                self.onecmd(line)
            self.lastcmd = lastcmd_back
            if not self.commands_silent[currentbp]:
                self.print_stack_entry(self.stack[self.curindex])
            if self.commands_doprompt[currentbp]:
                self.cmdloop()
            self.forget()
            return
        return 1 
开发者ID:glmcdona,项目名称:meddle,代码行数:25,代码来源:pdb.py

示例2: execRcLines

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def execRcLines(self):
        if not self.rcLines:
            return
        # local copy because of recursion
        rcLines = self.rcLines
        rcLines.reverse()
        # execute every line only once
        self.rcLines = []
        while rcLines:
            line = rcLines.pop().strip()
            if line and line[0] != '#':
                if self.onecmd(line):
                    # if onecmd returns True, the command wants to exit
                    # from the interaction, save leftover rc lines
                    # to execute before next interaction
                    self.rcLines += reversed(rcLines)
                    return True

    # Override Bdb methods 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:21,代码来源:pdb.py

示例3: bp_commands

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def bp_commands(self, frame):
        """Call every command that was set for the current active breakpoint
        (if there is one).

        Returns True if the normal interaction function must be called,
        False otherwise."""
        # self.currentbp is set in bdb in Bdb.break_here if a breakpoint was hit
        if getattr(self, "currentbp", False) and \
               self.currentbp in self.commands:
            currentbp = self.currentbp
            self.currentbp = 0
            lastcmd_back = self.lastcmd
            self.setup(frame, None)
            for line in self.commands[currentbp]:
                self.onecmd(line)
            self.lastcmd = lastcmd_back
            if not self.commands_silent[currentbp]:
                self.print_stack_entry(self.stack[self.curindex])
            if self.commands_doprompt[currentbp]:
                self._cmdloop()
            self.forget()
            return
        return 1 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:25,代码来源:pdb.py

示例4: run_in_pdb

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def run_in_pdb(func, args):
    def debug_signal_handler(signal, frame):
        import pdb
        pdb.set_trace()
    import signal
    signal.signal(signal.SIGINT, debug_signal_handler)

    import pdb as pdb_module

    import sys
    import traceback
    pdb = pdb_module.Pdb()
    while True:
        try:
            pdb.runcall(func, args)
            if pdb._user_requested_quit:
                break
            print("The program finished and will be restarted")
        except pdb_module.Restart:
            print("Restarting with arguments:")
            print("\t" + " ".join(sys.argv[1:]))
        except SystemExit:
            # In most cases SystemExit does not warrant a post-mortem session.
            print("The program exited via sys.exit(). Exit status: ",)
            print(sys.exc_info()[1])
        except SyntaxError:
            traceback.print_exc()
            sys.exit(1)
        except BaseException:
            traceback.print_exc()
            print("Uncaught exception. Entering post mortem debugging")
            print("Running 'cont' or 'step' will restart the program")
            t = sys.exc_info()[2]
            pdb.interaction(None, t)
            print("Post mortem debugger finished. The program will be restarted") 
开发者ID:fabiencro,项目名称:knmt,代码行数:37,代码来源:__main__.py

示例5: user_call

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def user_call(self, frame, argument_list):
        """This method is called when there is the remote possibility
        that we ever need to stop in this function."""
        if self._wait_for_mainpyfile:
            return
        if self.stop_here(frame):
            print >>self.stdout, '--Call--'
            self.interaction(frame, None) 
开发者ID:glmcdona,项目名称:meddle,代码行数:10,代码来源:pdb.py

示例6: user_line

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def user_line(self, frame):
        """This function is called when we stop or break at this line."""
        if self._wait_for_mainpyfile:
            if (self.mainpyfile != self.canonic(frame.f_code.co_filename)
                or frame.f_lineno<= 0):
                return
            self._wait_for_mainpyfile = 0
        if self.bp_commands(frame):
            self.interaction(frame, None) 
开发者ID:glmcdona,项目名称:meddle,代码行数:11,代码来源:pdb.py

示例7: user_return

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def user_return(self, frame, return_value):
        """This function is called when a return trap is set here."""
        if self._wait_for_mainpyfile:
            return
        frame.f_locals['__return__'] = return_value
        print >>self.stdout, '--Return--'
        self.interaction(frame, None) 
开发者ID:glmcdona,项目名称:meddle,代码行数:9,代码来源:pdb.py

示例8: user_exception

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def user_exception(self, frame, exc_info):
        """This function is called if an exception occurs,
        but only if we are to stop at or just below this level."""
        if self._wait_for_mainpyfile:
            return
        exc_type, exc_value, exc_traceback = exc_info
        frame.f_locals['__exception__'] = exc_type, exc_value
        if type(exc_type) == type(''):
            exc_type_name = exc_type
        else: exc_type_name = exc_type.__name__
        print >>self.stdout, exc_type_name + ':', _saferepr(exc_value)
        self.interaction(frame, exc_traceback)

    # General interaction function 
开发者ID:glmcdona,项目名称:meddle,代码行数:16,代码来源:pdb.py

示例9: post_mortem

# 需要导入模块: import pdb [as 别名]
# 或者: from pdb import interaction [as 别名]
def post_mortem(t=None):
    # handling the default
    if t is None:
        # sys.exc_info() returns (type, value, traceback) if an exception is
        # being handled, otherwise it returns None
        t = sys.exc_info()[2]
        if t is None:
            raise ValueError("A valid traceback must be passed if no "
                                               "exception is being handled")

    p = Pdb()
    p.reset()
    p.interaction(None, t) 
开发者ID:glmcdona,项目名称:meddle,代码行数:15,代码来源:pdb.py


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