diff options
23 files changed, 66 insertions, 51 deletions
diff --git a/lldb/include/lldb/Core/UniqueCStringMap.h b/lldb/include/lldb/Core/UniqueCStringMap.h index 34b91f30a6d..8aee529b4ea 100644 --- a/lldb/include/lldb/Core/UniqueCStringMap.h +++ b/lldb/include/lldb/Core/UniqueCStringMap.h @@ -157,13 +157,16 @@ public: const Entry * FindNextValueForName (const char *unique_cstr, const Entry *entry_ptr) const { - const Entry *first_entry = m_map.data(); - const Entry *after_last_entry = first_entry + m_map.size(); - const Entry *next_entry = entry_ptr + 1; - if (first_entry <= next_entry && next_entry < after_last_entry) + if (!m_map.empty()) { - if (next_entry->cstring == unique_cstr) - return next_entry; + const Entry *first_entry = &m_map[0]; + const Entry *after_last_entry = first_entry + m_map.size(); + const Entry *next_entry = entry_ptr + 1; + if (first_entry <= next_entry && next_entry < after_last_entry) + { + if (next_entry->cstring == unique_cstr) + return next_entry; + } } return NULL; } diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 30dfe2a0bd5..936ce20303f 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -647,7 +647,7 @@ public: if (!buffer.GetString().empty()) { Error error; - if (process->WriteMemory (addr, buffer.GetString().data(), buffer.GetString().size(), error) == buffer.GetString().size()) + if (process->WriteMemory (addr, buffer.GetString().c_str(), buffer.GetString().size(), error) == buffer.GetString().size()) return true; else { diff --git a/lldb/source/Commands/CommandObjectThread.cpp b/lldb/source/Commands/CommandObjectThread.cpp index 6c38758e3fc..8f49237767f 100644 --- a/lldb/source/Commands/CommandObjectThread.cpp +++ b/lldb/source/Commands/CommandObjectThread.cpp @@ -1028,7 +1028,7 @@ public: index_ptr++; } - new_plan = thread->QueueThreadPlanForStepUntil (abort_other_plans, address_list.data(), address_list.size(), m_options.m_stop_others); + new_plan = thread->QueueThreadPlanForStepUntil (abort_other_plans, &address_list.front(), address_list.size(), m_options.m_stop_others); new_plan->SetOkayToDiscard(false); } else diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 7119b71987f..c3cb88ec065 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -167,7 +167,7 @@ ReadAddress (ExecutionContextScope *exe_scope, const Address &address, uint32_t static bool DumpUInt (ExecutionContextScope *exe_scope, const Address &address, uint32_t byte_size, Stream* strm) { - if (exe_scope == NULL) + if (exe_scope == NULL || byte_size == 0) return 0; std::vector<uint8_t> buf(byte_size, 0); @@ -177,7 +177,7 @@ DumpUInt (ExecutionContextScope *exe_scope, const Address &address, uint32_t byt uint32_t addr_size = 0; if (GetByteOrderAndAddressSize (exe_scope, address, byte_order, addr_size)) { - DataExtractor data (buf.data(), buf.size(), byte_order, addr_size); + DataExtractor data (&buf.front(), buf.size(), byte_order, addr_size); data.Dump (strm, 0, // Start offset in "data" diff --git a/lldb/source/Core/Communication.cpp b/lldb/source/Core/Communication.cpp index ee355dcd467..9fa06479511 100644 --- a/lldb/source/Core/Communication.cpp +++ b/lldb/source/Core/Communication.cpp @@ -248,7 +248,7 @@ Communication::GetCachedBytes (void *dst, size_t dst_len) const size_t len = std::min<size_t>(dst_len, m_bytes.size()); - ::memcpy (dst, m_bytes.data(), len); + ::memcpy (dst, m_bytes.c_str(), len); m_bytes.erase(m_bytes.begin(), m_bytes.begin() + len); return len; diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index 32b1bf3508a..f079b9be8fb 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -337,7 +337,7 @@ Debugger::WriteToDefaultReader (const char *bytes, size_t bytes_len) if (!reader_sp) break; - size_t bytes_handled = reader_sp->HandleRawBytes (m_input_reader_data.data(), + size_t bytes_handled = reader_sp->HandleRawBytes (m_input_reader_data.c_str(), m_input_reader_data.size()); if (bytes_handled) { diff --git a/lldb/source/Core/Event.cpp b/lldb/source/Core/Event.cpp index c848cd48307..8ca2a9fb800 100644 --- a/lldb/source/Core/Event.cpp +++ b/lldb/source/Core/Event.cpp @@ -169,10 +169,10 @@ EventDataBytes::Dump (Stream *s) const { s->Printf("\"%s\"", m_bytes.c_str()); } - else + else if (m_bytes.size() > 0) { DataExtractor data; - data.SetData(m_bytes.data(), m_bytes.size(), eByteOrderHost); + data.SetData(&m_bytes[0], m_bytes.size(), eByteOrderHost); data.Dump(s, 0, eFormatBytes, 1, m_bytes.size(), 32, LLDB_INVALID_ADDRESS, 0, 0); } } @@ -182,7 +182,7 @@ EventDataBytes::GetBytes() const { if (m_bytes.empty()) return NULL; - return m_bytes.data(); + return &m_bytes[0]; } size_t diff --git a/lldb/source/Core/RegularExpression.cpp b/lldb/source/Core/RegularExpression.cpp index 5b723ed71dd..b632c2eb0b0 100644 --- a/lldb/source/Core/RegularExpression.cpp +++ b/lldb/source/Core/RegularExpression.cpp @@ -100,7 +100,7 @@ RegularExpression::Execute(const char* s, size_t num_matches, int execute_flags) match_result = ::regexec (&m_preg, s, m_matches.size(), - const_cast<regmatch_t *>(m_matches.data()), + &m_matches.front(), execute_flags); } return match_result == 0; diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp index c32bdc28148..72984c6c082 100644 --- a/lldb/source/Core/ValueObject.cpp +++ b/lldb/source/Core/ValueObject.cpp @@ -395,8 +395,8 @@ ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope) // Resize the formatted buffer in case every character // uses the "\xXX" format and one extra byte for a NULL cstr_buffer.resize(data_buffer.size() * 4 + 1); - data.SetData (data_buffer.data(), data_buffer.size(), eByteOrderHost); - bytes_read = process->ReadMemory (cstr_address, data_buffer.data(), fixed_length, error); + data.SetData (&data_buffer.front(), data_buffer.size(), eByteOrderHost); + bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), fixed_length, error); if (bytes_read > 0) { sstr << '"'; @@ -423,11 +423,11 @@ ValueObject::GetSummaryAsCString (ExecutionContextScope *exe_scope) // "\xXX" format and one extra byte for a NULL cstr_buffer.resize (k_max_buf_size * 4 + 1); - data.SetData (data_buffer.data(), data_buffer.size(), eByteOrderHost); + data.SetData (&data_buffer.front(), data_buffer.size(), eByteOrderHost); size_t total_cstr_len = 0; - while ((bytes_read = process->ReadMemory (cstr_address, data_buffer.data(), k_max_buf_size, error)) > 0) + while ((bytes_read = process->ReadMemory (cstr_address, &data_buffer.front(), k_max_buf_size, error)) > 0) { - size_t len = strlen(data_buffer.data()); + size_t len = strlen(&data_buffer.front()); if (len == 0) break; if (len > bytes_read) diff --git a/lldb/source/Core/ValueObjectChild.cpp b/lldb/source/Core/ValueObjectChild.cpp index b9258bd45db..9b9b8d9e849 100644 --- a/lldb/source/Core/ValueObjectChild.cpp +++ b/lldb/source/Core/ValueObjectChild.cpp @@ -112,8 +112,8 @@ ValueObjectChild::GetTypeName() if (clang_type_name) { std::vector<char> bitfield_type_name (strlen(clang_type_name) + 32, 0); - ::snprintf (bitfield_type_name.data(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size); - m_type_name.SetCString(bitfield_type_name.data()); + ::snprintf (&bitfield_type_name.front(), bitfield_type_name.size(), "%s:%u", clang_type_name, m_bitfield_bit_size); + m_type_name.SetCString(&bitfield_type_name.front()); } } } diff --git a/lldb/source/Expression/ClangFunction.cpp b/lldb/source/Expression/ClangFunction.cpp index a7bbff7b52f..7e1160dfbef 100644 --- a/lldb/source/Expression/ClangFunction.cpp +++ b/lldb/source/Expression/ClangFunction.cpp @@ -358,8 +358,8 @@ ClangFunction::WriteFunctionArguments (ExecutionContext &exc_context, lldb::addr buffer.resize(byte_size); DataExtractor value_data; arg_scalar.GetData (value_data); - value_data.ExtractBytes(0, byte_size, process->GetByteOrder(), buffer.data()); - process->WriteMemory(args_addr_ref + offset, buffer.data(), byte_size, error); + value_data.ExtractBytes(0, byte_size, process->GetByteOrder(), &buffer.front()); + process->WriteMemory(args_addr_ref + offset, &buffer.front(), byte_size, error); } return true; @@ -417,7 +417,7 @@ ClangFunction::FetchFunctionResults (ExecutionContext &exc_context, lldb::addr_t data_buffer.resize(m_return_size); Process *process = exc_context.process; Error error; - size_t bytes_read = process->ReadMemory(args_addr + m_return_offset/8, data_buffer.data(), m_return_size, error); + size_t bytes_read = process->ReadMemory(args_addr + m_return_offset/8, &data_buffer.front(), m_return_size, error); if (bytes_read == 0) { @@ -427,7 +427,7 @@ ClangFunction::FetchFunctionResults (ExecutionContext &exc_context, lldb::addr_t if (bytes_read < m_return_size) return false; - DataExtractor data(data_buffer.data(), m_return_size, process->GetByteOrder(), process->GetAddressByteSize()); + DataExtractor data(&data_buffer.front(), m_return_size, process->GetByteOrder(), process->GetAddressByteSize()); // FIXME: Assuming an integer scalar for now: uint32_t offset = 0; diff --git a/lldb/source/Interpreter/Args.cpp b/lldb/source/Interpreter/Args.cpp index 4d358163721..059a69a36f7 100644 --- a/lldb/source/Interpreter/Args.cpp +++ b/lldb/source/Interpreter/Args.cpp @@ -1008,7 +1008,7 @@ Args::ParseArgsForCompletion int long_options_index = -1; val = ::getopt_long (dummy_vec.size() - 1, - (char *const *) dummy_vec.data(), + (char *const *) &dummy_vec.front(), sstr.GetData(), long_options, &long_options_index); diff --git a/lldb/source/Interpreter/Options.cpp b/lldb/source/Interpreter/Options.cpp index 90eb66c1a55..410efc669ff 100644 --- a/lldb/source/Interpreter/Options.cpp +++ b/lldb/source/Interpreter/Options.cpp @@ -285,7 +285,10 @@ Options::GetLongOptions () m_getopt_table[j].val = 0; } - return m_getopt_table.data(); + if (m_getopt_table.empty()) + return NULL; + + return &m_getopt_table.front(); } diff --git a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp index b9adb31c8a4..e1d9c49e8fc 100644 --- a/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp +++ b/lldb/source/Plugins/Process/MacOSX-User/source/ProcessMacOSX.cpp @@ -943,13 +943,13 @@ ProcessMacOSX::GetSTDOUT (char *buf, size_t buf_size, Error &error) ProcessMacOSXLog::LogIf (PD_LOG_PROCESS, "ProcessMacOSX::%s (&%p[%u]) ...", __FUNCTION__, buf, buf_size); if (bytes_available > buf_size) { - memcpy(buf, m_stdout_data.data(), buf_size); + memcpy(buf, m_stdout_data.c_str(), buf_size); m_stdout_data.erase(0, buf_size); bytes_available = buf_size; } else { - memcpy(buf, m_stdout_data.data(), bytes_available); + memcpy(buf, m_stdout_data.c_str(), bytes_available); m_stdout_data.clear(); //ResetEventBits(eBroadcastBitSTDOUT); diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 66c4b241ef3..062bd25d182 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -267,7 +267,7 @@ GDBRemoteCommunication::SendContinuePacketAndWaitForResponse m_async_response.Clear(); if (!m_async_packet.empty()) { - SendPacketAndWaitForResponse (m_async_packet.data(), + SendPacketAndWaitForResponse (&m_async_packet[0], m_async_packet.size(), m_async_response, m_async_timeout, @@ -483,7 +483,7 @@ GDBRemoteCommunication::WaitForPacketNoLock (StringExtractorGDBRemote &response, if (m_send_acks) { char packet_checksum = strtol (&packet_data[packet_size-2], NULL, 16); - char actual_checksum = CalculcateChecksum (response_str.data(), response_str.size()); + char actual_checksum = CalculcateChecksum (&response_str[0], response_str.size()); checksum_error = packet_checksum != actual_checksum; // Send the ack or nack if needed if (checksum_error) diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp index 5af4c9c2035..d1f82a2116c 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp @@ -379,7 +379,7 @@ GDBRemoteRegisterContext::ReadAllRegisterValues (lldb::DataBufferSP &data_sp) return false; response.GetStringRef().insert(0, 1, 'G'); - data_sp.reset (new DataBufferHeap(response.GetStringRef().data(), + data_sp.reset (new DataBufferHeap(response.GetStringRef().c_str(), response.GetStringRef().size())); return true; } diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index fcf00270514..ea5ac5cd14f 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -1313,13 +1313,13 @@ ProcessGDBRemote::GetSTDOUT (char *buf, size_t buf_size, Error &error) ProcessGDBRemoteLog::LogIf (GDBR_LOG_PROCESS, "ProcessGDBRemote::%s (&%p[%u]) ...", __FUNCTION__, buf, buf_size); if (bytes_available > buf_size) { - memcpy(buf, m_stdout_data.data(), buf_size); + memcpy(buf, m_stdout_data.c_str(), buf_size); m_stdout_data.erase(0, buf_size); bytes_available = buf_size; } else { - memcpy(buf, m_stdout_data.data(), bytes_available); + memcpy(buf, m_stdout_data.c_str(), bytes_available); m_stdout_data.clear(); //ResetEventBits(eBroadcastBitSTDOUT); diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index a0fe0e2a0ec..0c84d2b1160 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2878,17 +2878,18 @@ SymbolFileDWARF::ParseType(const SymbolContext& sc, const DWARFCompileUnit* dwar { // This is a class and all members that didn't have // their access specified are private. - type_list->GetClangASTContext().SetDefaultAccessForRecordFields (clang_type, clang::AS_private, member_accessibilities.data(), member_accessibilities.size()); + type_list->GetClangASTContext().SetDefaultAccessForRecordFields (clang_type, clang::AS_private, &member_accessibilities.front(), member_accessibilities.size()); } if (!base_classes.empty()) { - type_list->GetClangASTContext().SetBaseClassesForClassType (clang_type, base_classes.data(), base_classes.size()); + type_list->GetClangASTContext().SetBaseClassesForClassType (clang_type, &base_classes.front(), base_classes.size()); + + // Clang will copy each CXXBaseSpecifier in "base_classes" + // so we have to free them all. + ClangASTContext::DeleteBaseClassSpecifiers (&base_classes.front(), base_classes.size()); } - // Clang will copy each CXXBaseSpecifier in "base_classes" - // so we have to free them all. - ClangASTContext::DeleteBaseClassSpecifiers (base_classes.data(), base_classes.size()); } type_list->GetClangASTContext().CompleteTagDeclarationDefinition (clang_type); } @@ -3069,7 +3070,7 @@ SymbolFileDWARF::ParseType(const SymbolContext& sc, const DWARFCompileUnit* dwar assert (function_decl); m_die_to_decl_ctx[die] = function_decl; if (!function_param_decls.empty()) - type_list->GetClangASTContext().SetFunctionParameters (function_decl, function_param_decls.data(), function_param_decls.size()); + type_list->GetClangASTContext().SetFunctionParameters (function_decl, &function_param_decls.front(), function_param_decls.size()); } type_sp.reset( new Type(die->GetOffset(), this, type_name_dbstr, 0, NULL, LLDB_INVALID_UID, Type::eIsTypeWithUID, &decl, clang_type)); diff --git a/lldb/source/Symbol/ClangASTContext.cpp b/lldb/source/Symbol/ClangASTContext.cpp index 8087953c32b..754ab195930 100644 --- a/lldb/source/Symbol/ClangASTContext.cpp +++ b/lldb/source/Symbol/ClangASTContext.cpp @@ -1944,7 +1944,7 @@ ClangASTContext::CreateFunctionType (void *result_type, void **args, unsigned nu // TODO: Detect calling convention in DWARF? return ast_context->getFunctionType(QualType::getFromOpaquePtr(result_type), - qual_type_args.data(), + qual_type_args.empty() ? NULL : &qual_type_args.front(), qual_type_args.size(), isVariadic, TypeQuals, diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index 87d58600a59..7cb76106c34 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -503,8 +503,11 @@ Symtab::InitAddressIndexes() size_t Symtab::CalculateSymbolSize (Symbol *symbol) { + if (m_symbols.empty()) + return 0; + // Make sure this symbol is from this symbol table... - if (symbol < m_symbols.data() || symbol >= m_symbols.data() + m_symbols.size()) + if (symbol < &m_symbols.front() || symbol > &m_symbols.back()) return 0; // See if this symbol already has a byte size? @@ -523,7 +526,7 @@ Symtab::CalculateSymbolSize (Symbol *symbol) if (m_addr_indexes.empty()) InitAddressIndexes(); const size_t num_addr_indexes = m_addr_indexes.size(); - SymbolSearchInfo info = FindIndexPtrForSymbolContainingAddress(this, symbol->GetAddressRangePtr()->GetBaseAddress().GetFileAddress(), m_addr_indexes.data(), num_addr_indexes); + SymbolSearchInfo info = FindIndexPtrForSymbolContainingAddress(this, symbol->GetAddressRangePtr()->GetBaseAddress().GetFileAddress(), &m_addr_indexes.front(), num_addr_indexes); if (info.match_index_ptr != NULL) { const lldb::addr_t curr_file_addr = symbol->GetAddressRangePtr()->GetBaseAddress().GetFileAddress(); @@ -531,7 +534,7 @@ Symtab::CalculateSymbolSize (Symbol *symbol) // last one by taking the delta between the current symbol and // the next symbol - for (uint32_t addr_index = info.match_index_ptr - m_addr_indexes.data() + 1; + for (uint32_t addr_index = info.match_index_ptr - &m_addr_indexes.front() + 1; addr_index < num_addr_indexes; ++addr_index) { diff --git a/lldb/source/Symbol/Type.cpp b/lldb/source/Symbol/Type.cpp index 41336a703d8..31a5bac7d51 100644 --- a/lldb/source/Symbol/Type.cpp +++ b/lldb/source/Symbol/Type.cpp @@ -399,14 +399,14 @@ lldb_private::Type::DumpSummary else buf.resize (256); - lldb_private::DataExtractor cstr_data(buf.data(), buf.size(), exe_ctx->process->GetByteOrder(), 4); + lldb_private::DataExtractor cstr_data(&buf.front(), buf.size(), exe_ctx->process->GetByteOrder(), 4); buf.back() = '\0'; size_t bytes_read; size_t total_cstr_len = 0; Error error; - while ((bytes_read = exe_ctx->process->ReadMemory (pointer_addresss, buf.data(), buf.size(), error)) > 0) + while ((bytes_read = exe_ctx->process->ReadMemory (pointer_addresss, &buf.front(), buf.size(), error)) > 0) { - const size_t len = strlen((const char *)buf.data()); + const size_t len = strlen((const char *)&buf.front()); if (len == 0) break; if (total_cstr_len == 0) diff --git a/lldb/source/Target/ObjCObjectPrinter.cpp b/lldb/source/Target/ObjCObjectPrinter.cpp index 4cf079f62cd..1e436d77edc 100644 --- a/lldb/source/Target/ObjCObjectPrinter.cpp +++ b/lldb/source/Target/ObjCObjectPrinter.cpp @@ -86,7 +86,7 @@ ObjCObjectPrinter::PrintObject (ConstString &str, Value &object_ptr, ExecutionCo if (!desc.empty()) { - str.SetCString(desc.data()); + str.SetCString(&desc.front()); return true; } return false; diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp index 31f801f7695..11ba38e6b89 100644 --- a/lldb/source/Target/Process.cpp +++ b/lldb/source/Target/Process.cpp @@ -989,7 +989,12 @@ Process::Launch exec_path_plus_argv.push_back(NULL); // Now launch using these arguments. - error = DoLaunch (exe_module, exec_path_plus_argv.data(), envp, stdin_path, stdout_path, stderr_path); + error = DoLaunch (exe_module, + exec_path_plus_argv.empty() ? NULL : &exec_path_plus_argv.front(), + envp, + stdin_path, + stdout_path, + stderr_path); if (error.Fail()) { |

