[Lldb-commits] [lldb] r178057 - Data formatters cleanup:
Enrico Granata
egranata at apple.com
Tue Mar 26 11:55:08 PDT 2013
Author: enrico
Date: Tue Mar 26 13:55:08 2013
New Revision: 178057
URL: http://llvm.org/viewvc/llvm-project?rev=178057&view=rev
Log:
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
Modified:
lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h
lldb/trunk/source/DataFormatters/Cocoa.cpp
lldb/trunk/source/DataFormatters/LibCxxList.cpp
lldb/trunk/source/DataFormatters/LibCxxMap.cpp
Modified: lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h?rev=178057&r1=178056&r2=178057&view=diff
==============================================================================
--- lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h (original)
+++ lldb/trunk/include/lldb/DataFormatters/CXXFormatterFunctions.h Tue Mar 26 13:55:08 2013
@@ -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<size_t,lldb::ValueObjectSP> 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<size_t,lldb::ValueObjectSP> m_children;
Modified: lldb/trunk/source/DataFormatters/Cocoa.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/Cocoa.cpp?rev=178057&r1=178056&r2=178057&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/Cocoa.cpp (original)
+++ lldb/trunk/source/DataFormatters/Cocoa.cpp Tue Mar 26 13:55:08 2013
@@ -402,7 +402,7 @@ lldb_private::formatters::NSNumberSummar
break;
}
default:
- stream.Printf("absurd: dt=%d",data_type);
+ stream.Printf("unexpected value: dt=%d",data_type);
break;
}
return true;
Modified: lldb/trunk/source/DataFormatters/LibCxxList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/LibCxxList.cpp?rev=178057&r1=178056&r2=178057&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/LibCxxList.cpp (original)
+++ lldb/trunk/source/DataFormatters/LibCxxList.cpp Tue Mar 26 13:55:08 2013
@@ -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::LibcxxStdListS
{
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::LibcxxStdListS
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::LibcxxStdListS
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;
Modified: lldb/trunk/source/DataFormatters/LibCxxMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/DataFormatters/LibCxxMap.cpp?rev=178057&r1=178056&r2=178057&view=diff
==============================================================================
--- lldb/trunk/source/DataFormatters/LibCxxMap.cpp (original)
+++ lldb/trunk/source/DataFormatters/LibCxxMap.cpp Tue Mar 26 13:55:08 2013
@@ -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::LibcxxStdMapSy
if (!deref)
return false;
m_element_type.SetClangType(deref->GetClangAST(), deref->GetClangType());
- m_element_size = m_element_type.GetTypeByteSize();
return true;
}
More information about the lldb-commits
mailing list