[Lldb-commits] [PATCH] D134927: Make the sanitizer Notify callbacks asynchronous

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Sep 29 17:35:33 PDT 2022


jingham created this revision.
jingham added reviewers: JDevlieghere, kubamracek.
Herald added a project: All.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

lldb handles breakpoints in two phases, the "sync" and "async" phase.  The synchronous phase happens early in the event handling, and is for when you need to do some work before anyone else gets a chance to look at the breakpoint.  It's used by the dynamic loader plugins, for instance.

As such, we're in a place where we haven't quite figured out about the current event, and are not in a state to handle another one.  That makes running the expression evaluator in synchronous callbacks flakey.  The Sanitizer callbacks were all registered as synchronous, even though their primary job is to call report generation functions in the target.  TTTT, calling functions works better than I would have expected, but if you rapidly continue enough times over a sequence of sanitizer reports, you eventually confuse the event state machine.

I bet with enough thinking we could make expression evaluation in sync callbacks work, but it would further complicate an already complex system.  And there's no reason for the sanitizer callbacks to be synchronous, they are very like user report functions in a breakpoint, and should run in the same way.  So the simpler path of converting these to async seems the better one.

This patch switches the report functions from sync to async, adds some testing for continuing past sequential UBSan reports, and adds a comment telling people not to use expressions in sync callbacks.   The test is not great, in that I can get this same test code to misbehave quite regularly in Xcode, but I couldn't reproduce enough of the Xcode environment in a test to produce a reliably failing test, so this test for the most part passes even without the fix.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D134927

Files:
  lldb/include/lldb/Breakpoint/Breakpoint.h
  lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp
  lldb/source/Plugins/InstrumentationRuntime/MainThreadChecker/InstrumentationRuntimeMainThreadChecker.cpp
  lldb/source/Plugins/InstrumentationRuntime/TSan/InstrumentationRuntimeTSan.cpp
  lldb/source/Plugins/InstrumentationRuntime/UBSan/InstrumentationRuntimeUBSan.cpp
  lldb/test/API/functionalities/ubsan/basic/TestUbsanBasic.py
  lldb/test/API/functionalities/ubsan/basic/main.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D134927.464103.patch
Type: text/x-patch
Size: 5054 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220930/eca0bb36/attachment-0001.bin>


More information about the lldb-commits mailing list