Add a breakpoint, bp can be: * a :class:`Breakpoint` (addr and type must be ``None``) * any callable (addr and type must NOT be ``None``) (NON-TESTED) If the ``bp`` type is ``STANDARD_BP`` or ``MEMORY_BREAKPOINT``, target can be ``None`` (all targets) or a proce
(self, bp, addr=None, type=None, target=None)
| 904 | break |
| 905 | |
| 906 | def add_bp(self, bp, addr=None, type=None, target=None): |
| 907 | """Add a breakpoint, bp can be: |
| 908 | |
| 909 | * a :class:`Breakpoint` (addr and type must be ``None``) |
| 910 | * any callable (addr and type must NOT be ``None``) (NON-TESTED) |
| 911 | |
| 912 | If the ``bp`` type is ``STANDARD_BP`` or ``MEMORY_BREAKPOINT``, target can be ``None`` (all targets) or a process. |
| 913 | |
| 914 | If the ``bp`` type is ``HARDWARE_EXEC_BP``, target can be ``None`` (all targets), a process or a thread. |
| 915 | """ |
| 916 | if getattr(bp, "addr", None) is None: |
| 917 | if addr is None or type is None: |
| 918 | raise ValueError("SUCK YOUR NONE") |
| 919 | bp = ProxyBreakpoint(bp, addr, type) |
| 920 | else: |
| 921 | if addr is not None or type is not None: |
| 922 | raise ValueError("Given <addr|type> by parameters but BP object have them") |
| 923 | del addr |
| 924 | del type |
| 925 | |
| 926 | if target is None: |
| 927 | # Need to add it to all other breakpoint |
| 928 | self.add_pending_breakpoint(bp, None) |
| 929 | elif target is not None: |
| 930 | # Check that targets are accepted |
| 931 | if target not in list(self.processes.values()) + list(self.threads.values()): |
| 932 | # if target == self.target: # Original target (that have not been lauched yet) |
| 933 | return self.add_pending_breakpoint(bp, target) |
| 934 | # else: |
| 935 | # raise ValueError("Unknown target {0}".format(target)) |
| 936 | return self._setup_breakpoint(bp, target) |
| 937 | |
| 938 | def del_bp(self, bp, targets=None): |
| 939 | """Delete a breakpoint, if targets is ``None``: delete it from all targets""" |
no test coverage detected