diff options
author | Tamas Berghammer <tberghammer@google.com> | 2015-02-12 18:18:27 +0000 |
---|---|---|
committer | Tamas Berghammer <tberghammer@google.com> | 2015-02-12 18:18:27 +0000 |
commit | 3c4f89d7029ad73ce25c798ab2109d3eea7d7151 (patch) | |
tree | 5e50a26030f9716cecc97028253e6bf4662a299a /lldb/source/Plugins | |
parent | 00e305d281502a9b4d90dc02aa4c7dad819a9083 (diff) | |
download | bcm5719-llvm-3c4f89d7029ad73ce25c798ab2109d3eea7d7151.tar.gz bcm5719-llvm-3c4f89d7029ad73ce25c798ab2109d3eea7d7151.zip |
Add Initialize/Terminate method to Platform base plugin
Platform holds a smart pointer to each platform object created in a
static variable what cause the platform destructors called only on
program exit when other static variables are not availables. With this
change the destructors are called on lldb_private::Terminate()
+ Fix DebuggerRefCount handling in ScriptInterpreterPython
Differential Revision: http://reviews.llvm.org/D7590
llvm-svn: 228944
Diffstat (limited to 'lldb/source/Plugins')
10 files changed, 40 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp index e89254d89f0..5628284476d 100644 --- a/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp +++ b/lldb/source/Plugins/Platform/Android/PlatformAndroid.cpp @@ -25,6 +25,8 @@ static uint32_t g_initialize_count = 0; void PlatformAndroid::Initialize () { + PlatformLinux::Initialize (); + if (g_initialize_count++ == 0) { PluginManager::RegisterPlugin (PlatformAndroid::GetPluginNameStatic(), @@ -43,6 +45,8 @@ PlatformAndroid::Terminate () PluginManager::UnregisterPlugin (PlatformAndroid::CreateInstance); } } + + PlatformLinux::Terminate (); } PlatformSP diff --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp index 3b38a581993..d795e0c023d 100644 --- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp +++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp @@ -118,6 +118,8 @@ static uint32_t g_initialize_count = 0; void PlatformFreeBSD::Initialize () { + Platform::Initialize (); + if (g_initialize_count++ == 0) { #if defined (__FreeBSD__) @@ -137,6 +139,8 @@ PlatformFreeBSD::Terminate () { if (g_initialize_count > 0 && --g_initialize_count == 0) PluginManager::UnregisterPlugin (PlatformFreeBSD::CreateInstance); + + Platform::Terminate (); } //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp index b3729e2976d..f4f1fb4f297 100644 --- a/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp +++ b/lldb/source/Plugins/Platform/Kalimba/PlatformKalimba.cpp @@ -76,6 +76,8 @@ PlatformKalimba::GetPluginName() void PlatformKalimba::Initialize () { + Platform::Initialize (); + if (g_initialize_count++ == 0) { PluginManager::RegisterPlugin(PlatformKalimba::GetPluginNameStatic(false), @@ -94,6 +96,8 @@ PlatformKalimba::Terminate () PluginManager::UnregisterPlugin (PlatformKalimba::CreateInstance); } } + + Platform::Terminate (); } Error diff --git a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp index a6998a51eba..c70e0849585 100644 --- a/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp +++ b/lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp @@ -242,6 +242,8 @@ PlatformLinux::GetPluginName() void PlatformLinux::Initialize () { + PlatformPOSIX::Initialize (); + if (g_initialize_count++ == 0) { #if defined(__linux__) @@ -266,6 +268,8 @@ PlatformLinux::Terminate () PluginManager::UnregisterPlugin (PlatformLinux::CreateInstance); } } + + PlatformPOSIX::Terminate (); } Error diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp index a807c3360ae..eb9ca451069 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp @@ -51,6 +51,8 @@ static uint32_t g_initialize_count = 0; void PlatformDarwinKernel::Initialize () { + PlatformDarwin::Initialize (); + if (g_initialize_count++ == 0) { PluginManager::RegisterPlugin (PlatformDarwinKernel::GetPluginNameStatic(), @@ -70,6 +72,8 @@ PlatformDarwinKernel::Terminate () PluginManager::UnregisterPlugin (PlatformDarwinKernel::CreateInstance); } } + + PlatformDarwin::Terminate (); } PlatformSP diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp index 55a30bcc50c..aef8034f42e 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformMacOSX.cpp @@ -40,6 +40,8 @@ static uint32_t g_initialize_count = 0; void PlatformMacOSX::Initialize () { + PlatformDarwin::Initialize (); + if (g_initialize_count++ == 0) { #if defined (__APPLE__) @@ -64,6 +66,8 @@ PlatformMacOSX::Terminate () PluginManager::UnregisterPlugin (PlatformMacOSX::CreateInstance); } } + + PlatformDarwin::Terminate (); } PlatformSP diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp index 8bdd3cb4b1e..25509c3902a 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformRemoteiOS.cpp @@ -63,6 +63,8 @@ static uint32_t g_initialize_count = 0; void PlatformRemoteiOS::Initialize () { + PlatformDarwin::Initialize (); + if (g_initialize_count++ == 0) { PluginManager::RegisterPlugin (PlatformRemoteiOS::GetPluginNameStatic(), @@ -81,6 +83,8 @@ PlatformRemoteiOS::Terminate () PluginManager::UnregisterPlugin (PlatformRemoteiOS::CreateInstance); } } + + PlatformDarwin::Terminate (); } PlatformSP diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp index a6ffce7c952..70c81a27ad3 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformiOSSimulator.cpp @@ -41,6 +41,8 @@ static uint32_t g_initialize_count = 0; void PlatformiOSSimulator::Initialize () { + PlatformDarwin::Initialize (); + if (g_initialize_count++ == 0) { PluginManager::RegisterPlugin (PlatformiOSSimulator::GetPluginNameStatic(), @@ -59,6 +61,8 @@ PlatformiOSSimulator::Terminate () PluginManager::UnregisterPlugin (PlatformiOSSimulator::CreateInstance); } } + + PlatformDarwin::Terminate (); } PlatformSP diff --git a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp index ade4dccf6f8..3843e955a81 100644 --- a/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp +++ b/lldb/source/Plugins/Platform/Windows/PlatformWindows.cpp @@ -146,6 +146,8 @@ PlatformWindows::GetPluginName(void) void PlatformWindows::Initialize(void) { + Platform::Initialize (); + if (g_initialize_count++ == 0) { #if defined (_WIN32) @@ -175,6 +177,8 @@ PlatformWindows::Terminate( void ) PluginManager::UnregisterPlugin (PlatformWindows::CreateInstance); } } + + Platform::Terminate (); } //------------------------------------------------------------------ diff --git a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp index 4365a960086..1de07ffbafe 100644 --- a/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp +++ b/lldb/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp @@ -40,6 +40,8 @@ static bool g_initialized = false; void PlatformRemoteGDBServer::Initialize () { + Platform::Initialize (); + if (g_initialized == false) { g_initialized = true; @@ -57,6 +59,8 @@ PlatformRemoteGDBServer::Terminate () g_initialized = false; PluginManager::UnregisterPlugin (PlatformRemoteGDBServer::CreateInstance); } + + Platform::Terminate (); } PlatformSP |