llvm-project/lldb/source/Plugins/Process/FreeBSD
Dimitry Andric a42942e0ec Fix process launch failure on FreeBSD after r365761
Summary:
After 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, use `llvm::Optional<>` for the members (as indicated
by labath), 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.

Reviewers: devnexen, emaste, MaskRay, mgorny

Reviewed By: devnexen

Subscribers: jfb, labath, krytarowski, lldb-commits

Differential Revision: https://reviews.llvm.org/D68723

llvm-svn: 374444
2019-10-10 20:26:59 +00:00
..
CMakeLists.txt Normalize some lldb #include statements. 2018-05-22 22:53:50 +00:00
FreeBSDThread.cpp [Logging] Replace Log::Printf with LLDB_LOG macro (NFC) 2019-07-24 17:56:10 +00:00
FreeBSDThread.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
POSIXStopInfo.cpp Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
POSIXStopInfo.h Bring Doxygen comment syntax in sync with LLVM coding style. 2019-03-11 17:09:29 +00:00
ProcessFreeBSD.cpp [NFC] Fix typo in the "kind" description for the software single-step breakpoint 2019-09-24 14:24:52 +00:00
ProcessFreeBSD.h [LLDB] Fix FreeBSD build 2019-06-12 08:54:14 +00:00
ProcessMonitor.cpp Fix process launch failure on FreeBSD after r365761 2019-10-10 20:26:59 +00:00
ProcessMonitor.h Fix process launch failure on FreeBSD after r365761 2019-10-10 20:26:59 +00:00
RegisterContextPOSIX.h [NFC] Remove ASCII lines from comments 2019-04-10 20:48:55 +00:00
RegisterContextPOSIXProcessMonitor_arm.cpp Remove null checks of results of new expressions 2019-07-01 11:09:15 +00:00
RegisterContextPOSIXProcessMonitor_arm.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RegisterContextPOSIXProcessMonitor_arm64.cpp Remove null checks of results of new expressions 2019-07-01 11:09:15 +00:00
RegisterContextPOSIXProcessMonitor_arm64.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RegisterContextPOSIXProcessMonitor_mips64.cpp Remove null checks of results of new expressions 2019-07-01 11:09:15 +00:00
RegisterContextPOSIXProcessMonitor_mips64.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RegisterContextPOSIXProcessMonitor_powerpc.cpp Remove null checks of results of new expressions 2019-07-01 11:09:15 +00:00
RegisterContextPOSIXProcessMonitor_powerpc.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00
RegisterContextPOSIXProcessMonitor_x86.cpp Remove null checks of results of new expressions 2019-07-01 11:09:15 +00:00
RegisterContextPOSIXProcessMonitor_x86.h Update the file headers across all of the LLVM projects in the monorepo 2019-01-19 08:50:56 +00:00