diff options
| author | Greg Clayton <gclayton@apple.com> | 2013-03-27 23:08:40 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2013-03-27 23:08:40 +0000 |
| commit | 5160ce5c72e5f55c2e83ca9914cd0f02e0c5ceb3 (patch) | |
| tree | b24bb5959b40d8f0e99ed6d8b13271270dbf08e3 /lldb/source/Target/Target.cpp | |
| parent | ccc266559f5c028442b6393362da14d866d9b32b (diff) | |
| download | bcm5719-llvm-5160ce5c72e5f55c2e83ca9914cd0f02e0c5ceb3.tar.gz bcm5719-llvm-5160ce5c72e5f55c2e83ca9914cd0f02e0c5ceb3.zip | |
<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.
llvm-svn: 178191
Diffstat (limited to 'lldb/source/Target/Target.cpp')
| -rw-r--r-- | lldb/source/Target/Target.cpp | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index b8b6c0c3216..ab8fb865926 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -93,7 +93,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat CheckInWithManager(); - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Target::Target()", this); if (m_arch.IsValid()) @@ -107,7 +107,7 @@ Target::Target(Debugger &debugger, const ArchSpec &target_arch, const lldb::Plat //---------------------------------------------------------------------- Target::~Target() { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT)); if (log) log->Printf ("%p Target::~Target()", this); DeleteCurrentProcess (); @@ -495,7 +495,7 @@ Target::CreateBreakpoint (SearchFilterSP &filter_sp, BreakpointResolverSP &resol else m_breakpoint_list.Add (bp_sp, true); - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) { StreamString s; @@ -540,7 +540,7 @@ CheckIfWatchpointsExhausted(Target *target, Error &error) WatchpointSP Target::CreateWatchpoint(lldb::addr_t addr, size_t size, const ClangASTType *type, uint32_t kind, Error &error) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf("Target::%s (addr = 0x%8.8" PRIx64 " size = %" PRIu64 " type = %u)\n", __FUNCTION__, addr, (uint64_t)size, kind); @@ -620,7 +620,7 @@ Target::CreateWatchpoint(lldb::addr_t addr, size_t size, const ClangASTType *typ void Target::RemoveAllBreakpoints (bool internal_also) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -634,7 +634,7 @@ Target::RemoveAllBreakpoints (bool internal_also) void Target::DisableAllBreakpoints (bool internal_also) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -646,7 +646,7 @@ Target::DisableAllBreakpoints (bool internal_also) void Target::EnableAllBreakpoints (bool internal_also) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (internal_also = %s)\n", __FUNCTION__, internal_also ? "yes" : "no"); @@ -658,7 +658,7 @@ Target::EnableAllBreakpoints (bool internal_also) bool Target::RemoveBreakpointByID (break_id_t break_id) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no"); @@ -683,7 +683,7 @@ Target::RemoveBreakpointByID (break_id_t break_id) bool Target::DisableBreakpointByID (break_id_t break_id) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, break_id, LLDB_BREAK_ID_IS_INTERNAL (break_id) ? "yes" : "no"); @@ -704,7 +704,7 @@ Target::DisableBreakpointByID (break_id_t break_id) bool Target::EnableBreakpointByID (break_id_t break_id) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_BREAKPOINTS)); if (log) log->Printf ("Target::%s (break_id = %i, internal = %s)\n", __FUNCTION__, @@ -734,7 +734,7 @@ Target::EnableBreakpointByID (break_id_t break_id) bool Target::RemoveAllWatchpoints (bool end_to_end) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); @@ -768,7 +768,7 @@ Target::RemoveAllWatchpoints (bool end_to_end) bool Target::DisableAllWatchpoints (bool end_to_end) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); @@ -801,7 +801,7 @@ Target::DisableAllWatchpoints (bool end_to_end) bool Target::EnableAllWatchpoints (bool end_to_end) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); @@ -833,7 +833,7 @@ Target::EnableAllWatchpoints (bool end_to_end) bool Target::ClearAllWatchpointHitCounts () { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); @@ -854,7 +854,7 @@ Target::ClearAllWatchpointHitCounts () bool Target::IgnoreAllWatchpoints (uint32_t ignore_count) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s\n", __FUNCTION__); @@ -877,7 +877,7 @@ Target::IgnoreAllWatchpoints (uint32_t ignore_count) bool Target::DisableWatchpointByID (lldb::watch_id_t watch_id) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); @@ -900,7 +900,7 @@ Target::DisableWatchpointByID (lldb::watch_id_t watch_id) bool Target::EnableWatchpointByID (lldb::watch_id_t watch_id) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); @@ -923,7 +923,7 @@ Target::EnableWatchpointByID (lldb::watch_id_t watch_id) bool Target::RemoveWatchpointByID (lldb::watch_id_t watch_id) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); @@ -939,7 +939,7 @@ Target::RemoveWatchpointByID (lldb::watch_id_t watch_id) bool Target::IgnoreWatchpointByID (lldb::watch_id_t watch_id, uint32_t ignore_count) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_WATCHPOINTS)); if (log) log->Printf ("Target::%s (watch_id = %i)\n", __FUNCTION__, watch_id); @@ -982,7 +982,7 @@ LoadScriptingResourceForModule (const ModuleSP &module_sp, Target *target) void Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET)); m_images.Clear(); m_scratch_ast_context_ap.reset(); m_scratch_ast_source_ap.reset(); @@ -1037,7 +1037,7 @@ Target::SetExecutableModule (ModuleSP& executable_sp, bool get_dependent_files) bool Target::SetArchitecture (const ArchSpec &arch_spec) { - LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET)); + Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TARGET)); if (m_arch.IsCompatibleMatch(arch_spec) || !m_arch.IsValid()) { // If we haven't got a valid arch spec, or the architectures are |

