API Reference
Sans-IO Client
Debug Adapter Protocol (DAP) Client implementation without connection handling.
The client is responsible for sending requests and receiving events from the debug adapter. It is up to the user to handle the connection to the debug adapter, making it more flexible.
The client can be used in a synchronous or asynchronous manner, depending on the user's needs.
Source code in src\dap\client.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 |
|
__init__(adapter_id, client_id=None, client_name=None, locale=None, lines_start_at1=None, columns_start_at1=None, path_format=None)
Initializes the debug adapter client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adapter_id |
str
|
The ID of the debug adapter. |
required |
client_id |
Optional[str]
|
The ID of the client. |
None
|
client_name |
Optional[str]
|
The name of the client. |
None
|
locale |
Optional[str]
|
The locale of the client. |
None
|
lines_start_at1 |
Optional[bool]
|
Whether the lines start at 1. |
None
|
columns_start_at1 |
Optional[bool]
|
Whether the columns start at 1. |
None
|
path_format |
Optional[Literal[path, uri] | str]
|
The format of the paths. |
None
|
Source code in src\dap\client.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
attach(__restart=None)
attach to a running process.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
__restart |
Optional[Any]
|
Arbitrary data from the previous, restarted session. The data is sent as the |
None
|
Source code in src\dap\client.py
136 137 138 139 140 141 142 143 |
|
breakpoint_locations(source, line, column=None, end_line=None, end_column=None)
Retrieve all possible locations for source breakpoints in a given range.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
Source
|
The source location of the breakpoints. |
required |
line |
int
|
The source line of the breakpoints. |
required |
column |
Optional[int]
|
An optional source column of the breakpoints. |
None
|
end_line |
Optional[int]
|
An optional end line of the range covered by the breakpoint. |
None
|
end_column |
Optional[int]
|
An optional end column of the range covered by the breakpoint. |
None
|
Source code in src\dap\client.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
cancel(request_id=None, progress_id=None)
The cancel request is used by the client in two situations:
- to indicate that it is no longer interested in the result produced by a specific request issued earlier
- to cancel a progress sequence.
Both progress_id
and request_id
CAN BE specified in the same request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
request_id |
Optional[int]
|
The ID (_seq) of the request to cancel. If missing no request is canceled. |
None
|
progress_id |
Optional[str]
|
The progress ID of the progress sequence to cancel. If missing no progress is canceled. |
None
|
Source code in src\dap\client.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
completions(text, column, line, frame_id=None)
Returns a list of possible completions for a given caret position and text.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
text |
str
|
One or more source lines. Typically this is the text users have typed into the debug console before they asked for completion. |
required |
column |
int
|
The position within |
required |
line |
Optional[int]
|
A line for which to determine the completion proposals. If missing the first line of the text is assumed. |
required |
frame_id |
Optional[int]
|
An optional frameId of the stack frame, if specified returns completions in the scope of this stack frame. |
None
|
Source code in src\dap\client.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 |
|
configuration_done()
This request indicates that the client has finished initialization of the debug adapter.
Source code in src\dap\client.py
203 204 205 206 |
|
continue_(thread_id, single_thread=None)
The request resumes execution of all threads.
If the debug adapter supports single thread execution, setting single_thread
true resumes only the specified thread.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
the active thread. |
required |
single_thread |
Optional[bool]
|
Execute only this thread. |
None
|
Source code in src\dap\client.py
208 209 210 211 212 213 214 215 216 217 218 219 |
|
data_breakpoint_info(name, variables_reference=None, frameId=None, bytes=None, asAddress=None, mode=None)
Retrieve the information of a data breakpoint.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variables_reference |
Optional[int]
|
Reference to the variable container if the data breakpoint is requested for a child of the container. |
None
|
name |
str
|
The name of the variable's child to obtain data breakpoint information for. |
required |
frameId |
Optional[int]
|
When |
None
|
bytes |
Optional[int]
|
If specified, a debug adapter should return information for the range of memory extending |
None
|
asAddress |
Optional[bool]
|
If true, |
None
|
mode |
Optional[str]
|
The mode of the desired breakpoint. |
None
|
Source code in src\dap\client.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 |
|
disassemble(memory_reference, instruction_count=None, offset=None, instruction_offset=None, resolve_symbols=None)
Disassembles code stored at the provided location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
memory_reference |
str
|
Memory reference to the base location containing the instructions to disassemble. |
required |
instruction_count |
Optional[int]
|
The number of instructions to disassemble starting at the specified location and offset. |
None
|
offset |
Optional[int]
|
The offset (in bytes) of the first instruction to disassemble. |
None
|
instruction_offset |
Optional[int]
|
The offset (in instructions) of the first instruction to disassemble. |
None
|
resolve_symbols |
Optional[bool]
|
If set to true, the adapter should attempt to resolve memory addresses to function names and line numbers. |
None
|
Source code in src\dap\client.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
disconnect(restart=None, terminal_debuggee=None, suspend_debuggee=None)
Asks the debug adapter to disconnect from the debuggee (thus ending the debug session) and then to shut down.
In addition, the debug adapter must terminate the debuggee if it was started with the launch request. If an attach request was used to connect to the debuggee, then the debug adapter must not terminate the debuggee.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
restart |
Optional[bool]
|
A value of true indicates that this 'disconnect' request is part of a restart sequence. |
None
|
terminal_debuggee |
Optional[bool]
|
Indicates whether the debuggee should be terminated when the debugger is disconnected. |
None
|
suspend_debuggee |
Optional[bool]
|
Indicates whether the debuggee should be allowed to run after the debugger is disconnected. |
None
|
Source code in src\dap\client.py
284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 |
|
evaluate(expression, frame_id=None, line=None, column=None, source=None, context=None, format=None)
Evaluate the given expression in the context of topmost stack frame. The expression has access to any variables and arguments that are in scope.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expression |
str
|
The expression to evaluate. |
required |
frame_id |
Optional[int]
|
Evaluate the expression in the scope of this stack frame. If not specified, the expression is evaluated in the global scope. |
None
|
line |
Optional[int]
|
The contextual line where the expression should be evaluated. In the 'hover' context, this should be set to the start of the expression being hovered. |
None
|
column |
Optional[int]
|
The contextual column where the expression should be evaluated. This may be provided if |
None
|
source |
Optional[Source]
|
The contextual source in which the |
None
|
context |
Optional[Literal[watch, repl, hover, clipboard, variables] | str]
|
The context in which the evaluate request is used. |
None
|
format |
Optional[ValueFormat]
|
Specifies details on how to format the result. |
None
|
Source code in src\dap\client.py
310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
exception_info(thread_id)
Retrieves the details of the exception that caused this event to be raised.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
Thread for which exception information should be retrieved. |
required |
Source code in src\dap\client.py
352 353 354 355 356 357 358 359 |
|
goto(thread_id, target_id)
The request sets the location where the debuggee will continue to run.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
The thread to continue. |
required |
target_id |
str
|
The location where the debuggee will continue to run. |
required |
Source code in src\dap\client.py
361 362 363 364 365 366 367 368 369 |
|
goto_targets(source, line, column=None)
Retrieve possible goto targets for the specified location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
Source
|
The source location for which the goto targets are determined. |
required |
line |
int
|
The line for which the goto targets are determined. |
required |
column |
Optional[int]
|
An optional column for which the goto targets are determined. |
None
|
Source code in src\dap\client.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
initialize(adapter_id, client_id=None, client_name=None, locale=None, lines_start_at1=None, columns_start_at1=None, path_format=None, supports_variable_type=None, supports_variable_paging=None, supports_run_in_terminal_request=None, supports_memory_references=None, supports_progress_reporting=None, supports_invalidated_event=None, supports_memory_event=None, supports_args_can_be_interpreted_by_shell=None, supports_start_debugging_request=None)
Initializes the debug adapter with the client capabilities.
Source code in src\dap\client.py
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 |
|
launch(no_debug=None, __restart=None)
The launch request is used to start the debuggee with or without debugging enabled.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
no_debug |
Optional[bool]
|
Set to true if the launch request is used to just start the debuggee for the purpose of collecting output. The debuggee is not supposed to stop at breakpoints. |
None
|
__restart |
Optional[Any]
|
Arbitrary data from the previous, restarted session. The data is sent as the |
None
|
Source code in src\dap\client.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 |
|
loaded_sources()
Retrieves the set of all sources currently loaded by the debugged process.
Source code in src\dap\client.py
448 449 450 451 |
|
modules(start_module=None, module_count=None)
Modules can be retrieved from the debug adapter with this request which can either return all modules or a range of modules to support paging.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start_module |
Optional[int]
|
The 0-based index of the first module to return; if omitted modules start at 0. |
None
|
module_count |
Optional[int]
|
The number of modules to return. If moduleCount is not specified or 0, all modules are returned. |
None
|
Source code in src\dap\client.py
453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 |
|
next(thread_id, single_thread=None, granularity=None)
The request steps through the program.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
Specifies the thread for which to resume execution for one step. |
required |
single_thread |
Optional[bool]
|
If this is true, all other suspended threads are not resumed. |
None
|
granularity |
Optional[str]
|
The granularity of the step, assumed to be 'statement' if not specified. |
None
|
Source code in src\dap\client.py
469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 |
|
pause(thread_id)
Suspends the debuggee.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
The thread to pause. |
required |
Source code in src\dap\client.py
492 493 494 495 496 497 498 499 |
|
read_memory(memory_reference, count, offset=None)
Reads memory from the debuggee.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
memory_reference |
str
|
The memory reference to the base location from which to read memory. |
required |
count |
int
|
The number of bytes to read at the specified location and offset. |
required |
offset |
Optional[int]
|
The offset (in bytes) of the first byte to read. |
None
|
Source code in src\dap\client.py
501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 |
|
receive(data)
Feed data from the debug adapter to the client.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
The data to receive. |
required |
Yields:
Type | Description |
---|---|
ResponseBody | EventBody
|
The response or event body. |
Source code in src\dap\client.py
92 93 94 95 96 97 98 99 100 101 102 103 |
|
restart(arguments=None)
Restarts a debug session.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
arguments |
Optional[LaunchRequestArguments | AttachRequestArguments]
|
Use either arguments for the 'launch' or 'attach' request. |
None
|
Source code in src\dap\client.py
517 518 519 520 521 522 523 524 525 526 527 |
|
restart_frame(frame_id)
Restart the stack frame identified by the given frame ID. The frame ID must have been obtained in the current suspended state.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame_id |
int
|
The frame to restart. |
required |
Source code in src\dap\client.py
529 530 531 532 533 534 535 536 537 |
|
reverse_continue(thread_id, single_thread=None)
The request starts the debuggee to run backward.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
ID of the active thread. |
required |
single_thread |
Optional[bool]
|
If true, backward execution is limited to the specified thread. |
None
|
Source code in src\dap\client.py
539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
|
scopes(frame_id)
The request returns the variable scopes for a given stack frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame_id |
int
|
Retrieve the scopes for this stackframe. |
required |
Source code in src\dap\client.py
554 555 556 557 558 559 560 561 |
|
send()
Get the data to send to the debug adapter.
Returns:
Type | Description |
---|---|
bytes
|
The data to send. |
Source code in src\dap\client.py
105 106 107 108 109 110 111 112 113 114 |
|
send_request(command, arguments=None)
Send a request to the debug adapter.
This can be useful for sending requests that are not yet implemented in the client or for sending custom requests to the debug adapter that are specific to the adapter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command |
str
|
The command to send. |
required |
arguments |
Optional[dict[str, Any]]
|
The arguments to send. |
None
|
Returns:
Type | Description |
---|---|
int
|
The sequence number of the request. |
Source code in src\dap\client.py
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
set_breakpoints(source, breakpoints, lines=None, source_modified=None)
Sets multiple breakpoints for a single source and clears all previous breakpoints in that source.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source |
Source
|
The source location of the breakpoints. |
required |
breakpoints |
List[SourceBreakpoint]
|
The code locations of the breakpoints. |
required |
lines |
Optional[List[int]]
|
Deprecated: The code locations of the breakpoints. |
None
|
source_modified |
Optional[bool]
|
A value of true indicates that the underlying source has been modified which results in new breakpoint locations. |
None
|
Source code in src\dap\client.py
563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
|
set_data_breakpoints(breakpoints)
Replaces all existing data breakpoints with new data breakpoints.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
breakpoints |
List[DataBreakpoint]
|
The data breakpoints to set. |
required |
Source code in src\dap\client.py
590 591 592 593 594 595 596 597 |
|
set_exception_breakpoints(filters, filter_options, exception_options)
The request configures the debugger's response to thrown exceptions.
Each of the filters, filterOptions, and exceptionOptions in the request are independent configurations to a debug adapter indicating a kind of exception to catch. An exception thrown in a program should result in a stopped event from the debug adapter (with reason exception) if any of the configured filters match.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filters |
List[str]
|
Set of exception filters specified by their ID. |
required |
filter_options |
Optional[List[ExceptionFilterOptions]]
|
An array of ExceptionFilterOptions. The set of all possible exception filters is defined by the |
required |
exception_options |
Optional[List[ExceptionOptions]]
|
An array of ExceptionOptions. Configuration options for selected exceptions. |
required |
Source code in src\dap\client.py
599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 |
|
set_expression(expression, value, frame_id=None, format=None)
Evaluates the given value expression and assigns it to the expression which must be a modifiable l-value.
The expressions have access to any variables and arguments that are in scope of the specified frame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
expression |
str
|
The l-value expression to assign the result to. |
required |
value |
str
|
The value expression to assign to the l-value expression. |
required |
frame_id |
Optional[int]
|
Evaluate the expressions in the scope of this stack frame. If not specified, the expressions are evaluated in the global scope. |
None
|
format |
Optional[ValueFormat]
|
Specifies details on how to format the result. |
None
|
Source code in src\dap\client.py
627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
|
set_function_breakpoints(breakpoints=[])
Replaces all existing function breakpoints with new function breakpoints.
To clear all function breakpoints, call this without arguments. When a function breakpoint is hit, a stopped event (with reason function breakpoint) is generated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
breakpoints |
List[FunctionBreakpoint]
|
The function breakpoints to set. |
[]
|
Source code in src\dap\client.py
656 657 658 659 660 661 662 663 664 665 666 667 668 |
|
set_instruction_breakpoints(breakpoints)
Replaces all existing instruction breakpoints. Typically, instruction breakpoints would be set from a disassembly window.
To clear all instruction breakpoints, specify an empty array. When an instruction breakpoint is hit, a stopped event (with reason instruction breakpoint) is generated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
breakpoints |
List[InstructionBreakpoint]
|
The instruction breakpoints to set. |
required |
Source code in src\dap\client.py
670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
|
set_variable(variables_reference, name, value, format=None)
Set the variable with the given name in the variable container to a new value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variables_reference |
int
|
The reference of the variable container. |
required |
name |
str
|
The name of the variable to set. |
required |
value |
str
|
The value to set. |
required |
format |
Optional[ValueFormat]
|
Specifies details on how to format the response value. |
None
|
Source code in src\dap\client.py
686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 |
|
source(source_reference, source=None)
The request retrieves the source code for a given source reference.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
source_reference |
int
|
The reference to the source. This is the same as |
required |
source |
Optional[Source]
|
Specifies the source content to load. Either |
None
|
Source code in src\dap\client.py
712 713 714 715 716 717 718 719 720 721 722 |
|
stack_trace(thread_id=None, start_frame=None, levels=None, format=None)
The request returns a stack trace from the current execution state.
Request all stack frames by omitting the startFrame and levels arguments.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
Optional[int]
|
Retrieve the stacktrace for this thread. |
None
|
start_frame |
Optional[int]
|
The index of the first frame to return; if omitted frames start at 0. |
None
|
levels |
Optional[int]
|
The maximum number of frames to return. If levels is not specified or 0, all frames are returned. |
None
|
format |
Optional[StackFrameFormat]
|
Specifies details on how to format the stack frames. |
None
|
Source code in src\dap\client.py
724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 |
|
step_back(thread_id, single_thread=None, granularity=None)
The request executes one backward step (in the given granularity) for the specified thread and allows all other threads to run backward freely by resuming them.
If the debug adapter supports single thread execution (see capability supportsSingleThreadExecutionRequests
),
setting the singleThread argument to true prevents other suspended threads from resuming.
The debug adapter first sends the response and then a stopped event (with reason step) after the step has completed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
ID of the active thread. |
required |
single_thread |
Optional[bool]
|
If true, backward execution is limited to the specified thread. |
None
|
granularity |
Optional[SteppingGranularity]
|
The granularity of the step, assumed to be 'statement' if not specified. |
None
|
Source code in src\dap\client.py
752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 |
|
step_in(thread_id, single_thread=None, target_id=None, granularity=None)
The request resumes the given thread to step into a function/method and allows all other threads to run freely by resuming them.
If the debug adapter supports single thread execution (see capability supportsSingleThreadExecutionRequests
),
setting the singleThread argument to true prevents other suspended threads from resuming.
If the request cannot step into a target, stepIn behaves like the next request. The debug adapter first sends the response and then a stopped event (with reason step) after the step has completed.
If there are multiple function/method calls (or other targets) on the source line, the argument targetId can be used to control into which target the stepIn should occur.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
ID of the active thread. |
required |
single_thread |
Optional[bool]
|
If true, stepIn is limited to the specified thread. |
None
|
target_id |
Optional[int]
|
The stepIn target for this step. |
None
|
granularity |
Optional[SteppingGranularity]
|
The granularity of the step, assumed to be 'statement' if not specified. |
None
|
Source code in src\dap\client.py
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 |
|
step_in_targets(frame_id)
The request retrieves the possible stepIn targets for the specified stack frame. These targets can be used in the stepIn request.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
frame_id |
int
|
The stack frame for which to retrieve the possible stepIn targets. |
required |
Source code in src\dap\client.py
815 816 817 818 819 820 821 822 823 |
|
step_out(thread_id, single_thread=None, granularity=None)
The request resumes the given thread to step out of the current function/method and allows all other threads to run freely by resuming them.
If the debug adapter supports single thread execution (see capability supportsSingleThreadExecutionRequests
),
setting the singleThread argument to true prevents other suspended threads from resuming.
The debug adapter first sends the response and then a stopped event (with reason step) after the step has completed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_id |
int
|
ID of the active thread. |
required |
single_thread |
Optional[bool]
|
If true, stepOut is limited to the specified thread. |
None
|
granularity |
Optional[SteppingGranularity]
|
The granularity of the step, assumed to be 'statement' if not specified. |
None
|
Source code in src\dap\client.py
825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 |
|
terminate(restart=None)
The terminate request is sent from the client to the debug adapter in order to shut down the debuggee gracefully.
Typically a debug adapter implements terminate by sending a software signal which the debuggee intercepts in order to clean things up properly before terminating itself.
Please note that this request does not directly affect the state of the debug session: if the debuggee decides to veto the graceful shutdown for any reason by not terminating itself, then the debug session just continues.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
restart |
Optional[bool]
|
A value of true indicates that this 'terminate' request is part of a restart sequence. |
None
|
Source code in src\dap\client.py
853 854 855 856 857 858 859 860 861 862 863 864 865 866 |
|
terminate_threads(thread_ids)
The request terminates the threads with the given ids.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
thread_ids |
List[int]
|
The threads to terminate. |
required |
Source code in src\dap\client.py
868 869 870 871 872 873 874 875 |
|
threads()
The request retrieves a list of all threads.
Source code in src\dap\client.py
877 878 879 880 |
|
variables(variables_reference, filter=None, start=None, count=None, format=None)
Retrieves all child variables for the given variable reference.
A filter can be used to limit the fetched children to either named or indexed children.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
variables_reference |
int
|
The variable for which to retrieve its children. |
required |
filter |
Optional[Literal[indexed, named]] | str
|
Filter to limit the child variables to either named or indexed. If not specified, both types are fetched. |
None
|
start |
Optional[int]
|
The index of the first variable to return; if omitted variables start at 0. |
None
|
count |
Optional[int]
|
The number of variables to return. If not passed or 0, all variables are returned. |
None
|
format |
Optional[ValueFormat]
|
Specifies details on how to format the response value. |
None
|
Source code in src\dap\client.py
882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 |
|
write_memory(memory_reference, data, offset=None, allow_partial=None)
Writes bytes to memory at the provided location.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
memory_reference |
str
|
The memory reference to the base location to write memory. |
required |
data |
str
|
Bytes to write, encoded using base64. |
required |
offset |
Optional[int]
|
The offset (in bytes) of the first byte to write. Can be negative. |
None
|
allow_partial |
Optional[bool]
|
Property to control partial writes. If true, the debug adapter should attempt to write memory even if the entire memory region is not writable. |
None
|
Source code in src\dap\client.py
913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 |
|
Responses
Attached
Bases: Response
Response to 'attach' request.
Source code in src\dap\responses.py
52 53 54 55 |
|
BreakpointLocationsResponse
Bases: ResponseBody
Body of a 'breakpointLocations' response.
Source code in src\dap\responses.py
58 59 60 61 62 63 |
|
Cancelled
Bases: Response
Response to 'cancel' request.
Source code in src\dap\responses.py
46 47 48 49 |
|
CompletionsResponse
Bases: ResponseBody
Body of a 'completions' response.
Source code in src\dap\responses.py
66 67 68 69 |
|
ConfigurationDone
Bases: Response
Response to 'configurationDone' request.
Source code in src\dap\responses.py
72 73 74 75 |
|
Continued
Bases: ResponseBody
Body of a 'continue' response.
Source code in src\dap\responses.py
78 79 80 81 82 83 |
|
DataBreakpointInfoResponse
Bases: ResponseBody
Body of a 'dataBreakpoint' response.
Source code in src\dap\responses.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
DisassembleResponse
Bases: ResponseBody
Body of a 'disassemble' response.
Source code in src\dap\responses.py
103 104 105 106 107 108 |
|
Disconnected
Bases: Response
Response to 'disconnect' request.
Source code in src\dap\responses.py
111 112 113 114 |
|
EvaluateResponse
Bases: ResponseBody
Body of an 'evaluate' response.
Source code in src\dap\responses.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
GotoDone
Bases: Response
Response to 'goto' request.
Source code in src\dap\responses.py
153 154 155 156 |
|
GotoTargetsResponse
Bases: ResponseBody
Body of a 'gotoTargets' response.
Source code in src\dap\responses.py
159 160 161 162 |
|
Initialized
Bases: Capabilities
Response to 'initialize' request.
Source code in src\dap\responses.py
165 166 167 168 |
|
LaunchDone
Bases: Response
Response to 'launch' request.
Source code in src\dap\responses.py
171 172 173 174 |
|
LoadedSourcesResponse
Bases: ResponseBody
Body of a 'loadedSources' response.
Source code in src\dap\responses.py
177 178 179 180 |
|
ModulesResponse
Bases: ResponseBody
Body of a 'modules' response.
Source code in src\dap\responses.py
183 184 185 186 187 188 189 |
|
NextResponse
Bases: Response
Response to 'next' request.
Source code in src\dap\responses.py
192 193 194 195 |
|
Paused
Bases: Response
Response to 'pause' request.
Source code in src\dap\responses.py
198 199 200 201 |
|
ReadMemoryResponse
Bases: ResponseBody
Body of a 'readMemory' response.
Source code in src\dap\responses.py
204 205 206 207 208 209 210 211 |
|
RestartFrameDone
Bases: Response
Response to 'restartFrame' request.
Source code in src\dap\responses.py
220 221 222 223 |
|
Restarted
Bases: Response
Response to 'restart' request.
Source code in src\dap\responses.py
214 215 216 217 |
|
ReverseContinueDone
Bases: Response
Response to 'reverseContinue' request.
Source code in src\dap\responses.py
226 227 228 229 |
|
RunInTerminalResponse
Bases: Response
Response to 'runInTerminal' request.
Source code in src\dap\responses.py
20 21 22 23 24 25 26 27 28 29 30 |
|
RunInTerminalResponseBody
Bases: ResponseBody
Body of a 'runInTerminal' response.
Source code in src\dap\responses.py
9 10 11 12 13 14 15 16 17 |
|
ScopesResponse
Bases: ResponseBody
Body of a 'scopes' response.
Source code in src\dap\responses.py
232 233 234 235 |
|
SetBreakpointsResponse
Bases: ResponseBody
Body of a 'setBreakpoints' response.
Source code in src\dap\responses.py
238 239 240 241 |
|
SetDataBreakpointsResponse
Bases: ResponseBody
Body of a 'setDataBreakpoints' response.
Source code in src\dap\responses.py
244 245 246 247 |
|
SetExceptionBreakpointsResponse
Bases: Response
Response to 'setExceptionBreakpoints' request.
Source code in src\dap\responses.py
256 257 258 259 |
|
SetExpressionResponse
Bases: ResponseBody
Body of a 'setExpression' response.
Source code in src\dap\responses.py
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 |
|
SetFunctionBreakpointsResponse
Bases: ResponseBody
Body of a 'setFunctionBreakpoints' response.
Source code in src\dap\responses.py
285 286 287 288 289 290 |
|
SetInstructionBreakpointsResponse
Bases: ResponseBody
Body of a 'setInstructionBreakpoints' response.
Source code in src\dap\responses.py
293 294 295 296 |
|
SetVariableResponse
Bases: ResponseBody
Body of a 'setVariable' response.
Source code in src\dap\responses.py
299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 |
|
SourceResponse
Bases: ResponseBody
Body of a 'source' response.
Source code in src\dap\responses.py
319 320 321 322 323 |
|
StackTraceResponse
Bases: ResponseBody
Body of a 'stackTrace' response.
Source code in src\dap\responses.py
326 327 328 329 330 |
|
StartDebuggingResponse
Bases: Response
Body of a 'startDebugging' response.
Source code in src\dap\responses.py
33 34 35 36 37 38 39 40 41 42 |
|
StepBackDone
Bases: Response
Response to 'stepBack' request.
Source code in src\dap\responses.py
333 334 335 336 |
|
StepInDone
Bases: Response
Response to 'stepIn' request.
Source code in src\dap\responses.py
339 340 341 342 |
|
StepInTargetsResponse
Bases: ResponseBody
Body of a 'stepInTargets' response.
Source code in src\dap\responses.py
345 346 347 348 |
|
StepOutDone
Bases: Response
Response to 'stepOut' request.
Source code in src\dap\responses.py
351 352 353 354 |
|
TerminateThreadsDone
Bases: Response
Response to 'terminateThreads' request.
Source code in src\dap\responses.py
363 364 365 366 |
|
Terminated
Bases: Response
Response to 'terminate' request.
Source code in src\dap\responses.py
357 358 359 360 |
|
ThreadsResponse
Bases: ResponseBody
Body of a 'threads' response.
Source code in src\dap\responses.py
369 370 371 372 |
|
VariablesResponse
Bases: ResponseBody
Body of a 'variables' response.
Source code in src\dap\responses.py
375 376 377 378 |
|
WriteMemoryResponse
Bases: ResponseBody
Body of a 'writeMemory' response.
Source code in src\dap\responses.py
381 382 383 384 385 386 387 |
|
Events
BreakpointEvent
Bases: EventBody
Event sent when a breakpoint is hit.
Source code in src\dap\events.py
7 8 9 10 11 12 13 14 |
|
CapabilitiesEvent
Bases: EventBody
Event sent when capabilities are requested.
Source code in src\dap\events.py
17 18 19 20 21 22 |
|
ContinuedEvent
Bases: EventBody
Event sent when the execution is continued.
Source code in src\dap\events.py
25 26 27 28 29 30 31 32 |
|
ExitedEvent
Bases: EventBody
Event sent when the debuggee has exited.
Source code in src\dap\events.py
35 36 37 38 |
|
InitializedEvent
Bases: EventBody
Event sent when the debug adapter is initialized.
Source code in src\dap\events.py
41 42 43 44 |
|
InvalidatedEvent
Bases: EventBody
Event sent when breakpoints are invalidated.
Source code in src\dap\events.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
|
LoadedSourceEvent
Bases: EventBody
Event sent when a source is loaded.
Source code in src\dap\events.py
63 64 65 66 67 68 69 70 |
|
MemoryEvent
Bases: EventBody
Event sent when memory is accessed.
Source code in src\dap\events.py
73 74 75 76 77 78 |
|
ModuleEvent
Bases: EventBody
Event sent when a module is loaded or unloaded.
Source code in src\dap\events.py
81 82 83 84 85 86 87 88 |
|
OutputEvent
Bases: EventBody
Event sent when output is produced.
Source code in src\dap\events.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
|
ProcessEvent
Bases: EventBody
Event sent when a process is created or exited.
Source code in src\dap\events.py
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
ProgressEndEvent
Bases: EventBody
Event sent when a progress ends.
Source code in src\dap\events.py
148 149 150 151 152 |
|
ProgressStartEvent
Bases: EventBody
Event sent when a progress starts.
Source code in src\dap\events.py
155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
ProgressUpdateEvent
Bases: EventBody
Event sent when a progress updates.
Source code in src\dap\events.py
175 176 177 178 179 180 181 182 183 |
|
StoppedEvent
Bases: EventBody
Event sent when the execution is stopped.
Source code in src\dap\events.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 |
|
TerminatedEvent
Bases: EventBody
Event sent when the debuggee is terminated.
Source code in src\dap\events.py
229 230 231 232 233 234 235 |
|
ThreadEvent
Bases: EventBody
Event sent when a thread is created or exited.
Source code in src\dap\events.py
238 239 240 241 242 243 244 245 |
|
Requests
AttachRequestArguments
Bases: TypedDict
Arguments for 'attach' request.
Source code in src\dap\requests.py
13 14 15 16 |
|
LaunchRequestArguments
Bases: TypedDict
Arguments for 'launch' request.
Source code in src\dap\requests.py
19 20 21 22 23 |
|
RunInTerminalRequest
Bases: Request
Request for 'runInTerminal' reverse request.
Source code in src\dap\requests.py
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
|
RunInTerminalRequestArguments
Bases: RequestArguments
Arguments for 'runInTerminal' reverse request.
Source code in src\dap\requests.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
StartDebuggingRequest
Bases: Request
Request for 'startDebugging' request.
Source code in src\dap\requests.py
96 97 98 99 100 101 102 103 104 105 106 107 |
|
StartDebuggingRequestArguments
Bases: RequestArguments
Arguments for 'startDebugging' request.
Source code in src\dap\requests.py
81 82 83 84 85 86 87 88 89 90 91 92 93 |
|
Base Protocol
EventBody
Bases: BaseModel
Base class of event bodies
Source code in src\dap\base.py
38 39 40 41 |
|
Events
Bases: StrEnum
Enumeration of DAP events.
Source code in src\dap\base.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
|
ProtocolMessage
Bases: BaseModel
Base class of requests, responses, and events
Source code in src\dap\base.py
11 12 13 14 15 16 17 |
|
Request
Bases: ProtocolMessage
Source code in src\dap\base.py
24 25 26 27 28 29 30 31 32 33 34 35 |
|
reply(*a, **kw)
Create a response message for the request.
This method is for reverse requests only.
Source code in src\dap\base.py
31 32 33 34 35 |
|
RequestArguments
Bases: BaseModel
Base class of request arguments
Source code in src\dap\base.py
20 21 |
|
Requests
Bases: StrEnum
Enumeration of DAP requests.
Source code in src\dap\base.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
ResponseBody
Bases: BaseModel
Base class of response bodies
Source code in src\dap\base.py
52 53 54 55 |
|
Connection
AsyncConnection
Asyncio-based connection to a debug adapter server.
This class is used to connect to a debug adapter server using asyncio. It provides methods to start, stop, read and write to the server.
Source code in src\dap\connection.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
|
read()
async
Read data from the server
Returns:
Name | Type | Description |
---|---|---|
bytes |
bytes
|
The data read from the server. |
Source code in src\dap\connection.py
46 47 48 49 50 51 52 53 |
|
start()
async
Start the connection to the server.
Source code in src\dap\connection.py
23 24 25 26 27 |
|
stop()
async
Stop the connection to the server.
Source code in src\dap\connection.py
29 30 31 32 33 34 |
|
write(data)
async
Write data to the server
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data |
bytes
|
The data to write to the server. |
required |
Source code in src\dap\connection.py
36 37 38 39 40 41 42 43 44 |
|
Connection
Connection to a debug adapter server.
This class is used to connect to a debug adapter server using threads. It provides methods to start, stop, read and write to the server.
Source code in src\dap\connection.py
56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
|
read()
Read data from the server
Returns:
Name | Type | Description |
---|---|---|
bytes |
None
|
The data read from the server. |
Source code in src\dap\connection.py
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
|
start(*_)
Start the connection to the server.
Source code in src\dap\connection.py
96 97 98 99 100 101 102 103 |
|
stop(*_)
Stop the connection to the server.
Source code in src\dap\connection.py
105 106 107 108 109 |
|
write(buf)
Write data to the server
Parameters:
Name | Type | Description | Default |
---|---|---|---|
buf |
bytes
|
The data to write to the server. |
required |
Source code in src\dap\connection.py
69 70 71 72 73 74 75 76 |
|
Threaded Socket IO Client
Abstract Threaded server implementation of the DAP Client
It is meant to be used as a base class for creating a server. It handles the connection and the client. Following methods need to be implemented by the child class: - handle_message
Source code in src\dap\server.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
|
__init__(adapter_id, host='localhost', port=6789)
Initializes the server with the given adapter_id, host and port
Parameters:
Name | Type | Description | Default |
---|---|---|---|
adapter_id |
str
|
The adapter id |
required |
host |
str
|
The host to connect to. Defaults to "localhost". |
'localhost'
|
port |
int
|
The port to connect to. Defaults to 6789. |
6789
|
Source code in src\dap\server.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
|
handle_message(message)
Handles the message received from the client
To be implemented by child classes Args: message (Any): The message to handle
Source code in src\dap\server.py
60 61 62 63 64 65 66 67 68 |
|
start()
Starts the server
Source code in src\dap\server.py
30 31 32 33 34 |
|
stop()
Stops the server
Source code in src\dap\server.py
36 37 38 39 40 41 |
|
Asyncio Client
Abstract Asyncio-based DAP server.
Handles communication between the client and the adapter. Child classes should implement the following methods:
- handle_message: Handle a message from the client or adapter.
Example:
class MyServer(AsyncServer):
def handle_message(self, message):
print(message)
Source code in src\dap\asyncserver.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
|
handle_message(message)
Handle a message from the client or adapter.
To be implemented by subclasses.
Source code in src\dap\asyncserver.py
64 65 66 67 68 69 70 |
|
start()
async
Start the server.
Source code in src\dap\asyncserver.py
33 34 35 36 37 38 39 |
|
stop()
async
Stop the server.
Source code in src\dap\asyncserver.py
41 42 43 44 45 46 |
|