diff options
Diffstat (limited to 'lldb/source/Core')
42 files changed, 477 insertions, 489 deletions
diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 9d4d8706c5a..5c9ed1a51fb 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -86,7 +86,7 @@ ReadUIntMax64 (ExecutionContextScope *exe_scope, const Address &address, uint32_ if (GetByteOrderAndAddressSize (exe_scope, address, byte_order, addr_size)) { DataExtractor data (&buf, sizeof(buf), byte_order, addr_size); - uint32_t offset = 0; + lldb::offset_t offset = 0; uval64 = data.GetU64(&offset); } else @@ -696,8 +696,8 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum stop_if_block_is_inlined_function, &variable_list); - uint32_t num_variables = variable_list.GetSize(); - for (uint32_t var_idx = 0; var_idx < num_variables; ++var_idx) + const size_t num_variables = variable_list.GetSize(); + for (size_t var_idx = 0; var_idx < num_variables; ++var_idx) { Variable *var = variable_list.GetVariableAtIndex (var_idx).get(); if (var && var->LocationIsValidForAddress (*this)) diff --git a/lldb/source/Core/ArchSpec.cpp b/lldb/source/Core/ArchSpec.cpp index 476807c338e..51bea8a95b5 100644 --- a/lldb/source/Core/ArchSpec.cpp +++ b/lldb/source/Core/ArchSpec.cpp @@ -118,7 +118,7 @@ struct ArchDefinition }; -uint32_t +size_t ArchSpec::AutoComplete (const char *name, StringList &matches) { uint32_t i; @@ -495,11 +495,11 @@ ParseMachCPUDashSubtypeTriple (const char *triple_cstr, ArchSpec &arch) { char *end = NULL; errno = 0; - uint32_t cpu = ::strtoul (triple_cstr, &end, 0); + uint32_t cpu = (uint32_t)::strtoul (triple_cstr, &end, 0); if (errno == 0 && cpu != 0 && end && ((*end == '-') || (*end == '.'))) { errno = 0; - uint32_t sub = ::strtoul (end + 1, &end, 0); + uint32_t sub = (uint32_t)::strtoul (end + 1, &end, 0); if (errno == 0 && end && ((*end == '-') || (*end == '.') || (*end == '\0'))) { if (arch.SetArchitecture (eArchTypeMachO, cpu, sub)) @@ -513,7 +513,7 @@ ParseMachCPUDashSubtypeTriple (const char *triple_cstr, ArchSpec &arch) llvm::StringRef vendor_str(vendor_os.substr(0, dash_pos)); arch.GetTriple().setVendorName(vendor_str); const size_t vendor_start_pos = dash_pos+1; - dash_pos = vendor_os.find(vendor_start_pos, '-'); + dash_pos = vendor_os.find('-', vendor_start_pos); if (dash_pos == llvm::StringRef::npos) { if (vendor_start_pos < vendor_os.size()) diff --git a/lldb/source/Core/CXXFormatterFunctions.cpp b/lldb/source/Core/CXXFormatterFunctions.cpp index a907d793989..81e72e5418c 100644 --- a/lldb/source/Core/CXXFormatterFunctions.cpp +++ b/lldb/source/Core/CXXFormatterFunctions.cpp @@ -1092,7 +1092,7 @@ m_data_64(NULL) } } -uint32_t +size_t lldb_private::formatters::NSArrayMSyntheticFrontEnd::CalculateNumChildren () { if (m_data_32) @@ -1103,7 +1103,7 @@ lldb_private::formatters::NSArrayMSyntheticFrontEnd::CalculateNumChildren () } lldb::ValueObjectSP -lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex (uint32_t idx) +lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex (size_t idx) { if (!m_data_32 && !m_data_64) return lldb::ValueObjectSP(); @@ -1112,7 +1112,7 @@ lldb_private::formatters::NSArrayMSyntheticFrontEnd::GetChildAtIndex (uint32_t i lldb::addr_t object_at_idx = (m_data_32 ? m_data_32->_data : m_data_64->_data); object_at_idx += (idx * m_ptr_size); StreamString idx_name; - idx_name.Printf("[%d]",idx); + idx_name.Printf("[%zu]",idx); lldb::ValueObjectSP retval_sp = ValueObject::CreateValueObjectFromAddress(idx_name.GetData(), object_at_idx, m_exe_ctx_ref, @@ -1240,7 +1240,7 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd::GetIndexOfChildWithName (co return idx; } -uint32_t +size_t lldb_private::formatters::NSArrayISyntheticFrontEnd::CalculateNumChildren () { return m_items; @@ -1286,7 +1286,7 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd::MightHaveChildren () } lldb::ValueObjectSP -lldb_private::formatters::NSArrayISyntheticFrontEnd::GetChildAtIndex (uint32_t idx) +lldb_private::formatters::NSArrayISyntheticFrontEnd::GetChildAtIndex (size_t idx) { if (idx >= CalculateNumChildren()) return lldb::ValueObjectSP(); @@ -1302,7 +1302,7 @@ lldb_private::formatters::NSArrayISyntheticFrontEnd::GetChildAtIndex (uint32_t i StreamString expr; expr.Printf("(id)%" PRIu64,object_at_idx); StreamString idx_name; - idx_name.Printf("[%d]",idx); + idx_name.Printf("[%zu]",idx); lldb::ValueObjectSP retval_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref); m_children.push_back(retval_sp); return retval_sp; @@ -1353,7 +1353,7 @@ lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::NSArrayCodeRunnin SyntheticChildrenFrontEnd(*valobj_sp.get()) {} -uint32_t +size_t lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::CalculateNumChildren () { uint64_t count = 0; @@ -1363,10 +1363,10 @@ lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::CalculateNumChild } lldb::ValueObjectSP -lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::GetChildAtIndex (uint32_t idx) +lldb_private::formatters::NSArrayCodeRunningSyntheticFrontEnd::GetChildAtIndex (size_t idx) { StreamString idx_name; - idx_name.Printf("[%d]",idx); + idx_name.Printf("[%zu]",idx); lldb::ValueObjectSP valobj_sp = CallSelectorOnObject(m_backend,"id","objectAtIndex:",idx); if (valobj_sp) valobj_sp->SetName(ConstString(idx_name.GetData())); @@ -1440,7 +1440,7 @@ lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::NSDictionary SyntheticChildrenFrontEnd(*valobj_sp.get()) {} -uint32_t +size_t lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::CalculateNumChildren () { uint64_t count = 0; @@ -1450,14 +1450,14 @@ lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::CalculateNum } lldb::ValueObjectSP -lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::GetChildAtIndex (uint32_t idx) +lldb_private::formatters::NSDictionaryCodeRunningSyntheticFrontEnd::GetChildAtIndex (size_t idx) { StreamString idx_name; - idx_name.Printf("[%d]",idx); + idx_name.Printf("[%zu]",idx); StreamString valobj_expr_path; m_backend.GetExpressionPath(valobj_expr_path, false); StreamString key_fetcher_expr; - key_fetcher_expr.Printf("(id)[(NSArray*)[%s allKeys] objectAtIndex:%d]",valobj_expr_path.GetData(),idx); + key_fetcher_expr.Printf("(id)[(NSArray*)[%s allKeys] objectAtIndex:%zu]",valobj_expr_path.GetData(),idx); StreamString value_fetcher_expr; value_fetcher_expr.Printf("(id)[%s objectForKey:%s]",valobj_expr_path.GetData(),key_fetcher_expr.GetData()); StreamString object_fetcher_expr; @@ -1520,7 +1520,7 @@ lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetIndexOfChildWithNam return idx; } -uint32_t +size_t lldb_private::formatters::NSDictionaryISyntheticFrontEnd::CalculateNumChildren () { if (!m_data_32 && !m_data_64) @@ -1581,7 +1581,7 @@ lldb_private::formatters::NSDictionaryISyntheticFrontEnd::MightHaveChildren () } lldb::ValueObjectSP -lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex (uint32_t idx) +lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex (size_t idx) { uint32_t num_children = CalculateNumChildren(); @@ -1633,7 +1633,7 @@ lldb_private::formatters::NSDictionaryISyntheticFrontEnd::GetChildAtIndex (uint3 StreamString expr; expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%" PRIu64 " ; _lldb_valgen_item.value = (id)%" PRIu64 "; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr); StreamString idx_name; - idx_name.Printf("[%d]",idx); + idx_name.Printf("[%zu]",idx); dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref); } return dict_item.valobj_sp; @@ -1668,7 +1668,7 @@ lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetIndexOfChildWithNam return idx; } -uint32_t +size_t lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::CalculateNumChildren () { if (!m_data_32 && !m_data_64) @@ -1728,7 +1728,7 @@ lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::MightHaveChildren () } lldb::ValueObjectSP -lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex (uint32_t idx) +lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex (size_t idx) { lldb::addr_t m_keys_ptr = (m_data_32 ? m_data_32->_keys_addr : m_data_64->_keys_addr); lldb::addr_t m_values_ptr = (m_data_32 ? m_data_32->_objs_addr : m_data_64->_objs_addr); @@ -1783,7 +1783,7 @@ lldb_private::formatters::NSDictionaryMSyntheticFrontEnd::GetChildAtIndex (uint3 StreamString expr; expr.Printf("struct __lldb_autogen_nspair { id key; id value; } _lldb_valgen_item; _lldb_valgen_item.key = (id)%" PRIu64 " ; _lldb_valgen_item.value = (id)%" PRIu64 "; _lldb_valgen_item;",dict_item.key_ptr,dict_item.val_ptr); StreamString idx_name; - idx_name.Printf("[%d]",idx); + idx_name.Printf("[%zu]",idx); dict_item.valobj_sp = ValueObject::CreateValueObjectFromExpression(idx_name.GetData(), expr.GetData(), m_exe_ctx_ref); } return dict_item.valobj_sp; diff --git a/lldb/source/Core/ConstString.cpp b/lldb/source/Core/ConstString.cpp index 72a4332a4ff..875169428d2 100644 --- a/lldb/source/Core/ConstString.cpp +++ b/lldb/source/Core/ConstString.cpp @@ -87,7 +87,7 @@ public: } const char * - GetConstCStringWithLength (const char *cstr, int cstr_len) + GetConstCStringWithLength (const char *cstr, size_t cstr_len) { if (cstr) { @@ -132,11 +132,11 @@ public: } const char * - GetConstTrimmedCStringWithLength (const char *cstr, int cstr_len) + GetConstTrimmedCStringWithLength (const char *cstr, size_t cstr_len) { if (cstr) { - int trimmed_len = std::min<int> (strlen (cstr), cstr_len); + const size_t trimmed_len = std::min<size_t> (strlen (cstr), cstr_len); return GetConstCStringWithLength (cstr, trimmed_len); } return NULL; diff --git a/lldb/source/Core/DataBufferMemoryMap.cpp b/lldb/source/Core/DataBufferMemoryMap.cpp index 5e1403a5a82..0a94f57e40a 100644 --- a/lldb/source/Core/DataBufferMemoryMap.cpp +++ b/lldb/source/Core/DataBufferMemoryMap.cpp @@ -116,8 +116,7 @@ DataBufferMemoryMap::MemoryMapFromFileSpec (const FileSpec* filespec, if (error.Success()) { const bool fd_is_file = true; - MemoryMapFromFileDescriptor (file.GetDescriptor(), offset, length, writeable, fd_is_file); - return GetByteSize(); + return MemoryMapFromFileDescriptor (file.GetDescriptor(), offset, length, writeable, fd_is_file); } } } diff --git a/lldb/source/Core/DataExtractor.cpp b/lldb/source/Core/DataExtractor.cpp index 0be3ef8546b..71dff0d54e8 100644 --- a/lldb/source/Core/DataExtractor.cpp +++ b/lldb/source/Core/DataExtractor.cpp @@ -38,35 +38,35 @@ using namespace lldb; using namespace lldb_private; static inline uint16_t -ReadInt16(const unsigned char* ptr, unsigned offset) +ReadInt16(const unsigned char* ptr, offset_t offset) { return *(uint16_t *)(ptr + offset); } static inline uint32_t -ReadInt32 (const unsigned char* ptr, unsigned offset) +ReadInt32 (const unsigned char* ptr, offset_t offset) { return *(uint32_t *)(ptr + offset); } static inline uint64_t -ReadInt64(const unsigned char* ptr, unsigned offset) +ReadInt64(const unsigned char* ptr, offset_t offset) { return *(uint64_t *)(ptr + offset); } static inline uint16_t -ReadSwapInt16(const unsigned char* ptr, unsigned offset) +ReadSwapInt16(const unsigned char* ptr, offset_t offset) { return llvm::ByteSwap_16(*(uint16_t *)(ptr + offset)); } static inline uint32_t -ReadSwapInt32 (const unsigned char* ptr, unsigned offset) +ReadSwapInt32 (const unsigned char* ptr, offset_t offset) { return llvm::ByteSwap_32(*(uint32_t *)(ptr + offset)); } static inline uint64_t -ReadSwapInt64(const unsigned char* ptr, unsigned offset) +ReadSwapInt64(const unsigned char* ptr, offset_t offset) { return llvm::ByteSwap_64(*(uint64_t *)(ptr + offset)); } @@ -88,7 +88,7 @@ DataExtractor::DataExtractor () : // This constructor allows us to use data that is owned by someone else. // The data must stay around as long as this object is valid. //---------------------------------------------------------------------- -DataExtractor::DataExtractor (const void* data, uint32_t length, ByteOrder endian, uint8_t addr_size) : +DataExtractor::DataExtractor (const void* data, offset_t length, ByteOrder endian, uint32_t addr_size) : m_start ((uint8_t*)data), m_end ((uint8_t*)data + length), m_byte_order(endian), @@ -104,7 +104,7 @@ DataExtractor::DataExtractor (const void* data, uint32_t length, ByteOrder endia // as long as any DataExtractor objects exist that have a reference to // this data. //---------------------------------------------------------------------- -DataExtractor::DataExtractor (const DataBufferSP& data_sp, ByteOrder endian, uint8_t addr_size) : +DataExtractor::DataExtractor (const DataBufferSP& data_sp, ByteOrder endian, uint32_t addr_size) : m_start (NULL), m_end (NULL), m_byte_order(endian), @@ -121,7 +121,7 @@ DataExtractor::DataExtractor (const DataBufferSP& data_sp, ByteOrder endian, uin // as any object contains a reference to that data. The endian // swap and address size settings are copied from "data". //---------------------------------------------------------------------- -DataExtractor::DataExtractor (const DataExtractor& data, uint32_t offset, uint32_t length) : +DataExtractor::DataExtractor (const DataExtractor& data, offset_t offset, offset_t length) : m_start(NULL), m_end(NULL), m_byte_order(data.m_byte_order), @@ -130,7 +130,7 @@ DataExtractor::DataExtractor (const DataExtractor& data, uint32_t offset, uint32 { if (data.ValidOffset(offset)) { - uint32_t bytes_available = data.GetByteSize() - offset; + offset_t bytes_available = data.GetByteSize() - offset; if (length > bytes_available) length = bytes_available; SetData(data, offset, length); @@ -213,9 +213,9 @@ DataExtractor::GetSharedDataOffset () const // into the data that is in this object. //------------------------------------------------------------------ bool -DataExtractor::ValidOffsetForDataOfSize (uint32_t offset, uint32_t length) const +DataExtractor::ValidOffsetForDataOfSize (offset_t offset, offset_t length) const { - size_t size = GetByteSize(); + offset_t size = GetByteSize(); if (offset >= size) return false; // offset isn't valid @@ -244,8 +244,8 @@ DataExtractor::ValidOffsetForDataOfSize (uint32_t offset, uint32_t length) const // reference to that data will be released. Is SWAP is set to true, // any data extracted will be endian swapped. //---------------------------------------------------------------------- -uint32_t -DataExtractor::SetData (const void *bytes, uint32_t length, ByteOrder endian) +lldb::offset_t +DataExtractor::SetData (const void *bytes, offset_t length, ByteOrder endian) { m_byte_order = endian; m_data_sp.reset(); @@ -276,8 +276,8 @@ DataExtractor::SetData (const void *bytes, uint32_t length, ByteOrder endian) // refers to those bytes. The address size and endian swap settings // are copied from the current values in "data". //---------------------------------------------------------------------- -uint32_t -DataExtractor::SetData (const DataExtractor& data, uint32_t data_offset, uint32_t data_length) +lldb::offset_t +DataExtractor::SetData (const DataExtractor& data, offset_t data_offset, offset_t data_length) { m_addr_size = data.m_addr_size; // If "data" contains shared pointer to data, then we can use that @@ -311,8 +311,8 @@ DataExtractor::SetData (const DataExtractor& data, uint32_t data_offset, uint32_ // around as long as it is needed. The address size and endian swap // settings will remain unchanged from their current settings. //---------------------------------------------------------------------- -uint32_t -DataExtractor::SetData (const DataBufferSP& data_sp, uint32_t data_offset, uint32_t data_length) +lldb::offset_t +DataExtractor::SetData (const DataBufferSP& data_sp, offset_t data_offset, offset_t data_length) { m_start = m_end = NULL; @@ -335,7 +335,7 @@ DataExtractor::SetData (const DataBufferSP& data_sp, uint32_t data_offset, uint3 } } - uint32_t new_size = GetByteSize(); + size_t new_size = GetByteSize(); // Don't hold a shared pointer to the data buffer if we don't share // any valid bytes in the shared buffer. @@ -352,7 +352,7 @@ DataExtractor::SetData (const DataBufferSP& data_sp, uint32_t data_offset, uint3 // RETURNS the byte that was extracted, or zero on failure. //---------------------------------------------------------------------- uint8_t -DataExtractor::GetU8 (uint32_t *offset_ptr) const +DataExtractor::GetU8 (offset_t *offset_ptr) const { uint8_t val = 0; if ( m_start < m_end ) @@ -373,9 +373,9 @@ DataExtractor::GetU8 (uint32_t *offset_ptr) const // the buffer due to being out of bounds, or unsufficient data. //---------------------------------------------------------------------- void * -DataExtractor::GetU8 (uint32_t *offset_ptr, void *dst, uint32_t count) const +DataExtractor::GetU8 (offset_t *offset_ptr, void *dst, uint32_t count) const { - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ((count > 0) && ValidOffsetForDataOfSize(offset, count) ) { @@ -396,10 +396,10 @@ DataExtractor::GetU8 (uint32_t *offset_ptr, void *dst, uint32_t count) const // RETURNS the uint16_t that was extracted, or zero on failure. //---------------------------------------------------------------------- uint16_t -DataExtractor::GetU16 (uint32_t *offset_ptr) const +DataExtractor::GetU16 (offset_t *offset_ptr) const { uint16_t val = 0; - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ( ValidOffsetForDataOfSize(offset, sizeof(val)) ) { if (m_byte_order != lldb::endian::InlHostByteOrder()) @@ -414,7 +414,7 @@ DataExtractor::GetU16 (uint32_t *offset_ptr) const } uint16_t -DataExtractor::GetU16_unchecked (uint32_t *offset_ptr) const +DataExtractor::GetU16_unchecked (offset_t *offset_ptr) const { uint16_t val = (m_byte_order == lldb::endian::InlHostByteOrder()) ? ReadInt16 (m_start, *offset_ptr) : @@ -424,7 +424,7 @@ DataExtractor::GetU16_unchecked (uint32_t *offset_ptr) const } uint32_t -DataExtractor::GetU32_unchecked (uint32_t *offset_ptr) const +DataExtractor::GetU32_unchecked (offset_t *offset_ptr) const { uint32_t val = (m_byte_order == lldb::endian::InlHostByteOrder()) ? ReadInt32 (m_start, *offset_ptr) : @@ -434,7 +434,7 @@ DataExtractor::GetU32_unchecked (uint32_t *offset_ptr) const } uint64_t -DataExtractor::GetU64_unchecked (uint32_t *offset_ptr) const +DataExtractor::GetU64_unchecked (offset_t *offset_ptr) const { uint64_t val = (m_byte_order == lldb::endian::InlHostByteOrder()) ? ReadInt64 (m_start, *offset_ptr) : @@ -454,11 +454,11 @@ DataExtractor::GetU64_unchecked (uint32_t *offset_ptr) const // in the buffer due to being out of bounds, or unsufficient data. //---------------------------------------------------------------------- void * -DataExtractor::GetU16 (uint32_t *offset_ptr, void *void_dst, uint32_t count) const +DataExtractor::GetU16 (offset_t *offset_ptr, void *void_dst, uint32_t count) const { uint16_t *dst = (uint16_t *)void_dst; const size_t value_size = sizeof(*dst); - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ((count > 0) && ValidOffsetForDataOfSize(offset, value_size * count) ) { @@ -490,10 +490,10 @@ DataExtractor::GetU16 (uint32_t *offset_ptr, void *void_dst, uint32_t count) con // RETURNS the uint32_t that was extracted, or zero on failure. //---------------------------------------------------------------------- uint32_t -DataExtractor::GetU32 (uint32_t *offset_ptr) const +DataExtractor::GetU32 (offset_t *offset_ptr) const { uint32_t val = 0; - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ( ValidOffsetForDataOfSize(offset, sizeof(val)) ) { @@ -518,11 +518,11 @@ DataExtractor::GetU32 (uint32_t *offset_ptr) const // in the buffer due to being out of bounds, or unsufficient data. //---------------------------------------------------------------------- void * -DataExtractor::GetU32 (uint32_t *offset_ptr, void *void_dst, uint32_t count) const +DataExtractor::GetU32 (offset_t *offset_ptr, void *void_dst, uint32_t count) const { uint32_t *dst = (uint32_t *)void_dst; const size_t value_size = sizeof(*dst); - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ((count > 0) && ValidOffsetForDataOfSize(offset, value_size * count)) { @@ -555,10 +555,10 @@ DataExtractor::GetU32 (uint32_t *offset_ptr, void *void_dst, uint32_t count) con // RETURNS the uint64_t that was extracted, or zero on failure. //---------------------------------------------------------------------- uint64_t -DataExtractor::GetU64 (uint32_t *offset_ptr) const +DataExtractor::GetU64 (offset_t *offset_ptr) const { uint64_t val = 0; - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ( ValidOffsetForDataOfSize(offset, sizeof(val)) ) { if (m_byte_order != lldb::endian::InlHostByteOrder()) @@ -580,11 +580,11 @@ DataExtractor::GetU64 (uint32_t *offset_ptr) const // return false and leave the offset pointed to by offset_ptr unchanged. //---------------------------------------------------------------------- void * -DataExtractor::GetU64 (uint32_t *offset_ptr, void *void_dst, uint32_t count) const +DataExtractor::GetU64 (offset_t *offset_ptr, void *void_dst, uint32_t count) const { uint64_t *dst = (uint64_t *)void_dst; const size_t value_size = sizeof(uint64_t); - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ((count > 0) && ValidOffsetForDataOfSize(offset, value_size * count)) { @@ -621,7 +621,7 @@ DataExtractor::GetU64 (uint32_t *offset_ptr, void *void_dst, uint32_t count) con // RETURNS the integer value that was extracted, or zero on failure. //---------------------------------------------------------------------- uint32_t -DataExtractor::GetMaxU32 (uint32_t *offset_ptr, uint32_t byte_size) const +DataExtractor::GetMaxU32 (offset_t *offset_ptr, size_t byte_size) const { switch (byte_size) { @@ -629,7 +629,7 @@ DataExtractor::GetMaxU32 (uint32_t *offset_ptr, uint32_t byte_size) const case 2: return GetU16(offset_ptr); break; case 4: return GetU32(offset_ptr); break; default: - assert(!"GetMaxU32 unhandled case!"); + assert("GetMaxU32 unhandled case!" == NULL); break; } return 0; @@ -646,7 +646,7 @@ DataExtractor::GetMaxU32 (uint32_t *offset_ptr, uint32_t byte_size) const // RETURNS the integer value that was extracted, or zero on failure. //---------------------------------------------------------------------- uint64_t -DataExtractor::GetMaxU64 (uint32_t *offset_ptr, uint32_t size) const +DataExtractor::GetMaxU64 (offset_t *offset_ptr, size_t size) const { switch (size) { @@ -655,14 +655,14 @@ DataExtractor::GetMaxU64 (uint32_t *offset_ptr, uint32_t size) const case 4: return GetU32(offset_ptr); break; case 8: return GetU64(offset_ptr); break; default: - assert(!"GetMax64 unhandled case!"); + assert("GetMax64 unhandled case!" == NULL); break; } return 0; } uint64_t -DataExtractor::GetMaxU64_unchecked (uint32_t *offset_ptr, uint32_t size) const +DataExtractor::GetMaxU64_unchecked (offset_t *offset_ptr, size_t size) const { switch (size) { @@ -671,14 +671,14 @@ DataExtractor::GetMaxU64_unchecked (uint32_t *offset_ptr, uint32_t size) const case 4: return GetU32_unchecked (offset_ptr); break; case 8: return GetU64_unchecked (offset_ptr); break; default: - assert(!"GetMax64 unhandled case!"); + assert("GetMax64 unhandled case!" == NULL); break; } return 0; } int64_t -DataExtractor::GetMaxS64 (uint32_t *offset_ptr, uint32_t size) const +DataExtractor::GetMaxS64 (offset_t *offset_ptr, size_t size) const { switch (size) { @@ -687,14 +687,14 @@ DataExtractor::GetMaxS64 (uint32_t *offset_ptr, uint32_t size) const case 4: return (int32_t)GetU32(offset_ptr); break; case 8: return (int64_t)GetU64(offset_ptr); break; default: - assert(!"GetMax64 unhandled case!"); + assert("GetMax64 unhandled case!" == NULL); break; } return 0; } uint64_t -DataExtractor::GetMaxU64Bitfield (uint32_t *offset_ptr, uint32_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const +DataExtractor::GetMaxU64Bitfield (offset_t *offset_ptr, size_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const { uint64_t uval64 = GetMaxU64 (offset_ptr, size); if (bitfield_bit_size > 0) @@ -710,7 +710,7 @@ DataExtractor::GetMaxU64Bitfield (uint32_t *offset_ptr, uint32_t size, uint32_t } int64_t -DataExtractor::GetMaxS64Bitfield (uint32_t *offset_ptr, uint32_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const +DataExtractor::GetMaxS64Bitfield (offset_t *offset_ptr, size_t size, uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset) const { int64_t sval64 = GetMaxS64 (offset_ptr, size); if (bitfield_bit_size > 0) @@ -728,7 +728,7 @@ DataExtractor::GetMaxS64Bitfield (uint32_t *offset_ptr, uint32_t size, uint32_t float -DataExtractor::GetFloat (uint32_t *offset_ptr) const +DataExtractor::GetFloat (offset_t *offset_ptr) const { typedef float float_type; float_type val = 0.0; @@ -754,7 +754,7 @@ DataExtractor::GetFloat (uint32_t *offset_ptr) const } double -DataExtractor::GetDouble (uint32_t *offset_ptr) const +DataExtractor::GetDouble (offset_t *offset_ptr) const { typedef double float_type; float_type val = 0.0; @@ -781,7 +781,7 @@ DataExtractor::GetDouble (uint32_t *offset_ptr) const long double -DataExtractor::GetLongDouble (uint32_t *offset_ptr) const +DataExtractor::GetLongDouble (offset_t *offset_ptr) const { typedef long double float_type; float_type val = 0.0; @@ -816,13 +816,13 @@ DataExtractor::GetLongDouble (uint32_t *offset_ptr) const // RETURNS the address that was extracted, or zero on failure. //------------------------------------------------------------------ uint64_t -DataExtractor::GetAddress (uint32_t *offset_ptr) const +DataExtractor::GetAddress (offset_t *offset_ptr) const { return GetMaxU64 (offset_ptr, m_addr_size); } uint64_t -DataExtractor::GetAddress_unchecked (uint32_t *offset_ptr) const +DataExtractor::GetAddress_unchecked (offset_t *offset_ptr) const { return GetMaxU64_unchecked (offset_ptr, m_addr_size); } @@ -836,7 +836,7 @@ DataExtractor::GetAddress_unchecked (uint32_t *offset_ptr) const // RETURNS the pointer that was extracted, or zero on failure. //------------------------------------------------------------------ uint64_t -DataExtractor::GetPointer (uint32_t *offset_ptr) const +DataExtractor::GetPointer (offset_t *offset_ptr) const { return GetMaxU64 (offset_ptr, m_addr_size); } @@ -849,7 +849,7 @@ DataExtractor::GetPointer (uint32_t *offset_ptr) const //---------------------------------------------------------------------- uint64_t -DataExtractor::GetGNUEHPointer (uint32_t *offset_ptr, uint32_t eh_ptr_enc, lldb::addr_t pc_rel_addr, lldb::addr_t text_addr, lldb::addr_t data_addr)//, BSDRelocs *data_relocs) const +DataExtractor::GetGNUEHPointer (offset_t *offset_ptr, uint32_t eh_ptr_enc, lldb::addr_t pc_rel_addr, lldb::addr_t text_addr, lldb::addr_t data_addr)//, BSDRelocs *data_relocs) const { if (eh_ptr_enc == DW_EH_PE_omit) return ULLONG_MAX; // Value isn't in the buffer... @@ -948,7 +948,7 @@ DataExtractor::GetGNUEHPointer (uint32_t *offset_ptr, uint32_t eh_ptr_enc, lldb: } size_t -DataExtractor::ExtractBytes (uint32_t offset, uint32_t length, ByteOrder dst_byte_order, void *dst) const +DataExtractor::ExtractBytes (offset_t offset, offset_t length, ByteOrder dst_byte_order, void *dst) const { const uint8_t *src = PeekData (offset, length); if (src) @@ -971,7 +971,7 @@ DataExtractor::ExtractBytes (uint32_t offset, uint32_t length, ByteOrder dst_byt // and there are "length" bytes available, else NULL is returned. //---------------------------------------------------------------------- const uint8_t* -DataExtractor::PeekData (uint32_t offset, uint32_t length) const +DataExtractor::PeekData (offset_t offset, offset_t length) const { if ( length > 0 && ValidOffsetForDataOfSize(offset, length) ) return m_start + offset; @@ -988,10 +988,10 @@ DataExtractor::PeekData (uint32_t offset, uint32_t length) const // or NULL otherwise. //---------------------------------------------------------------------- const void* -DataExtractor::GetData (uint32_t *offset_ptr, uint32_t length) const +DataExtractor::GetData (offset_t *offset_ptr, offset_t length) const { const uint8_t* bytes = NULL; - register uint32_t offset = *offset_ptr; + lldb::offset_t offset = *offset_ptr; if ( length > 0 && ValidOffsetForDataOfSize(offset, length) ) { bytes = m_start + offset; @@ -1001,15 +1001,16 @@ DataExtractor::GetData (uint32_t *offset_ptr, uint32_t length) const } // Extract data and swap if needed when doing the copy -uint32_t -DataExtractor::CopyByteOrderedData (uint32_t src_offset, - uint32_t src_len, +lldb::offset_t +DataExtractor::CopyByteOrderedData (offset_t src_offset, + offset_t src_len, void *dst_void_ptr, - uint32_t dst_len, + offset_t dst_len, ByteOrder dst_byte_order) const { // Validate the source info - assert (ValidOffsetForDataOfSize(src_offset, src_len)); + if (!ValidOffsetForDataOfSize(src_offset, src_len)) + assert (ValidOffsetForDataOfSize(src_offset, src_len)); assert (src_len > 0); assert (m_byte_order == eByteOrderBig || m_byte_order == eByteOrderLittle); @@ -1033,7 +1034,7 @@ DataExtractor::CopyByteOrderedData (uint32_t src_offset, // We are copying the entire value from src into dst. // Calculate how many, if any, zeroes we need for the most // significant bytes if "dst_len" is greater than "src_len"... - const uint32_t num_zeroes = dst_len - src_len; + const size_t num_zeroes = dst_len - src_len; if (dst_byte_order == eByteOrderBig) { // Big endian, so we lead with zeroes... @@ -1126,7 +1127,7 @@ DataExtractor::CopyByteOrderedData (uint32_t src_offset, // updated. //---------------------------------------------------------------------- const char* -DataExtractor::GetCStr (uint32_t *offset_ptr) const +DataExtractor::GetCStr (offset_t *offset_ptr) const { const char *s = NULL; if ( m_start < m_end ) @@ -1153,7 +1154,7 @@ DataExtractor::GetCStr (uint32_t *offset_ptr) const // this object's data, else NULL is returned. //------------------------------------------------------------------ const char * -DataExtractor::PeekCStr (uint32_t offset) const +DataExtractor::PeekCStr (offset_t offset) const { if (ValidOffset (offset)) return (const char*)m_start + offset; @@ -1169,7 +1170,7 @@ DataExtractor::PeekCStr (uint32_t offset) const // Returned the extracted integer value. //---------------------------------------------------------------------- uint64_t -DataExtractor::GetULEB128 (uint32_t *offset_ptr) const +DataExtractor::GetULEB128 (offset_t *offset_ptr) const { const uint8_t *src = m_start + *offset_ptr; const uint8_t *end = m_end; @@ -1206,7 +1207,7 @@ DataExtractor::GetULEB128 (uint32_t *offset_ptr) const // Returned the extracted integer value. //---------------------------------------------------------------------- int64_t -DataExtractor::GetSLEB128 (uint32_t *offset_ptr) const +DataExtractor::GetSLEB128 (offset_t *offset_ptr) const { int64_t result = 0; @@ -1247,7 +1248,7 @@ DataExtractor::GetSLEB128 (uint32_t *offset_ptr) const // Returns the number of bytes consumed during the extraction. //---------------------------------------------------------------------- uint32_t -DataExtractor::Skip_LEB128 (uint32_t *offset_ptr) const +DataExtractor::Skip_LEB128 (offset_t *offset_ptr) const { uint32_t bytes_consumed = 0; if ( m_start < m_end ) @@ -1263,11 +1264,11 @@ DataExtractor::Skip_LEB128 (uint32_t *offset_ptr) const return bytes_consumed; } -static uint32_t -DumpAPInt (Stream *s, const DataExtractor &data, uint32_t offset, uint32_t byte_size, bool is_signed, unsigned radix) +static lldb::offset_t +DumpAPInt (Stream *s, const DataExtractor &data, lldb::offset_t offset, lldb::offset_t byte_size, bool is_signed, unsigned radix) { llvm::SmallVector<uint64_t, 2> uint64_array; - uint32_t bytes_left = byte_size; + lldb::offset_t bytes_left = byte_size; uint64_t u64; const lldb::ByteOrder byte_order = data.GetByteOrder(); if (byte_order == lldb::eByteOrderLittle) @@ -1281,7 +1282,7 @@ DumpAPInt (Stream *s, const DataExtractor &data, uint32_t offset, uint32_t byte_ } else { - u64 = data.GetMaxU64(&offset, bytes_left); + u64 = data.GetMaxU64(&offset, (uint32_t)bytes_left); bytes_left = 0; } uint64_array.push_back(u64); @@ -1289,8 +1290,8 @@ DumpAPInt (Stream *s, const DataExtractor &data, uint32_t offset, uint32_t byte_ } else if (byte_order == lldb::eByteOrderBig) { - uint32_t be_offset = offset + byte_size; - uint32_t temp_offset; + lldb::offset_t be_offset = offset + byte_size; + lldb::offset_t temp_offset; while (bytes_left > 0) { if (bytes_left >= 8) @@ -1304,7 +1305,7 @@ DumpAPInt (Stream *s, const DataExtractor &data, uint32_t offset, uint32_t byte_ { be_offset -= bytes_left; temp_offset = be_offset; - u64 = data.GetMaxU64(&temp_offset, bytes_left); + u64 = data.GetMaxU64(&temp_offset, (uint32_t)bytes_left); bytes_left = 0; } uint64_array.push_back(u64); @@ -1331,13 +1332,13 @@ DumpAPInt (Stream *s, const DataExtractor &data, uint32_t offset, uint32_t byte_ return offset; } -uint32_t +lldb::offset_t DataExtractor::Dump (Stream *s, - uint32_t start_offset, + offset_t start_offset, lldb::Format item_format, - uint32_t item_byte_size, - uint32_t item_count, - uint32_t num_per_line, + size_t item_byte_size, + size_t item_count, + size_t num_per_line, uint64_t base_addr, uint32_t item_bit_size, // If zero, this is not a bitfield value, if non-zero, the value is a bitfield uint32_t item_bit_offset, // If "item_bit_size" is non-zero, this is the shift amount to apply to a bitfield @@ -1352,7 +1353,7 @@ DataExtractor::Dump (Stream *s, item_byte_size = s->GetAddressByteSize(); } - uint32_t offset = start_offset; + offset_t offset = start_offset; if (item_format == eFormatInstruction) { @@ -1393,7 +1394,7 @@ DataExtractor::Dump (Stream *s, if ((item_format == eFormatOSType || item_format == eFormatAddressInfo) && item_byte_size > 8) item_format = eFormatHex; - uint32_t line_start_offset = start_offset; + lldb::offset_t line_start_offset = start_offset; for (uint32_t count = 0; ValidOffset(offset) && count < item_count; ++count) { if ((count % num_per_line) == 0) @@ -1402,8 +1403,8 @@ DataExtractor::Dump (Stream *s, { if (item_format == eFormatBytesWithASCII && offset > line_start_offset) { - s->Printf("%*s", (num_per_line - (offset - line_start_offset)) * 3 + 2, ""); - Dump(s, line_start_offset, eFormatCharPrintable, 1, offset - line_start_offset, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0); + s->Printf("%*s", static_cast<int>((num_per_line - (offset - line_start_offset)) * 3 + 2), ""); + Dump(s, line_start_offset, eFormatCharPrintable, 1, offset - line_start_offset, LLDB_INVALID_OFFSET, LLDB_INVALID_ADDRESS, 0, 0); } s->EOL(); } @@ -1428,7 +1429,7 @@ DataExtractor::Dump (Stream *s, s->Printf ("%s", GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset) ? "true" : "false"); else { - s->Printf("error: unsupported byte size (%u) for boolean format", item_byte_size); + s->Printf("error: unsupported byte size (%zu) for boolean format", item_byte_size); return offset; } break; @@ -1584,7 +1585,7 @@ DataExtractor::Dump (Stream *s, if (!cstr) { s->Printf("NULL"); - offset = UINT32_MAX; + offset = LLDB_INVALID_OFFSET; } else { @@ -1628,7 +1629,7 @@ DataExtractor::Dump (Stream *s, case eFormatComplexInteger: { - uint32_t complex_int_byte_size = item_byte_size / 2; + size_t complex_int_byte_size = item_byte_size / 2; if (complex_int_byte_size <= 8) { @@ -1637,7 +1638,7 @@ DataExtractor::Dump (Stream *s, } else { - s->Printf("error: unsupported byte size (%u) for complex integer format", item_byte_size); + s->Printf("error: unsupported byte size (%zu) for complex integer format", item_byte_size); return offset; } } @@ -1669,7 +1670,7 @@ DataExtractor::Dump (Stream *s, } else { - s->Printf("error: unsupported byte size (%u) for complex float format", item_byte_size); + s->Printf("error: unsupported byte size (%zu) for complex float format", item_byte_size); return offset; } break; @@ -1682,7 +1683,7 @@ DataExtractor::Dump (Stream *s, bool wantsuppercase = (item_format == eFormatHexUppercase); if (item_byte_size <= 8) { - s->Printf(wantsuppercase ? "0x%*.*" PRIX64 : "0x%*.*" PRIx64, 2 * item_byte_size, 2 * item_byte_size, GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); + s->Printf(wantsuppercase ? "0x%*.*" PRIX64 : "0x%*.*" PRIx64, (int)(2 * item_byte_size), (int)(2 * item_byte_size), GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); } else { @@ -1727,7 +1728,7 @@ DataExtractor::Dump (Stream *s, } else { - s->Printf("error: unsupported byte size (%u) for float format", item_byte_size); + s->Printf("error: unsupported byte size (%zu) for float format", item_byte_size); return offset; } ss.flush(); @@ -1746,7 +1747,7 @@ DataExtractor::Dump (Stream *s, case eFormatAddressInfo: { addr_t addr = GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset); - s->Printf("0x%*.*" PRIx64, 2 * item_byte_size, 2 * item_byte_size, addr); + s->Printf("0x%*.*" PRIx64, (int)(2 * item_byte_size), (int)(2 * item_byte_size), addr); if (exe_scope) { TargetSP target_sp (exe_scope->CalculateTarget()); @@ -1790,7 +1791,7 @@ DataExtractor::Dump (Stream *s, } else { - s->Printf("error: unsupported byte size (%u) for hex float format", item_byte_size); + s->Printf("error: unsupported byte size (%zu) for hex float format", item_byte_size); return offset; } break; @@ -1874,8 +1875,8 @@ DataExtractor::Dump (Stream *s, if (item_format == eFormatBytesWithASCII && offset > line_start_offset) { - s->Printf("%*s", (num_per_line - (offset - line_start_offset)) * 3 + 2, ""); - Dump(s, line_start_offset, eFormatCharPrintable, 1, offset - line_start_offset, UINT32_MAX, LLDB_INVALID_ADDRESS, 0, 0); + s->Printf("%*s", static_cast<int>((num_per_line - (offset - line_start_offset)) * 3 + 2), ""); + Dump(s, line_start_offset, eFormatCharPrintable, 1, offset - line_start_offset, LLDB_INVALID_OFFSET, LLDB_INVALID_ADDRESS, 0, 0); } return offset; // Return the offset at which we ended up } @@ -1892,12 +1893,12 @@ DataExtractor::Dump (Stream *s, // string will be used for the supplied "type". If the stream "s" // is NULL, then the output will be send to Log(). //---------------------------------------------------------------------- -uint32_t +lldb::offset_t DataExtractor::PutToLog ( Log *log, - uint32_t start_offset, - uint32_t length, + offset_t start_offset, + offset_t length, uint64_t base_addr, uint32_t num_per_line, DataExtractor::Type type, @@ -1907,8 +1908,8 @@ DataExtractor::PutToLog if (log == NULL) return start_offset; - uint32_t offset; - uint32_t end_offset; + offset_t offset; + offset_t end_offset; uint32_t count; StreamString sstr; for (offset = start_offset, end_offset = offset + length, count = 0; ValidOffset(offset) && offset < end_offset; ++count) @@ -1956,7 +1957,7 @@ DataExtractor::PutToLog // Dump out a UUID starting at 'offset' bytes into the buffer //---------------------------------------------------------------------- void -DataExtractor::DumpUUID (Stream *s, uint32_t offset) const +DataExtractor::DumpUUID (Stream *s, offset_t offset) const { if (s) { @@ -1968,7 +1969,7 @@ DataExtractor::DumpUUID (Stream *s, uint32_t offset) const } else { - s->Printf("<not enough data for UUID at offset 0x%8.8x>", offset); + s->Printf("<not enough data for UUID at offset 0x%8.8" PRIx64 ">", offset); } } } @@ -2039,7 +2040,7 @@ DataExtractor::Append(DataExtractor& rhs) } bool -DataExtractor::Append(void* buf, uint32_t length) +DataExtractor::Append(void* buf, offset_t length) { if (buf == NULL) return false; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 2a296dba15b..e7e0e203f4d 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -999,7 +999,7 @@ Debugger::GetAsyncErrorStream () CommandInterpreter::eBroadcastBitAsynchronousErrorData)); } -uint32_t +size_t Debugger::GetNumDebuggers() { if (g_shared_debugger_refcount > 0) @@ -1011,7 +1011,7 @@ Debugger::GetNumDebuggers() } lldb::DebuggerSP -Debugger::GetDebuggerAtIndex (uint32_t index) +Debugger::GetDebuggerAtIndex (size_t index) { DebuggerSP debugger_sp; @@ -1228,7 +1228,7 @@ ScanBracketedRange (const char* var_name_begin, { if (log) log->Printf("[ScanBracketedRange] swapping indices"); - int temp = *index_lower; + int64_t temp = *index_lower; *index_lower = *index_higher; *index_higher = temp; } @@ -1240,7 +1240,7 @@ ScanBracketedRange (const char* var_name_begin, static ValueObjectSP ExpandIndexedExpression (ValueObject* valobj, - uint32_t index, + size_t index, StackFrame* frame, bool deref_pointer) { @@ -2539,8 +2539,7 @@ Debugger::FormatPrompt unsigned long octal_value = ::strtoul (oct_str, NULL, 8); if (octal_value <= UINT8_MAX) { - char octal_char = octal_value; - s.Write (&octal_char, 1); + s.PutChar((char)octal_value); } } break; @@ -2563,7 +2562,7 @@ Debugger::FormatPrompt unsigned long hex_value = strtoul (hex_str, NULL, 16); if (hex_value <= UINT8_MAX) - s.PutChar (hex_value); + s.PutChar ((char)hex_value); } else { diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 08d6d9a5ac0..0d29e01ecc9 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -638,7 +638,7 @@ Instruction::ReadArray (FILE *in_file, Stream *out_stream, OptionValue::Type dat std::string line (buffer); - int len = line.size(); + size_t len = line.size(); if (line[len-1] == '\n') { line[len-1] = '\0'; @@ -706,7 +706,7 @@ Instruction::ReadDictionary (FILE *in_file, Stream *out_stream) // Check to see if the line contains the end-of-dictionary marker ("}") std::string line (buffer); - int len = line.size(); + size_t len = line.size(); if (line[len-1] == '\n') { line[len-1] = '\0'; @@ -776,7 +776,7 @@ Instruction::ReadDictionary (FILE *in_file, Stream *out_stream) } else { - int len = value.size(); + size_t len = value.size(); if ((value[0] == '"') && (value[len-1] == '"')) value = value.substr (1, len-2); value_sp.reset (new OptionValueString (value.c_str(), "")); @@ -945,7 +945,7 @@ InstructionList::GetMaxOpcocdeByteSize () const InstructionSP -InstructionList::GetInstructionAtIndex (uint32_t idx) const +InstructionList::GetInstructionAtIndex (size_t idx) const { InstructionSP inst_sp; if (idx < m_instructions.size()) @@ -1007,9 +1007,9 @@ InstructionList::GetIndexOfInstructionAtLoadAddress (lldb::addr_t load_addr, Tar { Address address; address.SetLoadAddress(load_addr, &target); - uint32_t num_instructions = m_instructions.size(); + size_t num_instructions = m_instructions.size(); uint32_t index = UINT32_MAX; - for (int i = 0; i < num_instructions; i++) + for (size_t i = 0; i < num_instructions; i++) { if (m_instructions[i]->GetAddress() == address) { @@ -1171,7 +1171,7 @@ PseudoInstruction::DoesBranch () const size_t PseudoInstruction::Decode (const lldb_private::Disassembler &disassembler, const lldb_private::DataExtractor &data, - uint32_t data_offset) + lldb::offset_t data_offset) { return m_opcode.GetByteSize(); } diff --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp index ad074181aff..73763f5ceec 100644 --- a/lldb/source/Core/EmulateInstruction.cpp +++ b/lldb/source/Core/EmulateInstruction.cpp @@ -186,7 +186,7 @@ EmulateInstruction::ReadMemoryUnsigned (const Context &context, lldb::addr_t add size_t bytes_read = m_read_mem_callback (this, m_baton, context, addr, buf, byte_size); if (bytes_read == byte_size) { - uint32_t offset = 0; + lldb::offset_t offset = 0; DataExtractor data (buf, byte_size, GetByteOrder(), GetAddressByteSize()); uval64 = data.GetMaxU64 (&offset, byte_size); success = true; diff --git a/lldb/source/Core/Error.cpp b/lldb/source/Core/Error.cpp index 61faca464b7..9de99be12f5 100644 --- a/lldb/source/Core/Error.cpp +++ b/lldb/source/Core/Error.cpp @@ -356,7 +356,7 @@ Error::SetErrorStringWithVarArg (const char *format, va_list args) // allocated buffer above va_list copy_args; va_copy (copy_args, args); - size_t length = ::vsnprintf (buf.data(), buf.size(), format, args); + unsigned length = ::vsnprintf (buf.data(), buf.size(), format, args); if (length >= buf.size()) { // The error formatted string didn't fit into our buffer, resize it diff --git a/lldb/source/Core/FileSpecList.cpp b/lldb/source/Core/FileSpecList.cpp index a24494d16e4..0cec8faa6bc 100644 --- a/lldb/source/Core/FileSpecList.cpp +++ b/lldb/source/Core/FileSpecList.cpp @@ -106,17 +106,16 @@ FileSpecList::Dump(Stream *s, const char *separator_cstr) const // Returns the valid index of the file that matches "file_spec" if // it is found, else UINT32_MAX is returned. //------------------------------------------------------------------ -uint32_t -FileSpecList::FindFileIndex (uint32_t start_idx, const FileSpec &file_spec, bool full) const +size_t +FileSpecList::FindFileIndex (size_t start_idx, const FileSpec &file_spec, bool full) const { - const uint32_t num_files = m_files.size(); - uint32_t idx; + const size_t num_files = m_files.size(); // When looking for files, we will compare only the filename if the // FILE_SPEC argument is empty bool compare_filename_only = file_spec.GetDirectory().IsEmpty(); - for (idx = start_idx; idx < num_files; ++idx) + for (size_t idx = start_idx; idx < num_files; ++idx) { if (compare_filename_only) { @@ -139,7 +138,7 @@ FileSpecList::FindFileIndex (uint32_t start_idx, const FileSpec &file_spec, bool // range, then an empty FileSpec object will be returned. //------------------------------------------------------------------ const FileSpec & -FileSpecList::GetFileSpecAtIndex(uint32_t idx) const +FileSpecList::GetFileSpecAtIndex(size_t idx) const { if (idx < m_files.size()) @@ -149,7 +148,7 @@ FileSpecList::GetFileSpecAtIndex(uint32_t idx) const } const FileSpec * -FileSpecList::GetFileSpecPointerAtIndex(uint32_t idx) const +FileSpecList::GetFileSpecPointerAtIndex(size_t idx) const { if (idx < m_files.size()) return &m_files[idx]; @@ -179,7 +178,7 @@ FileSpecList::MemorySize () const //------------------------------------------------------------------ // Return the number of files in the file spec list. //------------------------------------------------------------------ -uint32_t +size_t FileSpecList::GetSize() const { return m_files.size(); diff --git a/lldb/source/Core/FormatClasses.cpp b/lldb/source/Core/FormatClasses.cpp index 84d450a90b8..cc25f38e561 100644 --- a/lldb/source/Core/FormatClasses.cpp +++ b/lldb/source/Core/FormatClasses.cpp @@ -345,7 +345,7 @@ TypeSyntheticImpl::FrontEnd::~FrontEnd() } lldb::ValueObjectSP -TypeSyntheticImpl::FrontEnd::GetChildAtIndex (uint32_t idx) +TypeSyntheticImpl::FrontEnd::GetChildAtIndex (size_t idx) { if (!m_wrapper_sp || !m_interpreter) return lldb::ValueObjectSP(); @@ -369,7 +369,7 @@ TypeSyntheticImpl::GetDescription() #endif // #ifndef LLDB_DISABLE_PYTHON int -SyntheticArrayView::GetRealIndexForIndex(int i) +SyntheticArrayView::GetRealIndexForIndex(size_t i) { if (i >= GetCount()) return -1; diff --git a/lldb/source/Core/FormatManager.cpp b/lldb/source/Core/FormatManager.cpp index cd2ae7f29f2..2a84b806124 100644 --- a/lldb/source/Core/FormatManager.cpp +++ b/lldb/source/Core/FormatManager.cpp @@ -615,7 +615,7 @@ CategoryMap::LoopThrough(CallbackType callback, void* param) } TypeCategoryImplSP -CategoryMap::GetAtIndex (uint32_t index) +CategoryMap::GetAtIndex (size_t index) { Mutex::Locker locker(m_map_mutex); diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 82abbaec557..e7012875607 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -346,16 +346,15 @@ void Module::ParseAllDebugSymbols() { Mutex::Locker locker (m_mutex); - uint32_t num_comp_units = GetNumCompileUnits(); + size_t num_comp_units = GetNumCompileUnits(); if (num_comp_units == 0) return; SymbolContext sc; sc.module_sp = shared_from_this(); - uint32_t cu_idx; SymbolVendor *symbols = GetSymbolVendor (); - for (cu_idx = 0; cu_idx < num_comp_units; cu_idx++) + for (size_t cu_idx = 0; cu_idx < num_comp_units; cu_idx++) { sc.comp_unit = symbols->GetCompileUnitAtIndex(cu_idx).get(); if (sc.comp_unit) @@ -365,8 +364,7 @@ Module::ParseAllDebugSymbols() symbols->ParseCompileUnitFunctions(sc); - uint32_t func_idx; - for (func_idx = 0; (sc.function = sc.comp_unit->GetFunctionAtIndex(func_idx).get()) != NULL; ++func_idx) + for (size_t func_idx = 0; (sc.function = sc.comp_unit->GetFunctionAtIndex(func_idx).get()) != NULL; ++func_idx) { symbols->ParseFunctionBlocks(sc); @@ -400,7 +398,7 @@ Module::DumpSymbolContext(Stream *s) s->Printf(", Module{%p}", this); } -uint32_t +size_t Module::GetNumCompileUnits() { Mutex::Locker locker (m_mutex); @@ -412,10 +410,10 @@ Module::GetNumCompileUnits() } CompUnitSP -Module::GetCompileUnitAtIndex (uint32_t index) +Module::GetCompileUnitAtIndex (size_t index) { Mutex::Locker locker (m_mutex); - uint32_t num_comp_units = GetNumCompileUnits (); + size_t num_comp_units = GetNumCompileUnits (); CompUnitSP cu_sp; if (index < num_comp_units) @@ -529,16 +527,24 @@ Module::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_t li } -uint32_t -Module::FindGlobalVariables(const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, uint32_t max_matches, VariableList& variables) +size_t +Module::FindGlobalVariables (const ConstString &name, + const ClangNamespaceDecl *namespace_decl, + bool append, + size_t max_matches, + VariableList& variables) { SymbolVendor *symbols = GetSymbolVendor (); if (symbols) return symbols->FindGlobalVariables(name, namespace_decl, append, max_matches, variables); return 0; } -uint32_t -Module::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables) + +size_t +Module::FindGlobalVariables (const RegularExpression& regex, + bool append, + size_t max_matches, + VariableList& variables) { SymbolVendor *symbols = GetSymbolVendor (); if (symbols) @@ -546,7 +552,7 @@ Module::FindGlobalVariables(const RegularExpression& regex, bool append, uint32_ return 0; } -uint32_t +size_t Module::FindCompileUnits (const FileSpec &path, bool append, SymbolContextList &sc_list) @@ -554,12 +560,12 @@ Module::FindCompileUnits (const FileSpec &path, if (!append) sc_list.Clear(); - const uint32_t start_size = sc_list.GetSize(); - const uint32_t num_compile_units = GetNumCompileUnits(); + const size_t start_size = sc_list.GetSize(); + const size_t num_compile_units = GetNumCompileUnits(); SymbolContext sc; sc.module_sp = shared_from_this(); const bool compare_directory = path.GetDirectory(); - for (uint32_t i=0; i<num_compile_units; ++i) + for (size_t i=0; i<num_compile_units; ++i) { sc.comp_unit = GetCompileUnitAtIndex(i).get(); if (sc.comp_unit) @@ -571,10 +577,10 @@ Module::FindCompileUnits (const FileSpec &path, return sc_list.GetSize() - start_size; } -uint32_t +size_t Module::FindFunctions (const ConstString &name, const ClangNamespaceDecl *namespace_decl, - uint32_t name_type_mask, + uint32_t name_type_mask, bool include_symbols, bool include_inlines, bool append, @@ -583,7 +589,7 @@ Module::FindFunctions (const ConstString &name, if (!append) sc_list.Clear(); - const uint32_t start_size = sc_list.GetSize(); + const size_t start_size = sc_list.GetSize(); // Find all the functions (not symbols, but debug information functions... SymbolVendor *symbols = GetSymbolVendor (); @@ -601,12 +607,12 @@ Module::FindFunctions (const ConstString &name, { std::vector<uint32_t> symbol_indexes; symtab->FindAllSymbolsWithNameAndType (name, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes); - const uint32_t num_matches = symbol_indexes.size(); + const size_t num_matches = symbol_indexes.size(); if (num_matches) { const bool merge_symbol_into_function = true; SymbolContext sc(this); - for (uint32_t i=0; i<num_matches; i++) + for (size_t i=0; i<num_matches; i++) { sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]); sc_list.AppendIfUnique (sc, merge_symbol_into_function); @@ -618,7 +624,7 @@ Module::FindFunctions (const ConstString &name, return sc_list.GetSize() - start_size; } -uint32_t +size_t Module::FindFunctions (const RegularExpression& regex, bool include_symbols, bool include_inlines, @@ -628,7 +634,7 @@ Module::FindFunctions (const RegularExpression& regex, if (!append) sc_list.Clear(); - const uint32_t start_size = sc_list.GetSize(); + const size_t start_size = sc_list.GetSize(); SymbolVendor *symbols = GetSymbolVendor (); if (symbols) @@ -644,12 +650,12 @@ Module::FindFunctions (const RegularExpression& regex, { std::vector<uint32_t> symbol_indexes; symtab->AppendSymbolIndexesMatchingRegExAndType (regex, eSymbolTypeCode, Symtab::eDebugAny, Symtab::eVisibilityAny, symbol_indexes); - const uint32_t num_matches = symbol_indexes.size(); + const size_t num_matches = symbol_indexes.size(); if (num_matches) { const bool merge_symbol_into_function = true; SymbolContext sc(this); - for (uint32_t i=0; i<num_matches; i++) + for (size_t i=0; i<num_matches; i++) { sc.symbol = symtab->SymbolAtIndex(symbol_indexes[i]); sc_list.AppendIfUnique (sc, merge_symbol_into_function); @@ -661,12 +667,12 @@ Module::FindFunctions (const RegularExpression& regex, return sc_list.GetSize() - start_size; } -uint32_t +size_t Module::FindTypes_Impl (const SymbolContext& sc, const ConstString &name, const ClangNamespaceDecl *namespace_decl, bool append, - uint32_t max_matches, + size_t max_matches, TypeList& types) { Timer scoped_timer(__PRETTY_FUNCTION__, __PRETTY_FUNCTION__); @@ -679,11 +685,11 @@ Module::FindTypes_Impl (const SymbolContext& sc, return 0; } -uint32_t +size_t Module::FindTypesInNamespace (const SymbolContext& sc, const ConstString &type_name, const ClangNamespaceDecl *namespace_decl, - uint32_t max_matches, + size_t max_matches, TypeList& type_list) { const bool append = true; @@ -696,21 +702,21 @@ Module::FindFirstType (const SymbolContext& sc, bool exact_match) { TypeList type_list; - const uint32_t num_matches = FindTypes (sc, name, exact_match, 1, type_list); + const size_t num_matches = FindTypes (sc, name, exact_match, 1, type_list); if (num_matches) return type_list.GetTypeAtIndex(0); return TypeSP(); } -uint32_t +size_t Module::FindTypes (const SymbolContext& sc, const ConstString &name, bool exact_match, - uint32_t max_matches, + size_t max_matches, TypeList& types) { - uint32_t num_matches = 0; + size_t num_matches = 0; const char *type_name_cstr = name.GetCString(); std::string type_scope; std::string type_basename; @@ -756,17 +762,6 @@ Module::FindTypes (const SymbolContext& sc, } -//uint32_t -//Module::FindTypes(const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, Type::Encoding encoding, const char *udt_name, TypeList& types) -//{ -// Timer scoped_timer(__PRETTY_FUNCTION__); -// SymbolVendor *symbols = GetSymbolVendor (); -// if (symbols) -// return symbols->FindTypes(sc, regex, append, max_matches, encoding, udt_name, types); -// return 0; -// -//} - SymbolVendor* Module::GetSymbolVendor (bool can_create, lldb_private::Stream *feedback_strm) { diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index f2f39204688..05dc3e3a786 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -296,14 +296,14 @@ ModuleList::ClearImpl (bool use_notifier) } Module* -ModuleList::GetModulePointerAtIndex (uint32_t idx) const +ModuleList::GetModulePointerAtIndex (size_t idx) const { Mutex::Locker locker(m_modules_mutex); return GetModulePointerAtIndexUnlocked(idx); } Module* -ModuleList::GetModulePointerAtIndexUnlocked (uint32_t idx) const +ModuleList::GetModulePointerAtIndexUnlocked (size_t idx) const { if (idx < m_modules.size()) return m_modules[idx].get(); @@ -311,14 +311,14 @@ ModuleList::GetModulePointerAtIndexUnlocked (uint32_t idx) const } ModuleSP -ModuleList::GetModuleAtIndex(uint32_t idx) const +ModuleList::GetModuleAtIndex(size_t idx) const { Mutex::Locker locker(m_modules_mutex); return GetModuleAtIndexUnlocked(idx); } ModuleSP -ModuleList::GetModuleAtIndexUnlocked(uint32_t idx) const +ModuleList::GetModuleAtIndexUnlocked(size_t idx) const { ModuleSP module_sp; if (idx < m_modules.size()) @@ -326,7 +326,7 @@ ModuleList::GetModuleAtIndexUnlocked(uint32_t idx) const return module_sp; } -uint32_t +size_t ModuleList::FindFunctions (const ConstString &name, uint32_t name_type_mask, bool include_symbols, @@ -347,7 +347,7 @@ ModuleList::FindFunctions (const ConstString &name, return sc_list.GetSize(); } -uint32_t +size_t ModuleList::FindCompileUnits (const FileSpec &path, bool append, SymbolContextList &sc_list) const @@ -365,10 +365,10 @@ ModuleList::FindCompileUnits (const FileSpec &path, return sc_list.GetSize(); } -uint32_t +size_t ModuleList::FindGlobalVariables (const ConstString &name, bool append, - uint32_t max_matches, + size_t max_matches, VariableList& variable_list) const { size_t initial_size = variable_list.GetSize(); @@ -382,10 +382,10 @@ ModuleList::FindGlobalVariables (const ConstString &name, } -uint32_t +size_t ModuleList::FindGlobalVariables (const RegularExpression& regex, bool append, - uint32_t max_matches, + size_t max_matches, VariableList& variable_list) const { size_t initial_size = variable_list.GetSize(); @@ -495,12 +495,12 @@ ModuleList::FindModule (const UUID &uuid) const } -uint32_t -ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, uint32_t max_matches, TypeList& types) const +size_t +ModuleList::FindTypes (const SymbolContext& sc, const ConstString &name, bool name_is_fully_qualified, size_t max_matches, TypeList& types) const { Mutex::Locker locker(m_modules_mutex); - uint32_t total_matches = 0; + size_t total_matches = 0; collection::const_iterator pos, end = m_modules.end(); if (sc.module_sp) { @@ -689,7 +689,7 @@ ModuleList::ResolveSymbolContextsForFileSpec (const FileSpec &file_spec, uint32_ return sc_list.GetSize(); } -uint32_t +size_t ModuleList::GetIndexForModule (const Module *module) const { if (module) @@ -737,7 +737,7 @@ ModuleList::FindSharedModules (const ModuleSpec &module_spec, ModuleList &matchi return GetSharedModuleList ().FindModules (module_spec, matching_module_list); } -uint32_t +size_t ModuleList::RemoveOrphanSharedModules (bool mandatory) { return GetSharedModuleList ().RemoveOrphans(mandatory); @@ -781,7 +781,7 @@ ModuleList::GetSharedModule const size_t num_matching_modules = shared_module_list.FindModules (module_spec, matching_module_list); if (num_matching_modules > 0) { - for (uint32_t module_idx = 0; module_idx < num_matching_modules; ++module_idx) + for (size_t module_idx = 0; module_idx < num_matching_modules; ++module_idx) { module_sp = matching_module_list.GetModuleAtIndex(module_idx); diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index 0a4b21fd409..fc24cafc8aa 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -1346,7 +1346,7 @@ PluginManager::GetPlatformCreateCallbackForPluginName (const char *name) return NULL; } -uint32_t +size_t PluginManager::AutoCompletePlatformName (const char *name, StringList &matches) { if (name && name[0]) diff --git a/lldb/source/Core/RegisterValue.cpp b/lldb/source/Core/RegisterValue.cpp index a54e10dbbc4..4bfc7be0713 100644 --- a/lldb/source/Core/RegisterValue.cpp +++ b/lldb/source/Core/RegisterValue.cpp @@ -301,7 +301,7 @@ RegisterValue::SetType (const RegisterInfo *reg_info) } Error -RegisterValue::SetValueFromData (const RegisterInfo *reg_info, DataExtractor &src, uint32_t src_offset, bool partial_data_ok) +RegisterValue::SetValueFromData (const RegisterInfo *reg_info, DataExtractor &src, lldb::offset_t src_offset, bool partial_data_ok) { Error error; diff --git a/lldb/source/Core/Scalar.cpp b/lldb/source/Core/Scalar.cpp index 8750397197c..0fa112c80d6 100644 --- a/lldb/source/Core/Scalar.cpp +++ b/lldb/source/Core/Scalar.cpp @@ -523,11 +523,11 @@ Scalar::GetValueTypeAsCString (Scalar::Type type) Scalar::Type Scalar::GetValueTypeForSignedIntegerWithByteSize (size_t byte_size) { - if (byte_size <= sizeof(int)) + if (byte_size <= sizeof(sint_t)) return e_sint; - if (byte_size <= sizeof(long)) + if (byte_size <= sizeof(slong_t)) return e_slong; - if (byte_size <= sizeof(long long)) + if (byte_size <= sizeof(slonglong_t)) return e_slonglong; return e_void; } @@ -535,11 +535,11 @@ Scalar::GetValueTypeForSignedIntegerWithByteSize (size_t byte_size) Scalar::Type Scalar::GetValueTypeForUnsignedIntegerWithByteSize (size_t byte_size) { - if (byte_size <= sizeof(unsigned int)) + if (byte_size <= sizeof(uint_t)) return e_uint; - if (byte_size <= sizeof(unsigned long)) + if (byte_size <= sizeof(ulong_t)) return e_ulong; - if (byte_size <= sizeof(unsigned long long)) + if (byte_size <= sizeof(ulonglong_t)) return e_ulonglong; return e_void; } @@ -547,11 +547,11 @@ Scalar::GetValueTypeForUnsignedIntegerWithByteSize (size_t byte_size) Scalar::Type Scalar::GetValueTypeForFloatWithByteSize (size_t byte_size) { - if (byte_size == sizeof(float)) + if (byte_size == sizeof(float_t)) return e_float; - if (byte_size == sizeof(double)) + if (byte_size == sizeof(double_t)) return e_double; - if (byte_size == sizeof(long double)) + if (byte_size == sizeof(long_double_t)) return e_long_double; return e_void; } @@ -601,8 +601,8 @@ Scalar::Cast(Scalar::Type type) switch (type) { case e_void: - case e_sint: m_data.sint = m_data.slong; success = true; break; - case e_uint: m_data.uint = m_data.slong; success = true; break; + case e_sint: m_data.sint = (sint_t)m_data.slong; success = true; break; + case e_uint: m_data.uint = (uint_t)m_data.slong; success = true; break; case e_slong: success = true; break; case e_ulong: m_data.ulong = m_data.slong; success = true; break; case e_slonglong: m_data.slonglong = m_data.slong; success = true; break; @@ -617,8 +617,8 @@ Scalar::Cast(Scalar::Type type) switch (type) { case e_void: - case e_sint: m_data.sint = m_data.ulong; success = true; break; - case e_uint: m_data.uint = m_data.ulong; success = true; break; + case e_sint: m_data.sint = (sint_t)m_data.ulong; success = true; break; + case e_uint: m_data.uint = (uint_t)m_data.ulong; success = true; break; case e_slong: m_data.slong = m_data.ulong; success = true; break; case e_ulong: success = true; break; case e_slonglong: m_data.slonglong = m_data.ulong; success = true; break; @@ -633,8 +633,8 @@ Scalar::Cast(Scalar::Type type) switch (type) { case e_void: - case e_sint: m_data.sint = m_data.slonglong; success = true; break; - case e_uint: m_data.uint = m_data.slonglong; success = true; break; + case e_sint: m_data.sint = (sint_t)m_data.slonglong; success = true; break; + case e_uint: m_data.uint = (uint_t)m_data.slonglong; success = true; break; case e_slong: m_data.slong = m_data.slonglong; success = true; break; case e_ulong: m_data.ulong = m_data.slonglong; success = true; break; case e_slonglong: success = true; break; @@ -649,8 +649,8 @@ Scalar::Cast(Scalar::Type type) switch (type) { case e_void: - case e_sint: m_data.sint = m_data.ulonglong; success = true; break; - case e_uint: m_data.uint = m_data.ulonglong; success = true; break; + case e_sint: m_data.sint = (sint_t)m_data.ulonglong; success = true; break; + case e_uint: m_data.uint = (uint_t)m_data.ulonglong; success = true; break; case e_slong: m_data.slong = m_data.ulonglong; success = true; break; case e_ulong: m_data.ulong = m_data.ulonglong; success = true; break; case e_slonglong: m_data.slonglong = m_data.ulonglong; success = true; break; @@ -665,15 +665,15 @@ Scalar::Cast(Scalar::Type type) switch (type) { case e_void: - case e_sint: m_data.sint = m_data.flt; success = true; break; - case e_uint: m_data.uint = m_data.flt; success = true; break; - case e_slong: m_data.slong = m_data.flt; success = true; break; - case e_ulong: m_data.ulong = m_data.flt; success = true; break; - case e_slonglong: m_data.slonglong = m_data.flt; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.flt; success = true; break; + case e_sint: m_data.sint = (sint_t)m_data.flt; success = true; break; + case e_uint: m_data.uint = (uint_t)m_data.flt; success = true; break; + case e_slong: m_data.slong = (slong_t)m_data.flt; success = true; break; + case e_ulong: m_data.ulong = (ulong_t)m_data.flt; success = true; break; + case e_slonglong: m_data.slonglong = (slonglong_t)m_data.flt; success = true; break; + case e_ulonglong: m_data.ulonglong = (ulonglong_t)m_data.flt; success = true; break; case e_float: success = true; break; - case e_double: m_data.dbl = m_data.flt; success = true; break; - case e_long_double: m_data.ldbl = m_data.flt; success = true; break; + case e_double: m_data.dbl = m_data.flt; success = true; break; + case e_long_double: m_data.ldbl = m_data.flt; success = true; break; } break; @@ -681,15 +681,15 @@ Scalar::Cast(Scalar::Type type) switch (type) { case e_void: - case e_sint: m_data.sint = m_data.dbl; success = true; break; - case e_uint: m_data.uint = m_data.dbl; success = true; break; - case e_slong: m_data.slong = m_data.dbl; success = true; break; - case e_ulong: m_data.ulong = m_data.dbl; success = true; break; - case e_slonglong: m_data.slonglong = m_data.dbl; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.dbl; success = true; break; - case e_float: m_data.flt = m_data.dbl; success = true; break; + case e_sint: m_data.sint = (sint_t)m_data.dbl; success = true; break; + case e_uint: m_data.uint = (uint_t)m_data.dbl; success = true; break; + case e_slong: m_data.slong = (slong_t)m_data.dbl; success = true; break; + case e_ulong: m_data.ulong = (ulong_t)m_data.dbl; success = true; break; + case e_slonglong: m_data.slonglong = (slonglong_t)m_data.dbl; success = true; break; + case e_ulonglong: m_data.ulonglong = (ulonglong_t)m_data.dbl; success = true; break; + case e_float: m_data.flt = (float_t)m_data.dbl; success = true; break; case e_double: success = true; break; - case e_long_double: m_data.ldbl = m_data.dbl; success = true; break; + case e_long_double: m_data.ldbl = m_data.dbl; success = true; break; } break; @@ -697,14 +697,14 @@ Scalar::Cast(Scalar::Type type) switch (type) { case e_void: - case e_sint: m_data.sint = m_data.ldbl; success = true; break; - case e_uint: m_data.uint = m_data.ldbl; success = true; break; - case e_slong: m_data.slong = m_data.ldbl; success = true; break; - case e_ulong: m_data.ulong = m_data.ldbl; success = true; break; - case e_slonglong: m_data.slonglong = m_data.ldbl; success = true; break; - case e_ulonglong: m_data.ulonglong = m_data.ldbl; success = true; break; - case e_float: m_data.flt = m_data.ldbl; success = true; break; - case e_double: m_data.dbl = m_data.ldbl; success = true; break; + case e_sint: m_data.sint = (sint_t)m_data.ldbl; success = true; break; + case e_uint: m_data.uint = (uint_t)m_data.ldbl; success = true; break; + case e_slong: m_data.slong = (slong_t)m_data.ldbl; success = true; break; + case e_ulong: m_data.ulong = (ulong_t)m_data.ldbl; success = true; break; + case e_slonglong: m_data.slonglong = (slonglong_t)m_data.ldbl; success = true; break; + case e_ulonglong: m_data.ulonglong = (ulonglong_t)m_data.ldbl; success = true; break; + case e_float: m_data.flt = (float_t)m_data.ldbl; success = true; break; + case e_double: m_data.dbl = (double_t)m_data.ldbl; success = true; break; case e_long_double: success = true; break; } break; @@ -815,29 +815,29 @@ Scalar::GetRawBits64(uint64_t fail_value) const return m_data.ulonglong; case e_float: - if (sizeof(m_data.flt) == sizeof(int)) + if (sizeof(m_data.flt) == sizeof(m_data.uint)) return m_data.uint; - else if (sizeof(m_data.flt) == sizeof(unsigned long)) + else if (sizeof(m_data.flt) == sizeof(m_data.ulong)) return m_data.ulong; - else if (sizeof(m_data.flt) == sizeof(unsigned long long)) + else if (sizeof(m_data.flt) == sizeof(m_data.ulonglong)) return m_data.ulonglong; break; case e_double: - if (sizeof(m_data.dbl) == sizeof(int)) + if (sizeof(m_data.dbl) == sizeof(m_data.uint)) return m_data.uint; - else if (sizeof(m_data.dbl) == sizeof(unsigned long)) + else if (sizeof(m_data.dbl) == sizeof(m_data.ulong)) return m_data.ulong; - else if (sizeof(m_data.dbl) == sizeof(unsigned long long)) + else if (sizeof(m_data.dbl) == sizeof(m_data.ulonglong)) return m_data.ulonglong; break; case e_long_double: - if (sizeof(m_data.ldbl) == sizeof(int)) + if (sizeof(m_data.ldbl) == sizeof(m_data.uint)) return m_data.uint; - else if (sizeof(m_data.ldbl) == sizeof(unsigned long)) + else if (sizeof(m_data.ldbl) == sizeof(m_data.ulong)) return m_data.ulong; - else if (sizeof(m_data.ldbl) == sizeof(unsigned long long)) + else if (sizeof(m_data.ldbl) == sizeof(m_data.ulonglong)) return m_data.ulonglong; break; } @@ -1756,7 +1756,7 @@ Scalar::RawULongLong () const Error -Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t byte_size) +Scalar::SetValueFromCString (const char *value_str, Encoding encoding, size_t byte_size) { Error error; if (value_str == NULL || value_str[0] == '\0') @@ -1778,24 +1778,24 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t if (!success) error.SetErrorStringWithFormat ("'%s' is not a valid unsigned integer string value", value_str); else if (!UIntValueIsValidForSize (uval64, byte_size)) - error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %u byte unsigned integer value", uval64, byte_size); + error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %zu byte unsigned integer value", uval64, byte_size); else { m_type = Scalar::GetValueTypeForUnsignedIntegerWithByteSize (byte_size); switch (m_type) { - case e_uint: m_data.uint = uval64; break; - case e_ulong: m_data.ulong = uval64; break; - case e_ulonglong: m_data.ulonglong = uval64; break; + case e_uint: m_data.uint = (uint_t)uval64; break; + case e_ulong: m_data.ulong = (ulong_t)uval64; break; + case e_ulonglong: m_data.ulonglong = (ulonglong_t)uval64; break; default: - error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %u", byte_size); + error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %zu", byte_size); break; } } } else { - error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %u", byte_size); + error.SetErrorStringWithFormat ("unsupported unsigned integer byte size: %zu", byte_size); return error; } break; @@ -1807,24 +1807,24 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t if (!success) error.SetErrorStringWithFormat ("'%s' is not a valid signed integer string value", value_str); else if (!SIntValueIsValidForSize (sval64, byte_size)) - error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %u byte signed integer value", sval64, byte_size); + error.SetErrorStringWithFormat ("value 0x%" PRIx64 " is too large to fit in a %zu byte signed integer value", sval64, byte_size); else { m_type = Scalar::GetValueTypeForSignedIntegerWithByteSize (byte_size); switch (m_type) { - case e_sint: m_data.sint = sval64; break; - case e_slong: m_data.slong = sval64; break; - case e_slonglong: m_data.slonglong = sval64; break; + case e_sint: m_data.sint = (sint_t)sval64; break; + case e_slong: m_data.slong = (slong_t)sval64; break; + case e_slonglong: m_data.slonglong = (slonglong_t)sval64; break; default: - error.SetErrorStringWithFormat ("unsupported signed integer byte size: %u", byte_size); + error.SetErrorStringWithFormat ("unsupported signed integer byte size: %zu", byte_size); break; } } } else { - error.SetErrorStringWithFormat ("unsupported signed integer byte size: %u", byte_size); + error.SetErrorStringWithFormat ("unsupported signed integer byte size: %zu", byte_size); return error; } break; @@ -1853,7 +1853,7 @@ Scalar::SetValueFromCString (const char *value_str, Encoding encoding, uint32_t } else { - error.SetErrorStringWithFormat ("unsupported float byte size: %u", byte_size); + error.SetErrorStringWithFormat ("unsupported float byte size: %zu", byte_size); return error; } break; @@ -1935,9 +1935,9 @@ Scalar::SignExtend (uint32_t sign_bit_pos) return false; } -uint32_t +size_t Scalar::GetAsMemoryData (void *dst, - uint32_t dst_len, + size_t dst_len, lldb::ByteOrder dst_byte_order, Error &error) const { @@ -1952,7 +1952,7 @@ Scalar::GetAsMemoryData (void *dst, const size_t src_len = data.GetByteSize(); // Prepare a memory buffer that contains some or all of the register value - const uint32_t bytes_copied = data.CopyByteOrderedData (0, // src offset + const size_t bytes_copied = data.CopyByteOrderedData (0, // src offset src_len, // src length dst, // dst buffer dst_len, // dst length @@ -1978,60 +1978,60 @@ Scalar::ExtractBitfield (uint32_t bit_size, break; case e_float: - if (sizeof(m_data.flt) == sizeof(int)) - m_data.sint = SignedBits (m_data.sint, msbit, lsbit); - else if (sizeof(m_data.flt) == sizeof(unsigned long)) - m_data.slong = SignedBits (m_data.slong, msbit, lsbit); - else if (sizeof(m_data.flt) == sizeof(unsigned long long)) - m_data.slonglong = SignedBits (m_data.slonglong, msbit, lsbit); + if (sizeof(m_data.flt) == sizeof(sint_t)) + m_data.sint = (sint_t)SignedBits (m_data.sint, msbit, lsbit); + else if (sizeof(m_data.flt) == sizeof(ulong_t)) + m_data.slong = (slong_t)SignedBits (m_data.slong, msbit, lsbit); + else if (sizeof(m_data.flt) == sizeof(ulonglong_t)) + m_data.slonglong = (slonglong_t)SignedBits (m_data.slonglong, msbit, lsbit); else return false; return true; case e_double: - if (sizeof(m_data.dbl) == sizeof(int)) + if (sizeof(m_data.dbl) == sizeof(sint_t)) m_data.sint = SignedBits (m_data.sint, msbit, lsbit); - else if (sizeof(m_data.dbl) == sizeof(unsigned long)) + else if (sizeof(m_data.dbl) == sizeof(ulong_t)) m_data.slong = SignedBits (m_data.slong, msbit, lsbit); - else if (sizeof(m_data.dbl) == sizeof(unsigned long long)) + else if (sizeof(m_data.dbl) == sizeof(ulonglong_t)) m_data.slonglong = SignedBits (m_data.slonglong, msbit, lsbit); else return false; return true; case e_long_double: - if (sizeof(m_data.ldbl) == sizeof(int)) + if (sizeof(m_data.ldbl) == sizeof(sint_t)) m_data.sint = SignedBits (m_data.sint, msbit, lsbit); - else if (sizeof(m_data.ldbl) == sizeof(unsigned long)) + else if (sizeof(m_data.ldbl) == sizeof(ulong_t)) m_data.slong = SignedBits (m_data.slong, msbit, lsbit); - else if (sizeof(m_data.ldbl) == sizeof(unsigned long long)) + else if (sizeof(m_data.ldbl) == sizeof(ulonglong_t)) m_data.slonglong = SignedBits (m_data.slonglong, msbit, lsbit); else return false; return true; case Scalar::e_sint: - m_data.sint = SignedBits (m_data.sint, msbit, lsbit); + m_data.sint = (sint_t)SignedBits (m_data.sint, msbit, lsbit); return true; case Scalar::e_uint: - m_data.uint = UnsignedBits (m_data.uint, msbit, lsbit); + m_data.uint = (uint_t)UnsignedBits (m_data.uint, msbit, lsbit); return true; case Scalar::e_slong: - m_data.slong = SignedBits (m_data.slong, msbit, lsbit); + m_data.slong = (slong_t)SignedBits (m_data.slong, msbit, lsbit); return true; case Scalar::e_ulong: - m_data.ulong = UnsignedBits (m_data.ulong, msbit, lsbit); + m_data.ulong = (ulong_t)UnsignedBits (m_data.ulong, msbit, lsbit); return true; case Scalar::e_slonglong: - m_data.slonglong = SignedBits (m_data.slonglong, msbit, lsbit); + m_data.slonglong = (slonglong_t)SignedBits (m_data.slonglong, msbit, lsbit); return true; case Scalar::e_ulonglong: - m_data.ulonglong = UnsignedBits (m_data.ulonglong, msbit, lsbit); + m_data.ulonglong = (ulonglong_t)UnsignedBits (m_data.ulonglong, msbit, lsbit); return true; } return false; diff --git a/lldb/source/Core/SearchFilter.cpp b/lldb/source/Core/SearchFilter.cpp index d9af19ed183..edc565698e5 100644 --- a/lldb/source/Core/SearchFilter.cpp +++ b/lldb/source/Core/SearchFilter.cpp @@ -245,8 +245,8 @@ SearchFilter::DoCUIteration (const ModuleSP &module_sp, const SymbolContext &con Searcher::CallbackReturn shouldContinue; if (context.comp_unit == NULL) { - uint32_t num_comp_units = module_sp->GetNumCompileUnits(); - for (uint32_t i = 0; i < num_comp_units; i++) + const size_t num_comp_units = module_sp->GetNumCompileUnits(); + for (size_t i = 0; i < num_comp_units; i++) { CompUnitSP cu_sp (module_sp->GetCompileUnitAtIndex (i)); if (cu_sp) @@ -617,7 +617,7 @@ SearchFilterByModuleList::Search (Searcher &searcher) void SearchFilterByModuleList::GetDescription (Stream *s) { - uint32_t num_modules = m_module_spec_list.GetSize(); + size_t num_modules = m_module_spec_list.GetSize(); if (num_modules == 1) { s->Printf (", module = "); @@ -634,8 +634,8 @@ SearchFilterByModuleList::GetDescription (Stream *s) } else { - s->Printf (", modules(%u) = ", num_modules); - for (uint32_t i = 0; i < num_modules; i++) + s->Printf (", modules(%zu) = ", num_modules); + for (size_t i = 0; i < num_modules; i++) { if (s->GetVerbose()) { @@ -812,7 +812,7 @@ SearchFilterByModuleListAndCU::Search (Searcher &searcher) void SearchFilterByModuleListAndCU::GetDescription (Stream *s) { - uint32_t num_modules = m_module_spec_list.GetSize(); + size_t num_modules = m_module_spec_list.GetSize(); if (num_modules == 1) { s->Printf (", module = "); @@ -829,8 +829,8 @@ SearchFilterByModuleListAndCU::GetDescription (Stream *s) } else if (num_modules > 0) { - s->Printf (", modules(%d) = ", num_modules); - for (uint32_t i = 0; i < num_modules; i++) + s->Printf (", modules(%zd) = ", num_modules); + for (size_t i = 0; i < num_modules; i++) { if (s->GetVerbose()) { diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp index 0efa39a03e2..a9481d2ccac 100644 --- a/lldb/source/Core/Section.cpp +++ b/lldb/source/Core/Section.cpp @@ -162,10 +162,10 @@ Section::GetLoadBaseAddress (Target *target) const bool Section::ResolveContainedAddress (addr_t offset, Address &so_addr) const { - const uint32_t num_children = m_children.GetSize(); + const size_t num_children = m_children.GetSize(); if (num_children > 0) { - for (uint32_t i=0; i<num_children; i++) + for (size_t i=0; i<num_children; i++) { Section* child_section = m_children.GetSectionAtIndex (i).get(); @@ -395,17 +395,17 @@ SectionList::~SectionList () { } -uint32_t +size_t SectionList::AddSection (const lldb::SectionSP& section_sp) { assert (section_sp.get()); - uint32_t section_index = m_sections.size(); + size_t section_index = m_sections.size(); m_sections.push_back(section_sp); InvalidateRangeCache(); return section_index; } -uint32_t +size_t SectionList::FindSectionIndex (const Section* sect) { iterator sect_iter; @@ -422,10 +422,10 @@ SectionList::FindSectionIndex (const Section* sect) return UINT32_MAX; } -uint32_t +size_t SectionList::AddUniqueSection (const lldb::SectionSP& sect_sp) { - uint32_t sect_idx = FindSectionIndex (sect_sp.get()); + size_t sect_idx = FindSectionIndex (sect_sp.get()); if (sect_idx == UINT32_MAX) sect_idx = AddSection (sect_sp); return sect_idx; @@ -470,7 +470,7 @@ SectionList::GetNumSections (uint32_t depth) const } SectionSP -SectionList::GetSectionAtIndex (uint32_t idx) const +SectionList::GetSectionAtIndex (size_t idx) const { SectionSP sect_sp; if (idx < m_sections.size()) @@ -530,11 +530,11 @@ SectionList::FindSectionByID (user_id_t sect_id) const SectionSP -SectionList::FindSectionByType (SectionType sect_type, bool check_children, uint32_t start_idx) const +SectionList::FindSectionByType (SectionType sect_type, bool check_children, size_t start_idx) const { SectionSP sect_sp; - uint32_t num_sections = m_sections.size(); - for (uint32_t idx = start_idx; idx < num_sections; ++idx) + size_t num_sections = m_sections.size(); + for (size_t idx = start_idx; idx < num_sections; ++idx) { if (m_sections[idx]->GetType() == sect_type) { diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index 87874c6b866..65b81650712 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -284,13 +284,18 @@ SourceManager::GetDefaultFileAndLine (FileSpec &file_spec, uint32_t &line) if (executable_ptr) { SymbolContextList sc_list; - uint32_t num_matches; ConstString main_name("main"); bool symbols_okay = false; // Force it to be a debug symbol. bool inlines_okay = true; bool append = false; - num_matches = executable_ptr->FindFunctions (main_name, NULL, lldb::eFunctionNameTypeBase, inlines_okay, symbols_okay, append, sc_list); - for (uint32_t idx = 0; idx < num_matches; idx++) + size_t num_matches = executable_ptr->FindFunctions (main_name, + NULL, + lldb::eFunctionNameTypeBase, + inlines_okay, + symbols_okay, + append, + sc_list); + for (size_t idx = 0; idx < num_matches; idx++) { SymbolContext sc; sc_list.GetContextAtIndex(idx, sc); @@ -584,14 +589,14 @@ SourceManager::File::CalculateLineOffsets (uint32_t line) else { // Some lines have been populated, start where we last left off - assert(!"Not implemented yet"); + assert("Not implemented yet" == NULL); } } else { // Calculate all line offsets up to "line" - assert(!"Not implemented yet"); + assert("Not implemented yet" == NULL); } return false; } @@ -602,8 +607,8 @@ SourceManager::File::GetLine (uint32_t line_no, std::string &buffer) if (!LineIsValid(line_no)) return false; - uint32_t start_offset = GetLineOffset (line_no); - uint32_t end_offset = GetLineOffset (line_no + 1); + size_t start_offset = GetLineOffset (line_no); + size_t end_offset = GetLineOffset (line_no + 1); if (end_offset == UINT32_MAX) { end_offset = m_data_sp->GetByteSize(); diff --git a/lldb/source/Core/Stream.cpp b/lldb/source/Core/Stream.cpp index bb1af7b407c..49c15d63c36 100644 --- a/lldb/source/Core/Stream.cpp +++ b/lldb/source/Core/Stream.cpp @@ -64,10 +64,10 @@ Stream::Offset (uint32_t uval, const char *format) // Put an SLEB128 "uval" out to the stream using the printf format // in "format". //------------------------------------------------------------------ -int +size_t Stream::PutSLEB128 (int64_t sval) { - int bytes_written = 0; + size_t bytes_written = 0; if (m_flags.Test(eBinary)) { bool more = true; @@ -98,10 +98,10 @@ Stream::PutSLEB128 (int64_t sval) // Put an ULEB128 "uval" out to the stream using the printf format // in "format". //------------------------------------------------------------------ -int +size_t Stream::PutULEB128 (uint64_t uval) { - int bytes_written = 0; + size_t bytes_written = 0; if (m_flags.Test(eBinary)) { do @@ -127,10 +127,10 @@ Stream::PutULEB128 (uint64_t uval) //------------------------------------------------------------------ // Print a raw NULL terminated C string to the stream. //------------------------------------------------------------------ -int +size_t Stream::PutCString (const char *cstr) { - int cstr_len = strlen(cstr); + size_t cstr_len = strlen(cstr); // when in binary mode, emit the NULL terminator if (m_flags.Test(eBinary)) ++cstr_len; @@ -152,7 +152,7 @@ Stream::QuotedCString (const char *cstr, const char *format) // and suffix strings. //------------------------------------------------------------------ void -Stream::Address (uint64_t addr, int addr_size, const char *prefix, const char *suffix) +Stream::Address (uint64_t addr, uint32_t addr_size, const char *prefix, const char *suffix) { if (prefix == NULL) prefix = ""; @@ -168,7 +168,7 @@ Stream::Address (uint64_t addr, int addr_size, const char *prefix, const char *s // and suffix strings. //------------------------------------------------------------------ void -Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, int addr_size, const char *prefix, const char *suffix) +Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, uint32_t addr_size, const char *prefix, const char *suffix) { if (prefix && prefix[0]) PutCString (prefix); @@ -179,7 +179,7 @@ Stream::AddressRange(uint64_t lo_addr, uint64_t hi_addr, int addr_size, const ch } -int +size_t Stream::PutChar (char ch) { return Write (&ch, 1); @@ -189,7 +189,7 @@ Stream::PutChar (char ch) //------------------------------------------------------------------ // Print some formatted output to the stream. //------------------------------------------------------------------ -int +size_t Stream::Printf (const char *format, ...) { va_list args; @@ -202,7 +202,7 @@ Stream::Printf (const char *format, ...) //------------------------------------------------------------------ // Print some formatted output to the stream. //------------------------------------------------------------------ -int +size_t Stream::PrintfVarArg (const char *format, va_list args) { char str[1024]; @@ -210,7 +210,7 @@ Stream::PrintfVarArg (const char *format, va_list args) va_copy (args_copy, args); - int bytes_written = 0; + size_t bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits size_t length = ::vsnprintf (str, sizeof(str), format, args); if (length < sizeof(str)) @@ -244,7 +244,7 @@ Stream::PrintfVarArg (const char *format, va_list args) //------------------------------------------------------------------ // Print and End of Line character to the stream //------------------------------------------------------------------ -int +size_t Stream::EOL() { return PutChar ('\n'); @@ -254,7 +254,7 @@ Stream::EOL() // Indent the current line using the current indentation level and // print an optional string following the idenatation spaces. //------------------------------------------------------------------ -int +size_t Stream::Indent(const char *s) { return Printf ("%*.*s%s", m_indent_level, m_indent_level, "", s ? s : ""); @@ -412,7 +412,7 @@ Stream::IndentLess (int amount) //------------------------------------------------------------------ // Get the address size in bytes //------------------------------------------------------------------ -uint8_t +uint32_t Stream::GetAddressByteSize() const { return m_addr_size; @@ -422,7 +422,7 @@ Stream::GetAddressByteSize() const // Set the address size in bytes //------------------------------------------------------------------ void -Stream::SetAddressByteSize(uint8_t addr_size) +Stream::SetAddressByteSize(uint32_t addr_size) { m_addr_size = addr_size; } @@ -473,7 +473,7 @@ Stream::GetByteOrder() const return m_byte_order; } -int +size_t Stream::PrintfAsRawHex8 (const char *format, ...) { va_list args; @@ -482,7 +482,7 @@ Stream::PrintfAsRawHex8 (const char *format, ...) va_copy (args, args_copy); // Copy this so we char str[1024]; - int bytes_written = 0; + size_t bytes_written = 0; // Try and format our string into a fixed buffer first and see if it fits size_t length = ::vsnprintf (str, sizeof(str), format, args); if (length < sizeof(str)) @@ -511,19 +511,19 @@ Stream::PrintfAsRawHex8 (const char *format, ...) return bytes_written; } -int +size_t Stream::PutNHex8 (size_t n, uint8_t uvalue) { - int bytes_written = 0; + size_t bytes_written = 0; for (size_t i=0; i<n; ++i) bytes_written += _PutHex8 (uvalue, m_flags.Test(eAddPrefix)); return bytes_written; } -int +size_t Stream::_PutHex8 (uint8_t uvalue, bool add_prefix) { - int bytes_written = 0; + size_t bytes_written = 0; if (m_flags.Test(eBinary)) { bytes_written = Write (&uvalue, 1); @@ -542,76 +542,76 @@ Stream::_PutHex8 (uint8_t uvalue, bool add_prefix) return bytes_written; } -int +size_t Stream::PutHex8 (uint8_t uvalue) { return _PutHex8 (uvalue, m_flags.Test(eAddPrefix)); } -int +size_t Stream::PutHex16 (uint16_t uvalue, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; bool add_prefix = m_flags.Test(eAddPrefix); - int bytes_written = 0; + size_t bytes_written = 0; if (byte_order == eByteOrderLittle) { for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } else { for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } return bytes_written; } -int +size_t Stream::PutHex32(uint32_t uvalue, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; bool add_prefix = m_flags.Test(eAddPrefix); - int bytes_written = 0; + size_t bytes_written = 0; if (byte_order == eByteOrderLittle) { for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } else { for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } return bytes_written; } -int +size_t Stream::PutHex64(uint64_t uvalue, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) byte_order = m_byte_order; bool add_prefix = m_flags.Test(eAddPrefix); - int bytes_written = 0; + size_t bytes_written = 0; if (byte_order == eByteOrderLittle) { for (size_t byte = 0; byte < sizeof(uvalue); ++byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } else { for (size_t byte = sizeof(uvalue)-1; byte < sizeof(uvalue); --byte, add_prefix = false) - bytes_written += _PutHex8 (uvalue >> (byte * 8), add_prefix); + bytes_written += _PutHex8 ((uint8_t)(uvalue >> (byte * 8)), add_prefix); } return bytes_written; } -int +size_t Stream::PutMaxHex64 ( uint64_t uvalue, @@ -621,21 +621,21 @@ Stream::PutMaxHex64 { switch (byte_size) { - case 1: return PutHex8 (uvalue); - case 2: return PutHex16 (uvalue); - case 4: return PutHex32 (uvalue); + case 1: return PutHex8 ((uint8_t)uvalue); + case 2: return PutHex16 ((uint16_t)uvalue); + case 4: return PutHex32 ((uint32_t)uvalue); case 8: return PutHex64 (uvalue); } return 0; } -int +size_t Stream::PutPointer (void *ptr) { return PutRawBytes (&ptr, sizeof(ptr), lldb::endian::InlHostByteOrder(), lldb::endian::InlHostByteOrder()); } -int +size_t Stream::PutFloat(float f, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) @@ -644,7 +644,7 @@ Stream::PutFloat(float f, ByteOrder byte_order) return PutRawBytes (&f, sizeof(f), lldb::endian::InlHostByteOrder(), byte_order); } -int +size_t Stream::PutDouble(double d, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) @@ -653,7 +653,7 @@ Stream::PutDouble(double d, ByteOrder byte_order) return PutRawBytes (&d, sizeof(d), lldb::endian::InlHostByteOrder(), byte_order); } -int +size_t Stream::PutLongDouble(long double ld, ByteOrder byte_order) { if (byte_order == eByteOrderInvalid) @@ -662,7 +662,7 @@ Stream::PutLongDouble(long double ld, ByteOrder byte_order) return PutRawBytes (&ld, sizeof(ld), lldb::endian::InlHostByteOrder(), byte_order); } -int +size_t Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, ByteOrder dst_byte_order) { if (src_byte_order == eByteOrderInvalid) @@ -671,7 +671,7 @@ Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, By if (dst_byte_order == eByteOrderInvalid) dst_byte_order = m_byte_order; - int bytes_written = 0; + size_t bytes_written = 0; const uint8_t *src = (const uint8_t *)s; bool binary_was_set = m_flags.Test (eBinary); if (!binary_was_set) @@ -692,7 +692,7 @@ Stream::PutRawBytes (const void *s, size_t src_len, ByteOrder src_byte_order, By return bytes_written; } -int +size_t Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_order, ByteOrder dst_byte_order) { if (src_byte_order == eByteOrderInvalid) @@ -701,7 +701,7 @@ Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_ord if (dst_byte_order == eByteOrderInvalid) dst_byte_order = m_byte_order; - int bytes_written = 0; + size_t bytes_written = 0; const uint8_t *src = (const uint8_t *)s; bool binary_is_set = m_flags.Test(eBinary); m_flags.Clear(eBinary); @@ -721,10 +721,10 @@ Stream::PutBytesAsRawHex8 (const void *s, size_t src_len, ByteOrder src_byte_ord return bytes_written; } -int +size_t Stream::PutCStringAsRawHex8 (const char *s) { - int bytes_written = 0; + size_t bytes_written = 0; bool binary_is_set = m_flags.Test(eBinary); m_flags.Clear(eBinary); do diff --git a/lldb/source/Core/StreamAsynchronousIO.cpp b/lldb/source/Core/StreamAsynchronousIO.cpp index 84659c6e16b..d6ab0d85725 100644 --- a/lldb/source/Core/StreamAsynchronousIO.cpp +++ b/lldb/source/Core/StreamAsynchronousIO.cpp @@ -44,7 +44,7 @@ StreamAsynchronousIO::Flush () } } -int +size_t StreamAsynchronousIO::Write (const void *s, size_t length) { m_accumulated_data.Write (s, length); diff --git a/lldb/source/Core/StreamCallback.cpp b/lldb/source/Core/StreamCallback.cpp index 63f3c9f8b2d..d144b16755e 100644 --- a/lldb/source/Core/StreamCallback.cpp +++ b/lldb/source/Core/StreamCallback.cpp @@ -55,7 +55,7 @@ StreamCallback::Flush () out_stream.Clear(); } -int +size_t StreamCallback::Write (const void *s, size_t length) { lldb::tid_t cur_tid = Host::GetCurrentThreadID(); diff --git a/lldb/source/Core/StreamFile.cpp b/lldb/source/Core/StreamFile.cpp index 0d5750801aa..9a4eb796dbe 100644 --- a/lldb/source/Core/StreamFile.cpp +++ b/lldb/source/Core/StreamFile.cpp @@ -64,7 +64,7 @@ StreamFile::Flush () m_file.Flush(); } -int +size_t StreamFile::Write (const void *s, size_t length) { m_file.Write (s, length); diff --git a/lldb/source/Core/StreamString.cpp b/lldb/source/Core/StreamString.cpp index 1c6f146f1be..8d7d039fd65 100644 --- a/lldb/source/Core/StreamString.cpp +++ b/lldb/source/Core/StreamString.cpp @@ -34,7 +34,7 @@ StreamString::Flush () // Nothing to do when flushing a buffer based stream... } -int +size_t StreamString::Write (const void *s, size_t length) { m_packet.append ((char *)s, length); diff --git a/lldb/source/Core/StringList.cpp b/lldb/source/Core/StringList.cpp index 18b6224a520..fa023e0caf4 100644 --- a/lldb/source/Core/StringList.cpp +++ b/lldb/source/Core/StringList.cpp @@ -75,9 +75,9 @@ StringList::AppendList (const char **strv, int strc) void StringList::AppendList (StringList strings) { - uint32_t len = strings.GetSize(); + size_t len = strings.GetSize(); - for (uint32_t i = 0; i < len; ++i) + for (size_t i = 0; i < len; ++i) m_strings.push_back (strings.GetStringAtIndex(i)); } @@ -87,7 +87,7 @@ StringList::ReadFileLines (FileSpec &input_file) return input_file.ReadFileLines (m_strings); } -uint32_t +size_t StringList::GetSize () const { return m_strings.size(); @@ -104,7 +104,7 @@ StringList::GetStringAtIndex (size_t idx) const void StringList::Join (const char *separator, Stream &strm) { - uint32_t size = GetSize(); + size_t size = GetSize(); if (size == 0) return; @@ -127,8 +127,8 @@ void StringList::LongestCommonPrefix (std::string &common_prefix) { //arg_sstr_collection::iterator pos, end = m_args.end(); - int pos = 0; - int end = m_strings.size(); + size_t pos = 0; + size_t end = m_strings.size(); if (pos == end) common_prefix.clear(); diff --git a/lldb/source/Core/UUID.cpp b/lldb/source/Core/UUID.cpp index 8ff97afebcc..bfd6c189032 100644 --- a/lldb/source/Core/UUID.cpp +++ b/lldb/source/Core/UUID.cpp @@ -178,7 +178,7 @@ UUID::SetFromCString (const char *cstr) while (isspace(*p)) ++p; - const uint32_t uuid_byte_idx = UUID::DecodeUUIDBytesFromCString (p, m_uuid, &p); + const size_t uuid_byte_idx = UUID::DecodeUUIDBytesFromCString (p, m_uuid, &p); // If we successfully decoded a UUID, return the amount of characters that // were consumed diff --git a/lldb/source/Core/VMRange.cpp b/lldb/source/Core/VMRange.cpp index 0631069bb38..902489e1ff3 100644 --- a/lldb/source/Core/VMRange.cpp +++ b/lldb/source/Core/VMRange.cpp @@ -40,7 +40,7 @@ VMRange::ContainsRange(const VMRange::collection& coll, const VMRange& range) return false; } -uint32_t +size_t VMRange::FindRangeIndexThatContainsValue (const VMRange::collection& coll, lldb::addr_t value) { ValueInRangeUnaryPredicate in_range_predicate(value); diff --git a/lldb/source/Core/Value.cpp b/lldb/source/Core/Value.cpp index 193ae4f84cc..5b6e8fd9882 100644 --- a/lldb/source/Core/Value.cpp +++ b/lldb/source/Core/Value.cpp @@ -144,7 +144,7 @@ Value::GetType() } void -Value::ResizeData(int len) +Value::ResizeData(size_t len) { m_value_type = eValueTypeHostAddress; m_data_buffer.SetByteSize(len); @@ -560,7 +560,7 @@ Value::GetValueAsData (ExecutionContext *exe_ctx, } // If we got here, we need to read the value from memory - uint32_t byte_size = GetValueByteSize (ast_context, &error); + size_t byte_size = GetValueByteSize (ast_context, &error); // Bail if we encountered any errors getting the byte size if (error.Fail()) diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index 92d2c36415e..5ea8e7d6b8d 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -510,7 +510,7 @@ ValueObject::SetValueDidChange (bool value_changed) } ValueObjectSP -ValueObject::GetChildAtIndex (uint32_t idx, bool can_create) +ValueObject::GetChildAtIndex (size_t idx, bool can_create) { ValueObjectSP child_sp; // We may need to update our value if we are dynamic @@ -534,13 +534,13 @@ ValueObject::GetChildAtIndex (uint32_t idx, bool can_create) } ValueObjectSP -ValueObject::GetChildAtIndexPath (const std::initializer_list<uint32_t>& idxs, - uint32_t* index_of_error) +ValueObject::GetChildAtIndexPath (const std::initializer_list<size_t>& idxs, + size_t* index_of_error) { if (idxs.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); - for (uint32_t idx : idxs) + for (size_t idx : idxs) { root = root->GetChildAtIndex(idx, true); if (!root) @@ -554,13 +554,13 @@ ValueObject::GetChildAtIndexPath (const std::initializer_list<uint32_t>& idxs, } ValueObjectSP -ValueObject::GetChildAtIndexPath (const std::initializer_list< std::pair<uint32_t, bool> >& idxs, - uint32_t* index_of_error) +ValueObject::GetChildAtIndexPath (const std::initializer_list< std::pair<size_t, bool> >& idxs, + size_t* index_of_error) { if (idxs.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); - for (std::pair<uint32_t, bool> idx : idxs) + for (std::pair<size_t, bool> idx : idxs) { root = root->GetChildAtIndex(idx.first, idx.second); if (!root) @@ -574,13 +574,13 @@ ValueObject::GetChildAtIndexPath (const std::initializer_list< std::pair<uint32_ } lldb::ValueObjectSP -ValueObject::GetChildAtIndexPath (const std::vector<uint32_t> &idxs, - uint32_t* index_of_error) +ValueObject::GetChildAtIndexPath (const std::vector<size_t> &idxs, + size_t* index_of_error) { if (idxs.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); - for (uint32_t idx : idxs) + for (size_t idx : idxs) { root = root->GetChildAtIndex(idx, true); if (!root) @@ -594,13 +594,13 @@ ValueObject::GetChildAtIndexPath (const std::vector<uint32_t> &idxs, } lldb::ValueObjectSP -ValueObject::GetChildAtIndexPath (const std::vector< std::pair<uint32_t, bool> > &idxs, - uint32_t* index_of_error) +ValueObject::GetChildAtIndexPath (const std::vector< std::pair<size_t, bool> > &idxs, + size_t* index_of_error) { if (idxs.size() == 0) return GetSP(); ValueObjectSP root(GetSP()); - for (std::pair<uint32_t, bool> idx : idxs) + for (std::pair<size_t, bool> idx : idxs) { root = root->GetChildAtIndex(idx.first, idx.second); if (!root) @@ -613,7 +613,7 @@ ValueObject::GetChildAtIndexPath (const std::vector< std::pair<uint32_t, bool> > return root; } -uint32_t +size_t ValueObject::GetIndexOfChildWithName (const ConstString &name) { bool omit_empty_base_classes = true; @@ -668,7 +668,7 @@ ValueObject::GetChildMemberWithName (const ConstString &name, bool can_create) } -uint32_t +size_t ValueObject::GetNumChildren () { UpdateValueIfNeeded(); @@ -703,7 +703,7 @@ ValueObject::MightHaveChildren() // Should only be called by ValueObject::GetNumChildren() void -ValueObject::SetNumChildren (uint32_t num_children) +ValueObject::SetNumChildren (size_t num_children) { m_children_count_valid = true; m_children.SetChildrenCount(num_children); @@ -716,7 +716,7 @@ ValueObject::SetName (const ConstString &name) } ValueObject * -ValueObject::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index) +ValueObject::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index) { ValueObject *valobj = NULL; @@ -1474,10 +1474,10 @@ ValueObject::DumpPrintableRepresentation(Stream& s, if ((custom_format == eFormatBytes) || (custom_format == eFormatBytesWithASCII)) { - uint32_t count = GetNumChildren(); + const size_t count = GetNumChildren(); s << '['; - for (uint32_t low = 0; low < count; low++) + for (size_t low = 0; low < count; low++) { if (low) @@ -1510,12 +1510,12 @@ ValueObject::DumpPrintableRepresentation(Stream& s, (custom_format == eFormatVectorOfUInt64) || (custom_format == eFormatVectorOfUInt8)) // arrays of bytes, bytes with ASCII or any vector format should be printed directly { - uint32_t count = GetNumChildren(); + const size_t count = GetNumChildren(); Format format = FormatManager::GetSingleItemFormat(custom_format); s << '['; - for (uint32_t low = 0; low < count; low++) + for (size_t low = 0; low < count; low++) { if (low) @@ -1564,8 +1564,8 @@ ValueObject::DumpPrintableRepresentation(Stream& s, bool var_success = false; { - const char * return_value; - std::string alloc_mem; + const char *cstr = NULL; + StreamString strm; if (custom_format != eFormatInvalid) SetFormat(custom_format); @@ -1573,59 +1573,49 @@ ValueObject::DumpPrintableRepresentation(Stream& s, switch(val_obj_display) { case eValueObjectRepresentationStyleValue: - return_value = GetValueAsCString(); + cstr = GetValueAsCString(); break; case eValueObjectRepresentationStyleSummary: - return_value = GetSummaryAsCString(); + cstr = GetSummaryAsCString(); break; case eValueObjectRepresentationStyleLanguageSpecific: - return_value = GetObjectDescription(); + cstr = GetObjectDescription(); break; case eValueObjectRepresentationStyleLocation: - return_value = GetLocationAsCString(); + cstr = GetLocationAsCString(); break; case eValueObjectRepresentationStyleChildrenCount: - { - alloc_mem.resize(512); - return_value = &alloc_mem[0]; - int count = GetNumChildren(); - snprintf((char*)return_value, 512, "%d", count); - } + strm.Printf("%zu", GetNumChildren()); + cstr = strm.GetString().c_str(); break; case eValueObjectRepresentationStyleType: - return_value = GetTypeName().AsCString(); + cstr = GetTypeName().AsCString(); break; } - if (!return_value) + if (!cstr) { if (val_obj_display == eValueObjectRepresentationStyleValue) - return_value = GetSummaryAsCString(); + cstr = GetSummaryAsCString(); else if (val_obj_display == eValueObjectRepresentationStyleSummary) { if (ClangASTContext::IsAggregateType (GetClangType()) == true) { - // this thing has no value, and it seems to have no summary - // some combination of unitialized data and other factors can also - // raise this condition, so let's print a nice generic description - { - alloc_mem.resize(684); - return_value = &alloc_mem[0]; - snprintf((char*)return_value, 684, "%s @ %s", GetTypeName().AsCString(), GetLocationAsCString()); - } + strm.Printf("%s @ %s", GetTypeName().AsCString(), GetLocationAsCString()); + cstr = strm.GetString().c_str(); } else - return_value = GetValueAsCString(); + cstr = GetValueAsCString(); } } - if (return_value) - s.PutCString(return_value); + if (cstr) + s.PutCString(cstr); else { if (m_error.Fail()) @@ -1706,7 +1696,7 @@ ValueObject::GetPointerValue (AddressType *address_type) case Value::eValueTypeLoadAddress: case Value::eValueTypeFileAddress: { - uint32_t data_offset = 0; + lldb::offset_t data_offset = 0; address = m_data.GetPointer(&data_offset); } break; @@ -1913,7 +1903,7 @@ ValueObject::IsObjCNil () } ValueObjectSP -ValueObject::GetSyntheticArrayMember (int32_t index, bool can_create) +ValueObject::GetSyntheticArrayMember (size_t index, bool can_create) { if (IsArrayType()) return GetSyntheticArrayMemberFromArray(index, can_create); @@ -1926,13 +1916,13 @@ ValueObject::GetSyntheticArrayMember (int32_t index, bool can_create) } ValueObjectSP -ValueObject::GetSyntheticArrayMemberFromPointer (int32_t index, bool can_create) +ValueObject::GetSyntheticArrayMemberFromPointer (size_t index, bool can_create) { ValueObjectSP synthetic_child_sp; if (IsPointerType ()) { char index_str[64]; - snprintf(index_str, sizeof(index_str), "[%i]", index); + snprintf(index_str, sizeof(index_str), "[%zu]", index); ConstString index_const_str(index_str); // Check if we have already created a synthetic array member in this // valid object. If we have we will re-use it. @@ -1969,13 +1959,13 @@ ValueObject::GetSyntheticArrayMemberFromPointer (int32_t index, bool can_create) // there are more items in "item_array". ValueObjectSP -ValueObject::GetSyntheticArrayMemberFromArray (int32_t index, bool can_create) +ValueObject::GetSyntheticArrayMemberFromArray (size_t index, bool can_create) { ValueObjectSP synthetic_child_sp; if (IsArrayType ()) { char index_str[64]; - snprintf(index_str, sizeof(index_str), "[%i]", index); + snprintf(index_str, sizeof(index_str), "[%zu]", index); ConstString index_const_str(index_str); // Check if we have already created a synthetic array member in this // valid object. If we have we will re-use it. @@ -3057,8 +3047,8 @@ ValueObject::ExpandArraySliceExpression(const char* expression_cstr, } else // expand this into list { - int max_index = root->GetNumChildren() - 1; - for (int index = 0; index < max_index; index++) + const size_t max_index = root->GetNumChildren() - 1; + for (size_t index = 0; index < max_index; index++) { ValueObjectSP child = root->GetChildAtIndex(index, true); @@ -3094,8 +3084,8 @@ ValueObject::ExpandArraySliceExpression(const char* expression_cstr, { if (root_clang_type_info.Test(ClangASTContext::eTypeIsArray)) { - int max_index = root->GetNumChildren() - 1; - for (int index = 0; index < max_index; index++) + const size_t max_index = root->GetNumChildren() - 1; + for (size_t index = 0; index < max_index; index++) { ValueObjectSP child = root->GetChildAtIndex(index, true); @@ -3467,7 +3457,7 @@ DumpValueObject_Impl (Stream &s, ValueObjectSP synth_valobj_sp = valobj->GetSyntheticValue (options.m_use_synthetic); synth_valobj = (synth_valobj_sp ? synth_valobj_sp.get() : valobj); - uint32_t num_children = synth_valobj->GetNumChildren(); + size_t num_children = synth_valobj->GetNumChildren(); bool print_dotdotdot = false; if (num_children) { @@ -3483,7 +3473,7 @@ DumpValueObject_Impl (Stream &s, s.IndentMore(); } - uint32_t max_num_children = valobj->GetTargetSP()->GetMaximumNumberOfChildrenToDisplay(); + const size_t max_num_children = valobj->GetTargetSP()->GetMaximumNumberOfChildrenToDisplay(); if (num_children > max_num_children && !options.m_ignore_cap) { @@ -3495,7 +3485,7 @@ DumpValueObject_Impl (Stream &s, child_options.SetFormat(options.m_format).SetSummary().SetRootValueObjectName(); child_options.SetScopeChecked(true) .SetOmitSummaryDepth(child_options.m_omit_summary_depth > 1 ? child_options.m_omit_summary_depth - 1 : 0); - for (uint32_t idx=0; idx<num_children; ++idx) + for (size_t idx=0; idx<num_children; ++idx) { ValueObjectSP child_sp(synth_valobj->GetChildAtIndex(idx, true)); if (child_sp.get()) diff --git a/lldb/source/Core/ValueObjectCast.cpp b/lldb/source/Core/ValueObjectCast.cpp index 7834c850874..6abf83607d1 100644 --- a/lldb/source/Core/ValueObjectCast.cpp +++ b/lldb/source/Core/ValueObjectCast.cpp @@ -67,7 +67,7 @@ ValueObjectCast::GetClangTypeImpl () return m_cast_type.GetOpaqueQualType(); } -uint32_t +size_t ValueObjectCast::CalculateNumChildren() { return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true); diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index 81f8ccef6dc..ee2bbb5ddc3 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -62,7 +62,7 @@ ValueObjectChild::GetValueType() const return m_parent->GetValueType(); } -uint32_t +size_t ValueObjectChild::CalculateNumChildren() { return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true); diff --git a/lldb/source/Core/ValueObjectConstResult.cpp b/lldb/source/Core/ValueObjectConstResult.cpp index cc6bafc0e88..4a9dfbe5d4b 100644 --- a/lldb/source/Core/ValueObjectConstResult.cpp +++ b/lldb/source/Core/ValueObjectConstResult.cpp @@ -124,7 +124,7 @@ ValueObjectConstResult::Create const ConstString &name, const lldb::DataBufferSP &data_sp, lldb::ByteOrder data_byte_order, - uint8_t data_addr_size, + uint32_t data_addr_size, lldb::addr_t address ) { @@ -155,7 +155,7 @@ ValueObjectConstResult::ValueObjectConstResult const ConstString &name, const lldb::DataBufferSP &data_sp, lldb::ByteOrder data_byte_order, - uint8_t data_addr_size, + uint32_t data_addr_size, lldb::addr_t address ) : ValueObject (exe_scope), @@ -185,7 +185,7 @@ ValueObjectConstResult::Create const ConstString &name, lldb::addr_t address, AddressType address_type, - uint8_t addr_byte_size + uint32_t addr_byte_size ) { return (new ValueObjectConstResult (exe_scope, @@ -205,7 +205,7 @@ ValueObjectConstResult::ValueObjectConstResult const ConstString &name, lldb::addr_t address, AddressType address_type, - uint8_t addr_byte_size + uint32_t addr_byte_size ) : ValueObject (exe_scope), m_clang_ast (clang_ast), @@ -300,7 +300,7 @@ ValueObjectConstResult::SetByteSize (size_t size) m_byte_size = size; } -uint32_t +size_t ValueObjectConstResult::CalculateNumChildren() { return ClangASTContext::GetNumChildren (GetClangAST (), GetClangType(), true); @@ -363,7 +363,7 @@ ValueObjectConstResult::GetAddressOf (bool scalar_is_load_address, } ValueObject * -ValueObjectConstResult::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index) +ValueObjectConstResult::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index) { return m_impl.CreateChildAtIndex(idx, synthetic_array_member, synthetic_index); } diff --git a/lldb/source/Core/ValueObjectConstResultChild.cpp b/lldb/source/Core/ValueObjectConstResultChild.cpp index 2a305a1bea5..4f40381eb54 100644 --- a/lldb/source/Core/ValueObjectConstResultChild.cpp +++ b/lldb/source/Core/ValueObjectConstResultChild.cpp @@ -68,7 +68,7 @@ ValueObjectConstResultChild::AddressOf (Error &error) } ValueObject * -ValueObjectConstResultChild::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index) +ValueObjectConstResultChild::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index) { return m_impl.CreateChildAtIndex(idx, synthetic_array_member, synthetic_index); } diff --git a/lldb/source/Core/ValueObjectConstResultImpl.cpp b/lldb/source/Core/ValueObjectConstResultImpl.cpp index 731f3938e28..3d86b9109f8 100644 --- a/lldb/source/Core/ValueObjectConstResultImpl.cpp +++ b/lldb/source/Core/ValueObjectConstResultImpl.cpp @@ -84,7 +84,7 @@ ValueObjectConstResultImpl::Dereference (Error &error) } ValueObject * -ValueObjectConstResultImpl::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index) +ValueObjectConstResultImpl::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index) { if (m_impl_backend == NULL) return NULL; diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp index 8cd1d1f547b..1af293660fc 100644 --- a/lldb/source/Core/ValueObjectDynamicValue.cpp +++ b/lldb/source/Core/ValueObjectDynamicValue.cpp @@ -87,7 +87,7 @@ ValueObjectDynamicValue::GetQualifiedTypeName() return m_parent->GetTypeName(); } -uint32_t +size_t ValueObjectDynamicValue::CalculateNumChildren() { const bool success = UpdateValueIfNeeded(false); diff --git a/lldb/source/Core/ValueObjectList.cpp b/lldb/source/Core/ValueObjectList.cpp index 9f7185aa668..180d4a0eaf1 100644 --- a/lldb/source/Core/ValueObjectList.cpp +++ b/lldb/source/Core/ValueObjectList.cpp @@ -61,20 +61,20 @@ ValueObjectList::Append (const ValueObjectList &valobj_list) } -uint32_t +size_t ValueObjectList::GetSize() const { return m_value_objects.size(); } void -ValueObjectList::Resize (uint32_t size) +ValueObjectList::Resize (size_t size) { m_value_objects.resize (size); } lldb::ValueObjectSP -ValueObjectList::GetValueObjectAtIndex (uint32_t idx) +ValueObjectList::GetValueObjectAtIndex (size_t idx) { lldb::ValueObjectSP valobj_sp; if (idx < m_value_objects.size()) @@ -83,7 +83,7 @@ ValueObjectList::GetValueObjectAtIndex (uint32_t idx) } lldb::ValueObjectSP -ValueObjectList::RemoveValueObjectAtIndex (uint32_t idx) +ValueObjectList::RemoveValueObjectAtIndex (size_t idx) { lldb::ValueObjectSP valobj_sp; if (idx < m_value_objects.size()) @@ -95,7 +95,7 @@ ValueObjectList::RemoveValueObjectAtIndex (uint32_t idx) } void -ValueObjectList::SetValueObjectAtIndex (uint32_t idx, const ValueObjectSP &valobj_sp) +ValueObjectList::SetValueObjectAtIndex (size_t idx, const ValueObjectSP &valobj_sp) { if (idx >= m_value_objects.size()) m_value_objects.resize (idx + 1); diff --git a/lldb/source/Core/ValueObjectMemory.cpp b/lldb/source/Core/ValueObjectMemory.cpp index 7b3dbf2f307..325dc88f9e9 100644 --- a/lldb/source/Core/ValueObjectMemory.cpp +++ b/lldb/source/Core/ValueObjectMemory.cpp @@ -146,7 +146,7 @@ ValueObjectMemory::GetTypeName() return ClangASTType::GetConstTypeName (GetClangAST(), m_clang_type.GetOpaqueQualType()); } -uint32_t +size_t ValueObjectMemory::CalculateNumChildren() { if (m_type_sp) diff --git a/lldb/source/Core/ValueObjectRegister.cpp b/lldb/source/Core/ValueObjectRegister.cpp index 843f10d2f61..95a6315f435 100644 --- a/lldb/source/Core/ValueObjectRegister.cpp +++ b/lldb/source/Core/ValueObjectRegister.cpp @@ -60,7 +60,7 @@ ValueObjectRegisterContext::GetQualifiedTypeName() return ConstString(); } -uint32_t +size_t ValueObjectRegisterContext::CalculateNumChildren() { return m_reg_ctx_sp->GetRegisterSetCount(); @@ -101,11 +101,11 @@ ValueObjectRegisterContext::UpdateValue () } ValueObject * -ValueObjectRegisterContext::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index) +ValueObjectRegisterContext::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index) { ValueObject *new_valobj = NULL; - const uint32_t num_children = GetNumChildren(); + const size_t num_children = GetNumChildren(); if (idx < num_children) { ExecutionContext exe_ctx(GetExecutionContextRef()); @@ -162,7 +162,7 @@ ValueObjectRegisterSet::GetQualifiedTypeName() return ConstString(); } -uint32_t +size_t ValueObjectRegisterSet::CalculateNumChildren() { const RegisterSet *reg_set = m_reg_ctx_sp->GetRegisterSet(m_reg_set_idx); @@ -222,12 +222,12 @@ ValueObjectRegisterSet::UpdateValue () ValueObject * -ValueObjectRegisterSet::CreateChildAtIndex (uint32_t idx, bool synthetic_array_member, int32_t synthetic_index) +ValueObjectRegisterSet::CreateChildAtIndex (size_t idx, bool synthetic_array_member, int32_t synthetic_index) { ValueObject *valobj = NULL; if (m_reg_ctx_sp && m_reg_set) { - const uint32_t num_children = GetNumChildren(); + const size_t num_children = GetNumChildren(); if (idx < num_children) valobj = new ValueObjectRegister(*this, m_reg_ctx_sp, m_reg_set->registers[idx]); } @@ -250,7 +250,7 @@ ValueObjectRegisterSet::GetChildMemberWithName (const ConstString &name, bool ca return ValueObjectSP(); } -uint32_t +size_t ValueObjectRegisterSet::GetIndexOfChildWithName (const ConstString &name) { if (m_reg_ctx_sp && m_reg_set) @@ -341,7 +341,7 @@ ValueObjectRegister::GetTypeName() return m_type_name; } -uint32_t +size_t ValueObjectRegister::CalculateNumChildren() { return 0; diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index f9c23a016a6..8ca0ea99111 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -27,14 +27,14 @@ public: SyntheticChildrenFrontEnd(backend) {} - uint32_t + size_t CalculateNumChildren() { return 0; } lldb::ValueObjectSP - GetChildAtIndex (uint32_t idx) + GetChildAtIndex (size_t idx) { return lldb::ValueObjectSP(); } @@ -95,7 +95,7 @@ ValueObjectSynthetic::GetTypeName() return m_parent->GetTypeName(); } -uint32_t +size_t ValueObjectSynthetic::CalculateNumChildren() { UpdateValueIfNeeded(); @@ -183,7 +183,7 @@ ValueObjectSynthetic::UpdateValue () } lldb::ValueObjectSP -ValueObjectSynthetic::GetChildAtIndex (uint32_t idx, bool can_create) +ValueObjectSynthetic::GetChildAtIndex (size_t idx, bool can_create) { UpdateValueIfNeeded(); @@ -219,7 +219,7 @@ ValueObjectSynthetic::GetChildMemberWithName (const ConstString &name, bool can_ return GetChildAtIndex(index, can_create); } -uint32_t +size_t ValueObjectSynthetic::GetIndexOfChildWithName (const ConstString &name) { UpdateValueIfNeeded(); diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp index 3ff37e9deac..5647fbb890e 100644 --- a/lldb/source/Core/ValueObjectVariable.cpp +++ b/lldb/source/Core/ValueObjectVariable.cpp @@ -80,7 +80,7 @@ ValueObjectVariable::GetQualifiedTypeName() return ConstString(); } -uint32_t +size_t ValueObjectVariable::CalculateNumChildren() { ClangASTType type(GetClangAST(), |