[Lldb-commits] [PATCH] D68723: Fix process launch failure on FreeBSD after r365761

Dimitry Andric via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Oct 9 13:10:20 PDT 2019


dim created this revision.
dim added reviewers: devnexen, emaste, MaskRay, mgorny.
Herald added a subscriber: krytarowski.
dim added a comment.

After rLLDB365761 <https://reviews.llvm.org/rLLDB365761>, and with `LLVM_ENABLE_ABI_BREAKING_CHECKS` enabled, launching
any process on FreeBSD crashes lldb with:

  Expected<T> must be checked before access or destruction.
  Expected<T> value was in success state. (Note: Expected<T> values in success mode must still be checked prior to being destroyed).

This is because `m_operation_thread` and `m_monitor_thread` were wrapped in
`llvm::Expected<>`, but this requires the objects to be correctly initialized
before accessing them.

To fix the crashes, revert the wrapping, and use local variables to store the
return values of `LaunchThread` and `StartMonitoringChildProcess`.  Then, only
assign to the member variables after checking if the return values indicated
success.


https://reviews.llvm.org/D68723

Files:
  source/Plugins/Process/FreeBSD/ProcessMonitor.cpp
  source/Plugins/Process/FreeBSD/ProcessMonitor.h

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68723.224137.patch
Type: text/x-patch
Size: 5068 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191009/20f5076e/attachment.bin>


More information about the lldb-commits mailing list