Skip to content

Update GDB stubs to 12.1 #11665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
143 changes: 53 additions & 90 deletions stubs/gdb/@tests/stubtest_allowlist.txt
Original file line number Diff line number Diff line change
@@ -1,102 +1,32 @@
# TODO: Update types in stub
# This list includes everything to allow initial stubtests to run in gdb's environment
gdb.BP_NONE
gdb.Breakpoint.stop
gdb.BreakpointEvent
gdb.ClearObjFilesEvent
# Internal list of packages to auto-load
gdb.packages
gdb.GdbSetPythonDirectory

# optional method, only called when present
gdb.Command.complete
gdb.Command.invoke
gdb.ConnectionEvent
gdb.ContinueEvent
gdb.DUMMY_FRAME
gdb.Event
gdb.EventRegistry
gdb.ExitedEvent
gdb.FRAME_UNWIND_FIRST_ERROR
gdb.FinishBreakpoint.out_of_scope
gdb.Parameter.get_set_string
gdb.Parameter.get_show_string


# TODO: abstract/optional methods to be implemented by subclasses
# gdb.FinishBreakpoint.out_of_scope
gdb.Breakpoint.stop
gdb.Command.invoke
gdb.Function.invoke
gdb.GdbExitingEvent
gdb.GdbSetPythonDirectory
gdb.HOST_CONFIG
gdb.Inferior.connection
gdb.Inferior.thread_from_thread_handle
gdb.InferiorCallPostEvent
gdb.InferiorCallPreEvent
gdb.InferiorDeletedEvent
gdb.InferiorThread.details
gdb.MICommand.invoke

# TODO: investigate why they are not present at runtime
gdb.Instruction
gdb.LazyString
gdb.LineTable.__next__
gdb.LineTable.is_valid
gdb.LineTable.source_lines
gdb.LineTable.source_lnes
gdb.LineTableIterator
gdb.MICommand.invoke
gdb.Membuf
gdb.MemoryChangedEvent
gdb.NewInferiorEvent
gdb.NewObjFileEvent
gdb.NewThreadEvent
gdb.Objfile.frame_unwinders
gdb.Objfile.lookup_static_method
gdb.Objfile.lookup_static_symbol
gdb.Objfile.xmethods
gdb.Parameter.get_set_string
gdb.Parameter.get_show_string
gdb.Progspace.frame_unwinders
gdb.Progspace.xmethods
gdb.Record
gdb.RecordFunctionSegment
gdb.RecordGap
gdb.RecordInstruction
gdb.RegisterChangedEvent
gdb.RegisterDescriptor
gdb.RegisterDescriptorIterator
gdb.RegisterGroup
gdb.RegisterGroupsIterator
gdb.RemoteTargetConnection
gdb.SYMBOL_FUNCTIONS_DOMAIN
gdb.SYMBOL_TYPES_DOMAIN
gdb.SYMBOL_VARIABLES_DOMAIN
gdb.SignalEvent
gdb.StopEvent
gdb.TARGET_CONFIG
gdb.ThreadEvent
gdb.TuiWindow
gdb.Type.__contains__
gdb.Type.get
gdb.Type.has_key
gdb.Type.is_scalar
gdb.Type.is_signed
gdb.Type.items
gdb.Type.iteritems
gdb.Type.iterkeys
gdb.Type.itervalues
gdb.Type.keys
gdb.Type.values
gdb.TypeIterator
gdb.Unwinder
gdb.Value.rvalue_reference_value
gdb.frame_filters
gdb.frame_unwinders
gdb.packages
gdb.prompt_hook
gdb.type_printers
gdb.xmethods
gdb.events
gdb.printing.RegexpCollectionPrettyPrinter.RegexpSubprinter
gdb.printing.add_builtin_pretty_printer
gdb.prompt.prompt_help
gdb.prompt.prompt_substitutions
gdb.types.TypePrinter.instantiate
gdb.unwinder.Unwinder
gdb.xmethod.SimpleXMethodMatcher
gdb.xmethod.XMethodMatcher.match
gdb.xmethod.XMethodWorker.__call__
gdb.xmethod.XMethodWorker.get_arg_types
gdb.xmethod.XMethodWorker.get_result_type
gdb.FrameDecorator
gdb.FrameIterator

# python implementation of built-in commands
gdb.command
gdb.command.explore
gdb.command.frame_filters
Expand All @@ -105,15 +35,48 @@ gdb.command.prompt
gdb.command.type_printers
gdb.command.unwinders
gdb.command.xmethods
gdb.frames

# module is auto-imported with gdb and cannot be imported on its own
gdb.events

# implementing internal convenience functions
gdb.function
gdb.function.as_string
gdb.function.caller_is
gdb.function.strfns

# internal workers for frame filters
gdb.frames
gdb.FrameDecorator.FrameVars

# function is only called when it's present
gdb.prompt_hook

# internal methods used in the public gdb.prompt.substitute_prompt
gdb.prompt.prompt_help
gdb.prompt.prompt_substitutions

# internal module to register a printer for mpx_bound128 type
gdb.printer
gdb.printer.bound_registers

gdb.printing.RegexpCollectionPrettyPrinter.RegexpSubprinter
gdb.printing.add_builtin_pretty_printer

# internal methods for colorful commandline output
gdb.styling

# internal worker for SimpleXMethodMatcher
gdb.xmethod.SimpleXMethodMatcher.SimpleXMethodWorker

# list of registered xmethods to be added by xmethod.register_xmethod_matcher()
gdb.xmethods
gdb.Objfile.xmethods
gdb.Progspace.xmethods

# Python 2 compatibility defines
gdb.FrameDecorator.basestring
gdb.printing.basestring
gdb.printing.long
gdb.xmethod.basestring
gdb.xmethod.long
gdb.styling
19 changes: 19 additions & 0 deletions stubs/gdb/gdb/FrameDecorator.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
from collections.abc import Iterator
from typing import Protocol

import gdb

class SymValueWrapper(Protocol):
def symbol(self) -> gdb.Symbol | str: ...
def value(self) -> gdb._ValueOrNative | None: ...

class FrameDecorator:
def __init__(self, base: gdb.Frame | FrameDecorator) -> None: ...
def elided(self) -> Iterator[gdb.Frame] | None: ...
def function(self) -> str | None: ...
def address(self) -> int | None: ...
def filename(self) -> str | None: ...
def line(self) -> int | None: ...
def frame_args(self) -> Iterator[SymValueWrapper] | None: ...
def frame_locals(self) -> Iterator[SymValueWrapper] | None: ...
def inferior_frame(self) -> gdb.Frame: ...
9 changes: 9 additions & 0 deletions stubs/gdb/gdb/FrameIterator.pyi
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import gdb

class FrameIterator:
frame: gdb.Frame

def __init__(self, frame_obj: gdb.Frame) -> None: ...
def __iter__(self) -> FrameIterator: ...
def next(self) -> gdb.Frame: ...
def __next__(self) -> gdb.Frame: ...
Loading