4
4
5
5
import _typeshed
6
6
import threading
7
- from _typeshed import Incomplete
8
7
from collections .abc import Callable , Iterator , Mapping , Sequence
9
8
from contextlib import AbstractContextManager
10
9
from typing import Any , Final , Generic , Literal , Protocol , TypedDict , TypeVar , final , overload , type_check_only
11
10
from typing_extensions import TypeAlias , deprecated
12
11
13
12
import gdb .FrameDecorator
14
13
import gdb .types
14
+ from gdb .missing_debug import MissingDebugHandler
15
+ from gdb .missing_files import MissingFileHandler
15
16
16
17
# The following submodules are automatically imported
17
18
from . import events as events , printing as printing , prompt as prompt , types as types
@@ -46,7 +47,8 @@ def add_history(value: Value, /) -> int: ...
46
47
def history_count () -> int : ...
47
48
def convenience_variable (name : str , / ) -> Value | None : ...
48
49
def set_convenience_variable (name : str , value : _ValueOrNative | None , / ) -> None : ...
49
- def parse_and_eval (expression : str , global_context : bool = False , / ) -> Value : ...
50
+ def parse_and_eval (expression : str , global_context : bool = False ) -> Value : ...
51
+ def format_address (address : int , progspace : Progspace = ..., architecture : Architecture = ...): ...
50
52
def find_pc_line (pc : int | Value ) -> Symtab_and_line : ...
51
53
def post_event (event : Callable [[], object ], / ) -> None : ...
52
54
def write (string : str , stream : int = ...) -> None : ...
@@ -107,7 +109,7 @@ class Value:
107
109
def __ge__ (self , other : _ValueOrNative , / ) -> bool : ...
108
110
def __getitem__ (self , key : int | str | Field , / ) -> Value : ...
109
111
def __call__ (self , * args : _ValueOrNative ) -> Value : ...
110
- def __init__ (self , val : _ValueOrNative ) -> None : ...
112
+ def __init__ (self , val : _ValueOrNative , type : Type | None = None ) -> None : ...
111
113
def cast (self , type : Type ) -> Value : ...
112
114
def dereference (self ) -> Value : ...
113
115
def referenced_value (self ) -> Value : ...
@@ -125,9 +127,12 @@ class Value:
125
127
symbols : bool = ...,
126
128
unions : bool = ...,
127
129
address : bool = ...,
130
+ styling : bool = ...,
131
+ nibbles : bool = ...,
128
132
deref_refs : bool = ...,
129
133
actual_objects : bool = ...,
130
134
static_members : bool = ...,
135
+ max_characters : int = ...,
131
136
max_elements : int = ...,
132
137
max_depth : int = ...,
133
138
repeat_threshold : int = ...,
@@ -265,15 +270,17 @@ class _FrameFilter(Protocol):
265
270
enabled : bool
266
271
priority : int
267
272
268
- def filter (self , iterator : Iterator [gdb .FrameDecorator .FrameDecorator ]) -> Iterator [gdb .FrameDecorator .FrameDecorator ]: ...
273
+ def filter (
274
+ self , iterator : Iterator [gdb .FrameDecorator .FrameDecorator | gdb .FrameDecorator .DAPFrameDecorator ]
275
+ ) -> Iterator [gdb .FrameDecorator .FrameDecorator | gdb .FrameDecorator .DAPFrameDecorator ]: ...
269
276
270
277
frame_filters : dict [str , _FrameFilter ]
271
278
272
279
# Unwinding Frames
273
280
274
281
@final
275
282
class PendingFrame :
276
- def read_register (self , reg : str | RegisterDescriptor | int , / ) -> Value : ...
283
+ def read_register (self , register : str | RegisterDescriptor | int ) -> Value : ...
277
284
def create_unwind_info (self , frame_id : object , / ) -> UnwindInfo : ...
278
285
def architecture (self ) -> Architecture : ...
279
286
def language (self ): ...
@@ -287,7 +294,7 @@ class PendingFrame:
287
294
288
295
@final
289
296
class UnwindInfo :
290
- def add_saved_register (self , reg : str | RegisterDescriptor | int , value : Value , / ) -> None : ...
297
+ def add_saved_register (self , register : str | RegisterDescriptor | int , value : Value ) -> None : ...
291
298
292
299
@type_check_only
293
300
class _Unwinder (Protocol ):
@@ -314,14 +321,16 @@ class Inferior:
314
321
pid : int
315
322
was_attached : bool
316
323
progspace : Progspace
317
- main_name : Incomplete
318
- arguments : Incomplete
319
-
324
+ main_name : str | None
325
+ @property
326
+ def arguments (self ) -> str | None : ...
327
+ @arguments .setter
328
+ def arguments (self , args : str | Sequence [str ]) -> None : ...
320
329
def is_valid (self ) -> bool : ...
321
330
def threads (self ) -> tuple [InferiorThread , ...]: ...
322
331
def architecture (self ) -> Architecture : ...
323
332
def read_memory (self , address : _ValueOrInt , length : int ) -> memoryview : ...
324
- def write_memory (self , address : _ValueOrInt , buffer : _BufferType , length : int = ...) -> memoryview : ...
333
+ def write_memory (self , address : _ValueOrInt , buffer : _BufferType , length : int = ...) -> None : ...
325
334
def search_memory (self , address : _ValueOrInt , length : int , pattern : _BufferType ) -> int | None : ...
326
335
def thread_from_handle (self , handle : Value ) -> InferiorThread : ...
327
336
@deprecated ("Use gdb.thread_from_handle() instead." )
@@ -368,6 +377,7 @@ class Record:
368
377
function_call_history : list [RecordFunctionSegment ]
369
378
370
379
def goto (self , instruction : Instruction , / ) -> None : ...
380
+ def clear (self ) -> None : ...
371
381
372
382
class Instruction :
373
383
pc : int
@@ -477,7 +487,7 @@ class Progspace:
477
487
type_printers : list [gdb .types ._TypePrinter ]
478
488
frame_filters : dict [str , _FrameFilter ]
479
489
frame_unwinders : list [_Unwinder ]
480
- missing_debug_handlers : Incomplete
490
+ missing_file_handlers : Sequence [ tuple [ Literal [ "debug" ], MissingDebugHandler ] | tuple [ Literal [ "file" ], MissingFileHandler ]]
481
491
482
492
def block_for_pc (self , pc : int , / ) -> Block | None : ...
483
493
def find_pc_line (self , pc : int , / ) -> Symtab_and_line : ...
@@ -540,17 +550,17 @@ class Frame:
540
550
def architecture (self ) -> Architecture : ...
541
551
def type (self ) -> int : ...
542
552
def unwind_stop_reason (self ) -> int : ...
543
- def pc (self ) -> Value : ...
553
+ def pc (self ) -> int : ...
544
554
def block (self ) -> Block : ...
545
555
def function (self ) -> Symbol : ...
546
556
def older (self ) -> Frame | None : ...
547
557
def newer (self ) -> Frame | None : ...
548
558
def find_sal (self ) -> Symtab_and_line : ...
549
- def read_register (self , register : str | RegisterDescriptor | int , / ) -> Value : ...
550
- def read_var (self , variable : str | Symbol , / , block : Block | None = ...) -> Value : ...
559
+ def read_register (self , register : str | RegisterDescriptor | int ) -> Value : ...
560
+ def read_var (self , variable : str | Symbol , block : Block | None = ...) -> Value : ...
551
561
def select (self ) -> None : ...
552
562
def level (self ) -> int : ...
553
- def static_link (self ) -> Incomplete | None : ...
563
+ def static_link (self ) -> Frame | None : ...
554
564
def language (self ): ...
555
565
556
566
# Blocks
@@ -596,6 +606,7 @@ class Symbol:
596
606
is_constant : bool
597
607
is_function : bool
598
608
is_variable : bool
609
+ is_artificial : bool
599
610
600
611
def is_valid (self ) -> bool : ...
601
612
def value (self , frame : Frame = ..., / ) -> Value : ...
@@ -672,13 +683,12 @@ class LineTable:
672
683
# Breakpoints
673
684
674
685
class Breakpoint :
675
-
676
686
# The where="spec" form of __init__(). See py-breakpoints.c:bppy_init():keywords for the positional order.
677
687
@overload
678
688
def __init__ (
679
689
self ,
680
690
# where
681
- spec : str ,
691
+ spec : str = ... ,
682
692
# options
683
693
type : int = ...,
684
694
wp_class : int = ...,
@@ -813,21 +823,21 @@ class Breakpoint:
813
823
temporary : bool
814
824
hit_count : int
815
825
location : str | None
816
- locations : Incomplete
826
+ locations : Sequence [ BreakpointLocation ]
817
827
inferior : int | None
818
828
expression : str | None
819
829
condition : str | None
820
830
commands : str | None
821
831
822
832
@final
823
833
class BreakpointLocation :
824
- address : Incomplete
834
+ address : int
825
835
enabled : bool
826
836
fullname : str
827
- function : Incomplete
828
- owner : Incomplete
829
- source : Incomplete
830
- thread_groups : Incomplete
837
+ function : str | None
838
+ owner : Breakpoint
839
+ source : tuple [ str , int ]
840
+ thread_groups : Sequence [ int ]
831
841
832
842
BP_NONE : int
833
843
BP_BREAKPOINT : int
@@ -920,7 +930,7 @@ class TuiWindow:
920
930
921
931
def is_valid (self ) -> bool : ...
922
932
def erase (self ) -> None : ...
923
- def write (self , string : str , full_window : bool = ..., / ) -> None : ...
933
+ def write (self , string : str , full_window : bool = ...) -> None : ...
924
934
925
935
@type_check_only
926
936
class _Window (Protocol ):
@@ -943,18 +953,19 @@ class ExitedEvent(Event):
943
953
inferior : Inferior
944
954
945
955
class ThreadExitedEvent (Event ): ...
946
- class StopEvent (ThreadEvent ): ...
956
+
957
+ class StopEvent (ThreadEvent ):
958
+ details : dict [str , object ]
947
959
948
960
class BreakpointEvent (StopEvent ):
949
961
breakpoints : Sequence [Breakpoint ]
950
962
breakpoint : Breakpoint
951
963
952
- missing_debug_handlers : list [Incomplete ]
953
-
954
964
class NewObjFileEvent (Event ):
955
965
new_objfile : Objfile
956
966
957
- class FreeObjFileEvent (Event ): ...
967
+ class FreeObjFileEvent (Event ):
968
+ objfile : Objfile
958
969
959
970
class ClearObjFilesEvent (Event ):
960
971
progspace : Progspace
@@ -1000,6 +1011,9 @@ class ConnectionEvent(Event):
1000
1011
1001
1012
class ExecutableChangedEvent (Event ): ...
1002
1013
1014
+ class TuiEnabledEvent (Event ):
1015
+ enabled : bool
1016
+
1003
1017
_ET = TypeVar ("_ET" , bound = Event | Breakpoint | None )
1004
1018
1005
1019
@final
@@ -1010,3 +1024,6 @@ class EventRegistry(Generic[_ET]):
1010
1024
class ValuePrinter : ...
1011
1025
1012
1026
def blocked_signals (): ...
1027
+ def notify_mi (name : str , data : dict [str , object ] | None = None ): ...
1028
+ def interrupt (): ...
1029
+ def execute_mi (command : str , * args : str ) -> dict [str , object ]: ...
0 commit comments