Commit 4453801
committed
[lldb] [debugserver] Use "full" x86_64 GPR state when available.
macOS 10.15 added a "full" x86_64 GPR thread state flavor, equivalent to
the normal one but with DS, ES, SS, and GSbase added.
This flavor can only be used with processes that install a custom LDT
(functionality that was also added in 10.15 and is used by apps like
Wine to execute 32-bit code).
Along with allowing DS, ES, SS, and GSbase to be viewed/modified, using
the full flavor is necessary when debugging a thread executing 32-bit
code.
If thread_set_state() is used with the regular thread state flavor, the
kernel resets CS to the 64-bit code segment, which makes debugging
impossible.
There's no way to detect whether the full flavor is available, try to
use it and fall back to the regular one if it's not available.
A downside is that this patch exposes the DS, ES, SS, and GSbase
registers for all x86_64 processes, even though they are not populated
unless the full thread state is available.
Fixes #575911 parent b74e779 commit 4453801
File tree
3 files changed
+51
-10
lines changed- lldb/tools/debugserver/source/MacOSX/x86_64
3 files changed
+51
-10
lines changedLines changed: 43 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
182 | 182 | | |
183 | 183 | | |
184 | 184 | | |
185 | | - | |
| 185 | + | |
| 186 | + | |
186 | 187 | | |
187 | 188 | | |
188 | | - | |
| 189 | + | |
189 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
190 | 203 | | |
191 | 204 | | |
192 | | - | |
| 205 | + | |
193 | 206 | | |
194 | 207 | | |
195 | 208 | | |
196 | 209 | | |
197 | 210 | | |
198 | | - | |
199 | | - | |
200 | | - | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
201 | 218 | | |
202 | 219 | | |
203 | 220 | | |
| |||
208 | 225 | | |
209 | 226 | | |
210 | 227 | | |
211 | | - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
212 | 231 | | |
213 | 232 | | |
214 | 233 | | |
| |||
461 | 480 | | |
462 | 481 | | |
463 | 482 | | |
464 | | - | |
| 483 | + | |
| 484 | + | |
465 | 485 | | |
466 | | - | |
| 486 | + | |
| 487 | + | |
467 | 488 | | |
468 | 489 | | |
469 | 490 | | |
| |||
1157 | 1178 | | |
1158 | 1179 | | |
1159 | 1180 | | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
1160 | 1185 | | |
1161 | 1186 | | |
1162 | 1187 | | |
| |||
1543 | 1568 | | |
1544 | 1569 | | |
1545 | 1570 | | |
| 1571 | + | |
1546 | 1572 | | |
1547 | 1573 | | |
1548 | 1574 | | |
| |||
1690 | 1716 | | |
1691 | 1717 | | |
1692 | 1718 | | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
1693 | 1723 | | |
1694 | 1724 | | |
1695 | 1725 | | |
| |||
2313 | 2343 | | |
2314 | 2344 | | |
2315 | 2345 | | |
| 2346 | + | |
| 2347 | + | |
2316 | 2348 | | |
2317 | 2349 | | |
2318 | 2350 | | |
| |||
2524 | 2556 | | |
2525 | 2557 | | |
2526 | 2558 | | |
| 2559 | + | |
| 2560 | + | |
2527 | 2561 | | |
2528 | 2562 | | |
2529 | 2563 | | |
| |||
Lines changed: 3 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
106 | | - | |
| 106 | + | |
| 107 | + | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
| |||
130 | 131 | | |
131 | 132 | | |
132 | 133 | | |
| 134 | + | |
133 | 135 | | |
134 | 136 | | |
135 | 137 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
48 | 53 | | |
49 | 54 | | |
50 | 55 | | |
| |||
0 commit comments