Commit 3a08337
[linux] handle stop events while stepping
## Purpose
Properly handle a case that occasionally triggers
[this](https://github.com/compnerd/ds2/blob/main/Sources/Target/Linux/Process.cpp#L274)
`DS2BUG` fatal error in `Linux::Process::wait` when running some
multi-threaded lldb tests.
## Overview
* Handle the case where we get a stop event for a single-stepping thread
with `kEventNone` and `kReasonNone`
* Enable 15 lldb test cases that were previously flaky due to this bug
* Rework the `Linux::Process::wait` function be a little bit more
readable
* Handle all failure cases in `Linux::Process::wait` with the `CHK()`
macro
## Problem Details
The scenario where a `kEventNone` event with a reason other than
`kReasonThreadSpawn` is alluded to in
[this](https://github.com/compnerd/ds2/blob/main/Sources/Target/Linux/Process.cpp#L236-L238)
comment block of `Linux::Process::wait` but it suggests it will never
happen while the thread is single stepping. However, this scenario can
legitimately occur and is fairly easy to reproduce with the lldb
multithreaded tests. In this case, the reason will be `kReasonNone`.
The implementation already handled this `kEventNone` and `kReasonNone`
event by continuing the thread as long as it wasn't also being
single-stepped. This change updates it to step the thread in the same
situation if it is being single-stepped. However, I haven't 100%
convinced myself the implementation was correct to begin with (it could
probably use an overhaul). Intuitively, I would expect to ignore events
with `kEventNone` and `kReasonNone`, but that's not what it was doing
previously.
## Validation
The re-enabled tests now pass consistently locally on Android and Linux,
and have now passed on at least 10 automated runs.
Manually set some breakpoints and stepped in a simple multi-threaded
program. It behaved as expected.
Co-authored-by: Saleem Abdulrasool <compnerd@compnerd.org>1 parent 246c9c0 commit 3a08337
File tree
2 files changed
+45
-55
lines changed- Sources/Target/Linux
- Support/Testing/Excluded/ds2
2 files changed
+45
-55
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
| 212 | + | |
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
| 220 | + | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| |||
232 | 232 | | |
233 | 233 | | |
234 | 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 | | - | |
| 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 | + | |
268 | 273 | | |
269 | | - | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
270 | 277 | | |
271 | 278 | | |
272 | | - | |
273 | | - | |
| 279 | + | |
274 | 280 | | |
275 | | - | |
276 | | - | |
| 281 | + | |
277 | 282 | | |
278 | 283 | | |
279 | 284 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | | - | |
10 | 9 | | |
11 | 10 | | |
12 | 11 | | |
13 | | - | |
14 | 12 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
19 | 13 | | |
20 | 14 | | |
21 | | - | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 15 | | |
27 | 16 | | |
28 | 17 | | |
29 | 18 | | |
30 | | - | |
31 | 19 | | |
32 | 20 | | |
33 | 21 | | |
| |||
149 | 137 | | |
150 | 138 | | |
151 | 139 | | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | 140 | | |
156 | 141 | | |
157 | 142 | | |
0 commit comments