[Lldb-commits] [PATCH] D90332: Mark the execution of commands in stop hooks as non-interactive

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 28 12:16:47 PDT 2020


jingham created this revision.
jingham added a reviewer: JDevlieghere.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.
jingham requested review of this revision.

stop-hooks were not intended to be interactive, that would be really confusing when there are many in flight.  So this patch marks the results as non-interactive.

Beyond correctness, then main reason for doing this patch is that when you go to run a command based stop hook that includes a Python command, if the command is marked as interactive, Python would try to act on stdin (fflush it) when switching to the Python Session, and if stdin was backed by an lldb NativeFile, the the fflush would deadlock against the I/O handler thread that was sitting in read on the same file handle.

That is a more general problem that this patch does not address.  The only place it has shown up IRL is in this scenario, and since doing the right thing for the stop-hook execution works around it, the more general fix can wait on somebody else's free time.  But I did add a test that will deadlock without this patch, and succeeds with it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D90332

Files:
  lldb/packages/Python/lldbsuite/test/lldbtest.py
  lldb/source/Interpreter/CommandInterpreter.cpp
  lldb/source/Target/Target.cpp
  lldb/test/API/api/multithreaded/TestMultithreaded.py
  lldb/test/API/api/multithreaded/some_cmd.py
  lldb/test/API/api/multithreaded/test_stop-hook.cpp.template

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90332.301367.patch
Type: text/x-patch
Size: 8670 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20201028/600bbc78/attachment.bin>


More information about the lldb-commits mailing list