[all-commits] [llvm/llvm-project] ac25e8: [lldb] Deal gracefully with concurrency in the API...

Jonas Devlieghere via All-commits all-commits at lists.llvm.org
Thu Dec 10 09:42:51 PST 2020


  Branch: refs/heads/master
  Home:   https://github.com/llvm/llvm-project
  Commit: ac25e8628c443cddd841c6c91d1c9e23e88969e5
      https://github.com/llvm/llvm-project/commit/ac25e8628c443cddd841c6c91d1c9e23e88969e5
  Author: Jonas Devlieghere <jonas at devlieghere.com>
  Date:   2020-12-10 (Thu, 10 Dec 2020)

  Changed paths:
    M lldb/include/lldb/Utility/ReproducerInstrumentation.h
    M lldb/source/Utility/ReproducerInstrumentation.cpp
    M lldb/unittests/Utility/ReproducerInstrumentationTest.cpp

  Log Message:
  -----------
  [lldb] Deal gracefully with concurrency in the API instrumentation.

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




More information about the All-commits mailing list