Skip to content

🍒/bastille/33e3b07af3ce9595f49c75a8af559bdec5cc19fa+5861234e72c035ad39b5fd843eef78ab4039351e+ac25e8628c443cddd841c6c91d1c9e23e88969e5 #2220

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

Conversation

JDevlieghere
Copy link

  • [lldb] Include thread id in the reproducer trace (NFC)
  • [lldb] Track the API boundary using a thread_local variable.
  • [lldb] Deal gracefully with concurrency in the API instrumentation.

Include the current thread ID in the reproducer trace during
capture/recording.

(cherry picked from commit 33e3b07)
The reproducers currently use a static variable to track the API
boundary. This is obviously incorrect when the SB API is used
concurrently. While I do not plan to support that use-case (right now),
I do want to avoid us crashing. As a first step, correctly track API
boundaries across multiple threads.

Before this patch SB API calls made by the embedded script interpreter
would be considered "behind the API boundary" and correctly ignored.
After this patch, we need to tell the reproducers to ignore the
scripting thread as a "private thread".

Differential revision: https://reviews.llvm.org/D92811

(cherry picked from commit 5861234)
Prevent lldb from crashing when multiple threads are concurrently
accessing the SB API with reproducer capture enabled.

The API instrumentation records both the input arguments and the return
value, but it cannot block for the duration of the API call. Therefore
we introduce a sequence number that allows to to correlate the function
with its result and add locking to ensure those two parts are emitted
atomically.

Using the sequence number, we can detect situations where the return
value does not succeed the function call, in which case we print an
error saying that concurrency is not (currently) supported. In the
future we might attempt to be smarter and read ahead until we've found
the return value matching the current call.

Differential revision: https://reviews.llvm.org/D92820

(cherry picked from commit ac25e86)
@fredriss fredriss merged commit f2c339c into apple/stable/20200714 Dec 10, 2020
@JDevlieghere JDevlieghere deleted the 🍒/bastille/33e3b07af3ce9595f49c75a8af559bdec5cc19fa+5861234e72c035ad39b5fd843eef78ab4039351e+ac25e8628c443cddd841c6c91d1c9e23e88969e5 branch December 10, 2020 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants