Commit 5b94fa5
committed
[lldb-dap] Add multi-session support with shared debugger instances
Summary:
This change introduces a DAPSessionManager to enable multiple concurrent
lldb-dap sessions and allow them to share debugger instances when needed.
Key changes:
- Add DAPSessionManager singleton to track and coordinate all active DAP sessions
- Support attaching to an existing target via unique target ID (targetId parameter)
- Share debugger instances across sessions when spawning new targets (e.g., GPU debugging)
- Refactor event thread management to allow sharing event threads between sessions
- Add eBroadcastBitNewTargetCreated event to notify when new targets are spawned
- Extract session names from target creation events for better identification
- Defer debugger initialization from 'initialize' request to 'launch'/'attach' requests
This enables scenarios where a native process spawns a new target (like a child process)
and the debug adapter can automatically start a new debug session for the spawned
target while sharing the parent's debugger instance.
Tests:
The refactoring maintains backward compatibility. All existing test cases pass.1 parent bf5f441 commit 5b94fa5
File tree
21 files changed
+802
-142
lines changed- lldb
- include/lldb
- API
- Target
- packages/Python/lldbsuite/test/tools/lldb-dap
- source
- API
- Target
- test/API/tools/lldb-dap/attach
- tools/lldb-dap
- Handler
- Protocol
- tool
- unittests/DAP
- llvm/utils/gn/secondary/lldb/tools/lldb-dap
21 files changed
+802
-142
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| 73 | + | |
| 74 | + | |
72 | 75 | | |
73 | 76 | | |
74 | 77 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
537 | 537 | | |
538 | 538 | | |
539 | 539 | | |
| 540 | + | |
540 | 541 | | |
541 | 542 | | |
542 | 543 | | |
| |||
556 | 557 | | |
557 | 558 | | |
558 | 559 | | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
559 | 565 | | |
560 | 566 | | |
561 | 567 | | |
| |||
564 | 570 | | |
565 | 571 | | |
566 | 572 | | |
| 573 | + | |
| 574 | + | |
567 | 575 | | |
568 | 576 | | |
569 | 577 | | |
| |||
579 | 587 | | |
580 | 588 | | |
581 | 589 | | |
| 590 | + | |
582 | 591 | | |
583 | 592 | | |
584 | 593 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
785 | 785 | | |
786 | 786 | | |
787 | 787 | | |
| 788 | + | |
788 | 789 | | |
789 | 790 | | |
790 | 791 | | |
| |||
804 | 805 | | |
805 | 806 | | |
806 | 807 | | |
| 808 | + | |
| 809 | + | |
807 | 810 | | |
808 | 811 | | |
809 | 812 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
148 | 156 | | |
149 | 157 | | |
150 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| 196 | + | |
196 | 197 | | |
197 | 198 | | |
198 | 199 | | |
| |||
5169 | 5170 | | |
5170 | 5171 | | |
5171 | 5172 | | |
5172 | | - | |
| 5173 | + | |
5173 | 5174 | | |
5174 | 5175 | | |
5175 | 5176 | | |
5176 | | - | |
| 5177 | + | |
| 5178 | + | |
| 5179 | + | |
| 5180 | + | |
| 5181 | + | |
| 5182 | + | |
| 5183 | + | |
| 5184 | + | |
| 5185 | + | |
| 5186 | + | |
| 5187 | + | |
5177 | 5188 | | |
5178 | 5189 | | |
5179 | 5190 | | |
| |||
5209 | 5220 | | |
5210 | 5221 | | |
5211 | 5222 | | |
| 5223 | + | |
| 5224 | + | |
| 5225 | + | |
| 5226 | + | |
| 5227 | + | |
| 5228 | + | |
| 5229 | + | |
| 5230 | + | |
| 5231 | + | |
| 5232 | + | |
| 5233 | + | |
| 5234 | + | |
| 5235 | + | |
| 5236 | + | |
| 5237 | + | |
| 5238 | + | |
| 5239 | + | |
| 5240 | + | |
| 5241 | + | |
5212 | 5242 | | |
5213 | 5243 | | |
5214 | 5244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
0 commit comments