-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
[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
Open
brianschubert
wants to merge
3
commits into
python:main
Choose a base branch
from
brianschubert:complete-gdb-dap
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+557
−34
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,49 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Incomplete, Unused | ||
from collections.abc import Sequence | ||
from contextlib import AbstractContextManager | ||
from typing import TypedDict, type_check_only | ||
from typing_extensions import NotRequired | ||
|
||
import gdb | ||
|
||
from .sources import Source | ||
|
||
@type_check_only | ||
class _SourceBreakpoint(TypedDict): | ||
source: str | ||
line: int | ||
condition: NotRequired[str | None] | ||
hitCondition: NotRequired[str | None] | ||
logMessage: NotRequired[str | None] | ||
|
||
@type_check_only | ||
class _ExceptionFilterOptions(TypedDict): | ||
filderId: str | ||
condition: NotRequired[str | None] | ||
|
||
@type_check_only | ||
class _BreakpointDescriptor(TypedDict): | ||
id: int | ||
verified: bool | ||
reason: NotRequired[str] # only present when verified is False. Possibly only literal "pending" or "failed" | ||
message: NotRequired[str] # only present when reason == "failed" | ||
source: NotRequired[Source] | ||
line: NotRequired[int] | ||
instructionReference: NotRequired[str] | ||
|
||
@type_check_only | ||
class _SetBreakpointResult(TypedDict): | ||
breakpoints: list[_BreakpointDescriptor] | ||
|
||
# frozenset entries are tuples from _SourceBreakpoint.items() or _ExceptionFilterOptions.items() | ||
breakpoint_map: dict[str, dict[frozenset[Incomplete], gdb.Breakpoint]] | ||
|
||
def suppress_new_breakpoint_event() -> AbstractContextManager[None]: ... | ||
def set_breakpoint(*, source: Source, breakpoints: Sequence[_SourceBreakpoint] = (), **args: Unused) -> _SetBreakpointResult: ... | ||
def set_fn_breakpoint(*, breakpoints: Sequence[_SourceBreakpoint], **args: Unused) -> _SetBreakpointResult: ... | ||
def set_insn_breakpoints( | ||
*, breakpoints: Sequence[_SourceBreakpoint], offset: int | None = None, **args: Unused | ||
) -> _SetBreakpointResult: ... | ||
def set_exception_breakpoints( | ||
*, filters: Sequence[str], filterOptions: Sequence[_ExceptionFilterOptions] = (), **args: Unused | ||
) -> _SetBreakpointResult: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,48 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from typing import TypedDict, type_check_only | ||
from typing_extensions import NotRequired | ||
|
||
from .sources import Source | ||
from .varref import ValueFormat | ||
|
||
@type_check_only | ||
class _StackFrameFormat(ValueFormat, total=False): | ||
parameters: bool | ||
parameterTypes: bool | ||
parameterNames: bool | ||
parameterValues: bool | ||
line: bool | ||
module: bool | ||
includeAll: bool | ||
|
||
@type_check_only | ||
class _StackFrame(TypedDict): | ||
id: int | ||
name: str | ||
line: int | ||
column: int | ||
instructionPointerReference: str | ||
moduleId: NotRequired[str | None] | ||
source: NotRequired[Source] | ||
|
||
class _StaceTraceResult(TypedDict): | ||
stackFrames: list[_StackFrame] | ||
|
||
def check_stack_frame( | ||
*, | ||
# From source: | ||
# Note that StackFrameFormat extends ValueFormat, which is why | ||
# "hex" appears here. | ||
hex: bool = False, | ||
parameters: bool = False, | ||
parameterTypes: bool = False, | ||
parameterNames: bool = False, | ||
parameterValues: bool = False, | ||
line: bool = False, | ||
module: bool = False, | ||
includeAll: bool = False, | ||
**rest: Unused, | ||
) -> _StackFrameFormat: ... | ||
def stacktrace( | ||
*, levels: int = 0, startFrame: int = 0, threadId: int, format: _StackFrameFormat | None = None, **extra: Unused | ||
) -> _StaceTraceResult: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,22 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from typing import TypedDict, type_check_only | ||
from typing_extensions import NotRequired | ||
|
||
from .sources import Source | ||
|
||
@type_check_only | ||
class _Instruction(TypedDict): | ||
address: str | ||
instruction: str | ||
instructionBytes: str | ||
symbol: NotRequired[str] # only set if there's a corresponding label | ||
line: NotRequired[int] # only set if source is available | ||
location: NotRequired[Source] # only set if source is available | ||
|
||
@type_check_only | ||
class _DisassembleResult(TypedDict): | ||
instructions: list[_Instruction] | ||
|
||
def disassemble( | ||
*, memoryReference: str, offset: int = 0, instructionOffset: int = 0, instructionCount: int, **extra: Unused | ||
) -> _DisassembleResult: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,31 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from typing import Literal, TypedDict, type_check_only | ||
|
||
import gdb | ||
|
||
from .varref import ValueFormat, VariableReference, VariableReferenceDescriptor | ||
|
||
class EvaluateResult(VariableReference): | ||
def __init__(self, value: gdb.Value) -> None: ... | ||
|
||
@type_check_only | ||
class _VariablesResult(TypedDict): | ||
variables: list[VariableReferenceDescriptor] | ||
|
||
def eval_request( | ||
*, | ||
expression: str, | ||
frameId: int | None = None, | ||
context: Literal["watch", "variables", "hover", "repl"] = "variables", | ||
format: ValueFormat | None = None, | ||
**args: Unused, | ||
) -> VariableReferenceDescriptor: ... | ||
def variables( | ||
*, 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: ... | ||
def set_variable( | ||
*, variablesReference: int, name: str, value: str, format: ValueFormat | None = None, **args: Unused | ||
) -> VariableReferenceDescriptor: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,12 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
import gdb | ||
|
||
inferior_running: bool | ||
|
||
def send_process_event_once() -> None: ... | ||
def expect_process(reason: str) -> None: ... | ||
def thread_event(event: gdb.ThreadEvent, reason: str) -> None: ... | ||
def expect_stop(reason: str) -> None: ... | ||
def exec_and_expect_stop(cmd: str, expected_pause: bool = False) -> None: ... | ||
|
||
# Map from gdb stop reasons to DAP stop reasons. | ||
stop_reason_map: dict[str, str] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from collections.abc import Generator | ||
|
||
import gdb | ||
|
||
def frame_for_id(id: int) -> gdb.Frame: ... | ||
def select_frame(id: int) -> None: ... | ||
def dap_frame_generator(frame_low: int, levels: int, include_all: bool) -> Generator[tuple[int, gdb.Frame]]: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,9 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from typing import Any, BinaryIO | ||
|
||
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: ... | ||
Comment on lines
+8
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we use a protocol (potentially an already existing one from |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from collections.abc import Mapping, Sequence | ||
|
||
def launch( | ||
*, | ||
program: str | None = None, | ||
cwd: str | None = None, | ||
args: Sequence[str] = (), | ||
env: Mapping[str, str] | None = None, | ||
stopAtBeginningOfMainSubprogram: bool = False, | ||
**extra: Unused, | ||
): ... | ||
def attach(*, program: str | None = None, pid: int | None = None, target: str | None = None, **args: Unused) -> None: ... | ||
def config_done(**args: Unused) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,16 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from typing import TypedDict, type_check_only | ||
|
||
from .sources import Source | ||
|
||
@type_check_only | ||
class _Line(TypedDict): | ||
line: int | ||
|
||
@type_check_only | ||
class _BreakpointLocationsResult(TypedDict): | ||
breakpoints: list[_Line] | ||
|
||
def breakpoint_locations( | ||
*, source: Source, line: int, endLine: int | None = None, **extra: Unused | ||
) -> _BreakpointLocationsResult: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,10 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from typing import TypedDict, type_check_only | ||
|
||
@type_check_only | ||
class _ReadMemoryResult(TypedDict): | ||
address: str | ||
data: str | ||
|
||
def read_memory(*, memoryReference: str, offset: int = 0, count: int, **extra: Unused) -> _ReadMemoryResult: ... | ||
def write_memory(*, memoryReference: str, offset: int = 0, data: str, **extra: Unused): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,21 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from typing import TypedDict, type_check_only | ||
from typing_extensions import NotRequired | ||
|
||
import gdb | ||
|
||
@type_check_only | ||
class _Module(TypedDict): | ||
id: str | None | ||
name: str | None | ||
path: NotRequired[str | None] | ||
|
||
@type_check_only | ||
class _ModulesResult(TypedDict): | ||
modules: list[_Module] | ||
totalModules: int | ||
|
||
def module_id(objfile: gdb.Objfile) -> str | None: ... | ||
def is_module(objfile: gdb.Objfile) -> bool: ... | ||
def make_module(objf: gdb.Objfile) -> _Module: ... | ||
def modules(*, startModule: int = 0, moduleCount: int = 0, **args: Unused) -> _ModulesResult: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,14 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from typing import Literal, TypedDict, type_check_only | ||
from typing_extensions import TypeAlias | ||
|
||
@type_check_only | ||
class _ContinueRequestResult(TypedDict): | ||
allThreadsContinued: bool | ||
|
||
_Granularity: TypeAlias = Literal["statement", "instruction"] | ||
|
||
def next(*, threadId: int, singleThread: bool = False, granularity: _Granularity = "statement", **args: Unused) -> None: ... | ||
def step_in(*, threadId: int, singleThread: bool = False, granularity: _Granularity = "statement", **args: Unused) -> None: ... | ||
def step_out(*, threadId: int, singleThread: bool = False, **args: Unused): ... | ||
def continue_request(*, threadId: int, singleThread: bool = False, **args: Unused) -> _ContinueRequestResult: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
|
||
def pause(**args: Unused) -> None: ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,47 @@ | ||
def __getattr__(name: str): ... # incomplete module | ||
from _typeshed import Unused | ||
from collections.abc import Iterable | ||
from typing import TypedDict, type_check_only | ||
from typing_extensions import NotRequired | ||
|
||
import gdb | ||
|
||
from ..FrameDecorator import FrameDecorator, SymValueWrapper | ||
from .varref import BaseReference, ReferenceDescriptor | ||
|
||
frame_to_scope: dict[int, _ScopeReference] | ||
|
||
@type_check_only | ||
class _ScopeReferenceDescriptor(ReferenceDescriptor): | ||
presentationHint: str | ||
expensive: bool | ||
namedVariables: int | ||
line: NotRequired[int] | ||
|
||
@type_check_only | ||
class _ScopesResult(TypedDict): | ||
scopes: list[_ScopeReferenceDescriptor] | ||
|
||
def clear_scopes(event: Unused) -> None: ... | ||
def set_finish_value(val: gdb.Value) -> None: ... | ||
def symbol_value(sym: SymValueWrapper, frame: FrameDecorator) -> tuple[str, gdb.Value]: ... | ||
|
||
class _ScopeReference(BaseReference): | ||
hint: str | ||
frame: FrameDecorator | ||
inf_frame: gdb.Frame | ||
function: str | None | ||
line: int | None | ||
var_list: tuple[SymValueWrapper, ...] | ||
def __init__(self, name: str, hint: str, frame: FrameDecorator, var_list: Iterable[SymValueWrapper]) -> None: ... | ||
def to_object(self) -> _ScopeReferenceDescriptor: ... | ||
def has_children(self) -> bool: ... | ||
def child_count(self) -> int: ... | ||
# note: parameter named changed from 'index' to 'idx' | ||
def fetch_one_child(self, idx: int) -> tuple[str, gdb.Value]: ... | ||
|
||
class _FinishScopeReference(_ScopeReference): ... | ||
|
||
class _RegisterReference(_ScopeReference): | ||
def __init__(self, name: str, frame: FrameDecorator) -> None: ... | ||
|
||
def scopes(*, frameId: int, **extra: Unused) -> _ScopesResult: ... |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to verify: Should this be annotated with
@type_check_only
as well?