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 , 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
15
16
16
# The following submodules are automatically imported
17
17
from . import events as events , printing as printing , prompt as prompt , types as types
@@ -46,7 +46,8 @@ def add_history(value: Value, /) -> int: ...
46
46
def history_count () -> int : ...
47
47
def convenience_variable (name : str , / ) -> Value | None : ...
48
48
def set_convenience_variable (name : str , value : _ValueOrNative | None , / ) -> None : ...
49
- def parse_and_eval (expression : str , global_context : bool = False , / ) -> Value : ...
49
+ def parse_and_eval (expression : str , global_context : bool = False ) -> Value : ...
50
+ def format_address (address : int , progspace : Progspace = ..., architecture : Architecture = ...): ...
50
51
def find_pc_line (pc : int | Value ) -> Symtab_and_line : ...
51
52
def post_event (event : Callable [[], object ], / ) -> None : ...
52
53
def write (string : str , stream : int = ...) -> None : ...
@@ -107,7 +108,7 @@ class Value:
107
108
def __ge__ (self , other : _ValueOrNative ) -> bool : ...
108
109
def __getitem__ (self , key : int | str | Field ) -> Value : ...
109
110
def __call__ (self , * args : _ValueOrNative ) -> Value : ...
110
- def __init__ (self , val : _ValueOrNative ) -> None : ...
111
+ def __init__ (self , val : _ValueOrNative , type : Type | None = None ) -> None : ...
111
112
def cast (self , type : Type ) -> Value : ...
112
113
def dereference (self ) -> Value : ...
113
114
def referenced_value (self ) -> Value : ...
@@ -125,9 +126,12 @@ class Value:
125
126
symbols : bool = ...,
126
127
unions : bool = ...,
127
128
address : bool = ...,
129
+ styling : bool = ...,
130
+ nibbles : bool = ...,
128
131
deref_refs : bool = ...,
129
132
actual_objects : bool = ...,
130
133
static_members : bool = ...,
134
+ max_characters : int = ...,
131
135
max_elements : int = ...,
132
136
max_depth : int = ...,
133
137
repeat_threshold : int = ...,
@@ -263,15 +267,17 @@ class _FrameFilter(Protocol):
263
267
enabled : bool
264
268
priority : int
265
269
266
- def filter (self , iterator : Iterator [gdb .FrameDecorator .FrameDecorator ]) -> Iterator [gdb .FrameDecorator .FrameDecorator ]: ...
270
+ def filter (
271
+ self , iterator : Iterator [gdb .FrameDecorator .FrameDecorator | gdb .FrameDecorator .DAPFrameDecorator ]
272
+ ) -> Iterator [gdb .FrameDecorator .FrameDecorator | gdb .FrameDecorator .DAPFrameDecorator ]: ...
267
273
268
274
frame_filters : dict [str , _FrameFilter ]
269
275
270
276
# Unwinding Frames
271
277
272
278
@final
273
279
class PendingFrame :
274
- def read_register (self , reg : str | RegisterDescriptor | int , / ) -> Value : ...
280
+ def read_register (self , register : str | RegisterDescriptor | int ) -> Value : ...
275
281
def create_unwind_info (self , frame_id : object , / ) -> UnwindInfo : ...
276
282
def architecture (self ) -> Architecture : ...
277
283
def language (self ): ...
@@ -285,7 +291,7 @@ class PendingFrame:
285
291
286
292
@final
287
293
class UnwindInfo :
288
- def add_saved_register (self , reg : str | RegisterDescriptor | int , value : Value , / ) -> None : ...
294
+ def add_saved_register (self , register : str | RegisterDescriptor | int , value : Value ) -> None : ...
289
295
290
296
@type_check_only
291
297
class _Unwinder (Protocol ):
@@ -312,14 +318,16 @@ class Inferior:
312
318
pid : int
313
319
was_attached : bool
314
320
progspace : Progspace
315
- main_name : Incomplete
316
- arguments : Incomplete
317
-
321
+ main_name : str | None
322
+ @property
323
+ def arguments (self ) -> str | None : ...
324
+ @arguments .setter
325
+ def arguments (self , args : str | Sequence [str ]) -> None : ...
318
326
def is_valid (self ) -> bool : ...
319
327
def threads (self ) -> tuple [InferiorThread , ...]: ...
320
328
def architecture (self ) -> Architecture : ...
321
329
def read_memory (self , address : _ValueOrInt , length : int ) -> memoryview : ...
322
- def write_memory (self , address : _ValueOrInt , buffer : _BufferType , length : int = ...) -> memoryview : ...
330
+ def write_memory (self , address : _ValueOrInt , buffer : _BufferType , length : int = ...) -> None : ...
323
331
def search_memory (self , address : _ValueOrInt , length : int , pattern : _BufferType ) -> int | None : ...
324
332
def thread_from_handle (self , handle : Value ) -> InferiorThread : ...
325
333
@deprecated ("Use gdb.thread_from_handle() instead." )
@@ -366,6 +374,7 @@ class Record:
366
374
function_call_history : list [RecordFunctionSegment ]
367
375
368
376
def goto (self , instruction : Instruction , / ) -> None : ...
377
+ def clear (self ) -> None : ...
369
378
370
379
class Instruction :
371
380
pc : int
@@ -475,7 +484,7 @@ class Progspace:
475
484
type_printers : list [gdb .types ._TypePrinter ]
476
485
frame_filters : dict [str , _FrameFilter ]
477
486
frame_unwinders : list [_Unwinder ]
478
- missing_debug_handlers : Incomplete
487
+ missing_debug_handlers : Sequence [ MissingDebugHandler ]
479
488
480
489
def block_for_pc (self , pc : int , / ) -> Block | None : ...
481
490
def find_pc_line (self , pc : int , / ) -> Symtab_and_line : ...
@@ -538,17 +547,17 @@ class Frame:
538
547
def architecture (self ) -> Architecture : ...
539
548
def type (self ) -> int : ...
540
549
def unwind_stop_reason (self ) -> int : ...
541
- def pc (self ) -> Value : ...
550
+ def pc (self ) -> int : ...
542
551
def block (self ) -> Block : ...
543
552
def function (self ) -> Symbol : ...
544
553
def older (self ) -> Frame | None : ...
545
554
def newer (self ) -> Frame | None : ...
546
555
def find_sal (self ) -> Symtab_and_line : ...
547
- def read_register (self , register : str | RegisterDescriptor | int , / ) -> Value : ...
548
- def read_var (self , variable : str | Symbol , / , block : Block | None = ...) -> Value : ...
556
+ def read_register (self , register : str | RegisterDescriptor | int ) -> Value : ...
557
+ def read_var (self , variable : str | Symbol , block : Block | None = ...) -> Value : ...
549
558
def select (self ) -> None : ...
550
559
def level (self ) -> int : ...
551
- def static_link (self ) -> Incomplete | None : ...
560
+ def static_link (self ) -> Frame | None : ...
552
561
def language (self ): ...
553
562
554
563
# Blocks
@@ -594,6 +603,7 @@ class Symbol:
594
603
is_constant : bool
595
604
is_function : bool
596
605
is_variable : bool
606
+ is_artificial : bool
597
607
598
608
def is_valid (self ) -> bool : ...
599
609
def value (self , frame : Frame = ..., / ) -> Value : ...
@@ -670,13 +680,12 @@ class LineTable:
670
680
# Breakpoints
671
681
672
682
class Breakpoint :
673
-
674
683
# The where="spec" form of __init__(). See py-breakpoints.c:bppy_init():keywords for the positional order.
675
684
@overload
676
685
def __init__ (
677
686
self ,
678
687
# where
679
- spec : str ,
688
+ spec : str = ... ,
680
689
# options
681
690
type : int = ...,
682
691
wp_class : int = ...,
@@ -811,21 +820,21 @@ class Breakpoint:
811
820
temporary : bool
812
821
hit_count : int
813
822
location : str | None
814
- locations : Incomplete
823
+ locations : Sequence [ BreakpointLocation ]
815
824
inferior : int | None
816
825
expression : str | None
817
826
condition : str | None
818
827
commands : str | None
819
828
820
829
@final
821
830
class BreakpointLocation :
822
- address : Incomplete
831
+ address : int
823
832
enabled : bool
824
833
fullname : str
825
- function : Incomplete
826
- owner : Incomplete
827
- source : Incomplete
828
- thread_groups : Incomplete
834
+ function : str | None
835
+ owner : Breakpoint
836
+ source : tuple [ str , int ]
837
+ thread_groups : Sequence [ int ]
829
838
830
839
BP_NONE : int
831
840
BP_BREAKPOINT : int
@@ -912,7 +921,7 @@ class TuiWindow:
912
921
913
922
def is_valid (self ) -> bool : ...
914
923
def erase (self ) -> None : ...
915
- def write (self , string : str , full_window : bool = ..., / ) -> None : ...
924
+ def write (self , string : str , full_window : bool = ...) -> None : ...
916
925
917
926
class _Window (Protocol ):
918
927
def close (self ) -> None : ...
@@ -934,18 +943,19 @@ class ExitedEvent(Event):
934
943
inferior : Inferior
935
944
936
945
class ThreadExitedEvent (Event ): ...
937
- class StopEvent (ThreadEvent ): ...
946
+
947
+ class StopEvent (ThreadEvent ):
948
+ details : dict [str , object ]
938
949
939
950
class BreakpointEvent (StopEvent ):
940
951
breakpoints : Sequence [Breakpoint ]
941
952
breakpoint : Breakpoint
942
953
943
- missing_debug_handlers : list [Incomplete ]
944
-
945
954
class NewObjFileEvent (Event ):
946
955
new_objfile : Objfile
947
956
948
- class FreeObjFileEvent (Event ): ...
957
+ class FreeObjFileEvent (Event ):
958
+ objfile : Objfile
949
959
950
960
class ClearObjFilesEvent (Event ):
951
961
progspace : Progspace
@@ -990,6 +1000,9 @@ class ConnectionEvent(Event):
990
1000
991
1001
class ExecutableChangedEvent (Event ): ...
992
1002
1003
+ class TuiEnabledEvent (Event ):
1004
+ enabled : bool
1005
+
993
1006
_ET = TypeVar ("_ET" , bound = Event | Breakpoint | None )
994
1007
995
1008
@final
@@ -1000,3 +1013,6 @@ class EventRegistry(Generic[_ET]):
1000
1013
class ValuePrinter : ...
1001
1014
1002
1015
def blocked_signals (): ...
1016
+ def notify_mi (name : str , data : dict [str , object ] | None = None ): ...
1017
+ def interrupt (): ...
1018
+ def execute_mi (command : str , * args : str ) -> dict [str , object ]: ...
0 commit comments