[Lldb-commits] [PATCH] D80350: Handle the case where a thread exits while we were running a function on it

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed May 20 18:15:24 PDT 2020


jingham created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

It is possible that the thread we are running a function on could exit while we are waiting for the function call to return.

We sort of handled that case before, but it really only worked by accident because the ThreadPlan still had a pointer to the Thread, and it hadn't actually gone away when we touched it after stopping and finding that it had exited.  Now that ThreadPlans re-look up the thread after each stop, we were handing out a null Thread pointer and crashing.

I moved the checking for vanished threads to the helper routine that handles the stop event, added an expression result of eExpressionThreadVanished and handle it properly in RunThreadPlan.  I also added a test using a function that just called pthread_exit.  This crashed before these changes, and works correctly after.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D80350

Files:
  lldb/include/lldb/lldb-enumerations.h
  lldb/source/Expression/FunctionCaller.cpp
  lldb/source/Expression/LLVMUserExpression.cpp
  lldb/source/Target/Process.cpp
  lldb/test/API/functionalities/thread/exit_during_expression/Makefile
  lldb/test/API/functionalities/thread/exit_during_expression/TestExitDuringExpression.py
  lldb/test/API/functionalities/thread/exit_during_expression/main.c

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D80350.265400.patch
Type: text/x-patch
Size: 15671 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20200521/ed3aa84e/attachment.bin>


More information about the lldb-commits mailing list