Debian Codegraph @

cross-project-tests/debuginfo-tests/dexter/dex/command/commands/DexStepFunction.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 function breakpoint and step through
8 the function after hitting it.
9
10 NOTE: Only supported for DAP-based debuggers.
11 """
12
13 from dex.command.CommandBase import CommandBase
14
15
16 class DexStepFunction(CommandBase):
17 def __init__(self, *args, **kwargs):
18 if len(args) < 1:
19 raise TypeError("expected 1 positional argument")
20 self.function = str(args[0])
21 self.hit_count = kwargs.pop("hit_count", None)
22 if kwargs:
23 raise TypeError(f"unexpected named args: {', '.join(kwargs)}")
24 super(DexStepFunction, self).__init__()
25
26 def eval(self):
27 raise NotImplementedError("DexStepFunction commands cannot be evaled.")
28
29 def get_function(self):
30 return self.function
31
32 @staticmethod
33 def get_name():
34 return __class__.__name__
35
36 @staticmethod
37 def get_subcommands() -> dict:
38 return None