Skip to content

Commit d3c831c

Browse files
authored
Update GDB stubs to 12.1 (#11665)
1 parent 027115e commit d3c831c

File tree

8 files changed

+288
-246
lines changed

8 files changed

+288
-246
lines changed
Lines changed: 53 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,102 +1,32 @@
1-
# TODO: Update types in stub
2-
# This list includes everything to allow initial stubtests to run in gdb's environment
3-
gdb.BP_NONE
4-
gdb.Breakpoint.stop
5-
gdb.BreakpointEvent
6-
gdb.ClearObjFilesEvent
1+
# Internal list of packages to auto-load
2+
gdb.packages
3+
gdb.GdbSetPythonDirectory
4+
5+
# optional method, only called when present
76
gdb.Command.complete
8-
gdb.Command.invoke
9-
gdb.ConnectionEvent
10-
gdb.ContinueEvent
11-
gdb.DUMMY_FRAME
12-
gdb.Event
13-
gdb.EventRegistry
14-
gdb.ExitedEvent
15-
gdb.FRAME_UNWIND_FIRST_ERROR
167
gdb.FinishBreakpoint.out_of_scope
8+
gdb.Parameter.get_set_string
9+
gdb.Parameter.get_show_string
10+
11+
12+
# TODO: abstract/optional methods to be implemented by subclasses
13+
# gdb.FinishBreakpoint.out_of_scope
14+
gdb.Breakpoint.stop
15+
gdb.Command.invoke
1716
gdb.Function.invoke
18-
gdb.GdbExitingEvent
19-
gdb.GdbSetPythonDirectory
20-
gdb.HOST_CONFIG
21-
gdb.Inferior.connection
22-
gdb.Inferior.thread_from_thread_handle
23-
gdb.InferiorCallPostEvent
24-
gdb.InferiorCallPreEvent
25-
gdb.InferiorDeletedEvent
26-
gdb.InferiorThread.details
17+
gdb.MICommand.invoke
18+
19+
# TODO: investigate why they are not present at runtime
2720
gdb.Instruction
2821
gdb.LazyString
29-
gdb.LineTable.__next__
30-
gdb.LineTable.is_valid
31-
gdb.LineTable.source_lines
32-
gdb.LineTable.source_lnes
33-
gdb.LineTableIterator
34-
gdb.MICommand.invoke
3522
gdb.Membuf
36-
gdb.MemoryChangedEvent
37-
gdb.NewInferiorEvent
38-
gdb.NewObjFileEvent
39-
gdb.NewThreadEvent
40-
gdb.Objfile.frame_unwinders
41-
gdb.Objfile.lookup_static_method
42-
gdb.Objfile.lookup_static_symbol
43-
gdb.Objfile.xmethods
44-
gdb.Parameter.get_set_string
45-
gdb.Parameter.get_show_string
46-
gdb.Progspace.frame_unwinders
47-
gdb.Progspace.xmethods
4823
gdb.Record
4924
gdb.RecordFunctionSegment
5025
gdb.RecordGap
5126
gdb.RecordInstruction
52-
gdb.RegisterChangedEvent
53-
gdb.RegisterDescriptor
54-
gdb.RegisterDescriptorIterator
55-
gdb.RegisterGroup
56-
gdb.RegisterGroupsIterator
57-
gdb.RemoteTargetConnection
58-
gdb.SYMBOL_FUNCTIONS_DOMAIN
59-
gdb.SYMBOL_TYPES_DOMAIN
60-
gdb.SYMBOL_VARIABLES_DOMAIN
61-
gdb.SignalEvent
62-
gdb.StopEvent
63-
gdb.TARGET_CONFIG
64-
gdb.ThreadEvent
6527
gdb.TuiWindow
66-
gdb.Type.__contains__
67-
gdb.Type.get
68-
gdb.Type.has_key
69-
gdb.Type.is_scalar
70-
gdb.Type.is_signed
71-
gdb.Type.items
72-
gdb.Type.iteritems
73-
gdb.Type.iterkeys
74-
gdb.Type.itervalues
75-
gdb.Type.keys
76-
gdb.Type.values
77-
gdb.TypeIterator
78-
gdb.Unwinder
79-
gdb.Value.rvalue_reference_value
80-
gdb.frame_filters
81-
gdb.frame_unwinders
82-
gdb.packages
83-
gdb.prompt_hook
84-
gdb.type_printers
85-
gdb.xmethods
86-
gdb.events
87-
gdb.printing.RegexpCollectionPrettyPrinter.RegexpSubprinter
88-
gdb.printing.add_builtin_pretty_printer
89-
gdb.prompt.prompt_help
90-
gdb.prompt.prompt_substitutions
91-
gdb.types.TypePrinter.instantiate
92-
gdb.unwinder.Unwinder
93-
gdb.xmethod.SimpleXMethodMatcher
94-
gdb.xmethod.XMethodMatcher.match
95-
gdb.xmethod.XMethodWorker.__call__
96-
gdb.xmethod.XMethodWorker.get_arg_types
97-
gdb.xmethod.XMethodWorker.get_result_type
98-
gdb.FrameDecorator
99-
gdb.FrameIterator
28+
29+
# python implementation of built-in commands
10030
gdb.command
10131
gdb.command.explore
10232
gdb.command.frame_filters
@@ -105,15 +35,48 @@ gdb.command.prompt
10535
gdb.command.type_printers
10636
gdb.command.unwinders
10737
gdb.command.xmethods
108-
gdb.frames
38+
39+
# module is auto-imported with gdb and cannot be imported on its own
40+
gdb.events
41+
42+
# implementing internal convenience functions
10943
gdb.function
11044
gdb.function.as_string
11145
gdb.function.caller_is
11246
gdb.function.strfns
47+
48+
# internal workers for frame filters
49+
gdb.frames
50+
gdb.FrameDecorator.FrameVars
51+
52+
# function is only called when it's present
53+
gdb.prompt_hook
54+
55+
# internal methods used in the public gdb.prompt.substitute_prompt
56+
gdb.prompt.prompt_help
57+
gdb.prompt.prompt_substitutions
58+
59+
# internal module to register a printer for mpx_bound128 type
11360
gdb.printer
11461
gdb.printer.bound_registers
62+
63+
gdb.printing.RegexpCollectionPrettyPrinter.RegexpSubprinter
64+
gdb.printing.add_builtin_pretty_printer
65+
66+
# internal methods for colorful commandline output
67+
gdb.styling
68+
69+
# internal worker for SimpleXMethodMatcher
70+
gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker
71+
72+
# list of registered xmethods to be added by xmethod.register_xmethod_matcher()
73+
gdb.xmethods
74+
gdb.Objfile.xmethods
75+
gdb.Progspace.xmethods
76+
77+
# Python 2 compatibility defines
78+
gdb.FrameDecorator.basestring
11579
gdb.printing.basestring
11680
gdb.printing.long
11781
gdb.xmethod.basestring
11882
gdb.xmethod.long
119-
gdb.styling

stubs/gdb/gdb/FrameDecorator.pyi

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
from collections.abc import Iterator
2+
from typing import Protocol
3+
4+
import gdb
5+
6+
class SymValueWrapper(Protocol):
7+
def symbol(self) -> gdb.Symbol | str: ...
8+
def value(self) -> gdb._ValueOrNative | None: ...
9+
10+
class FrameDecorator:
11+
def __init__(self, base: gdb.Frame | FrameDecorator) -> None: ...
12+
def elided(self) -> Iterator[gdb.Frame] | None: ...
13+
def function(self) -> str | None: ...
14+
def address(self) -> int | None: ...
15+
def filename(self) -> str | None: ...
16+
def line(self) -> int | None: ...
17+
def frame_args(self) -> Iterator[SymValueWrapper] | None: ...
18+
def frame_locals(self) -> Iterator[SymValueWrapper] | None: ...
19+
def inferior_frame(self) -> gdb.Frame: ...

stubs/gdb/gdb/FrameIterator.pyi

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import gdb
2+
3+
class FrameIterator:
4+
frame: gdb.Frame
5+
6+
def __init__(self, frame_obj: gdb.Frame) -> None: ...
7+
def __iter__(self) -> FrameIterator: ...
8+
def next(self) -> gdb.Frame: ...
9+
def __next__(self) -> gdb.Frame: ...

0 commit comments

Comments
 (0)