[Lldb-commits] [lldb] fa2b038 - [lldb][NFC] Replace some counting loops with std::distance
Author: Vlad Serebrennikov Date: 2023-07-30T19:22:02+03:00 New Revision: fa2b038cadf17d08014e5fb75c47b5024860953e URL: https://github.com/llvm/llvm-project/commit/fa2b038cadf17d08014e5fb75c47b5024860953e DIFF: https://github.com/llvm/llvm-project/commit/fa2b038cadf17d08014e5fb75c47b5024860953e.diff LOG: [lldb][NFC] Replace some counting loops with std::distance Added: Modified: lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp Removed: diff --git a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp index 5bc7a47241028d..a83e4625077350 100644 --- a/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp +++ b/lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp @@ -5361,11 +5361,8 @@ uint32_t TypeSystemClang::GetNumChildren(lldb::opaque_compiler_type_t type, num_children += cxx_record_decl->getNumBases(); } } - clang::RecordDecl::field_iterator field, field_end; - for (field = record_decl->field_begin(), - field_end = record_decl->field_end(); - field != field_end; ++field) -++num_children; + num_children += std::distance(record_decl->field_begin(), + record_decl->field_end()); } break; @@ -5576,13 +5573,8 @@ uint32_t TypeSystemClang::GetNumFields(lldb::opaque_compiler_type_t type) { if (record_type) { clang::RecordDecl *record_decl = record_type->getDecl(); if (record_decl) { - uint32_t field_idx = 0; - clang::RecordDecl::field_iterator field, field_end; - for (field = record_decl->field_begin(), - field_end = record_decl->field_end(); - field != field_end; ++field) -++field_idx; - count = field_idx; + count = std::distance(record_decl->field_begin(), +record_decl->field_end()); } } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b9bb946 - [lldb] Re-enable Clang Modules in source/Host directory on macOS
Author: Jonas Devlieghere Date: 2023-07-30T13:40:56-07:00 New Revision: b9bb946ca3afa384a6376e3485bd49b09c54d743 URL: https://github.com/llvm/llvm-project/commit/b9bb946ca3afa384a6376e3485bd49b09c54d743 DIFF: https://github.com/llvm/llvm-project/commit/b9bb946ca3afa384a6376e3485bd49b09c54d743.diff LOG: [lldb] Re-enable Clang Modules in source/Host directory on macOS Re-enable clang modules for source/Host when targetting macOS 14 or later, in which the underlying issue has been fixed. Added: Modified: lldb/source/Host/CMakeLists.txt Removed: diff --git a/lldb/source/Host/CMakeLists.txt b/lldb/source/Host/CMakeLists.txt index 5451c2bcf776e9..18de97275e1e9f 100644 --- a/lldb/source/Host/CMakeLists.txt +++ b/lldb/source/Host/CMakeLists.txt @@ -1,9 +1,10 @@ if (APPLE AND LLVM_ENABLE_LOCAL_SUBMODULE_VISIBILITY) # The arpa/inet.h header used in the files here is providing a miscompiled - # htonl function on macOS <= 10.15 when local submodule visibility is active. - # Disabling modules in this directory until this is is fixed. - # See rdar://problem/62886385 - remove_module_flags() + # htonl function on macOS < 14 when local submodule visibility is active. + if (CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 14.0) +# Disabling modules in this directory. +remove_module_flags() + endif() endif() macro(add_host_subdirectory group) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 858a286 - [lldb] Remove outdated comment and radar link (NFC)
Author: Jonas Devlieghere Date: 2023-07-30T13:51:49-07:00 New Revision: 858a2865d3008b35f22597a411b2b4f7110aaa15 URL: https://github.com/llvm/llvm-project/commit/858a2865d3008b35f22597a411b2b4f7110aaa15 DIFF: https://github.com/llvm/llvm-project/commit/858a2865d3008b35f22597a411b2b4f7110aaa15.diff LOG: [lldb] Remove outdated comment and radar link (NFC) The comment and radar referenced PyThreadState_Get which is no longer used there and instead has been replaced to a call to PyThreadState_GetDict which has different semantics. Unlike PyThreadState_Get, it can return NULL and it is okay to call this function when no current thread state is available. Added: Modified: lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp Removed: diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp index 55b7a73712c4fc..3fbab6bacec7db 100644 --- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp +++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp @@ -582,10 +582,6 @@ void ScriptInterpreterPythonImpl::LeaveSession() { // up believing we have no thread state and PyImport_AddModule will crash if // that is the case - since that seems to only happen when destroying the // SBDebugger, we can make do without clearing up stdout and stderr - - // rdar://problem/11292882 - // When the current thread state is NULL, PyThreadState_Get() issues a fatal - // error. if (PyThreadState_GetDict()) { PythonDictionary &sys_module_dict = GetSysModuleDictionary(); if (sys_module_dict.IsValid()) { @@ -1783,7 +1779,7 @@ lldb::StateType ScriptInterpreterPythonImpl::ScriptedThreadPlanGetRunState( bool ScriptInterpreterPythonImpl::ScriptedThreadPlanGetStopDescription( -StructuredData::ObjectSP implementor_sp, lldb_private::Stream *stream, +StructuredData::ObjectSP implementor_sp, lldb_private::Stream *stream, bool &script_error) { StructuredData::Generic *generic = nullptr; if (implementor_sp) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b96ea7e - [lldb] Remove workaround in InstrumentationRuntimeASan
Author: Jonas Devlieghere Date: 2023-07-30T14:15:34-07:00 New Revision: b96ea7e1f1351cec89100097936524122a850225 URL: https://github.com/llvm/llvm-project/commit/b96ea7e1f1351cec89100097936524122a850225 DIFF: https://github.com/llvm/llvm-project/commit/b96ea7e1f1351cec89100097936524122a850225.diff LOG: [lldb] Remove workaround in InstrumentationRuntimeASan The code was commented out because it would trigger an assert in the source manager. I can no longer reproduce the assert and none of the ASan tests are failing with the code re-enabled. Added: Modified: lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp Removed: diff --git a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp index 44070b4018..10ff1ca7d5d438 100644 --- a/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp +++ b/lldb/source/Plugins/InstrumentationRuntime/ASan/InstrumentationRuntimeASan.cpp @@ -152,12 +152,10 @@ StructuredData::ObjectSP InstrumentationRuntimeASan::RetrieveReportData() { addr_t pc = return_value_sp->GetValueForExpressionPath(".pc")->GetValueAsUnsigned(0); - /* commented out because rdar://problem/18533301 addr_t bp = return_value_sp->GetValueForExpressionPath(".bp")->GetValueAsUnsigned(0); addr_t sp = - return_value_sp->GetValueForExpressionPath(".sp")->GetValueAsUnsigned(0); - */ + return_value_sp->GetValueForExpressionPath(".sp")->GetValueAsUnsigned(0); addr_t address = return_value_sp->GetValueForExpressionPath(".address") ->GetValueAsUnsigned(0); addr_t access_type = @@ -177,10 +175,8 @@ StructuredData::ObjectSP InstrumentationRuntimeASan::RetrieveReportData() { dict->AddStringItem("instrumentation_class", "AddressSanitizer"); dict->AddStringItem("stop_type", "fatal_error"); dict->AddIntegerItem("pc", pc); - /* commented out because rdar://problem/18533301 dict->AddIntegerItem("bp", bp); dict->AddIntegerItem("sp", sp); - */ dict->AddIntegerItem("address", address); dict->AddIntegerItem("access_type", access_type); dict->AddIntegerItem("access_size", access_size); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7963aa1 - [lldb] Remove inconsequential radar link (NFC)
Author: Jonas Devlieghere Date: 2023-07-30T14:24:50-07:00 New Revision: 7963aa13ac062f11ac05e024eb53adb8fae0bef9 URL: https://github.com/llvm/llvm-project/commit/7963aa13ac062f11ac05e024eb53adb8fae0bef9 DIFF: https://github.com/llvm/llvm-project/commit/7963aa13ac062f11ac05e024eb53adb8fae0bef9.diff LOG: [lldb] Remove inconsequential radar link (NFC) The comment after the radar link already explains the issue. There's no additional information in the radar and has been marked as closed by the corresponding code change. This commit removes the link and reflows the comment. Added: Modified: lldb/source/Target/Target.cpp Removed: diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index ab68f447cfdb6f..3ce7871f707861 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -2864,12 +2864,12 @@ bool Target::RunStopHooks() { if (!any_active_hooks) return false; - // make sure we check that we are not stopped - // because of us running a user expression since in that case we do not want - // to run the stop-hooks. Note, you can't just check whether the last stop - // was for a User Expression, because breakpoint commands get run before - // stop hooks, and one of them might have run an expression. You have - // to ensure you run the stop hooks once per natural stop. + // Make sure we check that we are not stopped because of us running a user + // expression since in that case we do not want to run the stop-hooks. Note, + // you can't just check whether the last stop was for a User Expression, + // because breakpoint commands get run before stop hooks, and one of them + // might have run an expression. You have to ensure you run the stop hooks + // once per natural stop. uint32_t last_natural_stop = m_process_sp->GetModIDRef().GetLastNaturalStopID(); if (last_natural_stop != 0 && m_latest_stop_hook_id == last_natural_stop) return false; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 949d4d1 - [lldb] Replace radar link with documenting comment (NFC)
Author: Jonas Devlieghere Date: 2023-07-30T14:28:29-07:00 New Revision: 949d4d16027a5829066046db74abcd7e8b31804c URL: https://github.com/llvm/llvm-project/commit/949d4d16027a5829066046db74abcd7e8b31804c DIFF: https://github.com/llvm/llvm-project/commit/949d4d16027a5829066046db74abcd7e8b31804c.diff LOG: [lldb] Replace radar link with documenting comment (NFC) This replaces the radar link with a comment explaining the underlying problem, which is that when the (dynamic) type of an object changes, so does their synthetic filter of choice, which requires us to regenerate the filter. Added: Modified: lldb/source/Core/ValueObjectSyntheticFilter.cpp Removed: diff --git a/lldb/source/Core/ValueObjectSyntheticFilter.cpp b/lldb/source/Core/ValueObjectSyntheticFilter.cpp index ad29d36ae08a08..b91acbc053593d 100644 --- a/lldb/source/Core/ValueObjectSyntheticFilter.cpp +++ b/lldb/source/Core/ValueObjectSyntheticFilter.cpp @@ -163,8 +163,8 @@ bool ValueObjectSynthetic::UpdateValue() { return false; } - // regenerate the synthetic filter if our typename changes - // + // Regenerate the synthetic filter if our typename changes. When the (dynamic) + // type of an object changes, so does their synthetic filter of choice. ConstString new_parent_type_name = m_parent->GetTypeName(); if (new_parent_type_name != m_parent_type_name) { LLDB_LOGF(log, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 2fcade9 - [lldb] Replace radars link with documenting comment (NFC)
Author: Jonas Devlieghere Date: 2023-07-30T15:17:16-07:00 New Revision: 2fcade935aa42d1d750f826b431961b6fafb86b7 URL: https://github.com/llvm/llvm-project/commit/2fcade935aa42d1d750f826b431961b6fafb86b7 DIFF: https://github.com/llvm/llvm-project/commit/2fcade935aa42d1d750f826b431961b6fafb86b7.diff LOG: [lldb] Replace radars link with documenting comment (NFC) This replaces two radar links with improved comments explaining the underlying issues. - The first issue is working around a compiler bug that was fixed in f454dfb6b5af. - The second issue is an invariant that doesn't actually hold. The latter was marked as FIXME but there was nothing in the radar about a possible alternative solution. Both radars were closed. Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp index a3ade51e1fe5b4..2dd61ee219e1e4 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp @@ -1171,16 +1171,17 @@ TypeSP DWARFASTParserClang::ParseSubroutine(const DWARFDIE &die, class_type->GetFullCompilerType(); // The type for this DIE should have been filled in the -// function call above +// function call above. Type *type_ptr = dwarf->GetDIEToType()[die.GetDIE()]; if (type_ptr && type_ptr != DIE_IS_BEING_PARSED) { return type_ptr->shared_from_this(); } -// FIXME This is fixing some even uglier behavior but we -// really need to -// uniq the methods of each class as well as the class -// itself. +// The previous comment isn't actually true if the class wasn't +// resolved using the current method's parent DIE as source +// data. We need to ensure that we look up the method correctly +// in the class and then link the method's DIE to the unique +// CXXMethodDecl appropriately. type_handled = true; } } @@ -2950,12 +2951,10 @@ void DWARFASTParserClang::ParseSingleMember( member_clang_type.GetCompleteType(); { -// Older versions of clang emit array[0] and array[1] in the -// same way (). If the current field -// is at the end of the structure, then there is definitely no -// room for extra elements and we override the type to -// array[0]. - +// Older versions of clang emit the same DWARF for array[0] and array[1]. If +// the current field is at the end of the structure, then there is +// definitely no room for extra elements and we override the type to +// array[0]. This was fixed by f454dfb6b5af. CompilerType member_array_element_type; uint64_t member_array_size; bool member_array_is_incomplete; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b699bf6 - [lldb] Replace another inconsequential radar link (NFC)
Author: Jonas Devlieghere Date: 2023-07-30T15:25:08-07:00 New Revision: b699bf671aa074f41433c6469707a7a2110ffa42 URL: https://github.com/llvm/llvm-project/commit/b699bf671aa074f41433c6469707a7a2110ffa42 DIFF: https://github.com/llvm/llvm-project/commit/b699bf671aa074f41433c6469707a7a2110ffa42.diff LOG: [lldb] Replace another inconsequential radar link (NFC) The existing comment already explains what the problem is. The radar tracks caching negative lookups in xcrun. Having a backlink is handy, but it's not necessary as the radar references the LLDB workaround. Furthermore, we have other places in LLDB that work around xcrun not caching negative that should potentially be reconsidered at that time. Added: Modified: lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp Removed: diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp index 7044426e17b501..1348eca05e337f 100644 --- a/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp +++ b/lldb/source/Plugins/Platform/MacOSX/PlatformAppleSimulator.cpp @@ -545,7 +545,7 @@ static bool shouldSkipSimulatorPlatform(bool force, const ArchSpec *arch) { // If the arch is known not to specify a simulator environment, skip creating // the simulator platform (we can create it later if there's a matching arch). // This avoids very slow xcrun queries for non-simulator archs (the slowness - // is due to xcrun not caching negative queries (rdar://74882205)). + // is due to xcrun not caching negative queries. return !force && arch && arch->IsValid() && !arch->TripleEnvironmentWasSpecified(); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b95c9b7 - [lldb] Remove the last radar link in LLDB source code (NFC)
Author: Jonas Devlieghere Date: 2023-07-30T15:28:07-07:00 New Revision: b95c9b7af315510306dfdd82e49b3dbac407e142 URL: https://github.com/llvm/llvm-project/commit/b95c9b7af315510306dfdd82e49b3dbac407e142 DIFF: https://github.com/llvm/llvm-project/commit/b95c9b7af315510306dfdd82e49b3dbac407e142.diff LOG: [lldb] Remove the last radar link in LLDB source code (NFC) This was probably the only really useful radar in our source code. It's a request to be able to tell if __LINKEDIT has been mapped or not. I've left a comment in the radar that we should update the corresponding code if and when such an ability becomes available. Added: Modified: lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp Removed: diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 82f21fef22156c..931d7d1f1b7bd6 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -909,10 +909,8 @@ bool DynamicLoaderDarwinKernel::KextImageInfo::LoadImageUsingMemoryModule( ondisk_section_list->GetSectionAtIndex(sect_idx)); if (ondisk_section_sp) { // Don't ever load __LINKEDIT as it may or may not be actually - // mapped into memory and there is no current way to tell. - // I filed rdar://problem/12851706 to track being able to tell - // if the __LINKEDIT is actually mapped, but until then, we need - // to not load the __LINKEDIT + // mapped into memory and there is no current way to tell. Until + // such an ability exists, do not load the __LINKEDIT. if (ignore_linkedit && ondisk_section_sp->GetName() == g_section_name_LINKEDIT) continue; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits