@@ -7,12 +7,11 @@ import threading
7
7
from _typeshed import Incomplete
8
8
from collections .abc import Callable , Iterator , Mapping , Sequence
9
9
from contextlib import AbstractContextManager
10
- from typing import Any , Final , Generic , Literal , Protocol , TypeVar , final , overload
10
+ from typing import Any , Final , Generic , Literal , Protocol , TypeVar , final , overload , type_check_only
11
11
from typing_extensions import TypeAlias , deprecated
12
12
13
13
import gdb .FrameDecorator
14
14
import gdb .types
15
- import gdb .unwinder
16
15
import gdb .xmethod
17
16
18
17
# The following submodules are automatically imported
@@ -289,7 +288,15 @@ class PendingFrame:
289
288
class UnwindInfo :
290
289
def add_saved_register (self , reg : str | RegisterDescriptor | int , value : Value , / ) -> None : ...
291
290
292
- frame_unwinders : list [gdb .unwinder .Unwinder ]
291
+ @type_check_only
292
+ class _Unwinder (Protocol ):
293
+ @property
294
+ def name (self ) -> str : ...
295
+ enabled : bool
296
+
297
+ def __call__ (self , pending_frame : PendingFrame ) -> UnwindInfo | None : ...
298
+
299
+ frame_unwinders : list [_Unwinder ]
293
300
294
301
# Inferiors
295
302
@@ -468,7 +475,7 @@ class Progspace:
468
475
pretty_printers : list [_PrettyPrinterLookupFunction ]
469
476
type_printers : list [gdb .types ._TypePrinter ]
470
477
frame_filters : dict [str , _FrameFilter ]
471
- frame_unwinders : list [gdb . unwinder . Unwinder ]
478
+ frame_unwinders : list [_Unwinder ]
472
479
missing_debug_handlers : Incomplete
473
480
474
481
def block_for_pc (self , pc : int , / ) -> Block | None : ...
@@ -493,7 +500,7 @@ class Objfile:
493
500
pretty_printers : list [_PrettyPrinterLookupFunction ]
494
501
type_printers : list [gdb .types ._TypePrinter ]
495
502
frame_filters : dict [str , _FrameFilter ]
496
- frame_unwinders : list [gdb . unwinder . Unwinder ]
503
+ frame_unwinders : list [_Unwinder ]
497
504
is_file : bool
498
505
499
506
def is_valid (self ) -> bool : ...
@@ -664,21 +671,131 @@ class LineTable:
664
671
# Breakpoints
665
672
666
673
class Breakpoint :
674
+
675
+ # The where="spec" form of __init__(). See py-breakpoints.c:bppy_init():keywords for the positional order.
676
+ @overload
677
+ def __init__ (
678
+ self ,
679
+ # where
680
+ spec : str ,
681
+ # options
682
+ type : int = ...,
683
+ wp_class : int = ...,
684
+ internal : bool = ...,
685
+ temporary : bool = ...,
686
+ qualified : bool = ...,
687
+ ) -> None : ...
688
+
689
+ # The where="location" form of __init__(). A watchpoint (`type=BP_WATCHPOINT`) cannot be created with this form.
690
+ #
691
+ # We exclude the `wp_class` (watchpoint class) option here, even though py-breakpoints.c accepts it. It doesn't make sense
692
+ # unless type==BP_WATCHPOINT, and is silently ignored in those cases; allowing it in those cases is likely an oversight, not
693
+ # an intentional allowance.
694
+ #
695
+ # We repeat this 7 times because the type system doesn't have simple a way for us to say "at least one of `function`, `label`,
696
+ # or `line`", so we must repeat it for each combination of the 3.
697
+ #
698
+ # The len=3 combination.
699
+ @overload
700
+ def __init__ (
701
+ self ,
702
+ * ,
703
+ # where
704
+ source : str = ...,
705
+ function : str ,
706
+ label : str ,
707
+ line : int | str ,
708
+ # options
709
+ type : int = ...,
710
+ internal : bool = ...,
711
+ temporary : bool = ...,
712
+ qualified : bool = ...,
713
+ ) -> None : ...
714
+ # The 3 len=2 combinations.
715
+ @overload
716
+ def __init__ (
717
+ self ,
718
+ * ,
719
+ source : str = ...,
720
+ # where
721
+ label : str ,
722
+ line : int | str ,
723
+ # options
724
+ type : int = ...,
725
+ internal : bool = ...,
726
+ temporary : bool = ...,
727
+ qualified : bool = ...,
728
+ ) -> None : ...
729
+ @overload
730
+ def __init__ (
731
+ self ,
732
+ * ,
733
+ source : str = ...,
734
+ # where
735
+ function : str ,
736
+ line : int | str ,
737
+ # options
738
+ type : int = ...,
739
+ internal : bool = ...,
740
+ temporary : bool = ...,
741
+ qualified : bool = ...,
742
+ ) -> None : ...
667
743
@overload
668
744
def __init__ (
669
- self , spec : str , type : int = ..., wp_class : int = ..., internal : bool = ..., temporary : bool = ..., qualified : bool = ...
745
+ self ,
746
+ * ,
747
+ source : str = ...,
748
+ # where
749
+ function : str ,
750
+ label : str ,
751
+ # options
752
+ type : int = ...,
753
+ internal : bool = ...,
754
+ temporary : bool = ...,
755
+ qualified : bool = ...,
670
756
) -> None : ...
757
+ # The 3 len=1 combinations.
671
758
@overload
672
759
def __init__ (
673
760
self ,
761
+ * ,
674
762
source : str = ...,
675
- function : str = ...,
676
- label : str = ...,
677
- line : int = ...,
763
+ # where
764
+ function : str ,
765
+ # options
766
+ type : int = ...,
678
767
internal : bool = ...,
679
768
temporary : bool = ...,
680
769
qualified : bool = ...,
681
770
) -> None : ...
771
+ @overload
772
+ def __init__ (
773
+ self ,
774
+ * ,
775
+ source : str = ...,
776
+ # where
777
+ label : str ,
778
+ # options
779
+ type : int = ...,
780
+ internal : bool = ...,
781
+ temporary : bool = ...,
782
+ qualified : bool = ...,
783
+ ) -> None : ...
784
+ @overload
785
+ def __init__ (
786
+ self ,
787
+ * ,
788
+ source : str = ...,
789
+ # where
790
+ line : int | str ,
791
+ # options
792
+ type : int = ...,
793
+ internal : bool = ...,
794
+ temporary : bool = ...,
795
+ qualified : bool = ...,
796
+ ) -> None : ...
797
+
798
+ # Methods.
682
799
def stop (self ) -> bool : ...
683
800
def is_valid (self ) -> bool : ...
684
801
def delete (self ) -> None : ...
0 commit comments