Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 42f6a21

Browse files
authored
Bump gdb to 15.0.* (#12804)
Closes: #12777
1 parent ddf9d54 commit 42f6a21

33 files changed

Lines changed: 338 additions & 134 deletions

pyrightconfig.stricter.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"stubs/docutils",
4848
"stubs/Flask-SocketIO",
4949
"stubs/fpdf2",
50+
"stubs/gdb",
5051
"stubs/google-cloud-ndb",
5152
"stubs/hdbcli/hdbcli/dbapi.pyi",
5253
"stubs/html5lib",

stubs/gdb/@tests/stubtest_allowlist.txt

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ gdb.FinishBreakpoint.out_of_scope
88
gdb.Parameter.get_set_string
99
gdb.Parameter.get_show_string
1010

11-
1211
# TODO: abstract/optional methods to be implemented by subclasses
1312
# gdb.FinishBreakpoint.out_of_scope
1413
gdb.Breakpoint.stop
@@ -30,15 +29,13 @@ gdb.TuiWindow
3029
gdb.command
3130
gdb.command.explore
3231
gdb.command.frame_filters
32+
gdb.command.missing_debug
3333
gdb.command.pretty_printers
3434
gdb.command.prompt
3535
gdb.command.type_printers
3636
gdb.command.unwinders
3737
gdb.command.xmethods
3838

39-
# module is auto-imported with gdb and cannot be imported on its own
40-
gdb.events
41-
4239
# implementing internal convenience functions
4340
gdb.function
4441
gdb.function.as_string
@@ -74,9 +71,8 @@ gdb.xmethods
7471
gdb.Objfile.xmethods
7572
gdb.Progspace.xmethods
7673

77-
# Python 2 compatibility defines
78-
gdb.FrameDecorator.basestring
79-
gdb.printing.basestring
80-
gdb.printing.long
81-
gdb.xmethod.basestring
82-
gdb.xmethod.long
74+
# stubtest thinks this can't be sub-classed at runtime, but it is
75+
gdb.disassembler.DisassemblerPart
76+
77+
# incomplete modules
78+
gdb\.dap\.[a-z_]+\.[A-Za-z_]+

stubs/gdb/METADATA.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
version = "12.1.*"
1+
version = "15.0.*"
22
# This is the official web portal for GDB,
33
# see https://sourceware.org/gdb/current/ for other ways of obtaining the source code.
44
upstream_repository = "https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=tree"

stubs/gdb/gdb/FrameDecorator.pyi

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,18 @@ class SymValueWrapper(Protocol):
77
def symbol(self) -> gdb.Symbol | str: ...
88
def value(self) -> gdb._ValueOrNative | None: ...
99

10-
class FrameDecorator:
10+
class _FrameDecoratorBase:
1111
def __init__(self, base: gdb.Frame | FrameDecorator) -> None: ...
1212
def elided(self) -> Iterator[gdb.Frame] | None: ...
1313
def function(self) -> str | None: ...
1414
def address(self) -> int | None: ...
15-
def filename(self) -> str | None: ...
1615
def line(self) -> int | None: ...
1716
def frame_args(self) -> Iterator[SymValueWrapper] | None: ...
1817
def frame_locals(self) -> Iterator[SymValueWrapper] | None: ...
1918
def inferior_frame(self) -> gdb.Frame: ...
19+
20+
class FrameDecorator(_FrameDecoratorBase):
21+
def filename(self) -> str | None: ...
22+
23+
class DAPFrameDecorator(_FrameDecoratorBase):
24+
def filename(self) -> str | None: ...

stubs/gdb/gdb/FrameIterator.pyi

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,4 @@ class FrameIterator:
55

66
def __init__(self, frame_obj: gdb.Frame) -> None: ...
77
def __iter__(self) -> FrameIterator: ...
8-
def next(self) -> gdb.Frame: ...
98
def __next__(self) -> gdb.Frame: ...

stubs/gdb/gdb/__init__.pyi

Lines changed: 120 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
# (https://sourceware.org/gdb/onlinedocs/gdb/Python-API.html).
44

55
import _typeshed
6+
import threading
7+
from _typeshed import Incomplete
68
from collections.abc import Callable, Iterator, Mapping, Sequence
79
from contextlib import AbstractContextManager
8-
from typing import Any, Generic, Literal, Protocol, TypeVar, final, overload
10+
from typing import Any, Final, Generic, Literal, Protocol, TypeVar, final, overload
911
from typing_extensions import TypeAlias, deprecated
1012

1113
import gdb.FrameDecorator
@@ -136,6 +138,8 @@ class Value:
136138
def string(self, encoding: str = ..., errors: str = ..., length: int = ...) -> str: ...
137139
def lazy_string(self, encoding: str = ..., length: int = ...) -> LazyString: ...
138140
def fetch_lazy(self) -> None: ...
141+
def assign(self, val): ...
142+
def to_array(self): ...
139143

140144
# Types
141145

@@ -193,33 +197,46 @@ class Field:
193197
type: Type | None
194198
parent_type: Type
195199

196-
TYPE_CODE_PTR: int
197-
TYPE_CODE_ARRAY: int
198-
TYPE_CODE_STRUCT: int
199-
TYPE_CODE_UNION: int
200-
TYPE_CODE_ENUM: int
201-
TYPE_CODE_FLAGS: int
202-
TYPE_CODE_FUNC: int
203-
TYPE_CODE_INT: int
204-
TYPE_CODE_FLT: int
205-
TYPE_CODE_VOID: int
206-
TYPE_CODE_SET: int
207-
TYPE_CODE_RANGE: int
208-
TYPE_CODE_STRING: int
209-
TYPE_CODE_BITSTRING: int
210-
TYPE_CODE_ERROR: int
211-
TYPE_CODE_METHOD: int
212-
TYPE_CODE_METHODPTR: int
213-
TYPE_CODE_MEMBERPTR: int
214-
TYPE_CODE_REF: int
215-
TYPE_CODE_RVALUE_REF: int
216-
TYPE_CODE_CHAR: int
217-
TYPE_CODE_BOOL: int
218-
TYPE_CODE_COMPLEX: int
219-
TYPE_CODE_TYPEDEF: int
220-
TYPE_CODE_NAMESPACE: int
221-
TYPE_CODE_DECFLOAT: int
222-
TYPE_CODE_INTERNAL_FUNCTION: int
200+
TYPE_CODE_BITSTRING: Final = -1
201+
TYPE_CODE_PTR: Final = 1
202+
TYPE_CODE_ARRAY: Final = 2
203+
TYPE_CODE_STRUCT: Final = 3
204+
TYPE_CODE_UNION: Final = 4
205+
TYPE_CODE_ENUM: Final = 5
206+
TYPE_CODE_FLAGS: Final = 6
207+
TYPE_CODE_FUNC: Final = 7
208+
TYPE_CODE_INT: Final = 8
209+
TYPE_CODE_FLT: Final = 9
210+
TYPE_CODE_VOID: Final = 10
211+
TYPE_CODE_SET: Final = 11
212+
TYPE_CODE_RANGE: Final = 12
213+
TYPE_CODE_STRING: Final = 13
214+
TYPE_CODE_ERROR: Final = 14
215+
TYPE_CODE_METHOD: Final = 15
216+
TYPE_CODE_METHODPTR: Final = 16
217+
TYPE_CODE_MEMBERPTR: Final = 17
218+
TYPE_CODE_REF: Final = 18
219+
TYPE_CODE_RVALUE_REF: Final = 19
220+
TYPE_CODE_CHAR: Final = 20
221+
TYPE_CODE_BOOL: Final = 21
222+
TYPE_CODE_COMPLEX: Final = 22
223+
TYPE_CODE_TYPEDEF: Final = 23
224+
TYPE_CODE_NAMESPACE: Final = 24
225+
TYPE_CODE_DECFLOAT: Final = 25
226+
TYPE_CODE_MODULE: Final = 26
227+
TYPE_CODE_INTERNAL_FUNCTION: Final = 27
228+
TYPE_CODE_XMETHOD: Final = 28
229+
TYPE_CODE_FIXED_POINT: Final = 29
230+
TYPE_CODE_NAMELIST: Final = 30
231+
232+
SEARCH_UNDEF_DOMAIN: Final[int]
233+
SEARCH_VAR_DOMAIN: Final[int]
234+
SEARCH_STRUCT_DOMAIN: Final[int]
235+
SEARCH_MODULE_DOMAIN: Final[int]
236+
SEARCH_LABEL_DOMAIN: Final[int]
237+
SEARCH_COMMON_BLOCK_DOMAIN: Final[int]
238+
SEARCH_TYPE_DOMAIN: Final[int]
239+
SEARCH_FUNCTION_DOMAIN: Final[int]
223240

224241
# Pretty Printing
225242

@@ -259,8 +276,16 @@ class PendingFrame:
259276
def read_register(self, reg: str | RegisterDescriptor | int, /) -> Value: ...
260277
def create_unwind_info(self, frame_id: object, /) -> UnwindInfo: ...
261278
def architecture(self) -> Architecture: ...
279+
def language(self): ...
262280
def level(self) -> int: ...
281+
def name(self) -> str: ...
282+
def pc(self) -> int: ...
283+
def block(self) -> Block: ...
284+
def find_sal(self) -> Symtab_and_line: ...
285+
def function(self) -> Symbol: ...
286+
def is_valid(self) -> bool: ...
263287

288+
@final
264289
class UnwindInfo:
265290
def add_saved_register(self, reg: str | RegisterDescriptor | int, value: Value, /) -> None: ...
266291

@@ -281,6 +306,8 @@ class Inferior:
281306
pid: int
282307
was_attached: bool
283308
progspace: Progspace
309+
main_name: Incomplete
310+
arguments: Incomplete
284311

285312
def is_valid(self) -> bool: ...
286313
def threads(self) -> tuple[InferiorThread, ...]: ...
@@ -291,9 +318,14 @@ class Inferior:
291318
def thread_from_handle(self, handle: Value) -> InferiorThread: ...
292319
@deprecated("Use gdb.thread_from_handle() instead.")
293320
def thread_from_thread_handle(self, handle: Value) -> InferiorThread: ...
321+
def set_env(self, name: str, value: str) -> None: ...
322+
def unset_env(self, name: str) -> None: ...
323+
def clear_env(self) -> None: ...
294324

295325
# Threads
296326

327+
class Thread(threading.Thread): ...
328+
297329
def selected_thread() -> InferiorThread: ...
298330
@final
299331
class InferiorThread:
@@ -302,6 +334,7 @@ class InferiorThread:
302334
num: int
303335
global_num: int
304336
ptid: tuple[int, int, int]
337+
ptid_string: str
305338
inferior: Inferior
306339

307340
def is_valid(self) -> bool: ...
@@ -429,15 +462,19 @@ def current_progspace() -> Progspace | None: ...
429462
def progspaces() -> Sequence[Progspace]: ...
430463
@final
431464
class Progspace:
432-
filename: str
465+
executable_filename: str | None
466+
filename: str | None
467+
symbol_file: Objfile | None
433468
pretty_printers: list[_PrettyPrinterLookupFunction]
434469
type_printers: list[gdb.types._TypePrinter]
435470
frame_filters: dict[str, _FrameFilter]
436471
frame_unwinders: list[gdb.unwinder.Unwinder]
472+
missing_debug_handlers: Incomplete
437473

438474
def block_for_pc(self, pc: int, /) -> Block | None: ...
439475
def find_pc_line(self, pc: int, /) -> Symtab_and_line: ...
440476
def is_valid(self) -> bool: ...
477+
def objfile_for_address(self, address: int, /) -> Objfile | None: ...
441478
def objfiles(self) -> Sequence[Objfile]: ...
442479
def solib_name(self, address: int, /) -> str | None: ...
443480

@@ -457,6 +494,7 @@ class Objfile:
457494
type_printers: list[gdb.types._TypePrinter]
458495
frame_filters: dict[str, _FrameFilter]
459496
frame_unwinders: list[gdb.unwinder.Unwinder]
497+
is_file: bool
460498

461499
def is_valid(self) -> bool: ...
462500
def add_separate_debug_file(self, file: str) -> None: ...
@@ -504,6 +542,8 @@ class Frame:
504542
def read_var(self, variable: str | Symbol, /, block: Block | None = ...) -> Value: ...
505543
def select(self) -> None: ...
506544
def level(self) -> int: ...
545+
def static_link(self) -> Incomplete | None: ...
546+
def language(self): ...
507547

508548
# Blocks
509549

@@ -552,34 +592,31 @@ class Symbol:
552592
def is_valid(self) -> bool: ...
553593
def value(self, frame: Frame = ..., /) -> Value: ...
554594

555-
SYMBOL_UNDEF_DOMAIN: int
556-
SYMBOL_VAR_DOMAIN: int
557-
SYMBOL_STRUCT_DOMAIN: int
558-
SYMBOL_LABEL_DOMAIN: int
559-
SYMBOL_MODULE_DOMAIN: int
560-
SYMBOL_COMMON_BLOCK_DOMAIN: int
561-
562-
# The constants were never correct. Use gdb.SYMBOL_VAR_DOMAIN instead.
563-
SYMBOL_VARIABLES_DOMAIN: int
564-
SYMBOL_FUNCTIONS_DOMAIN: int
565-
SYMBOL_TYPES_DOMAIN: int
566-
567-
SYMBOL_LOC_UNDEF: int
568-
SYMBOL_LOC_CONST: int
569-
SYMBOL_LOC_STATIC: int
570-
SYMBOL_LOC_REGISTER: int
571-
SYMBOL_LOC_ARG: int
572-
SYMBOL_LOC_REF_ARG: int
573-
SYMBOL_LOC_REGPARM_ADDR: int
574-
SYMBOL_LOC_LOCAL: int
575-
SYMBOL_LOC_TYPEDEF: int
576-
SYMBOL_LOC_LABEL: int
577-
SYMBOL_LOC_BLOCK: int
578-
SYMBOL_LOC_CONST_BYTES: int
579-
SYMBOL_LOC_UNRESOLVED: int
580-
SYMBOL_LOC_OPTIMIZED_OUT: int
581-
SYMBOL_LOC_COMPUTED: int
582-
SYMBOL_LOC_COMMON_BLOCK: int
595+
SYMBOL_UNDEF_DOMAIN: Final = 0
596+
SYMBOL_VAR_DOMAIN: Final = 1
597+
SYMBOL_STRUCT_DOMAIN: Final = 2
598+
SYMBOL_MODULE_DOMAIN: Final = 3
599+
SYMBOL_LABEL_DOMAIN: Final = 4
600+
SYMBOL_COMMON_BLOCK_DOMAIN: Final = 5
601+
SYMBOL_TYPE_DOMAIN: Final = 6
602+
SYMBOL_FUNCTION_DOMAIN: Final = 7
603+
604+
SYMBOL_LOC_UNDEF: Final = 0
605+
SYMBOL_LOC_CONST: Final = 1
606+
SYMBOL_LOC_STATIC: Final = 2
607+
SYMBOL_LOC_REGISTER: Final = 3
608+
SYMBOL_LOC_ARG: Final = 4
609+
SYMBOL_LOC_REF_ARG: Final = 5
610+
SYMBOL_LOC_REGPARM_ADDR: Final = 6
611+
SYMBOL_LOC_LOCAL: Final = 7
612+
SYMBOL_LOC_TYPEDEF: Final = 8
613+
SYMBOL_LOC_LABEL: Final = 9
614+
SYMBOL_LOC_BLOCK: Final = 10
615+
SYMBOL_LOC_CONST_BYTES: Final = 11
616+
SYMBOL_LOC_UNRESOLVED: Final = 12
617+
SYMBOL_LOC_OPTIMIZED_OUT: Final = 13
618+
SYMBOL_LOC_COMPUTED: Final = 14
619+
SYMBOL_LOC_COMMON_BLOCK: Final = 15
583620

584621
# Symbol tables
585622

@@ -658,10 +695,22 @@ class Breakpoint:
658695
temporary: bool
659696
hit_count: int
660697
location: str | None
698+
locations: Incomplete
699+
inferior: int | None
661700
expression: str | None
662701
condition: str | None
663702
commands: str | None
664703

704+
@final
705+
class BreakpointLocation:
706+
address: Incomplete
707+
enabled: bool
708+
fullname: str
709+
function: Incomplete
710+
owner: Incomplete
711+
source: Incomplete
712+
thread_groups: Incomplete
713+
665714
BP_NONE: int
666715
BP_BREAKPOINT: int
667716
BP_HARDWARE_BREAKPOINT: int
@@ -768,18 +817,26 @@ class ExitedEvent(Event):
768817
exit_code: int
769818
inferior: Inferior
770819

820+
class ThreadExitedEvent(Event): ...
771821
class StopEvent(ThreadEvent): ...
772822

773823
class BreakpointEvent(StopEvent):
774824
breakpoints: Sequence[Breakpoint]
775825
breakpoint: Breakpoint
776826

827+
missing_debug_handlers: list[Incomplete]
828+
777829
class NewObjFileEvent(Event):
778830
new_objfile: Objfile
779831

832+
class FreeObjFileEvent(Event): ...
833+
780834
class ClearObjFilesEvent(Event):
781835
progspace: Progspace
782836

837+
class NewProgspaceEvent(Event): ...
838+
class FreeProgspaceEvent(Event): ...
839+
783840
class SignalEvent(StopEvent):
784841
stop_signal: str
785842

@@ -815,9 +872,15 @@ class GdbExitingEvent(Event):
815872
class ConnectionEvent(Event):
816873
connection: TargetConnection
817874

875+
class ExecutableChangedEvent(Event): ...
876+
818877
_ET = TypeVar("_ET", bound=Event | Breakpoint | None)
819878

820879
@final
821880
class EventRegistry(Generic[_ET]):
822881
def connect(self, object: Callable[[_ET], object], /) -> None: ...
823882
def disconnect(self, object: Callable[[_ET], object], /) -> None: ...
883+
884+
class ValuePrinter: ...
885+
886+
def blocked_signals(): ...

0 commit comments

Comments
 (0)