Add logging to a couple of regions of code

llvm-svn: 246580
This commit is contained in:
Enrico Granata 2015-09-01 20:11:13 +00:00
parent 1d397bfe40
commit 45a98fffa5
2 changed files with 74 additions and 2 deletions

View File

@ -229,6 +229,19 @@ TypeCategoryMap::GetFormat (ValueObject& valobj,
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
if (log)
{
for (auto match : matches)
{
log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
match.GetTypeName().GetCString(),
match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
match.DidStripReference() ? "strip-reference" : "no-strip-reference",
match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
match.GetReason());
}
}
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;
@ -256,6 +269,19 @@ TypeCategoryMap::GetSummaryFormat (ValueObject& valobj,
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
if (log)
{
for (auto match : matches)
{
log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
match.GetTypeName().GetCString(),
match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
match.DidStripReference() ? "strip-reference" : "no-strip-reference",
match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
match.GetReason());
}
}
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;
@ -285,6 +311,19 @@ TypeCategoryMap::GetSyntheticChildren (ValueObject& valobj,
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
if (log)
{
for (auto match : matches)
{
log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
match.GetTypeName().GetCString(),
match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
match.DidStripReference() ? "strip-reference" : "no-strip-reference",
match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
match.GetReason());
}
}
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;
@ -313,6 +352,19 @@ TypeCategoryMap::GetValidator (ValueObject& valobj,
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
if (log)
{
for (auto match : matches)
{
log->Printf("[CategoryMap::GetSummaryFormat] candidate match = %s %s %s %s reason = %" PRIu32,
match.GetTypeName().GetCString(),
match.DidStripPointer() ? "strip-pointers" : "no-strip-pointers",
match.DidStripReference() ? "strip-reference" : "no-strip-reference",
match.DidStripTypedef() ? "strip-typedef" : "no-strip-typedef",
match.GetReason());
}
}
for (begin = m_active_categories.begin(); begin != end; begin++)
{
lldb::TypeCategoryImplSP category_sp = *begin;

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "AppleObjCClassDescriptorV2.h"
#include "lldb/Core/Log.h"
using namespace lldb;
using namespace lldb_private;
@ -518,6 +519,9 @@ ClassDescriptorV2::iVarsStorage::fill (AppleObjCRuntimeV2& runtime, ClassDescrip
if (m_filled)
return;
Mutex::Locker lock(m_mutex);
Log *log(GetLogIfAllCategoriesSet(LIBLLDB_LOG_TYPES | LIBLLDB_LOG_VERBOSE));
if (log)
log->Printf("[ClassDescriptorV2::iVarsStorage::fill] class_name = %s", descriptor.GetClassName().AsCString("<unknown"));
m_filled = true;
ObjCLanguageRuntime::EncodingToTypeSP encoding_to_type_sp(runtime.GetEncodingToType());
Process* process(runtime.GetProcess());
@ -526,17 +530,33 @@ ClassDescriptorV2::iVarsStorage::fill (AppleObjCRuntimeV2& runtime, ClassDescrip
descriptor.Describe(nullptr,
nullptr,
nullptr,
[this,process,encoding_to_type_sp](const char * name, const char * type, lldb::addr_t offset_ptr, uint64_t size) -> bool {
[this,process,encoding_to_type_sp,log](const char * name, const char * type, lldb::addr_t offset_ptr, uint64_t size) -> bool {
const bool for_expression = false;
const bool stop_loop = false;
if (log)
log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64,
name,type,offset_ptr,size);
CompilerType ivar_type = encoding_to_type_sp->RealizeType(type, for_expression);
if (ivar_type)
{
if (log)
log->Printf("[ClassDescriptorV2::iVarsStorage::fill] name = %s, encoding = %s, offset_ptr = %" PRIx64 ", size = %" PRIu64 " , type_size = %" PRIu64,
name,type,offset_ptr,size,ivar_type.GetByteSize(nullptr));
Scalar offset_scalar;
Error error;
size_t read = process->ReadScalarIntegerFromMemory(offset_ptr, 4, true, offset_scalar, error);
const int offset_ptr_size = 4;
const bool is_signed = false;
size_t read = process->ReadScalarIntegerFromMemory(offset_ptr, offset_ptr_size, is_signed, offset_scalar, error);
if (error.Success() && 4 == read)
{
if (log)
log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> %" PRIu32,
offset_ptr, offset_scalar.SInt());
m_ivars.push_back({ ConstString(name), ivar_type, size, offset_scalar.SInt() });
}
else if (log)
log->Printf("[ClassDescriptorV2::iVarsStorage::fill] offset_ptr = %" PRIx64 " --> read fail, read = %zu",
offset_ptr, read);
}
return stop_loop;
});