[Lldb-commits] [lldb] Add new Python API `SBCommandInterpreter::GetTranscript()` (PR #90703)

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Thu May 16 09:56:15 PDT 2024


================
@@ -571,6 +571,15 @@ SBStructuredData SBCommandInterpreter::GetStatistics() {
   return data;
 }
 
+SBStructuredData SBCommandInterpreter::GetTranscript() {
+  LLDB_INSTRUMENT_VA(this);
+
+  SBStructuredData data;
+  if (IsValid())
+    data.m_impl_up->SetObjectSP(m_opaque_ptr->GetTranscript());
----------------
clayborg wrote:

Here don't want to hand out a shared pointer to the internal transcript. If we do and the caller starts accessing it, we can crash if new commands are added to the structured data. If we to not copy things, one thing we could do it to grab the transript shared pointer from the command interpreter and have it create a new one.

https://github.com/llvm/llvm-project/pull/90703


More information about the lldb-commits mailing list