mib added a subscriber: labath.
mib added inline comments.

================
Comment at: lldb/source/Plugins/Process/scripted/ScriptedProcess.cpp:332
+    lldb::ThreadSP thread_sp =
+        std::make_shared<ScriptedThread>(*this, error, *val->GetAsGeneric());
+
----------------
@labath This is why I switched to a raw pointer in D117065. Basically, I fetch 
a python dictionary for the `thread_info_sp`. It gets converted to a 
`StructuredData::Dictionary` and every element gets re-allocated in 
`pythonObject::CreateStructuredDictionary`. Then I iterate over each of element 
of the StructuredData::Dictionary and passes the StructuredData::Object to the 
ScriptedThread constructor.

The ScriptedThread needs a valid reference to the python object instance to 
perform calls on it. However, when the structured dictionary goes out of scope 
(at the end of the function), all the objects it holds get destroyed so when 
the ScriptedThread tries to make a call on the python object is causes a 
heap-use-after-free.


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

https://reviews.llvm.org/D117071

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to