[Lldb-commits] [PATCH] D92820: [lldb] Deal gracefully with concurrency in the API instrumentation.

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Dec 8 00:20:29 PST 2020


JDevlieghere created this revision.
JDevlieghere added reviewers: friss, labath.
Herald added a subscriber: jfb.
JDevlieghere requested review of this revision.

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 guarantee that the function id and its arguments are emitted as a single unit and that the return value is emitted as a single unit. Every API call is given a monotonically increasing index, which correlates the function with its return value.

Using the index, 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.


https://reviews.llvm.org/D92820

Files:
  lldb/include/lldb/Utility/ReproducerInstrumentation.h
  lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
  lldb/source/Utility/ReproducerInstrumentation.cpp
  lldb/test/API/functionalities/reproducers/concurrency/Makefile
  lldb/test/API/functionalities/reproducers/concurrency/TestReproducerConcurrency.py
  lldb/test/API/functionalities/reproducers/concurrency/driver.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92820.310097.patch
Type: text/x-patch
Size: 11528 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201208/2448f0ec/attachment-0001.bin>


More information about the lldb-commits mailing list