From: Enrico Granata Date: Tue, 26 Mar 2013 18:55:08 +0000 (+0000) Subject: Data formatters cleanup: X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7c0788b2d91bdbaa5d58fb96234fd153c18c293c;p=platform%2Fupstream%2Fllvm.git Data formatters cleanup: - Making an error message more consistent - Ensuring the element size is not zero before using it in a modulus - Properly using target settings to cap the std::list element count - Removing spurious element size calculations that were unused - Removing spurious capping in std::map llvm-svn: 178057 --- diff --git a/lldb/include/lldb/DataFormatters/CXXFormatterFunctions.h b/lldb/include/lldb/DataFormatters/CXXFormatterFunctions.h index f3b5ec8..39f8c28 100644 --- a/lldb/include/lldb/DataFormatters/CXXFormatterFunctions.h +++ b/lldb/include/lldb/DataFormatters/CXXFormatterFunctions.h @@ -779,13 +779,12 @@ namespace lldb_private { bool HasLoop(); - static const size_t g_list_capping_size = 255; + size_t m_list_capping_size; static const bool g_use_loop_detect = true; lldb::addr_t m_node_address; ValueObject* m_head; ValueObject* m_tail; ClangASTType m_element_type; - uint32_t m_element_size; size_t m_count; std::map m_children; }; @@ -821,11 +820,9 @@ namespace lldb_private { void GetValueOffset (const lldb::ValueObjectSP& node); - static const size_t g_map_capping_size = 255; ValueObject* m_tree; ValueObject* m_root_node; ClangASTType m_element_type; - uint32_t m_element_size; uint32_t m_skip_size; size_t m_count; std::map m_children; diff --git a/lldb/source/DataFormatters/Cocoa.cpp b/lldb/source/DataFormatters/Cocoa.cpp index afc7fe2..858bba9 100644 --- a/lldb/source/DataFormatters/Cocoa.cpp +++ b/lldb/source/DataFormatters/Cocoa.cpp @@ -402,7 +402,7 @@ lldb_private::formatters::NSNumberSummaryProvider (ValueObject& valobj, Stream& break; } default: - stream.Printf("absurd: dt=%d",data_type); + stream.Printf("unexpected value: dt=%d",data_type); break; } return true; diff --git a/lldb/source/DataFormatters/LibCxxList.cpp b/lldb/source/DataFormatters/LibCxxList.cpp index 7bedd8f..574d161 100644 --- a/lldb/source/DataFormatters/LibCxxList.cpp +++ b/lldb/source/DataFormatters/LibCxxList.cpp @@ -142,11 +142,11 @@ private: lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::LibcxxStdListSyntheticFrontEnd (lldb::ValueObjectSP valobj_sp) : SyntheticChildrenFrontEnd(*valobj_sp.get()), +m_list_capping_size(0), m_node_address(), m_head(NULL), m_tail(NULL), m_element_type(), -m_element_size(0), m_count(UINT32_MAX), m_children() { @@ -197,7 +197,7 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::CalculateNumChildren ( { size++; current.SetEntry(current.next()); - if (size > g_list_capping_size) + if (size > m_list_capping_size) break; } return m_count = (size-1); @@ -239,6 +239,11 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() m_count = UINT32_MAX; Error err; ValueObjectSP backend_addr(m_backend.AddressOf(err)); + m_list_capping_size = 0; + if (m_backend.GetTargetSP()) + m_list_capping_size = m_backend.GetTargetSP()->GetMaximumNumberOfChildrenToDisplay(); + if (m_list_capping_size == 0) + m_list_capping_size = 255; if (err.Fail() || backend_addr.get() == NULL) return false; m_node_address = backend_addr->GetValueAsUnsigned(0); @@ -257,7 +262,6 @@ lldb_private::formatters::LibcxxStdListSyntheticFrontEnd::Update() return false; lldb::TemplateArgumentKind kind; m_element_type = ClangASTType(m_backend.GetClangAST(), ClangASTContext::GetTemplateArgument(m_backend.GetClangAST(), list_type, 0, kind)); - m_element_size = m_element_type.GetTypeByteSize(); m_head = impl_sp->GetChildMemberWithName(ConstString("__next_"), true).get(); m_tail = impl_sp->GetChildMemberWithName(ConstString("__prev_"), true).get(); return false; diff --git a/lldb/source/DataFormatters/LibCxxMap.cpp b/lldb/source/DataFormatters/LibCxxMap.cpp index 2ffeb4b..8dfa592 100644 --- a/lldb/source/DataFormatters/LibCxxMap.cpp +++ b/lldb/source/DataFormatters/LibCxxMap.cpp @@ -215,7 +215,6 @@ SyntheticChildrenFrontEnd(*valobj_sp.get()), m_tree(NULL), m_root_node(NULL), m_element_type(), -m_element_size(0), m_skip_size(UINT32_MAX), m_count(UINT32_MAX), m_children() @@ -256,7 +255,6 @@ lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::GetDataType() if (!deref) return false; m_element_type.SetClangType(deref->GetClangAST(), deref->GetClangType()); - m_element_size = m_element_type.GetTypeByteSize(); return true; }