[Lldb-commits] [PATCH] D106171: [lldb] Avoid moving ThreadPlanSP from plans vector

Jonas Devlieghere via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Jul 28 09:48:40 PDT 2021


JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

IIRC the fact that the shared pointer is null is implementation defined and the standard just says that a moved-from object is in an undefined state.



================
Comment at: lldb/source/Target/ThreadPlanStack.cpp:145-147
+  // Note that `std::move` on `m_plans` elements can break its non-null
+  // invariant - if also calling functions (such as `WillPop`) that can't
+  // guarantee `m_plans` is not accessed in its inconsistent state.
----------------
Note that moving the top element of the vector leaves it in an undefined state, which breaks the thread plan stack guarantee that the last element is valid. 


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106171/new/

https://reviews.llvm.org/D106171



More information about the lldb-commits mailing list