[Lldb-commits] [lldb] r358916 - [Reproducers] Fix lifetime issue
Jonas Devlieghere via lldb-commits
lldb-commits at lists.llvm.org
Mon Apr 22 13:05:03 PDT 2019
Author: jdevlieghere
Date: Mon Apr 22 13:05:02 2019
New Revision: 358916
URL: http://llvm.org/viewvc/llvm-project?rev=358916&view=rev
Log:
[Reproducers] Fix lifetime issue
Deallocating the data recorder in during the ::Keep() operation causes
problems down the line when exiting the debugger. The command
interpreter still holds a pointer to the now deallocated object and has
no way to know it no longer exists. This is exactly what the m_record
flag was meant for, although it wasn't hooked up properly either.
Modified:
lldb/trunk/include/lldb/Utility/Reproducer.h
lldb/trunk/source/Utility/Reproducer.cpp
Modified: lldb/trunk/include/lldb/Utility/Reproducer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/Reproducer.h?rev=358916&r1=358915&r2=358916&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/Reproducer.h (original)
+++ lldb/trunk/include/lldb/Utility/Reproducer.h Mon Apr 22 13:05:02 2019
@@ -121,6 +121,8 @@ public:
Create(FileSpec filename);
template <typename T> void Record(const T &t, bool newline = false) {
+ if (!m_record)
+ return;
m_os << t;
if (newline)
m_os << '\n';
Modified: lldb/trunk/source/Utility/Reproducer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Utility/Reproducer.cpp?rev=358916&r1=358915&r2=358916&view=diff
==============================================================================
--- lldb/trunk/source/Utility/Reproducer.cpp (original)
+++ lldb/trunk/source/Utility/Reproducer.cpp Mon Apr 22 13:05:02 2019
@@ -259,8 +259,6 @@ void CommandProvider::Keep() {
return;
yaml::Output yout(os);
yout << files;
-
- m_data_recorders.clear();
}
void CommandProvider::Discard() { m_data_recorders.clear(); }
More information about the lldb-commits
mailing list