Skip to content

[gdb] Complete stubs for gdb.dap #14269

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 5 commits into from
Jul 12, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Address review comments
  • Loading branch information
brianschubert committed Jul 12, 2025
commit 0875b9d7162bfdd81c0a172124c9715321c29589
9 changes: 5 additions & 4 deletions stubs/gdb/gdb/dap/bt.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ from typing import TypedDict, type_check_only
from typing_extensions import NotRequired

from .sources import Source
from .varref import ValueFormat
from .varref import _ValueFormat

@type_check_only
class _StackFrameFormat(ValueFormat, total=False):
class _StackFrameFormat(_ValueFormat, total=False):
parameters: bool
parameterTypes: bool
parameterNames: bool
Expand All @@ -25,7 +25,8 @@ class _StackFrame(TypedDict):
moduleId: NotRequired[str | None]
source: NotRequired[Source]

class _StaceTraceResult(TypedDict):
@type_check_only
class _StackTraceResult(TypedDict):
stackFrames: list[_StackFrame]

def check_stack_frame(
Expand All @@ -45,4 +46,4 @@ def check_stack_frame(
) -> _StackFrameFormat: ...
def stacktrace(
*, levels: int = 0, startFrame: int = 0, threadId: int, format: _StackFrameFormat | None = None, **extra: Unused
) -> _StaceTraceResult: ...
) -> _StackTraceResult: ...
18 changes: 9 additions & 9 deletions stubs/gdb/gdb/dap/evaluate.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,29 @@ from typing import Literal, TypedDict, type_check_only

import gdb

from .varref import ValueFormat, VariableReference, VariableReferenceDescriptor
from .varref import VariableReference, _ValueFormat, _VariableReferenceDescriptor

class EvaluateResult(VariableReference):
def __init__(self, value: gdb.Value) -> None: ...

@type_check_only
class _VariablesResult(TypedDict):
variables: list[VariableReferenceDescriptor]
variables: list[_VariableReferenceDescriptor]

def eval_request(
*,
expression: str,
frameId: int | None = None,
context: Literal["watch", "variables", "hover", "repl"] = "variables",
format: ValueFormat | None = None,
format: _ValueFormat | None = None,
**args: Unused,
) -> VariableReferenceDescriptor: ...
) -> _VariableReferenceDescriptor: ...
def variables(
*, variablesReference: int, start: int = 0, count: int = 0, format: ValueFormat | None = None, **args: Unused
*, variablesReference: int, start: int = 0, count: int = 0, format: _ValueFormat | None = None, **args: Unused
) -> _VariablesResult: ...
def set_expression(
*, expression: str, value: str, frameId: int | None = None, format: ValueFormat | None = None, **args: Unused
) -> VariableReferenceDescriptor: ...
*, expression: str, value: str, frameId: int | None = None, format: _ValueFormat | None = None, **args: Unused
) -> _VariableReferenceDescriptor: ...
def set_variable(
*, variablesReference: int, name: str, value: str, format: ValueFormat | None = None, **args: Unused
) -> VariableReferenceDescriptor: ...
*, variablesReference: int, name: str, value: str, format: _ValueFormat | None = None, **args: Unused
) -> _VariableReferenceDescriptor: ...
13 changes: 10 additions & 3 deletions stubs/gdb/gdb/dap/io.pyi
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
from typing import Any, BinaryIO
from _typeshed import SupportsFlush, SupportsRead, SupportsReadline, SupportsWrite
from typing import Any, type_check_only

import gdb

from .server import _JSONValue
from .startup import DAPQueue

def read_json(stream: BinaryIO) -> Any: ... # returns result of json.loads
def start_json_writer(stream: BinaryIO, queue: DAPQueue[_JSONValue]) -> gdb.Thread: ...
@type_check_only
class _SupportsReadAndReadlineBytes(SupportsRead[bytes], SupportsReadline[bytes]): ...

@type_check_only
class _SupportsWriteAndFlushBytes(SupportsWrite[bytes], SupportsFlush): ...

def read_json(stream: _SupportsReadAndReadlineBytes) -> Any: ... # returns result of json.loads
def start_json_writer(stream: _SupportsWriteAndFlushBytes, queue: DAPQueue[_JSONValue]) -> gdb.Thread: ...
4 changes: 2 additions & 2 deletions stubs/gdb/gdb/dap/scopes.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ from typing_extensions import NotRequired
import gdb

from ..FrameDecorator import FrameDecorator, SymValueWrapper
from .varref import BaseReference, ReferenceDescriptor
from .varref import BaseReference, _ReferenceDescriptor

frame_to_scope: dict[int, _ScopeReference]

@type_check_only
class _ScopeReferenceDescriptor(ReferenceDescriptor):
class _ScopeReferenceDescriptor(_ReferenceDescriptor):
presentationHint: str
expensive: bool
namedVariables: int
Expand Down
12 changes: 6 additions & 6 deletions stubs/gdb/gdb/dap/varref.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ from typing_extensions import NotRequired
import gdb

@type_check_only
class ValueFormat(TypedDict, total=False):
class _ValueFormat(TypedDict, total=False):
hex: bool

@type_check_only
class ReferenceDescriptor(TypedDict):
class _ReferenceDescriptor(TypedDict):
# Result of BaseReference.to_object()
variableReference: int
name: NotRequired[str]

@type_check_only
class VariableReferenceDescriptor(ReferenceDescriptor):
class _VariableReferenceDescriptor(_ReferenceDescriptor):
# Result of VariableReference.to_object()
indexedVariables: NotRequired[int]
namedVariables: NotRequired[int]
Expand All @@ -32,7 +32,7 @@ class VariableReferenceDescriptor(ReferenceDescriptor):
all_variables: list[BaseReference]

def clear_vars(event: Unused) -> None: ...
def apply_format(value_format: ValueFormat | None) -> AbstractContextManager[None]: ...
def apply_format(value_format: _ValueFormat | None) -> AbstractContextManager[None]: ...

class BaseReference(abc.ABC):
ref: int
Expand All @@ -41,7 +41,7 @@ class BaseReference(abc.ABC):
by_name: dict[str, VariableReference]
name_counts: defaultdict[str, int]
def __init__(self, name: str) -> None: ...
def to_object(self) -> ReferenceDescriptor: ...
def to_object(self) -> _ReferenceDescriptor: ...
@abc.abstractmethod
def has_children(self) -> bool: ...
def reset_children(self): ...
Expand All @@ -63,7 +63,7 @@ class VariableReference(BaseReference):
def has_children(self) -> bool: ...
def cache_children(self) -> list[tuple[int | str, gdb.Value]]: ...
def child_count(self) -> int: ...
def to_object(self) -> VariableReferenceDescriptor: ...
def to_object(self) -> _VariableReferenceDescriptor: ...
# note: parameter named changed from 'index' to 'idx'
def fetch_one_child(self, idx: int) -> tuple[str, gdb.Value]: ...

Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy