Files
llvm/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLDLog.cpp
Greg Clayton 73b472d42a Updated the lldb_private::Flags class to have better method names and made
all of the calls inlined in the header file for better performance.

Fixed the summary for C string types (array of chars (with any combo if
modifiers), and pointers to chars) work in all cases.

Fixed an issue where a forward declaration to a clang type could cause itself
to resolve itself more than once if, during the resolving of the type itself
it caused something to try and resolve itself again. We now remove the clang
type from the forward declaration map in the DWARF parser when we start to 
resolve it and avoid this additional call. This should stop any duplicate
members from appearing and throwing all the alignment of structs, unions and
classes.

llvm-svn: 117437
2010-10-27 03:32:59 +00:00

73 lines
1.8 KiB
C++

//===-- DynamicLoaderMacOSXDYLDLog.cpp --------------------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#include "DynamicLoaderMacOSXDYLDLog.h"
#include "lldb/Core/Log.h"
using namespace lldb_private;
static Log *
LogAccessor (bool get, Log *log)
{
static Log* g_log = NULL; // Leak for now as auto_ptr was being cleaned up
// by global constructors before other threads
// were done with it.
if (get)
{
// // Debug code below for enabling logging by default
// if (g_log == NULL)
// {
// g_log = new Log("/dev/stdout", false);
// g_log->GetMask().SetAllFlagBits(0xffffffffu);
// g_log->GetOptions().Set(LLDB_LOG_OPTION_THREADSAFE | LLDB_LOG_OPTION_PREPEND_THREAD_NAME);
// }
}
else
{
if (g_log)
delete g_log;
g_log = log;
}
return g_log;
}
Log *
DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (uint32_t mask)
{
Log *log = LogAccessor (true, NULL);
if (log && mask)
{
uint32_t log_mask = log->GetMask().Get();
if ((log_mask & mask) != mask)
return NULL;
}
return log;
}
void
DynamicLoaderMacOSXDYLDLog::SetLog (Log *log)
{
LogAccessor (false, log);
}
void
DynamicLoaderMacOSXDYLDLog::LogIf (uint32_t mask, const char *format, ...)
{
Log *log = DynamicLoaderMacOSXDYLDLog::GetLogIfAllCategoriesSet (mask);
if (log)
{
va_list args;
va_start (args, format);
log->VAPrintf (format, args);
va_end (args);
}
}