forked from OSchip/llvm-project
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
This commit is contained in:
parent
bb1beaa220
commit
7c0788b2d9
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue