diff options
Diffstat (limited to 'source/Plugins')
-rw-r--r-- | source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp | 34 | ||||
-rw-r--r-- | source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp | 17 | ||||
-rw-r--r-- | source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp | 73 |
3 files changed, 55 insertions, 69 deletions
diff --git a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp index 04df0065d7bc5..65cbd271e9797 100644 --- a/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp +++ b/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp @@ -2362,32 +2362,30 @@ ValueObjectSP ABISysV_arm64::GetReturnValueObjectImpl( if (success) return_valobj_sp = ValueObjectConstResult::Create( thread.GetStackFrameAtIndex(0).get(), value, ConstString("")); - } else if (type_flags & eTypeIsVector) { + } else if (type_flags & eTypeIsVector && byte_size <= 16) { if (byte_size > 0) { const RegisterInfo *v0_info = reg_ctx->GetRegisterInfoByName("v0", 0); if (v0_info) { - if (byte_size <= v0_info->byte_size) { - std::unique_ptr<DataBufferHeap> heap_data_ap( - new DataBufferHeap(byte_size, 0)); - const ByteOrder byte_order = exe_ctx.GetProcessRef().GetByteOrder(); - RegisterValue reg_value; - if (reg_ctx->ReadRegister(v0_info, reg_value)) { - Error error; - if (reg_value.GetAsMemoryData(v0_info, heap_data_ap->GetBytes(), - heap_data_ap->GetByteSize(), - byte_order, error)) { - DataExtractor data(DataBufferSP(heap_data_ap.release()), - byte_order, - exe_ctx.GetProcessRef().GetAddressByteSize()); - return_valobj_sp = ValueObjectConstResult::Create( - &thread, return_compiler_type, ConstString(""), data); - } + std::unique_ptr<DataBufferHeap> heap_data_ap( + new DataBufferHeap(byte_size, 0)); + const ByteOrder byte_order = exe_ctx.GetProcessRef().GetByteOrder(); + RegisterValue reg_value; + if (reg_ctx->ReadRegister(v0_info, reg_value)) { + Error error; + if (reg_value.GetAsMemoryData(v0_info, heap_data_ap->GetBytes(), + heap_data_ap->GetByteSize(), byte_order, + error)) { + DataExtractor data(DataBufferSP(heap_data_ap.release()), byte_order, + exe_ctx.GetProcessRef().GetAddressByteSize()); + return_valobj_sp = ValueObjectConstResult::Create( + &thread, return_compiler_type, ConstString(""), data); } } } } - } else if (type_flags & eTypeIsStructUnion || type_flags & eTypeIsClass) { + } else if (type_flags & eTypeIsStructUnion || type_flags & eTypeIsClass || + (type_flags & eTypeIsVector && byte_size > 16)) { DataExtractor data; uint32_t NGRN = 0; // Search ABI docs for NGRN diff --git a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp index 20260ee5b5c31..c824653b2e930 100644 --- a/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp +++ b/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOS.cpp @@ -434,24 +434,25 @@ Error DynamicLoaderMacOS::CanLoadImage() { // Default assumption is that it is OK to load images. // Only say that we cannot load images if we find the symbol in libdyld and it - // indicates that - // we cannot. + // indicates that we cannot. if (symbol_address != LLDB_INVALID_ADDRESS) { { int lock_held = m_process->ReadUnsignedIntegerFromMemory(symbol_address, 4, 0, error); if (lock_held != 0) { - error.SetErrorToGenericError(); + error.SetErrorString("dyld lock held - unsafe to load images."); } } } else { // If we were unable to find _dyld_global_lock_held in any modules, or it is - // not loaded into - // memory yet, we may be at process startup (sitting at _dyld_start) - so we - // should not allow - // dlopen calls. - error.SetErrorToGenericError(); + // not loaded into memory yet, we may be at process startup (sitting + // at _dyld_start) - so we should not allow dlopen calls. + // But if we found more than one module then we are clearly past _dyld_start + // so in that case we'll default to "it's safe". + if (num_modules <= 1) + error.SetErrorString("could not find the dyld library or " + "the dyld lock symbol"); } return error; } diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 8c2fc3d3aa425..ad6af8dfebd55 100644 --- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -1946,7 +1946,9 @@ void SymbolFileDWARF::Index() { std::vector<NameToDIE> type_index(num_compile_units); std::vector<NameToDIE> namespace_index(num_compile_units); - std::vector<bool> clear_cu_dies(num_compile_units, false); + // std::vector<bool> might be implemented using bit test-and-set, so use + // uint8_t instead. + std::vector<uint8_t> clear_cu_dies(num_compile_units, false); auto parser_fn = [debug_info, &function_basename_index, &function_fullname_index, &function_method_index, &function_selector_index, &objc_class_selectors_index, @@ -1963,22 +1965,18 @@ void SymbolFileDWARF::Index() { return cu_idx; }; - auto extract_fn = [debug_info](uint32_t cu_idx) { + auto extract_fn = [debug_info, &clear_cu_dies](uint32_t cu_idx) { DWARFCompileUnit *dwarf_cu = debug_info->GetCompileUnitAtIndex(cu_idx); if (dwarf_cu) { // dwarf_cu->ExtractDIEsIfNeeded(false) will return zero if the // DIEs for a compile unit have already been parsed. - return std::make_pair(cu_idx, dwarf_cu->ExtractDIEsIfNeeded(false) > 1); + if (dwarf_cu->ExtractDIEsIfNeeded(false) > 1) + clear_cu_dies[cu_idx] = true; } - return std::make_pair(cu_idx, false); }; // Create a task runner that extracts dies for each DWARF compile unit in a // separate thread - TaskRunner<std::pair<uint32_t, bool>> task_runner_extract; - for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) - task_runner_extract.AddTask(extract_fn, cu_idx); - //---------------------------------------------------------------------- // First figure out which compile units didn't have their DIEs already // parsed and remember this. If no DIEs were parsed prior to this index @@ -1988,48 +1986,37 @@ void SymbolFileDWARF::Index() { // a DIE in one compile unit refers to another and the indexes accesses // those DIEs. //---------------------------------------------------------------------- - while (true) { - auto f = task_runner_extract.WaitForNextCompletedTask(); - if (!f.valid()) - break; - unsigned cu_idx; - bool clear; - std::tie(cu_idx, clear) = f.get(); - clear_cu_dies[cu_idx] = clear; - } + TaskMapOverInt(0, num_compile_units, extract_fn); // Now create a task runner that can index each DWARF compile unit in a // separate // thread so we can index quickly. - TaskRunner<uint32_t> task_runner; - for (uint32_t cu_idx = 0; cu_idx < num_compile_units; ++cu_idx) - task_runner.AddTask(parser_fn, cu_idx); + TaskMapOverInt(0, num_compile_units, parser_fn); - while (true) { - std::future<uint32_t> f = task_runner.WaitForNextCompletedTask(); - if (!f.valid()) - break; - uint32_t cu_idx = f.get(); - - m_function_basename_index.Append(function_basename_index[cu_idx]); - m_function_fullname_index.Append(function_fullname_index[cu_idx]); - m_function_method_index.Append(function_method_index[cu_idx]); - m_function_selector_index.Append(function_selector_index[cu_idx]); - m_objc_class_selectors_index.Append(objc_class_selectors_index[cu_idx]); - m_global_index.Append(global_index[cu_idx]); - m_type_index.Append(type_index[cu_idx]); - m_namespace_index.Append(namespace_index[cu_idx]); - } + auto finalize_fn = [](NameToDIE &index, std::vector<NameToDIE> &srcs) { + for (auto &src : srcs) + index.Append(src); + index.Finalize(); + }; - TaskPool::RunTasks([&]() { m_function_basename_index.Finalize(); }, - [&]() { m_function_fullname_index.Finalize(); }, - [&]() { m_function_method_index.Finalize(); }, - [&]() { m_function_selector_index.Finalize(); }, - [&]() { m_objc_class_selectors_index.Finalize(); }, - [&]() { m_global_index.Finalize(); }, - [&]() { m_type_index.Finalize(); }, - [&]() { m_namespace_index.Finalize(); }); + TaskPool::RunTasks( + [&]() { + finalize_fn(m_function_basename_index, function_basename_index); + }, + [&]() { + finalize_fn(m_function_fullname_index, function_fullname_index); + }, + [&]() { finalize_fn(m_function_method_index, function_method_index); }, + [&]() { + finalize_fn(m_function_selector_index, function_selector_index); + }, + [&]() { + finalize_fn(m_objc_class_selectors_index, objc_class_selectors_index); + }, + [&]() { finalize_fn(m_global_index, global_index); }, + [&]() { finalize_fn(m_type_index, type_index); }, + [&]() { finalize_fn(m_namespace_index, namespace_index); }); //---------------------------------------------------------------------- // Keep memory down by clearing DIEs for any compile units if indexing |