Esempio n. 1
0
 def test_want_different_line(self):
     for cmd, default, expected in [
         (
             's+',
             False,
             True,
         ),
         (
             's-',
             True,
             False,
         ),
         (
             's',
             False,
             False,
         ),
         (
             'n',
             True,
             True,
         ),
     ]:
         self.assertEqual(expected,
                          Mcmdfns.want_different_line(cmd, default), cmd)
         pass
     return
Esempio n. 2
0
    def run(self, args):
        """**next**[**+**|**-**] [*count*]

Step one statement ignoring steps into function calls at this level.

With an integer argument, perform `next` that many times. However if
an exception occurs at this level, or we *return*, *yield* or the
thread changes, we stop regardless of count.

A suffix of `+` on the command or an alias to the command forces to
move to another line, while a suffix of `-` does the opposite and
disables the requiring a move to a new line. If no suffix is given,
the debugger setting 'different-line' determines this behavior.

See also:
---------

`step`, `skip`, `jump` (there's no `hop` yet), `continue`, and
`finish` for other ways to progress execution.
"""

        if len(args) <= 1:
            step_ignore = 0
        else:
            step_ignore = self.proc.get_int(args[1], default=1, cmdname='next')
            if step_ignore is None: return False
            # 0 means stop now or step 1, so we subtract 1.
            step_ignore -= 1
            pass
        self.core.different_line   = \
            Mcmdfns.want_different_line(args[0],
                                        self.debugger.settings['different'])
        self.core.set_next(self.proc.frame, step_ignore)
        self.proc.continue_running = True  # Break out of command read loop
        return True
Esempio n. 3
0
    def run(self, args):
        """**next**[**+**|**-**] [*count*]

Step one statement ignoring steps into function calls at this level.

With an integer argument, perform `next` that many times. However if
an exception occurs at this level, or we *return*, *yield* or the
thread changes, we stop regardless of count.

A suffix of `+` on the command or an alias to the command forces to
move to another line, while a suffix of `-` does the opposite and
disables the requiring a move to a new line. If no suffix is given,
the debugger setting 'different-line' determines this behavior.
"""

        if len(args) <= 1:
            step_ignore = 0
        else:
            step_ignore = self.proc.get_int(args[1], default=1,
                                            cmdname='next')
            if step_ignore is None: return False
            # 0 means stop now or step 1, so we subtract 1.
            step_ignore -= 1
            pass
        self.core.different_line   = \
            Mcmdfns.want_different_line(args[0],
                                        self.debugger.settings['different'])
        self.core.set_next(self.proc.frame, step_ignore)
        self.proc.continue_running = True   # Break out of command read loop
        return True
 def test_want_different_line(self):
     for cmd, default, expected in [
         ('s+', False, True,),
         ('s-', True,  False,),
         ('s',  False, False,),
         ('n',  True,  True,), ]:
         self.assertEqual(expected,
                          Mcmdfns.want_different_line(cmd, default),
                          cmd)
         pass
     return
Esempio n. 5
0
    def run(self, args):
        step_events = []
        if args[0][-1] == ">":
            step_events = ["call"]
        elif args[0][-1] == "<":
            step_events = ["return"]
        elif args[0][-1] == "!":
            step_events = ["exception"]
            pass
        if len(args) <= 1:
            self.proc.debugger.core.step_ignore = 0
        else:
            pos = 1
            while pos < len(args):
                arg = args[pos]
                if arg in tracer.ALL_EVENT_NAMES:
                    step_events.append(arg)
                else:
                    break
                pos += 1
                pass
            if pos == len(args) - 1:
                self.core.step_ignore = self.proc.get_int(args[pos],
                                                          default=1,
                                                          cmdname="step")
                if self.core.step_ignore is None:
                    return False
                # 0 means stop now or step 1, so we subtract 1.
                self.core.step_ignore -= 1
                pass
            elif pos != len(args):
                self.errmsg("Invalid additional parameters %s" %
                            " ".join(args[pos]))
                return False
            pass

        if [] == step_events:
            self.core.step_events = None
        else:
            self.core.step_events = step_events
            pass

        self.core.different_line = want_different_line(
            args[0], self.settings["different"])
        self.core.stop_level = None
        self.core.last_frame = None
        self.core.stop_on_finish = False
        self.proc.continue_running = True  # Break out of command read loop
        return True
Esempio n. 6
0
 def run(self, args):
     if len(args) <= 1:
         step_ignore = 0
     else:
         step_ignore = self.proc.get_int(args[1], default=1, cmdname="next")
         if step_ignore is None:
             return False
         # 0 means stop now or step 1, so we subtract 1.
         step_ignore -= 1
         pass
     self.core.different_line = want_different_line(
         args[0], self.debugger.settings["different"]
     )
     self.core.set_next(self.proc.frame, step_ignore)
     self.proc.continue_running = True  # Break out of command read loop
     return True
Esempio n. 7
0
    def run(self, args):
        step_events  = []
        if args[0][-1] == '>':
            step_events  = ['call']
        elif args[0][-1] == '<':
            step_events  = ['return']
        elif args[0][-1] == '!':
            step_events  = ['exception']
            pass
        if len(args) <= 1:
            self.proc.debugger.core.step_ignore = 0
        else:
            pos = 1
            while pos < len(args):
                arg = args[pos]
                if arg in tracer.ALL_EVENT_NAMES:
                    step_events.append(arg)
                else:
                    break
                pos += 1
                pass
            if pos == len(args) - 1:
                self.core.step_ignore = self.proc.get_int(args[pos], default=1,
                                                          cmdname='step')
                if self.core.step_ignore is None: return False
                # 0 means stop now or step 1, so we subtract 1.
                self.core.step_ignore -= 1
                pass
            elif pos != len(args):
                self.errmsg("Invalid additional parameters %s"
                            % ' '.join(args[pos]))
                return False
            pass

        if [] == step_events:
            self.core.step_events = None
        else:
            self.core.step_events = step_events
            pass

        self.core.different_line   = \
            Mcmdfns.want_different_line(args[0], self.settings['different'])
        self.core.stop_level       = None
        self.core.last_frame       = None
        self.core.stop_on_finish   = False
        self.proc.continue_running = True  # Break out of command read loop
        return True