<rdar://problem/13521159>
LLDB is crashing when logging is enabled from lldb-perf-clang. This has to do with the global destructor chain as the process and its threads are being torn down.
All logging channels now make one and only one instance that is kept in a global pointer which is never freed. This guarantees that logging can correctly continue as the process tears itself down.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@178191 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 069d23e..36bd929 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -1231,7 +1231,7 @@
lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
uint32_t i;
- LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS));
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_SYMBOLS));
for (i=0; i<m_header.ncmds; ++i)
{
@@ -1252,28 +1252,28 @@
if (symtab_load_command.symoff == 0)
{
if (log)
- module_sp->LogMessage(log.get(), "LC_SYMTAB.symoff == 0");
+ module_sp->LogMessage(log, "LC_SYMTAB.symoff == 0");
return 0;
}
if (symtab_load_command.stroff == 0)
{
if (log)
- module_sp->LogMessage(log.get(), "LC_SYMTAB.stroff == 0");
+ module_sp->LogMessage(log, "LC_SYMTAB.stroff == 0");
return 0;
}
if (symtab_load_command.nsyms == 0)
{
if (log)
- module_sp->LogMessage(log.get(), "LC_SYMTAB.nsyms == 0");
+ module_sp->LogMessage(log, "LC_SYMTAB.nsyms == 0");
return 0;
}
if (symtab_load_command.strsize == 0)
{
if (log)
- module_sp->LogMessage(log.get(), "LC_SYMTAB.strsize == 0");
+ module_sp->LogMessage(log, "LC_SYMTAB.strsize == 0");
return 0;
}
break;
@@ -1411,7 +1411,7 @@
if (nlist_data.GetByteSize() == 0)
{
if (log)
- module_sp->LogMessage(log.get(), "failed to read nlist data");
+ module_sp->LogMessage(log, "failed to read nlist data");
return 0;
}
@@ -1424,14 +1424,14 @@
if (strtab_addr == LLDB_INVALID_ADDRESS)
{
if (log)
- module_sp->LogMessage(log.get(), "failed to locate the strtab in memory");
+ module_sp->LogMessage(log, "failed to locate the strtab in memory");
return 0;
}
}
else
{
if (log)
- module_sp->LogMessage(log.get(), "failed to read strtab data");
+ module_sp->LogMessage(log, "failed to read strtab data");
return 0;
}
}