Debian Codegraph @

cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexContinue.py

raw
1 # DExTer : Debugging Experience Tester
2 # ~~~~~~ ~ ~~ ~ ~~
3 #
4 # Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
5 # See https://llvm.org/LICENSE.txt for license information.
6 # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 """A Command that tells dexter to set a breakpoint which, after hitting,
8 signals that the debugger should 'continue' until another is hit. Continuing
9 out of a function being stepped through with DexStepFunction is well defined:
10 stepping will resume in other functions tracked further down the stacktrace.
11
12 NOTE: Only supported for DAP-based debuggers.
13 """
14
15 from dex.command.CommandBase import CommandBase
16
17
18 class DexContinue(CommandBase):
19 def __init__(self, *args, **kwargs):
20 # DexContinue(*[expr, *values], **from_line[, **to_line, **hit_count])
21
22 # Optional positional args: expr, values.
23 if len(args) == 0:
24 self.expression = None
25 self.values = []
26 elif len(args) == 1:
27 raise TypeError("expected 0 or at least 2 positional arguments")
28 else:
29 self.expression = args[0]
30 self.values = [str(arg) for arg in args[1:]]
31
32 # Required keyword arg: from_line.
33 try:
34 self.from_line = kwargs.pop("from_line")
35 except:
36 raise TypeError("Missing from_line argument")
37
38 # Optional conditional args: to_line, hit_count.
39 self.to_line = kwargs.pop("to_line", None)
40 self.hit_count = kwargs.pop("hit_count", None)
41
42 if kwargs:
43 raise TypeError("unexpected named args: {}".format(", ".join(kwargs)))
44 super(DexContinue, self).__init__()
45
46 def eval(self):
47 raise NotImplementedError("DexContinue commands cannot be evaled.")
48
49 @staticmethod
50 def get_name():
51 return __class__.__name__
52
53 @staticmethod
54 def get_subcommands() -> dict:
55 return None