[Lldb-commits] [PATCH] D17420: Don't use an atexit handler for cleaning up process specific temp dir
Zachary Turner via lldb-commits
lldb-commits at lists.llvm.org
Fri Feb 19 11:25:18 PST 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL261353: Don't use an atexit handler for cleaning up the temp directory. (authored by zturner).
Changed prior to commit:
http://reviews.llvm.org/D17420?vs=48414&id=48528#toc
Repository:
rL LLVM
http://reviews.llvm.org/D17420
Files:
lldb/trunk/include/lldb/Host/HostInfoBase.h
lldb/trunk/source/Host/common/HostInfoBase.cpp
lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
Index: lldb/trunk/include/lldb/Host/HostInfoBase.h
===================================================================
--- lldb/trunk/include/lldb/Host/HostInfoBase.h
+++ lldb/trunk/include/lldb/Host/HostInfoBase.h
@@ -34,6 +34,8 @@
public:
static void Initialize();
+ static void
+ Terminate();
//------------------------------------------------------------------
/// Returns the number of CPUs on this current host.
Index: lldb/trunk/source/Host/common/HostInfoBase.cpp
===================================================================
--- lldb/trunk/source/Host/common/HostInfoBase.cpp
+++ lldb/trunk/source/Host/common/HostInfoBase.cpp
@@ -31,19 +31,6 @@
namespace
{
- void
- CleanupProcessSpecificLLDBTempDir()
- {
- // Get the process specific LLDB temporary directory and delete it.
- FileSpec tmpdir_file_spec;
- if (!HostInfo::GetLLDBPath(ePathTypeLLDBTempSystemDir, tmpdir_file_spec))
- return;
-
- // Remove the LLDB temporary directory if we have one. Set "recurse" to
- // true to all files that were created for the LLDB process can be cleaned up.
- FileSystem::DeleteDirectory(tmpdir_file_spec, true);
- }
-
//----------------------------------------------------------------------
// The HostInfoBaseFields is a work around for windows not supporting
// static variables correctly in a thread safe way. Really each of the
@@ -54,6 +41,16 @@
struct HostInfoBaseFields
{
+ ~HostInfoBaseFields()
+ {
+ if (m_lldb_process_tmp_dir.Exists())
+ {
+ // Remove the LLDB temporary directory if we have one. Set "recurse" to
+ // true to all files that were created for the LLDB process can be cleaned up.
+ FileSystem::DeleteDirectory(m_lldb_process_tmp_dir, true);
+ }
+ }
+
uint32_t m_number_cpus;
std::string m_vendor_string;
std::string m_os_string;
@@ -82,6 +79,13 @@
g_fields = new HostInfoBaseFields();
}
+void
+HostInfoBase::Terminate()
+{
+ delete g_fields;
+ g_fields = nullptr;
+}
+
uint32_t
HostInfoBase::GetNumberCPUS()
{
@@ -335,9 +339,6 @@
if (!FileSystem::MakeDirectory(temp_file_spec, eFilePermissionsDirectoryDefault).Success())
return false;
- // Make an atexit handler to clean up the process specify LLDB temp dir
- // and all of its contents.
- ::atexit(CleanupProcessSpecificLLDBTempDir);
file_spec.GetDirectory().SetCString(temp_file_spec.GetCString());
return true;
}
Index: lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
===================================================================
--- lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
+++ lldb/trunk/source/Initialization/SystemInitializerCommon.cpp
@@ -194,5 +194,6 @@
#endif
OperatingSystemGo::Terminate();
+ HostInfo::Terminate();
Log::Terminate();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D17420.48528.patch
Type: text/x-patch
Size: 2990 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160219/34b2e955/attachment.bin>
More information about the lldb-commits
mailing list