[Lldb-commits] [lldb] d7fb94b - [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (#80167)
Author: Michael Buch Date: 2024-02-08T11:09:45Z New Revision: d7fb94b6daa643a764e9a756bc544f26c248dafd URL: https://github.com/llvm/llvm-project/commit/d7fb94b6daa643a764e9a756bc544f26c248dafd DIFF: https://github.com/llvm/llvm-project/commit/d7fb94b6daa643a764e9a756bc544f26c248dafd.diff LOG: [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (#80167) This patch changes the return value of `SyntheticChildrenFrontend::Update` to a scoped enum that aims to describe what the return value means. Added: Modified: lldb/include/lldb/DataFormatters/TypeSynthetic.h lldb/include/lldb/DataFormatters/VectorIterator.h lldb/include/lldb/lldb-enumerations.h lldb/source/Core/ValueObjectSyntheticFilter.cpp lldb/source/DataFormatters/TypeSynthetic.cpp lldb/source/DataFormatters/VectorType.cpp lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp lldb/source/Plugins/Language/CPlusPlus/Coroutines.h lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxx.h lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp lldb/source/Plugins/Language/ObjC/Cocoa.cpp lldb/source/Plugins/Language/ObjC/NSArray.cpp lldb/source/Plugins/Language/ObjC/NSDictionary.cpp lldb/source/Plugins/Language/ObjC/NSError.cpp lldb/source/Plugins/Language/ObjC/NSException.cpp lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp lldb/source/Plugins/Language/ObjC/NSSet.cpp Removed: diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h b/lldb/include/lldb/DataFormatters/TypeSynthetic.h index 41be9b7efda8fd..23cc054b399a67 100644 --- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h +++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h @@ -49,14 +49,15 @@ class SyntheticChildrenFrontEnd { virtual size_t GetIndexOfChildWithName(ConstString name) = 0; - // this function is assumed to always succeed and it if fails, the front-end - // should know to deal with it in the correct way (most probably, by refusing - // to return any children) the return value of Update() should actually be - // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true, - // ValueObjectSyntheticFilter is allowed to use the children it fetched - // previously and cached if =false, ValueObjectSyntheticFilter must throw - // away its cache, and query again for children - virtual bool Update() = 0; + /// This function is assumed to always succeed and if it fails, the front-end + /// should know to deal with it in the correct way (most probably, by refusing + /// to return any children). The return value of \ref Update should actually + /// be interpreted as "ValueObjectSyntheticFilter cache is good/bad". If this + /// function returns \ref lldb::ChildCacheState::eReuse, \ref + /// ValueObjectSyntheticFilter is allowed to use the children it fetched + /// previously and cached. Otherwise, \ref ValueObjectSyntheticFilter must + /// throw away its cache, and query again for children. + virtual lldb::ChildCacheState Update() = 0; // if this function returns false, then CalculateNumChildren() MUST return 0 // since UI frontends might validly decide not to inquire for children given @@ -116,7 +117,9 @@ class SyntheticValueProviderFrontEnd : public SyntheticChildrenFrontEnd { return UINT32_MAX; } - bool Update() override { return false; } + lldb::ChildCacheState Update() override { +return lldb::ChildCacheState::eRefetch; + } bool MightHaveChildren() override { return false; } @@ -328,7 +331,9 @@ class TypeFilterImpl : public SyntheticChildren { filter->GetExpressionPathAtIndex(idx), true); } -bool Update() override { return false; } +lldb::ChildCacheState Update() override { + return lldb::ChildCacheState::eRefetch; +} bool MightHaveChildren() override { return filte
[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/80167 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)
@@ -0,0 +1,140 @@ +//===-- LibCxxValarray.cpp ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===--===// + +#include "LibCxx.h" + +#include "lldb/Core/ValueObject.h" +#include "lldb/DataFormatters/FormattersHelpers.h" +#include + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::formatters; + +namespace lldb_private { +namespace formatters { +class LibcxxStdValarraySyntheticFrontEnd : public SyntheticChildrenFrontEnd { +public: + LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp); + + ~LibcxxStdValarraySyntheticFrontEnd() override; + + size_t CalculateNumChildren() override; + + lldb::ValueObjectSP GetChildAtIndex(size_t idx) override; + + bool Update() override; + + bool MightHaveChildren() override; + + size_t GetIndexOfChildWithName(ConstString name) override; + +private: + ValueObject *m_start = nullptr; + ValueObject *m_finish = nullptr; + CompilerType m_element_type; + uint32_t m_element_size = 0; +}; + +} // namespace formatters +} // namespace lldb_private + +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: +LibcxxStdValarraySyntheticFrontEnd(lldb::ValueObjectSP valobj_sp) +: SyntheticChildrenFrontEnd(*valobj_sp), m_element_type() { + if (valobj_sp) +Update(); +} + +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: +~LibcxxStdValarraySyntheticFrontEnd() { + // these need to stay around because they are child objects who will follow + // their parent's life cycle + // delete m_start; + // delete m_finish; +} + +size_t lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd:: +CalculateNumChildren() { + if (!m_start || !m_finish) +return 0; + uint64_t start_val = m_start->GetValueAsUnsigned(0); + uint64_t finish_val = m_finish->GetValueAsUnsigned(0); + + if (start_val == 0 || finish_val == 0) +return 0; + + if (start_val >= finish_val) +return 0; + + size_t num_children = (finish_val - start_val); + if (num_children % m_element_size) +return 0; + return num_children / m_element_size; +} + +lldb::ValueObjectSP +lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::GetChildAtIndex( +size_t idx) { + if (!m_start || !m_finish) +return lldb::ValueObjectSP(); + + uint64_t offset = idx * m_element_size; + offset = offset + m_start->GetValueAsUnsigned(0); + StreamString name; + name.Printf("[%" PRIu64 "]", (uint64_t)idx); + return CreateValueObjectFromAddress(name.GetString(), offset, + m_backend.GetExecutionContextRef(), + m_element_type); +} + +bool lldb_private::formatters::LibcxxStdValarraySyntheticFrontEnd::Update() { Michael137 wrote: The return type of `Update` changed in https://github.com/llvm/llvm-project/pull/80167. So you'll have some conflicts when rebasing. The `return false;` should be `return ChildCacheState::eRefetch` instead. https://github.com/llvm/llvm-project/pull/80609 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][libc++] Adds valarray data formatters. (PR #80609)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/80609 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
chelcassanova wrote: I'll start with this by changing this so that bookkeeping is done with the new bit instead of being done in the constructor for `Progress`. https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Don't search for separate debug files for mach-o object files (PR #81041)
@@ -118,7 +118,13 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec()); ObjectFileSP dsym_objfile_sp; -if (!dsym_fspec) { +// On Darwin, we store the debug information either in object files, +// using the debug map to tie them to the executable, or in a dSYM. We +// pass through this routine both for binaries and for .o files, but in the +// latter case there will never be an external debug file. So we shouldn't adrian-prantl wrote: Does "external debug file" in this context mean `dwo`? https://github.com/llvm/llvm-project/pull/81041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Don't search for separate debug files for mach-o object files (PR #81041)
@@ -118,7 +118,13 @@ SymbolVendorMacOSX::CreateInstance(const lldb::ModuleSP &module_sp, FileSpec dsym_fspec(module_sp->GetSymbolFileFileSpec()); ObjectFileSP dsym_objfile_sp; -if (!dsym_fspec) { +// On Darwin, we store the debug information either in object files, +// using the debug map to tie them to the executable, or in a dSYM. We +// pass through this routine both for binaries and for .o files, but in the +// latter case there will never be an external debug file. So we shouldn't adrian-prantl wrote: OK I think I get it. This is looking up a dSYM by UUID. LGTM https://github.com/llvm/llvm-project/pull/81041 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
@@ -4349,26 +4349,53 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() { const std::shared_ptr &SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { +// Create a list of files to try and append .dwp to adrian-prantl wrote: ```suggestion // Create a list of files to try and append .dwp to. ``` https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
@@ -4349,26 +4349,53 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() { const std::shared_ptr &SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { +// Create a list of files to try and append .dwp to +FileSpecList symfiles; +// Append the module's object file path. +const FileSpec module_fspec = m_objfile_sp->GetModule()->GetFileSpec(); +symfiles.Append(module_fspec); +// Append the object file for this SymbolFile only if it is different from +// the module's file path. Our main module could be "a.out", our symbol file +// could be "a.debug" and our ".dwp" file might be "a.debug.dwp" instead of +// "a.out.dwp". +const FileSpec symfile_fspec(m_objfile_sp->GetFileSpec()); +if (symfile_fspec != module_fspec) { + symfiles.Append(symfile_fspec); +} else { + // If we don't have a separate debug info file, then try stripping the + // extension. We main module could be "a.debug" and the .dwp file could be + // "a.dwp" instead of "a.debug.dwp". + ConstString filename_no_ext = + module_fspec.GetFileNameStrippingExtension(); + if (filename_no_ext != module_fspec.GetFilename()) { +FileSpec module_spec_no_ext(module_fspec); +module_spec_no_ext.SetFilename(filename_no_ext); +symfiles.Append(module_spec_no_ext); + } +} + +FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); ModuleSpec module_spec; module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec(); -module_spec.GetSymbolFileSpec() = -FileSpec(m_objfile_sp->GetModule()->GetFileSpec().GetPath() + ".dwp"); - module_spec.GetUUID() = m_objfile_sp->GetUUID(); -FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); -FileSpec dwp_filespec = -PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); -if (FileSystem::Instance().Exists(dwp_filespec)) { - DataBufferSP dwp_file_data_sp; - lldb::offset_t dwp_file_data_offset = 0; - ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( - GetObjectFile()->GetModule(), &dwp_filespec, 0, - FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp, - dwp_file_data_offset); - if (!dwp_obj_file) -return; - m_dwp_symfile = std::make_shared( - *this, dwp_obj_file, DIERef::k_file_index_mask); +for (const auto &symfile : symfiles.files()) { + module_spec.GetSymbolFileSpec() = + FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle()); + FileSpec dwp_filespec = + PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); + if (FileSystem::Instance().Exists(dwp_filespec)) { +DataBufferSP dwp_file_data_sp; +lldb::offset_t dwp_file_data_offset = 0; +ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( +GetObjectFile()->GetModule(), &dwp_filespec, 0, +FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp, +dwp_file_data_offset); +if (!dwp_obj_file) + return; +m_dwp_symfile = std::make_shared( +*this, dwp_obj_file, DIERef::k_file_index_mask); +break; adrian-prantl wrote: Either use break or return for both? https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
@@ -4349,26 +4349,53 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() { const std::shared_ptr &SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { +// Create a list of files to try and append .dwp to +FileSpecList symfiles; +// Append the module's object file path. +const FileSpec module_fspec = m_objfile_sp->GetModule()->GetFileSpec(); +symfiles.Append(module_fspec); +// Append the object file for this SymbolFile only if it is different from +// the module's file path. Our main module could be "a.out", our symbol file +// could be "a.debug" and our ".dwp" file might be "a.debug.dwp" instead of +// "a.out.dwp". +const FileSpec symfile_fspec(m_objfile_sp->GetFileSpec()); +if (symfile_fspec != module_fspec) { + symfiles.Append(symfile_fspec); +} else { + // If we don't have a separate debug info file, then try stripping the + // extension. We main module could be "a.debug" and the .dwp file could be adrian-prantl wrote: "The" main module? https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
@@ -69,6 +83,19 @@ // RUN: -o "statistics dump" \ // RUN: %t.dwarf4 -b | FileCheck %s -check-prefix=CACHED +// Make sure that if we load the "%t.dwarf4.debug" file, that we can find and +// load the .dwo file from the .dwp when it is "%t.dwarf4.dwp" +// RUN: %lldb %t.dwarf4.debug -o "b main" -b | FileCheck %s -check-prefix=DEBUG + +// Make sure that if we load the "%t.dwarf4" file, that we can find and +// load the .dwo file from the .dwp when it is "%t.dwarf4.debug.dwp" +// RUN: mv %t.dwarf4.dwp %t.dwarf4.debug.dwp +// RUN: %lldb %t.dwarf4.debug -o "b main" -b | FileCheck %s -check-prefix=DEBUG + +// Make sure that if we load the "%t.dwarf4.debug" file, that we can find and +// load the .dwo file from the .dwp when it is "%t.dwarf4.debug.dwp" +// RUN: %lldb %t.dwarf4.debug -o "b main" -b | FileCheck %s -check-prefix=DEBUG adrian-prantl wrote: Should there be some negative check that removes the dwp and verifies that it fails, so we know for sure that the dwp code path was taken? https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix printf formatting of std::time_t seconds (PR #81078)
https://github.com/adrian-prantl approved this pull request. If we switched to a streamstring or a raw_svector_ostream we could avoid having to deal with the printf specifiers altogether... https://github.com/llvm/llvm-project/pull/81078 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 750981f - Fix a truly strange triple in testcase
Author: Adrian Prantl Date: 2024-02-08T09:03:47-08:00 New Revision: 750981f1a2c6069cded709b75cc87d7abd05277a URL: https://github.com/llvm/llvm-project/commit/750981f1a2c6069cded709b75cc87d7abd05277a DIFF: https://github.com/llvm/llvm-project/commit/750981f1a2c6069cded709b75cc87d7abd05277a.diff LOG: Fix a truly strange triple in testcase Added: Modified: lldb/test/API/macosx/universal/Makefile Removed: diff --git a/lldb/test/API/macosx/universal/Makefile b/lldb/test/API/macosx/universal/Makefile index 8712fdecf5..7d4762f240874c 100644 --- a/lldb/test/API/macosx/universal/Makefile +++ b/lldb/test/API/macosx/universal/Makefile @@ -14,7 +14,7 @@ testit.x86_64: testit.x86_64.o $(CC) -isysroot $(SDKROOT) -target x86_64-apple-macosx10.9 -o testit.x86_64 $< testit.x86_64h.o: main.c - $(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64h-apple-macosx10.9-apple-macosx10.9-apple-macosx10.9-apple-macosx10.9 -c -o testit.x86_64h.o $< + $(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64h-apple-macosx10.9 -c -o testit.x86_64h.o $< testit.x86_64.o: main.c $(CC) -isysroot $(SDKROOT) -g -O0 -target x86_64-apple-macosx10.9 -c -o testit.x86_64.o $< ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f219cda - [lldb] Fix printf formatting of std::time_t seconds (#81078)
Author: Jason Molenda Date: 2024-02-08T09:16:12-08:00 New Revision: f219cda7bd43696792ca4668ca5a9fbf55a9f09f URL: https://github.com/llvm/llvm-project/commit/f219cda7bd43696792ca4668ca5a9fbf55a9f09f DIFF: https://github.com/llvm/llvm-project/commit/f219cda7bd43696792ca4668ca5a9fbf55a9f09f.diff LOG: [lldb] Fix printf formatting of std::time_t seconds (#81078) This formatter https://github.com/llvm/llvm-project/pull/78609 was originally passing the signed seconds (which can refer to times in the past) with an unsigned printf formatter, and had tests that expected to see negative values from the printf which always failed on macOS. I'm not clear how they ever passed on any platform. Fix the printf to print seconds as a signed value, and re-enable the tests. Added: Modified: lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py Removed: diff --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp index a7d7066bb2c11d..7893aa7cc1f9df 100644 --- a/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp +++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp @@ -1108,7 +1108,7 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider( const std::time_t seconds = ptr_sp->GetValueAsSigned(0); if (seconds < chrono_timestamp_min || seconds > chrono_timestamp_max) -stream.Printf("timestamp=%" PRIu64 " s", static_cast(seconds)); +stream.Printf("timestamp=%" PRId64 " s", static_cast(seconds)); else { std::array str; std::size_t size = @@ -1116,8 +1116,8 @@ bool lldb_private::formatters::LibcxxChronoSysSecondsSummaryProvider( if (size == 0) return false; -stream.Printf("date/time=%s timestamp=%" PRIu64 " s", str.data(), - static_cast(seconds)); +stream.Printf("date/time=%s timestamp=%" PRId64 " s", str.data(), + static_cast(seconds)); } return true; diff --git a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py index 9706f9e94e922f..a90fb828d121a7 100644 --- a/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py +++ b/lldb/test/API/functionalities/data-formatter/data-formatter-stl/libcxx/chrono/TestDataFormatterLibcxxChrono.py @@ -54,17 +54,16 @@ def test_with_run_command(self): substrs=["ss_0 = date/time=1970-01-01T00:00:00Z timestamp=0 s"], ) -# FIXME disabled temporarily, macOS is printing this as an unsigned? -#self.expect( -#"frame variable ss_neg_date_time", -#substrs=[ -#"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" -#], -#) -#self.expect( -#"frame variable ss_neg_seconds", -#substrs=["ss_neg_seconds = timestamp=-1096193779201 s"], -#) +self.expect( +"frame variable ss_neg_date_time", +substrs=[ +"ss_neg_date_time = date/time=-32767-01-01T00:00:00Z timestamp=-1096193779200 s" +], +) +self.expect( +"frame variable ss_neg_seconds", +substrs=["ss_neg_seconds = timestamp=-1096193779201 s"], +) self.expect( "frame variable ss_pos_date_time", @@ -77,11 +76,10 @@ def test_with_run_command(self): substrs=["ss_pos_seconds = timestamp=971890963200 s"], ) -# FIXME disabled temporarily, macOS is printing this as an unsigned? -#self.expect( -#"frame variable ss_min", -#substrs=["ss_min = timestamp=-9223372036854775808 s"], -#) +self.expect( +"frame variable ss_min", +substrs=["ss_min = timestamp=-9223372036854775808 s"], +) self.expect( "frame variable ss_max", substrs=["ss_max = timestamp=9223372036854775807 s"], ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix printf formatting of std::time_t seconds (PR #81078)
https://github.com/jasonmolenda closed https://github.com/llvm/llvm-project/pull/81078 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] af97edf - [lldb] Refactor GetFormatFromCString to always check for partial matches (NFC) (#81018)
Author: Dave Lee Date: 2024-02-08T09:32:12-08:00 New Revision: af97edff70b0d9cb89729dc0d8af1d1ea101686e URL: https://github.com/llvm/llvm-project/commit/af97edff70b0d9cb89729dc0d8af1d1ea101686e DIFF: https://github.com/llvm/llvm-project/commit/af97edff70b0d9cb89729dc0d8af1d1ea101686e.diff LOG: [lldb] Refactor GetFormatFromCString to always check for partial matches (NFC) (#81018) Refactors logic in `ParseInternal` that was previously calling `GetFormatFromCString` twice, once with `partial_match_ok` set to false, and the second time set to true. With this change, lldb formats (ie `%@`, `%S`, etc) are checked first. If a format is not one of those, then `GetFormatFromCString` is called once, and now always checks for partial matches. Added: Modified: lldb/include/lldb/DataFormatters/FormatManager.h lldb/source/Core/FormatEntity.cpp lldb/source/DataFormatters/FormatManager.cpp lldb/source/Interpreter/OptionArgParser.cpp Removed: diff --git a/lldb/include/lldb/DataFormatters/FormatManager.h b/lldb/include/lldb/DataFormatters/FormatManager.h index 986614f0c5e431..db2fe99c44cafc 100644 --- a/lldb/include/lldb/DataFormatters/FormatManager.h +++ b/lldb/include/lldb/DataFormatters/FormatManager.h @@ -138,7 +138,7 @@ class FormatManager : public IFormatChangeListener { } static bool GetFormatFromCString(const char *format_cstr, - bool partial_match_ok, lldb::Format &format); + lldb::Format &format); static char GetFormatAsFormatChar(lldb::Format format); diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index 3c665c2eb2133b..fa5eadc6ff4e9a 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -2151,11 +2151,7 @@ static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry, if (entry.printf_format.find('%') == std::string::npos) { bool clear_printf = false; - if (FormatManager::GetFormatFromCString( - entry.printf_format.c_str(), false, entry.fmt)) { -// We have an LLDB format, so clear the printf format -clear_printf = true; - } else if (entry.printf_format.size() == 1) { + if (entry.printf_format.size() == 1) { switch (entry.printf_format[0]) { case '@': // if this is an @ sign, print ObjC description entry.number = ValueObject:: @@ -2198,20 +2194,20 @@ static Status ParseInternal(llvm::StringRef &format, Entry &parent_entry, eValueObjectRepresentationStyleExpressionPath; clear_printf = true; break; -default: +} + } + + if (entry.number == 0) { +if (FormatManager::GetFormatFromCString( +entry.printf_format.c_str(), entry.fmt)) { + clear_printf = true; +} else if (entry.printf_format == "tid") { + verify_is_thread_id = true; +} else { error.SetErrorStringWithFormat("invalid format: '%s'", entry.printf_format.c_str()); return error; } - } else if (FormatManager::GetFormatFromCString( - entry.printf_format.c_str(), true, entry.fmt)) { -clear_printf = true; - } else if (entry.printf_format == "tid") { -verify_is_thread_id = true; - } else { -error.SetErrorStringWithFormat("invalid format: '%s'", - entry.printf_format.c_str()); -return error; } // Our format string turned out to not be a printf style format diff --git a/lldb/source/DataFormatters/FormatManager.cpp b/lldb/source/DataFormatters/FormatManager.cpp index f1f135de32ca87..092fa3c8ce496d 100644 --- a/lldb/source/DataFormatters/FormatManager.cpp +++ b/lldb/source/DataFormatters/FormatManager.cpp @@ -91,7 +91,7 @@ static bool GetFormatFromFormatChar(char format_char, Format &format) { } static bool GetFormatFromFormatName(llvm::StringRef format_name, -bool partial_match_ok, Format &format) { +Format &format) { uint32_t i; for (i = 0; i < g_num_format_infos; ++i) { if (format_name.equals_insensitive(g_format_infos[i].format_name)) { @@ -100,13 +100,11 @@ static bool GetFormatFromFormatName(llvm::StringRef format_name, } } - if (partial_match_ok) { -for (i = 0; i < g_num_format_infos; ++i) { - if (llvm::StringRef(g_format_infos[i].format_name) - .star
[Lldb-commits] [lldb] [lldb] Refactor GetFormatFromCString to always check for partial matches (NFC) (PR #81018)
https://github.com/kastiglione closed https://github.com/llvm/llvm-project/pull/81018 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
dwblaikie wrote: FWIW, I think we should be opinionated (& consistent with whatever gdb does, if it has some precedent here - if it is less opinionated, then maybe we have to be accepting) when it comes to whether x.debug goes with x.dwp or x.debug.dwp - we shouldn't support both unless there's some prior precedent that's unavoidable to support. It'd be better for everyone if there was one option we encourage people to follow. (so I think we shouldn't support (2) and (3) if we can help it - we should pick one) I'm not sure I understand the "lldb loads .debug and needs to find .dwp" case. the .debug file usually only has the debug info, not the executable code, so you can't load it directly, right? (see the documentation in https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html - `objcopy --only-keep-debug foo foo.debug`). https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
chelcassanova wrote: The discussions happening here are talking about 2 major things, how to do the bookkeeping of the map that keeps track of progress reports and where to do that bookkeeping. I think it makes sense to split up this work into smaller patches as such: 1. Since it's best to do the bookkeeping using the `Debugger::eBroadcastBitProgressByCategory` bit, I'll add this bit to `Debugger` and `SBDebugger` in its own patch. 2. Add a class to manage the map that holds progress reports. 3. Once that class and the bit are added, use it to perform operations on the map of progress reports and use the new bit to actual broadcast operations. I'll put up a patch to add the bit now and start work on parts 2 and 3. I'm also going to close this PR since the work is now being split up. https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (PR #81169)
https://github.com/chelcassanova created https://github.com/llvm/llvm-project/pull/81169 This commit adds a new broadcast bit to the debugger. When in use, it will be listened to for progress events that will be delivered and kept track of by category as opposed to the current behaviour of coming in one by one. >From d9bed21614aff84176766a63fdc691203352ef6b Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Thu, 8 Feb 2024 10:22:14 -0800 Subject: [PATCH] [lldb][debugger][NFC] Add broadcast bit for category-based progress events. This commit adds a new broadcast bit to the debugger. When in use, it will be listened to for progress events that will be delivered and kept track of by category as opposed to the current behaviour of coming in one by one. --- lldb/include/lldb/API/SBDebugger.h | 1 + lldb/include/lldb/Core/Debugger.h | 1 + 2 files changed, 2 insertions(+) diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 218113a7a391f..62b2f91f5076d 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -46,6 +46,7 @@ class LLDB_API SBDebugger { eBroadcastBitProgress = (1 << 0), eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), + eBroadcastBitProgressCategory = (1 << 3), }; SBDebugger(); diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index c6d603ca5dcde..6ba90eb6ed8fd 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -84,6 +84,7 @@ class Debugger : public std::enable_shared_from_this, eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), eBroadcastSymbolChange = (1 << 3), +eBroadcastBitProgressCategory = (1 << 4), }; using DebuggerList = std::vector; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (PR #81169)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Chelsea Cassanova (chelcassanova) Changes This commit adds a new broadcast bit to the debugger. When in use, it will be listened to for progress events that will be delivered and kept track of by category as opposed to the current behaviour of coming in one by one. --- Full diff: https://github.com/llvm/llvm-project/pull/81169.diff 2 Files Affected: - (modified) lldb/include/lldb/API/SBDebugger.h (+1) - (modified) lldb/include/lldb/Core/Debugger.h (+1) ``diff diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 218113a7a391f3..62b2f91f5076d5 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -46,6 +46,7 @@ class LLDB_API SBDebugger { eBroadcastBitProgress = (1 << 0), eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), + eBroadcastBitProgressCategory = (1 << 3), }; SBDebugger(); diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index c6d603ca5dcde0..6ba90eb6ed8fdf 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -84,6 +84,7 @@ class Debugger : public std::enable_shared_from_this, eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), eBroadcastSymbolChange = (1 << 3), +eBroadcastBitProgressCategory = (1 << 4), }; using DebuggerList = std::vector; `` https://github.com/llvm/llvm-project/pull/81169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (PR #81169)
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/81169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (PR #81169)
https://github.com/JDevlieghere approved this pull request. This doesn't do much by itself but based on the discussion in #81026 we have consensus on this part. LGTM. https://github.com/llvm/llvm-project/pull/81169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] ab4a793 - [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (#81169)
Author: Chelsea Cassanova Date: 2024-02-08T10:33:37-08:00 New Revision: ab4a793e8bc78f50f9f104c9c732e2dd91bf70a2 URL: https://github.com/llvm/llvm-project/commit/ab4a793e8bc78f50f9f104c9c732e2dd91bf70a2 DIFF: https://github.com/llvm/llvm-project/commit/ab4a793e8bc78f50f9f104c9c732e2dd91bf70a2.diff LOG: [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (#81169) This commit adds a new broadcast bit to the debugger. When in use, it will be listened to for progress events that will be delivered and kept track of by category as opposed to the current behaviour of coming in one by one. Added: Modified: lldb/include/lldb/API/SBDebugger.h lldb/include/lldb/Core/Debugger.h Removed: diff --git a/lldb/include/lldb/API/SBDebugger.h b/lldb/include/lldb/API/SBDebugger.h index 218113a7a391f3..62b2f91f5076d5 100644 --- a/lldb/include/lldb/API/SBDebugger.h +++ b/lldb/include/lldb/API/SBDebugger.h @@ -46,6 +46,7 @@ class LLDB_API SBDebugger { eBroadcastBitProgress = (1 << 0), eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), + eBroadcastBitProgressCategory = (1 << 3), }; SBDebugger(); diff --git a/lldb/include/lldb/Core/Debugger.h b/lldb/include/lldb/Core/Debugger.h index c6d603ca5dcde0..6ba90eb6ed8fdf 100644 --- a/lldb/include/lldb/Core/Debugger.h +++ b/lldb/include/lldb/Core/Debugger.h @@ -84,6 +84,7 @@ class Debugger : public std::enable_shared_from_this, eBroadcastBitWarning = (1 << 1), eBroadcastBitError = (1 << 2), eBroadcastSymbolChange = (1 << 3), +eBroadcastBitProgressCategory = (1 << 4), }; using DebuggerList = std::vector; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][debugger][NFC] Add broadcast bit for category-based progress events. (PR #81169)
https://github.com/chelcassanova closed https://github.com/llvm/llvm-project/pull/81169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
clayborg wrote: > The discussions happening here are talking about 2 major things, how to do > the bookkeeping of the map that keeps track of progress reports and where to > do that bookkeeping. I think it makes sense to split up this work into > smaller patches as such: > > 1. Since it's best to do the bookkeeping using the > `Debugger::eBroadcastBitProgressByCategory` bit, I'll add this bit to > `Debugger` and `SBDebugger` in its own patch. > 2. Add a class to manage the map that holds progress reports. > 3. Once that class and the bit are added, use it to perform operations on the > map of progress reports and use the new bit to actual broadcast operations. > > I'll put up a patch to add the bit now and start work on parts 2 and 3. I'm > also going to close this PR since the work is now being split up. Sounds great. Thanks for putting in the work on this! Also, I do have the PR that adds settings and throttles progress events, do we still want that patch? I do believe that will improve our progress events and keep them from overwhelming clients. https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expand background symbol lookup (PR #80890)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/80890 >From 8846fb6cdb83b0364238bd74a99e97c1dba604a2 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 6 Feb 2024 16:25:37 -0800 Subject: [PATCH] [lldb] Expand background symbol lookup LLDB has a setting (symbols.enable-background-lookup) that calls dsymForUUID on a background thread for images as they appear in the current backtrace. Originally, the laziness of only looking up symbols for images in the backtrace only existed to bring the number of dsymForUUID calls down to a manageable number. Users have requesting the same functionality but blocking. This gives them the same user experience as enabling dsymForUUID globally, but without the massive upfront cost of having to download all the images, the majority of which they'll likely not need. This patch renames the setting to have a more generic name (symbols.download) and changes its values from a boolean to an enum. Users can now specify "off", "background" and "foreground". The default remains "off" although I'll probably change that in the near future. --- lldb/include/lldb/Core/ModuleList.h | 23 ++- lldb/include/lldb/lldb-enumerations.h | 6 ++ lldb/source/Core/CoreProperties.td| 7 ++- lldb/source/Core/ModuleList.cpp | 13 + lldb/source/Host/common/Host.cpp | 2 ++ lldb/source/Symbol/SymbolLocator.cpp | 22 -- 6 files changed, 61 insertions(+), 12 deletions(-) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index d78f7c5ef3f706..43d931a8447406 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,6 +47,26 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; +static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { +{ +lldb::eSymbolDownloadOff, +"off", +"Disable automatically downloading symbols.", +}, +{ +lldb::eSymbolDownloadBackground, +"background", +"Download symbols in the background for images as they appear in the " +"backtrace.", +}, +{ +lldb::eSymbolDownloadForeground, +"foreground", +"Download symbols in the foreground for images as they appear in the " +"backtrace.", +}, +}; + class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -60,7 +80,6 @@ class ModuleListProperties : public Properties { bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); - bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -71,6 +90,8 @@ class ModuleListProperties : public Properties { bool GetLoadSymbolOnDemand(); + lldb::SymbolDownload GetSymbolAutoDownload() const; + PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 7e9b538aa8372b..4640533047833b 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,6 +1314,12 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; +enum SymbolDownload { + eSymbolDownloadOff = 0, + eSymbolDownloadBackground = 1, + eSymbolDownloadForeground = 2, +}; + } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 8d81967bdb50a4..9c4aa2de3d7b73 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,7 +8,12 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, -Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; +Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; + def AutoDownload: Property<"auto-download", "Enum">, +Global, +DefaultEnumValue<"eSymbolDownloadOff">, +EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, +Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b7f393636ba28d..b03490bacf9593 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,10 +104,15 @@ bool
[Lldb-commits] [lldb] [lldb] Expand background symbol lookup (PR #80890)
JDevlieghere wrote: Rebased & renamed the property to `symbols.auto-download`. I think all the review comments have been addressed. The only oustanding question is if @clayborg wants to have an additional setting for `symbols.auto-download-stack-symbols`. https://github.com/llvm/llvm-project/pull/80890 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expand background symbol lookup (PR #80890)
clayborg wrote: > @clayborg The idea behind the feature is to get symbols for things that are > relevant to the user. Right now, that's only hooked up for images that appear > in the stack trace, but there are certainly other places this would be > useful. So yeah, I absolutely expect this to apply to other things in the > future as well. > > We currently check the setting right before downloading, so in a generic > place that would be shared by all the other places that could trigger a > download. Therefore I think the "mode" should be generic. If we have > different triggers we could have separate settings to turn those things off > (e.g. only download symbols for images in the stack trace, not for address > lookups). So down the line it could look something like this: > > ``` > (lldb) settings set symbols.auto-download background > (lldb) settings set symbols.auto-download-stack-symbols true > (lldb) settings set symbols.auto-download-address-lookup false > ``` > > Let me know if you think it's critical to add > `symbols.auto-download-stack-symbols` now in addition to > `symbols.auto-download` (which I like better than `symbols.download`, thanks > for the suggestion!) . Thanks for the update. Not critical to this patch, just wondering where we are going with this in the future and auto downloading of symbols. https://github.com/llvm/llvm-project/pull/80890 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expand background symbol lookup (PR #80890)
https://github.com/clayborg approved this pull request. https://github.com/llvm/llvm-project/pull/80890 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 74fc16a - [lldb] Expand background symbol download (#80890)
Author: Jonas Devlieghere Date: 2024-02-08T11:24:07-08:00 New Revision: 74fc16227b84e22706d2c5e376287f560b9e URL: https://github.com/llvm/llvm-project/commit/74fc16227b84e22706d2c5e376287f560b9e DIFF: https://github.com/llvm/llvm-project/commit/74fc16227b84e22706d2c5e376287f560b9e.diff LOG: [lldb] Expand background symbol download (#80890) LLDB has a setting (symbols.enable-background-lookup) that calls dsymForUUID on a background thread for images as they appear in the current backtrace. Originally, the laziness of only looking up symbols for images in the backtrace only existed to bring the number of dsymForUUID calls down to a manageable number. Users have requesting the same functionality but blocking. This gives them the same user experience as enabling dsymForUUID globally, but without the massive upfront cost of having to download all the images, the majority of which they'll likely not need. This patch renames the setting to have a more generic name (symbols.auto-download) and changes its values from a boolean to an enum. Users can now specify "off", "background" and "foreground". The default remains "off" although I'll probably change that in the near future. Added: Modified: lldb/include/lldb/Core/ModuleList.h lldb/include/lldb/lldb-enumerations.h lldb/source/Core/CoreProperties.td lldb/source/Core/ModuleList.cpp lldb/source/Host/common/Host.cpp lldb/source/Symbol/SymbolLocator.cpp Removed: diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index d78f7c5ef3f706..43d931a8447406 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,6 +47,26 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; +static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { +{ +lldb::eSymbolDownloadOff, +"off", +"Disable automatically downloading symbols.", +}, +{ +lldb::eSymbolDownloadBackground, +"background", +"Download symbols in the background for images as they appear in the " +"backtrace.", +}, +{ +lldb::eSymbolDownloadForeground, +"foreground", +"Download symbols in the foreground for images as they appear in the " +"backtrace.", +}, +}; + class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -60,7 +80,6 @@ class ModuleListProperties : public Properties { bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); - bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -71,6 +90,8 @@ class ModuleListProperties : public Properties { bool GetLoadSymbolOnDemand(); + lldb::SymbolDownload GetSymbolAutoDownload() const; + PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 7e9b538aa8372b..4640533047833b 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,6 +1314,12 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; +enum SymbolDownload { + eSymbolDownloadOff = 0, + eSymbolDownloadBackground = 1, + eSymbolDownloadForeground = 2, +}; + } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 8d81967bdb50a4..9c4aa2de3d7b73 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,7 +8,12 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, -Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; +Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; + def AutoDownload: Property<"auto-download", "Enum">, +Global, +DefaultEnumValue<"eSymbolDownloadOff">, +EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, +Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b7f393636ba28d..b03490bacf9593 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/sou
[Lldb-commits] [lldb] [lldb] Expand background symbol lookup (PR #80890)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/80890 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)
felipepiovezan wrote: Any other comments here? I would like to land this once the YAML review is unblocked https://github.com/llvm/llvm-project/pull/79932 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expand background symbol lookup (PR #80890)
nico wrote: This doesn't build on Linux: http://45.33.8.238/linux/130329/step_4.txt Please take a look and revert for now if it takes a while to fix. (Looks like you added a definition on non apple; maybe the declaration is just still missing) https://github.com/llvm/llvm-project/pull/80890 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Expand background symbol lookup" (PR #81182)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/81182 Reverts llvm/llvm-project#80890 >From 63b2f16bdf812613d368304be453a44c2a1f8fe3 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 8 Feb 2024 11:50:28 -0800 Subject: [PATCH] Revert "[lldb] Expand background symbol download (#80890)" This reverts commit 74fc16227b84e22706d2c5e376287f560b9e. --- lldb/include/lldb/Core/ModuleList.h | 23 +-- lldb/include/lldb/lldb-enumerations.h | 6 -- lldb/source/Core/CoreProperties.td| 7 +-- lldb/source/Core/ModuleList.cpp | 13 - lldb/source/Host/common/Host.cpp | 2 -- lldb/source/Symbol/SymbolLocator.cpp | 22 ++ 6 files changed, 12 insertions(+), 61 deletions(-) diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 43d931a8447406..d78f7c5ef3f706 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,26 +47,6 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; -static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { -{ -lldb::eSymbolDownloadOff, -"off", -"Disable automatically downloading symbols.", -}, -{ -lldb::eSymbolDownloadBackground, -"background", -"Download symbols in the background for images as they appear in the " -"backtrace.", -}, -{ -lldb::eSymbolDownloadForeground, -"foreground", -"Download symbols in the foreground for images as they appear in the " -"backtrace.", -}, -}; - class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -80,6 +60,7 @@ class ModuleListProperties : public Properties { bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); + bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -90,8 +71,6 @@ class ModuleListProperties : public Properties { bool GetLoadSymbolOnDemand(); - lldb::SymbolDownload GetSymbolAutoDownload() const; - PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 4640533047833b..7e9b538aa8372b 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,12 +1314,6 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; -enum SymbolDownload { - eSymbolDownloadOff = 0, - eSymbolDownloadBackground = 1, - eSymbolDownloadForeground = 2, -}; - } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 9c4aa2de3d7b73..8d81967bdb50a4 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,12 +8,7 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, -Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; - def AutoDownload: Property<"auto-download", "Enum">, -Global, -DefaultEnumValue<"eSymbolDownloadOff">, -EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, -Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; +Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b03490bacf9593..b7f393636ba28d 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,15 +104,10 @@ bool ModuleListProperties::SetEnableExternalLookup(bool new_value) { return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value); } -SymbolDownload ModuleListProperties::GetSymbolAutoDownload() const { - // Backward compatibility alias. - if (GetPropertyAtIndexAs(ePropertyEnableBackgroundLookup, false)) -return eSymbolDownloadBackground; - - const uint32_t idx = ePropertyAutoDownload; - return GetPropertyAtIndexAs( - idx, static_cast( - g_modulelist_properties[idx].default_uint_value)); +bool ModuleListProperties::GetEnableBackgroundLookup() const { + const uint32_t idx = ePropertyEnableBackgroundLookup; + return GetPropertyAtIndexAs( + idx, g_modulelist_properties[idx].def
[Lldb-commits] [lldb] 705fcd4 - Revert "[lldb] Expand background symbol lookup" (#81182)
Author: Jonas Devlieghere Date: 2024-02-08T11:50:53-08:00 New Revision: 705fcd4e0addee6e9e13541dbcbc81cec9748a83 URL: https://github.com/llvm/llvm-project/commit/705fcd4e0addee6e9e13541dbcbc81cec9748a83 DIFF: https://github.com/llvm/llvm-project/commit/705fcd4e0addee6e9e13541dbcbc81cec9748a83.diff LOG: Revert "[lldb] Expand background symbol lookup" (#81182) Reverts llvm/llvm-project#80890 Added: Modified: lldb/include/lldb/Core/ModuleList.h lldb/include/lldb/lldb-enumerations.h lldb/source/Core/CoreProperties.td lldb/source/Core/ModuleList.cpp lldb/source/Host/common/Host.cpp lldb/source/Symbol/SymbolLocator.cpp Removed: diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 43d931a844740..d78f7c5ef3f70 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,26 +47,6 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; -static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { -{ -lldb::eSymbolDownloadOff, -"off", -"Disable automatically downloading symbols.", -}, -{ -lldb::eSymbolDownloadBackground, -"background", -"Download symbols in the background for images as they appear in the " -"backtrace.", -}, -{ -lldb::eSymbolDownloadForeground, -"foreground", -"Download symbols in the foreground for images as they appear in the " -"backtrace.", -}, -}; - class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -80,6 +60,7 @@ class ModuleListProperties : public Properties { bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); + bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -90,8 +71,6 @@ class ModuleListProperties : public Properties { bool GetLoadSymbolOnDemand(); - lldb::SymbolDownload GetSymbolAutoDownload() const; - PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 4640533047833..7e9b538aa8372 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,12 +1314,6 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; -enum SymbolDownload { - eSymbolDownloadOff = 0, - eSymbolDownloadBackground = 1, - eSymbolDownloadForeground = 2, -}; - } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 9c4aa2de3d7b7..8d81967bdb50a 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,12 +8,7 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, -Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; - def AutoDownload: Property<"auto-download", "Enum">, -Global, -DefaultEnumValue<"eSymbolDownloadOff">, -EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, -Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; +Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b03490bacf959..b7f393636ba28 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,15 +104,10 @@ bool ModuleListProperties::SetEnableExternalLookup(bool new_value) { return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value); } -SymbolDownload ModuleListProperties::GetSymbolAutoDownload() const { - // Backward compatibility alias. - if (GetPropertyAtIndexAs(ePropertyEnableBackgroundLookup, false)) -return eSymbolDownloadBackground; - - const uint32_t idx = ePropertyAutoDownload; - return GetPropertyAtIndexAs( - idx, static_cast( - g_modulelist_properties[idx].default_uint_value)); +bool ModuleListProperties::GetEnableBackgroundLookup() const { + const uint32_t idx = ePropertyEnableBackgroundLookup; + return GetPropertyAtIndexAs( + idx, g_modulelist_properties[idx].default_uint_value != 0); } FileSpec M
[Lldb-commits] [lldb] Revert "[lldb] Expand background symbol lookup" (PR #81182)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/81182 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Expand background symbol lookup" (PR #81182)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Reverts llvm/llvm-project#80890 --- Full diff: https://github.com/llvm/llvm-project/pull/81182.diff 6 Files Affected: - (modified) lldb/include/lldb/Core/ModuleList.h (+1-22) - (modified) lldb/include/lldb/lldb-enumerations.h (-6) - (modified) lldb/source/Core/CoreProperties.td (+1-6) - (modified) lldb/source/Core/ModuleList.cpp (+4-9) - (modified) lldb/source/Host/common/Host.cpp (-2) - (modified) lldb/source/Symbol/SymbolLocator.cpp (+6-16) ``diff diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index 43d931a844740..d78f7c5ef3f70 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,26 +47,6 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; -static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { -{ -lldb::eSymbolDownloadOff, -"off", -"Disable automatically downloading symbols.", -}, -{ -lldb::eSymbolDownloadBackground, -"background", -"Download symbols in the background for images as they appear in the " -"backtrace.", -}, -{ -lldb::eSymbolDownloadForeground, -"foreground", -"Download symbols in the foreground for images as they appear in the " -"backtrace.", -}, -}; - class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -80,6 +60,7 @@ class ModuleListProperties : public Properties { bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); + bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -90,8 +71,6 @@ class ModuleListProperties : public Properties { bool GetLoadSymbolOnDemand(); - lldb::SymbolDownload GetSymbolAutoDownload() const; - PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 4640533047833..7e9b538aa8372 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,12 +1314,6 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; -enum SymbolDownload { - eSymbolDownloadOff = 0, - eSymbolDownloadBackground = 1, - eSymbolDownloadForeground = 2, -}; - } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 9c4aa2de3d7b7..8d81967bdb50a 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,12 +8,7 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, -Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; - def AutoDownload: Property<"auto-download", "Enum">, -Global, -DefaultEnumValue<"eSymbolDownloadOff">, -EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, -Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; +Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b03490bacf959..b7f393636ba28 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,15 +104,10 @@ bool ModuleListProperties::SetEnableExternalLookup(bool new_value) { return SetPropertyAtIndex(ePropertyEnableExternalLookup, new_value); } -SymbolDownload ModuleListProperties::GetSymbolAutoDownload() const { - // Backward compatibility alias. - if (GetPropertyAtIndexAs(ePropertyEnableBackgroundLookup, false)) -return eSymbolDownloadBackground; - - const uint32_t idx = ePropertyAutoDownload; - return GetPropertyAtIndexAs( - idx, static_cast( - g_modulelist_properties[idx].default_uint_value)); +bool ModuleListProperties::GetEnableBackgroundLookup() const { + const uint32_t idx = ePropertyEnableBackgroundLookup; + return GetPropertyAtIndexAs( + idx, g_modulelist_properties[idx].default_uint_value != 0); } FileSpec ModuleListProperties::GetClangModulesCachePath() const { diff --git a/lldb/source/Host/common/Host.cpp b/lldb/source/Host/common/Host.cpp index b72ba7e8d2012..f4cec97f5af63 100644 --- a/lldb/sou
[Lldb-commits] [lldb] 5f4b40c - [lldb] Expand background symbol download (#80890)
Author: Jonas Devlieghere Date: 2024-02-08T12:39:04-08:00 New Revision: 5f4b40c90a51248b097de7b5bc89c6976d4c3298 URL: https://github.com/llvm/llvm-project/commit/5f4b40c90a51248b097de7b5bc89c6976d4c3298 DIFF: https://github.com/llvm/llvm-project/commit/5f4b40c90a51248b097de7b5bc89c6976d4c3298.diff LOG: [lldb] Expand background symbol download (#80890) LLDB has a setting (symbols.enable-background-lookup) that calls dsymForUUID on a background thread for images as they appear in the current backtrace. Originally, the laziness of only looking up symbols for images in the backtrace only existed to bring the number of dsymForUUID calls down to a manageable number. Users have requesting the same functionality but blocking. This gives them the same user experience as enabling dsymForUUID globally, but without the massive upfront cost of having to download all the images, the majority of which they'll likely not need. This patch renames the setting to have a more generic name (symbols.auto-download) and changes its values from a boolean to an enum. Users can now specify "off", "background" and "foreground". The default remains "off" although I'll probably change that in the near future. Added: Modified: lldb/include/lldb/Core/ModuleList.h lldb/include/lldb/lldb-enumerations.h lldb/source/Core/CoreProperties.td lldb/source/Core/ModuleList.cpp lldb/source/Symbol/SymbolLocator.cpp Removed: diff --git a/lldb/include/lldb/Core/ModuleList.h b/lldb/include/lldb/Core/ModuleList.h index d78f7c5ef3f706..43d931a8447406 100644 --- a/lldb/include/lldb/Core/ModuleList.h +++ b/lldb/include/lldb/Core/ModuleList.h @@ -47,6 +47,26 @@ class UUID; class VariableList; struct ModuleFunctionSearchOptions; +static constexpr OptionEnumValueElement g_auto_download_enum_values[] = { +{ +lldb::eSymbolDownloadOff, +"off", +"Disable automatically downloading symbols.", +}, +{ +lldb::eSymbolDownloadBackground, +"background", +"Download symbols in the background for images as they appear in the " +"backtrace.", +}, +{ +lldb::eSymbolDownloadForeground, +"foreground", +"Download symbols in the foreground for images as they appear in the " +"backtrace.", +}, +}; + class ModuleListProperties : public Properties { mutable llvm::sys::RWMutex m_symlink_paths_mutex; PathMappingList m_symlink_paths; @@ -60,7 +80,6 @@ class ModuleListProperties : public Properties { bool SetClangModulesCachePath(const FileSpec &path); bool GetEnableExternalLookup() const; bool SetEnableExternalLookup(bool new_value); - bool GetEnableBackgroundLookup() const; bool GetEnableLLDBIndexCache() const; bool SetEnableLLDBIndexCache(bool new_value); uint64_t GetLLDBIndexCacheMaxByteSize(); @@ -71,6 +90,8 @@ class ModuleListProperties : public Properties { bool GetLoadSymbolOnDemand(); + lldb::SymbolDownload GetSymbolAutoDownload() const; + PathMappingList GetSymlinkMappings() const; }; diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 7e9b538aa8372b..4640533047833b 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -1314,6 +1314,12 @@ enum class ChildCacheState { ///< re-use what we computed the last time we called Update. }; +enum SymbolDownload { + eSymbolDownloadOff = 0, + eSymbolDownloadBackground = 1, + eSymbolDownloadForeground = 2, +}; + } // namespace lldb #endif // LLDB_LLDB_ENUMERATIONS_H diff --git a/lldb/source/Core/CoreProperties.td b/lldb/source/Core/CoreProperties.td index 8d81967bdb50a4..9c4aa2de3d7b73 100644 --- a/lldb/source/Core/CoreProperties.td +++ b/lldb/source/Core/CoreProperties.td @@ -8,7 +8,12 @@ let Definition = "modulelist" in { def EnableBackgroundLookup: Property<"enable-background-lookup", "Boolean">, Global, DefaultFalse, -Desc<"On macOS, enable calling dsymForUUID (or an equivalent script/binary) in the background to locate symbol files that weren't found.">; +Desc<"Alias for backward compatibility: when enabled this is the equivalent to 'symbols.download background'.">; + def AutoDownload: Property<"auto-download", "Enum">, +Global, +DefaultEnumValue<"eSymbolDownloadOff">, +EnumValues<"OptionEnumValues(g_auto_download_enum_values)">, +Desc<"On macOS, automatically download symbols with dsymForUUID (or an equivalent script/binary) for relevant images in the debug session.">; def ClangModulesCachePath: Property<"clang-modules-cache-path", "FileSpec">, Global, DefaultStringValue<"">, diff --git a/lldb/source/Core/ModuleList.cpp b/lldb/source/Core/ModuleList.cpp index b7f393636ba28d..b03490bacf9593 100644 --- a/lldb/source/Core/ModuleList.cpp +++ b/lldb/source/Core/ModuleList.cpp @@ -104,10 +1
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
@@ -99,6 +105,10 @@ class Progress { private: void ReportProgress(); static std::atomic g_id; + static std::atomic g_refcount; + /// Map that tracks each progress object and if we've seen its start and stop + /// events + static std::unordered_map g_map; adrian-prantl wrote: https://llvm.org/doxygen/classllvm_1_1StringMap.html https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
@@ -12,6 +12,7 @@ #include "lldb/Utility/ConstString.h" #include "lldb/lldb-types.h" #include +#include adrian-prantl wrote: Unless you need the sorted iteration property you probably want to use something more efficient instead. https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
@@ -99,6 +105,10 @@ class Progress { private: void ReportProgress(); static std::atomic g_id; + static std::atomic g_refcount; + /// Map that tracks each progress object and if we've seen its start and stop + /// events + static std::unordered_map g_map; adrian-prantl wrote: llvm::StringMap? https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
@@ -12,6 +12,7 @@ #include "lldb/Utility/ConstString.h" #include "lldb/lldb-types.h" #include +#include chelcassanova wrote: I shouldn't need a sorted map so I'll go with StringMap for the updated patch with the class that will handle the progress report map. 👍🏾 https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
https://github.com/kastiglione created https://github.com/llvm/llvm-project/pull/81196 None >From 81a2034ff2b41e30a1f5b82c86b4d5d4c429ed52 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Thu, 8 Feb 2024 13:59:12 -0800 Subject: [PATCH] [lldb] Support custom printf formatting for variables --- lldb/source/Core/FormatEntity.cpp | 25 +++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index fa5eadc6ff4e9..0e92920393530 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -883,8 +883,29 @@ static bool DumpValue(Stream &s, const SymbolContext *sc, } if (!is_array_range) { -LLDB_LOGF(log, - "[Debugger::FormatPrompt] dumping ordinary printable output"); +if (!entry.printf_format.empty()) { + auto type_info = target->GetTypeInfo(); + if (type_info & eTypeIsInteger) { +if (type_info & eTypeIsSigned) { + bool success = false; + auto integer = target->GetValueAsSigned(0, &success); + if (success) { +LLDB_LOGF(log, "dumping using printf format"); +s.Printf(entry.printf_format.c_str(), integer); +return true; + } +} else { + bool success = false; + auto integer = target->GetValueAsUnsigned(0, &success); + if (success) { +LLDB_LOGF(log, "dumping using printf format"); +s.Printf(entry.printf_format.c_str(), integer); +return true; + } +} + } +} +LLDB_LOGF(log, "dumping ordinary printable output"); return target->DumpPrintableRepresentation(s, val_obj_display, custom_format); } else { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
https://github.com/kastiglione converted_to_draft https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Dave Lee (kastiglione) Changes --- Full diff: https://github.com/llvm/llvm-project/pull/81196.diff 1 Files Affected: - (modified) lldb/source/Core/FormatEntity.cpp (+23-2) ``diff diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index fa5eadc6ff4e9a..0e929203935304 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -883,8 +883,29 @@ static bool DumpValue(Stream &s, const SymbolContext *sc, } if (!is_array_range) { -LLDB_LOGF(log, - "[Debugger::FormatPrompt] dumping ordinary printable output"); +if (!entry.printf_format.empty()) { + auto type_info = target->GetTypeInfo(); + if (type_info & eTypeIsInteger) { +if (type_info & eTypeIsSigned) { + bool success = false; + auto integer = target->GetValueAsSigned(0, &success); + if (success) { +LLDB_LOGF(log, "dumping using printf format"); +s.Printf(entry.printf_format.c_str(), integer); +return true; + } +} else { + bool success = false; + auto integer = target->GetValueAsUnsigned(0, &success); + if (success) { +LLDB_LOGF(log, "dumping using printf format"); +s.Printf(entry.printf_format.c_str(), integer); +return true; + } +} + } +} +LLDB_LOGF(log, "dumping ordinary printable output"); return target->DumpPrintableRepresentation(s, val_obj_display, custom_format); } else { `` https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
kastiglione wrote: Note that the implementation here is a draft for illustration. I am first interested in high level agreement that allowing custom printf formatting of variables is good. https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
https://github.com/kastiglione edited https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][progress][NFC] Add groundwork to keep track of progress reports (PR #81026)
https://github.com/chelcassanova closed https://github.com/llvm/llvm-project/pull/81026 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Support custom printf formatting for variables (PR #81196)
jimingham wrote: The way the current FormatEntity strings work, the first `%` says "formatter coming next" then say `S` is "the kind of formatter" (in this case "return summary instead of value". So in your case, like: ${var%%1x} The "kind of formatter" is "%" which seems like a reasonable name for "printf format string following". To be entirely strict, if the data following the "kind" is the format string, this should be: ${var%%%1x} but that's kind of silly. I think it's fine to say the format kind `%` means `printf formatting string`, and then the data is everything after the % in a printf formatting string. If you didn't like the two percents, you could do this by having `p` be the format kind that meant `printf formatting string` but I'm not sure that would gain much. This seems fine to me. https://github.com/llvm/llvm-project/pull/81196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
clayborg wrote: > > > Will this now work with .dwp files not having UUID? > > > > > > No. If binairies have UUIDs (GNU build IDs), they need to match right now. > > That is larger fix that involves adding a "enum UUIDFlavor" to the UUIDs so > > we can ensure we aren't comparing two different things. > > What Alexander is talking about is if we have a GNU build ID in ``, > > the `.debug` file will have the same UUID, but llvm-dwp currently > > doesn't copy the GNU build ID over into the `.dwp` file. This causes LLDB > > to not allow the .dwp file to be loaded. The problem is if the .dwp file > > doesn't have a UUID, it will make one up by calculating a CRC of the file > > itself, and then we will compare a GNU build ID from `` to the CRC > > calculated by the `.dwp` file and they won't match. > > @dwblaikie do you know how accurate the DWO ID is? Can we avoid relying on > > matching up the UUID on the .dwp file and solely rely on allowing it to be > > loaded and rely on the DWO IDs matching between the skeleton unit and the > > .dwo unit? If so, there is an easy fix I can make to this patch to solve > > that problem. > > Not sure I follow. For .dwo files path is described in Skeleton CU: > DW_AT_comp_dir/DW_AT_dwo_name. The DWP file can have multiple CUs with > different DWO IDs. Exactly. The question is, if a have one `a.out.dwp` file that is out of date, and one of the .dwo files was recompiled into the `a.out` binary, but the `a.out.dwp` file wasn't recreated and if it was actually allowed to be loaded without comparing the GNU build ID, will the DWO ID be unique if the skeleton unit has a `DW_AT_dwo_name` with "foo.o" that has a DWO ID of `0x123` and if we lookup up "foo.o" in the old .dwp file, will the DWO ID mismatch be enough for us to ensure we don't load the .dwo info. If the answer is yes, which implied the DWO ID is some sort of checksum or signature that always changes when a specific file is rebuilt, then it is ok to not match a UUID on a .dwp file. Seeing as no .dwp files actually have a GNU build ID right now unless people manually add it, it seems like we should allow loading any .dwp regardless of the lack of a GNU build ID and deal with the mismatches from the DWO ID. If the DWO ID is just a hash of the file path or something that isn't guaranteed to be unique with each new build, then we need the UUID in the .dwp file. https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
dwblaikie wrote: > If the DWO ID is just a hash of the file path or something that isn't > guaranteed to be unique with each new build, then we need the UUID in the > .dwp file. Nah, the DWO ID, as per spec, is a semantic hash of the DWARF contents. It should change, generally, if any part of the DWARF changes. https://github.com/llvm/llvm-project/blob/1d4fc381d3da4317cc2cfa59b2d59d53decddf71/llvm/lib/CodeGen/AsmPrinter/DIEHash.cpp#L399 https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
clayborg wrote: > FWIW, I think we should be opinionated (& consistent with whatever gdb does, > if it has some precedent here - if it is less opinionated, then maybe we have > to be accepting) when it comes to whether x.debug goes with x.dwp or > x.debug.dwp - we shouldn't support both unless there's some prior precedent > that's unavoidable to support. It'd be better for everyone if there was one > option we encourage people to follow. (so I think we shouldn't support (2) > and (3) if we can help it - we should pick one) There currently is no enforcement on any of this from the compiler or linker driver side and everyone must do the stripping of the executable and creating the .dwp file manually. Since there is no actual enforcement, it seems like we should support both IMHO. More on this below... > I'm not sure I understand the "lldb loads .debug and needs to find .dwp" > case. the .debug file usually only has the debug info, not the executable > code, so you can't load it directly, right? (see the documentation in > https://sourceware.org/gdb/current/onlinedocs/gdb.html/Separate-Debug-Files.html > - `objcopy --only-keep-debug foo foo.debug`). If we have a build system that creates: - `a.out` which is stripped and shipped for distribution - `a.out.debug` which contains debug info only with the skeleton units, address table, line tables, accelerator tables - `a.out.dwp` or `a.out.debug.dwp` which contains the .dwo files for `a.out.debug` We might request to download debug info for this build using a GNU build ID or some other build number for say a symbolication server which wants to use LLDB. If we get this debug info, we might only download `a.out.debug` and the associated `.dwp` file (either `a.out.dwp` or `a.out.debug.dwp`). It would be a shame to require that we download the `a.out` binary as well just so that we can load this into a debugger and get the .dwp file to load automatically. With this change people _can_ load `a.out.debug` into LLDB and peruse the debug information and perform symbolication without having to download the original `a.out`, a file which is not required for symbolication. If we downloaded `a.out.debug` + `a.out.dwp`, unless a user knows to rename `a.out.dwp` to `a.out.debug.dwp`, or create a symlink, then they won't get any info from the .dwo files in the .dwp file. If we don't fix this, then people will get confused and not know how to fix things and get full debug info to get loaded. No one besides debugger, compiler, and linker engineers and very few other people actually know what split DWARF does and or means and if they can't get things to work, they give up or waste time figuring out the magic things that need to happen to make us able to load the right debug info. So I prefer to allow things to work more seamlessly without trying to enforce something that is left up to users to do in the first place. I am someone that often responds to peoples posts when I am on call and I need to help people figure out how to load their debug symbols correrctl. With split DWARF it is even worse because if they get the debug info file with the skeleton compile units but the .dwp file isn't named consistent with GDB conventions, then they can set file and line breakpoints and hit them, but as soon as they stop there, they get no variable information because the .dwo file doesn't get loaded. They don't know what a .dwo or a .dwp file is or why it is needed. We get a few posts a week with people trying to use split DWARF symbols and not being able to get things to work. So IMHO there is no harm in making all scenarios work without having to require some naming convention that isn't actually enforced by _any_ compiler or linker driver, and when things don't work, we put the pressure on the user to find some wiki somewhere that says "here is how you were supposed to do it" and figure out how to fix the issue themselves or by seeking help from us. https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
https://github.com/clayborg updated https://github.com/llvm/llvm-project/pull/81067 >From 3c2f6039cf0e253d78b5193098b311028daaea72 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 7 Feb 2024 16:43:50 -0800 Subject: [PATCH 1/2] Add more ways to find the .dwp file. When using split DWARF we can run into many different ways to store debug info: - lldb loads "" which contains skeleton DWARF and needs to find ".dwp" - lldb loads "" which is stripped but has .gnu_debuglink pointing to ".debug" with skeleton DWARF and needs to find ".dwp" - lldb loads "" which is stripped but has .gnu_debuglink pointing to ".debug" with skeleton DWARF and needs to find ".debug.dwp" - lldb loads ".debug" and needs to find ".dwp Previously we only handled the first two cases. This patch adds support for the latter two. --- lldb/include/lldb/Utility/FileSpecList.h | 4 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 61 +-- .../DWARF/x86/dwp-separate-debug-file.cpp | 30 + 3 files changed, 78 insertions(+), 17 deletions(-) diff --git a/lldb/include/lldb/Utility/FileSpecList.h b/lldb/include/lldb/Utility/FileSpecList.h index 49edc667ddd5b6..6eb3bb9971f13a 100644 --- a/lldb/include/lldb/Utility/FileSpecList.h +++ b/lldb/include/lldb/Utility/FileSpecList.h @@ -238,6 +238,10 @@ class FileSpecList { const_iterator begin() const { return m_files.begin(); } const_iterator end() const { return m_files.end(); } + llvm::iterator_range files() const { +return llvm::make_range(begin(), end()); + } + protected: collection m_files; ///< A collection of FileSpec objects. }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 781f5c5a436778..487961fa7437fb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4349,26 +4349,53 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() { const std::shared_ptr &SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { +// Create a list of files to try and append .dwp to +FileSpecList symfiles; +// Append the module's object file path. +const FileSpec module_fspec = m_objfile_sp->GetModule()->GetFileSpec(); +symfiles.Append(module_fspec); +// Append the object file for this SymbolFile only if it is different from +// the module's file path. Our main module could be "a.out", our symbol file +// could be "a.debug" and our ".dwp" file might be "a.debug.dwp" instead of +// "a.out.dwp". +const FileSpec symfile_fspec(m_objfile_sp->GetFileSpec()); +if (symfile_fspec != module_fspec) { + symfiles.Append(symfile_fspec); +} else { + // If we don't have a separate debug info file, then try stripping the + // extension. We main module could be "a.debug" and the .dwp file could be + // "a.dwp" instead of "a.debug.dwp". + ConstString filename_no_ext = + module_fspec.GetFileNameStrippingExtension(); + if (filename_no_ext != module_fspec.GetFilename()) { +FileSpec module_spec_no_ext(module_fspec); +module_spec_no_ext.SetFilename(filename_no_ext); +symfiles.Append(module_spec_no_ext); + } +} + +FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); ModuleSpec module_spec; module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec(); -module_spec.GetSymbolFileSpec() = -FileSpec(m_objfile_sp->GetModule()->GetFileSpec().GetPath() + ".dwp"); - module_spec.GetUUID() = m_objfile_sp->GetUUID(); -FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); -FileSpec dwp_filespec = -PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); -if (FileSystem::Instance().Exists(dwp_filespec)) { - DataBufferSP dwp_file_data_sp; - lldb::offset_t dwp_file_data_offset = 0; - ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( - GetObjectFile()->GetModule(), &dwp_filespec, 0, - FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp, - dwp_file_data_offset); - if (!dwp_obj_file) -return; - m_dwp_symfile = std::make_shared( - *this, dwp_obj_file, DIERef::k_file_index_mask); +for (const auto &symfile : symfiles.files()) { + module_spec.GetSymbolFileSpec() = + FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle()); + FileSpec dwp_filespec = + PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); + if (FileSystem::Instance().Exists(dwp_filespec)) { +DataBufferSP dwp_file_data_sp; +lldb::offset_t dwp_file_data_offset = 0; +ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( +GetObjectFile()->GetModule(), &dwp_filespec, 0, +FileSystem::Instance().GetByteSize(dwp_filespec), dwp
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
https://github.com/clayborg updated https://github.com/llvm/llvm-project/pull/81067 >From 3c2f6039cf0e253d78b5193098b311028daaea72 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 7 Feb 2024 16:43:50 -0800 Subject: [PATCH 1/3] Add more ways to find the .dwp file. When using split DWARF we can run into many different ways to store debug info: - lldb loads "" which contains skeleton DWARF and needs to find ".dwp" - lldb loads "" which is stripped but has .gnu_debuglink pointing to ".debug" with skeleton DWARF and needs to find ".dwp" - lldb loads "" which is stripped but has .gnu_debuglink pointing to ".debug" with skeleton DWARF and needs to find ".debug.dwp" - lldb loads ".debug" and needs to find ".dwp Previously we only handled the first two cases. This patch adds support for the latter two. --- lldb/include/lldb/Utility/FileSpecList.h | 4 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 61 +-- .../DWARF/x86/dwp-separate-debug-file.cpp | 30 + 3 files changed, 78 insertions(+), 17 deletions(-) diff --git a/lldb/include/lldb/Utility/FileSpecList.h b/lldb/include/lldb/Utility/FileSpecList.h index 49edc667ddd5b6..6eb3bb9971f13a 100644 --- a/lldb/include/lldb/Utility/FileSpecList.h +++ b/lldb/include/lldb/Utility/FileSpecList.h @@ -238,6 +238,10 @@ class FileSpecList { const_iterator begin() const { return m_files.begin(); } const_iterator end() const { return m_files.end(); } + llvm::iterator_range files() const { +return llvm::make_range(begin(), end()); + } + protected: collection m_files; ///< A collection of FileSpec objects. }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 781f5c5a436778..487961fa7437fb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4349,26 +4349,53 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() { const std::shared_ptr &SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { +// Create a list of files to try and append .dwp to +FileSpecList symfiles; +// Append the module's object file path. +const FileSpec module_fspec = m_objfile_sp->GetModule()->GetFileSpec(); +symfiles.Append(module_fspec); +// Append the object file for this SymbolFile only if it is different from +// the module's file path. Our main module could be "a.out", our symbol file +// could be "a.debug" and our ".dwp" file might be "a.debug.dwp" instead of +// "a.out.dwp". +const FileSpec symfile_fspec(m_objfile_sp->GetFileSpec()); +if (symfile_fspec != module_fspec) { + symfiles.Append(symfile_fspec); +} else { + // If we don't have a separate debug info file, then try stripping the + // extension. We main module could be "a.debug" and the .dwp file could be + // "a.dwp" instead of "a.debug.dwp". + ConstString filename_no_ext = + module_fspec.GetFileNameStrippingExtension(); + if (filename_no_ext != module_fspec.GetFilename()) { +FileSpec module_spec_no_ext(module_fspec); +module_spec_no_ext.SetFilename(filename_no_ext); +symfiles.Append(module_spec_no_ext); + } +} + +FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); ModuleSpec module_spec; module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec(); -module_spec.GetSymbolFileSpec() = -FileSpec(m_objfile_sp->GetModule()->GetFileSpec().GetPath() + ".dwp"); - module_spec.GetUUID() = m_objfile_sp->GetUUID(); -FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); -FileSpec dwp_filespec = -PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); -if (FileSystem::Instance().Exists(dwp_filespec)) { - DataBufferSP dwp_file_data_sp; - lldb::offset_t dwp_file_data_offset = 0; - ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( - GetObjectFile()->GetModule(), &dwp_filespec, 0, - FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp, - dwp_file_data_offset); - if (!dwp_obj_file) -return; - m_dwp_symfile = std::make_shared( - *this, dwp_obj_file, DIERef::k_file_index_mask); +for (const auto &symfile : symfiles.files()) { + module_spec.GetSymbolFileSpec() = + FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle()); + FileSpec dwp_filespec = + PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); + if (FileSystem::Instance().Exists(dwp_filespec)) { +DataBufferSP dwp_file_data_sp; +lldb::offset_t dwp_file_data_offset = 0; +ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( +GetObjectFile()->GetModule(), &dwp_filespec, 0, +FileSystem::Instance().GetByteSize(dwp_filespec), dwp
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff c13e271a38363d354294e2af1651470bed8facb3 9d58f41457fc2c9e54b1409c64f3028fdaededf1 -- lldb/include/lldb/Utility/FileSpecList.h lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp index dbb8aed54e..4fe20832d2 100644 --- a/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp +++ b/lldb/test/Shell/SymbolFile/DWARF/x86/dwp-separate-debug-file.cpp @@ -137,7 +137,6 @@ // nor any .dwo files that we are not able to fine the .dwp or .dwo files. // NODWP: unable to locate separate debug file (dwo, dwp). Debugging will be degraded. - struct A { int x = 47; }; `` https://github.com/llvm/llvm-project/pull/81067 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Add more ways to find the .dwp file. (PR #81067)
https://github.com/clayborg updated https://github.com/llvm/llvm-project/pull/81067 >From 3c2f6039cf0e253d78b5193098b311028daaea72 Mon Sep 17 00:00:00 2001 From: Greg Clayton Date: Wed, 7 Feb 2024 16:43:50 -0800 Subject: [PATCH 1/4] Add more ways to find the .dwp file. When using split DWARF we can run into many different ways to store debug info: - lldb loads "" which contains skeleton DWARF and needs to find ".dwp" - lldb loads "" which is stripped but has .gnu_debuglink pointing to ".debug" with skeleton DWARF and needs to find ".dwp" - lldb loads "" which is stripped but has .gnu_debuglink pointing to ".debug" with skeleton DWARF and needs to find ".debug.dwp" - lldb loads ".debug" and needs to find ".dwp Previously we only handled the first two cases. This patch adds support for the latter two. --- lldb/include/lldb/Utility/FileSpecList.h | 4 ++ .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 61 +-- .../DWARF/x86/dwp-separate-debug-file.cpp | 30 + 3 files changed, 78 insertions(+), 17 deletions(-) diff --git a/lldb/include/lldb/Utility/FileSpecList.h b/lldb/include/lldb/Utility/FileSpecList.h index 49edc667ddd5b..6eb3bb9971f13 100644 --- a/lldb/include/lldb/Utility/FileSpecList.h +++ b/lldb/include/lldb/Utility/FileSpecList.h @@ -238,6 +238,10 @@ class FileSpecList { const_iterator begin() const { return m_files.begin(); } const_iterator end() const { return m_files.end(); } + llvm::iterator_range files() const { +return llvm::make_range(begin(), end()); + } + protected: collection m_files; ///< A collection of FileSpec objects. }; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 781f5c5a43677..487961fa7437f 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4349,26 +4349,53 @@ SymbolFileDWARFDebugMap *SymbolFileDWARF::GetDebugMapSymfile() { const std::shared_ptr &SymbolFileDWARF::GetDwpSymbolFile() { llvm::call_once(m_dwp_symfile_once_flag, [this]() { +// Create a list of files to try and append .dwp to +FileSpecList symfiles; +// Append the module's object file path. +const FileSpec module_fspec = m_objfile_sp->GetModule()->GetFileSpec(); +symfiles.Append(module_fspec); +// Append the object file for this SymbolFile only if it is different from +// the module's file path. Our main module could be "a.out", our symbol file +// could be "a.debug" and our ".dwp" file might be "a.debug.dwp" instead of +// "a.out.dwp". +const FileSpec symfile_fspec(m_objfile_sp->GetFileSpec()); +if (symfile_fspec != module_fspec) { + symfiles.Append(symfile_fspec); +} else { + // If we don't have a separate debug info file, then try stripping the + // extension. We main module could be "a.debug" and the .dwp file could be + // "a.dwp" instead of "a.debug.dwp". + ConstString filename_no_ext = + module_fspec.GetFileNameStrippingExtension(); + if (filename_no_ext != module_fspec.GetFilename()) { +FileSpec module_spec_no_ext(module_fspec); +module_spec_no_ext.SetFilename(filename_no_ext); +symfiles.Append(module_spec_no_ext); + } +} + +FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); ModuleSpec module_spec; module_spec.GetFileSpec() = m_objfile_sp->GetFileSpec(); -module_spec.GetSymbolFileSpec() = -FileSpec(m_objfile_sp->GetModule()->GetFileSpec().GetPath() + ".dwp"); - module_spec.GetUUID() = m_objfile_sp->GetUUID(); -FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths(); -FileSpec dwp_filespec = -PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); -if (FileSystem::Instance().Exists(dwp_filespec)) { - DataBufferSP dwp_file_data_sp; - lldb::offset_t dwp_file_data_offset = 0; - ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( - GetObjectFile()->GetModule(), &dwp_filespec, 0, - FileSystem::Instance().GetByteSize(dwp_filespec), dwp_file_data_sp, - dwp_file_data_offset); - if (!dwp_obj_file) -return; - m_dwp_symfile = std::make_shared( - *this, dwp_obj_file, DIERef::k_file_index_mask); +for (const auto &symfile : symfiles.files()) { + module_spec.GetSymbolFileSpec() = + FileSpec(symfile.GetPath() + ".dwp", symfile.GetPathStyle()); + FileSpec dwp_filespec = + PluginManager::LocateExecutableSymbolFile(module_spec, search_paths); + if (FileSystem::Instance().Exists(dwp_filespec)) { +DataBufferSP dwp_file_data_sp; +lldb::offset_t dwp_file_data_offset = 0; +ObjectFileSP dwp_obj_file = ObjectFile::FindPlugin( +GetObjectFile()->GetModule(), &dwp_filespec, 0, +FileSystem::Instance().GetByteSize(dwp_filespec), dwp_fil