[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)
@@ -696,6 +696,87 @@ llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) { return llvm::StringRef(); } +llvm::Error DWARFUnit::GetDIEBitSizeAndSign(uint64_t die_offset, +uint64_t &bit_size, bool &sign) { + // Retrieve the type DIE that the value is being converted to. This + // offset is compile unit relative so we need to fix it up. + const uint64_t abs_die_offset = die_offset + GetOffset(); + // FIXME: the constness has annoying ripple effects. + DWARFDIE die = GetDIE(abs_die_offset); + if (!die) +return llvm::createStringError("cannot resolve DW_OP_convert type DIE"); + uint64_t encoding = + die.GetAttributeValueAsUnsigned(DW_AT_encoding, DW_ATE_hi_user); + bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8; + if (!bit_size) +bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0); + if (!bit_size) +return llvm::createStringError("unsupported type size in DW_OP_convert"); slydiman wrote: Done. https://github.com/llvm/llvm-project/pull/131645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)
@@ -696,6 +696,87 @@ llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) { return llvm::StringRef(); } +llvm::Error DWARFUnit::GetDIEBitSizeAndSign(uint64_t die_offset, +uint64_t &bit_size, bool &sign) { + // Retrieve the type DIE that the value is being converted to. This + // offset is compile unit relative so we need to fix it up. + const uint64_t abs_die_offset = die_offset + GetOffset(); + // FIXME: the constness has annoying ripple effects. + DWARFDIE die = GetDIE(abs_die_offset); + if (!die) +return llvm::createStringError("cannot resolve DW_OP_convert type DIE"); + uint64_t encoding = + die.GetAttributeValueAsUnsigned(DW_AT_encoding, DW_ATE_hi_user); + bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8; + if (!bit_size) +bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0); + if (!bit_size) +return llvm::createStringError("unsupported type size in DW_OP_convert"); + switch (encoding) { + case DW_ATE_signed: + case DW_ATE_signed_char: +sign = true; +break; + case DW_ATE_unsigned: + case DW_ATE_unsigned_char: +sign = false; +break; + default: +return llvm::createStringError("unsupported encoding in DW_OP_convert"); + } + return llvm::Error::success(); +} + +lldb::offset_t +DWARFUnit::GetVendorDWARFOpcodeSize(const DataExtractor &data, +const lldb::offset_t data_offset, +const uint8_t op) const { + return GetSymbolFileDWARF().GetVendorDWARFOpcodeSize(data, data_offset, op); +} + +bool DWARFUnit::ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes, + lldb::offset_t &offset, + std::vector &stack) const { + return GetSymbolFileDWARF().ParseVendorDWARFOpcode(op, opcodes, offset, + stack); +} + +bool DWARFUnit::ParseDWARFLocationList( +const DataExtractor &data, DWARFExpressionList *location_list) const { + location_list->Clear(); slydiman wrote: Done. https://github.com/llvm/llvm-project/pull/131645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] use platform independent path separator in testSettings.py. (PR #132392)
https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/132392 The build bot was failing when running remote test from windows to linux. >From 493a5798524361442ab19be4b0a8077910984ffc Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Fri, 21 Mar 2025 13:04:29 + Subject: [PATCH] [lldb][NFC] use platform independent path separator. The build bot was failing when connecting from windows to linux. Signed-off-by: Ebuka Ezike --- lldb/test/API/commands/settings/TestSettings.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py index 6b89ff76a2900..045b93dab2e2a 100644 --- a/lldb/test/API/commands/settings/TestSettings.py +++ b/lldb/test/API/commands/settings/TestSettings.py @@ -1018,7 +1018,9 @@ def test_settings_api(self): # Test OptionValueFileSpec and OptionValueFileSpecList setting_path = "target.debug-file-search-paths" -setting_value = ["/tmp" "/tmp2"] +path1 = os.path.join(self.getSourceDir(), "tmp") +path2 = os.path.join(self.getSourceDir(), "tmp2") +setting_value = [path1, path2] self.runCmd("settings set %s %s" % (setting_path, " ".join(setting_value))) settings_json = self.get_setting_json(setting_path) self.assertEqual(settings_json, setting_value) ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] use platform independent path separator in testSettings.py. (PR #132392)
@@ -1018,7 +1018,9 @@ def test_settings_api(self): # Test OptionValueFileSpec and OptionValueFileSpecList setting_path = "target.debug-file-search-paths" -setting_value = ["/tmp" "/tmp2"] +path1 = os.path.join(self.getSourceDir(), "tmp") +path2 = os.path.join(self.getSourceDir(), "tmp2") +setting_value = [path1, path2] self.runCmd("settings set %s %s" % (setting_path, " ".join(setting_value))) labath wrote: ```suggestion self.runCmd("settings set %s '%s' '%s'" % (setting_path, path1, path2)) ``` Might as well quote, just in case. https://github.com/llvm/llvm-project/pull/132392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix TestGdbRemoteForkNonStop.py test (PR #131293)
sga-sc wrote: I don’t have merge rights, so could you merge it, please? https://github.com/llvm/llvm-project/pull/131293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
llvmbot wrote: @llvm/pr-subscribers-clang-tools-extra @llvm/pr-subscribers-lldb Author: Matheus Izvekov (mizvekov) Changes Original PR: #130537 Originally reverted due to revert of dependent commit. Relanding with no changes. This changes the MemberPointerType representation to use a NestedNameSpecifier instead of a Type to represent the base class. Since the qualifiers are always parsed as nested names, there was an impedance mismatch when converting these back and forth into types, and this led to issues in preserving sugar. The nested names are indeed a better match for these, as the differences which a QualType can represent cannot be expressed syntatically, and they represent the use case more exactly, being either dependent or referring to a CXXRecord, unqualified. This patch also makes the MemberPointerType able to represent sugar for a {up/downcast}cast conversion of the base class, although for now the underlying type is canonical, as preserving the sugar up to that point requires further work. As usual, includes a few drive-by fixes in order to make use of the improvements. --- Patch is 143.32 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/132401.diff 71 Files Affected: - (modified) clang-tools-extra/clang-tidy/modernize/UseNullptrCheck.cpp (+1-2) - (modified) clang-tools-extra/clang-tidy/utils/ExceptionAnalyzer.cpp (+3-1) - (modified) clang-tools-extra/clangd/unittests/FindTargetTests.cpp (+1-1) - (modified) clang/docs/ReleaseNotes.rst (+1) - (modified) clang/include/clang/AST/ASTContext.h (+3-4) - (modified) clang/include/clang/AST/ASTNodeTraverser.h (+5-2) - (modified) clang/include/clang/AST/CanonicalType.h (+1-1) - (modified) clang/include/clang/AST/RecursiveASTVisitor.h (+5-4) - (modified) clang/include/clang/AST/Type.h (+15-13) - (modified) clang/include/clang/AST/TypeLoc.h (+19-14) - (modified) clang/include/clang/AST/TypeProperties.td (+6-3) - (modified) clang/include/clang/Basic/DiagnosticSemaKinds.td (+2-4) - (modified) clang/include/clang/Sema/Sema.h (+9-2) - (modified) clang/lib/AST/ASTContext.cpp (+47-21) - (modified) clang/lib/AST/ASTImporter.cpp (+9-5) - (modified) clang/lib/AST/ASTStructuralEquivalence.cpp (+6-2) - (modified) clang/lib/AST/ItaniumMangle.cpp (+10-1) - (modified) clang/lib/AST/NestedNameSpecifier.cpp (+1) - (modified) clang/lib/AST/ODRHash.cpp (+1-1) - (modified) clang/lib/AST/QualTypeNames.cpp (+4-3) - (modified) clang/lib/AST/Type.cpp (+30-4) - (modified) clang/lib/AST/TypePrinter.cpp (+2-2) - (modified) clang/lib/CodeGen/CGCXXABI.cpp (+1-1) - (modified) clang/lib/CodeGen/CGPointerAuth.cpp (+2-2) - (modified) clang/lib/CodeGen/CGVTables.cpp (+2-3) - (modified) clang/lib/CodeGen/CodeGenModule.cpp (+1-1) - (modified) clang/lib/CodeGen/ItaniumCXXABI.cpp (+5-5) - (modified) clang/lib/CodeGen/MicrosoftCXXABI.cpp (+4-3) - (modified) clang/lib/Sema/SemaAccess.cpp (+18-8) - (modified) clang/lib/Sema/SemaCast.cpp (+2-2) - (modified) clang/lib/Sema/SemaExpr.cpp (+4-6) - (modified) clang/lib/Sema/SemaExprCXX.cpp (+3-1) - (modified) clang/lib/Sema/SemaOpenMP.cpp (+2-3) - (modified) clang/lib/Sema/SemaOverload.cpp (+60-27) - (modified) clang/lib/Sema/SemaTemplate.cpp (+6-2) - (modified) clang/lib/Sema/SemaTemplateDeduction.cpp (+16-5) - (modified) clang/lib/Sema/SemaType.cpp (+22-100) - (modified) clang/lib/Sema/TreeTransform.h (+29-30) - (modified) clang/lib/Serialization/ASTReader.cpp (+1-1) - (modified) clang/lib/Serialization/ASTWriter.cpp (+1-1) - (modified) clang/lib/Serialization/TemplateArgumentHasher.cpp (+3-1) - (modified) clang/test/AST/ast-dump-template-json-win32-mangler-crash.cpp (+3-1) - (modified) clang/test/AST/ast-dump-templates.cpp (+238) - (modified) clang/test/AST/ast-dump-types-json.cpp (+338-44) - (modified) clang/test/AST/attr-print-emit.cpp (+1-1) - (modified) clang/test/Analysis/cxx-uninitialized-object-ptr-ref.cpp (+5-5) - (modified) clang/test/CXX/class.access/p6.cpp (+2-2) - (modified) clang/test/CXX/drs/cwg0xx.cpp (+6-6) - (modified) clang/test/CXX/drs/cwg13xx.cpp (+2-2) - (modified) clang/test/CXX/drs/cwg26xx.cpp (+3-3) - (modified) clang/test/CXX/drs/cwg2xx.cpp (+2-2) - (modified) clang/test/CXX/drs/cwg4xx.cpp (+1-1) - (modified) clang/test/CXX/drs/cwg7xx.cpp (+1-2) - (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p1.cpp (+1-1) - (modified) clang/test/CXX/temp/temp.arg/temp.arg.nontype/p5.cpp (+3-3) - (modified) clang/test/Index/print-type.cpp (+1-1) - (modified) clang/test/SemaCXX/addr-of-overloaded-function.cpp (+13-13) - (modified) clang/test/SemaCXX/builtin-ptrtomember-ambig.cpp (+2-2) - (modified) clang/test/SemaCXX/calling-conv-compat.cpp (+21-21) - (modified) clang/test/SemaCXX/err_init_conversion_failed.cpp (+1-1) - (modified) clang/test/SemaCXX/member-pointer.cpp (+13-4) - (modified) clang/test/SemaOpenACC/combined-construct-if-ast.cpp (+2-2) - (modified) clang/test/SemaOpenACC/combined-con
[Lldb-commits] [lldb] [lldb][NFC] use platform independent path separator in testSettings.py. (PR #132392)
https://github.com/da-viper closed https://github.com/llvm/llvm-project/pull/132392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)
@@ -696,6 +696,87 @@ llvm::StringRef DWARFUnit::PeekDIEName(dw_offset_t die_offset) { return llvm::StringRef(); } +llvm::Error DWARFUnit::GetDIEBitSizeAndSign(uint64_t die_offset, +uint64_t &bit_size, bool &sign) { + // Retrieve the type DIE that the value is being converted to. This + // offset is compile unit relative so we need to fix it up. + const uint64_t abs_die_offset = die_offset + GetOffset(); + // FIXME: the constness has annoying ripple effects. + DWARFDIE die = GetDIE(abs_die_offset); + if (!die) +return llvm::createStringError("cannot resolve DW_OP_convert type DIE"); + uint64_t encoding = + die.GetAttributeValueAsUnsigned(DW_AT_encoding, DW_ATE_hi_user); + bit_size = die.GetAttributeValueAsUnsigned(DW_AT_byte_size, 0) * 8; + if (!bit_size) +bit_size = die.GetAttributeValueAsUnsigned(DW_AT_bit_size, 0); + if (!bit_size) +return llvm::createStringError("unsupported type size in DW_OP_convert"); + switch (encoding) { + case DW_ATE_signed: + case DW_ATE_signed_char: +sign = true; +break; + case DW_ATE_unsigned: + case DW_ATE_unsigned_char: +sign = false; +break; + default: +return llvm::createStringError("unsupported encoding in DW_OP_convert"); + } + return llvm::Error::success(); +} + +lldb::offset_t +DWARFUnit::GetVendorDWARFOpcodeSize(const DataExtractor &data, +const lldb::offset_t data_offset, +const uint8_t op) const { + return GetSymbolFileDWARF().GetVendorDWARFOpcodeSize(data, data_offset, op); +} + +bool DWARFUnit::ParseVendorDWARFOpcode(uint8_t op, const DataExtractor &opcodes, + lldb::offset_t &offset, + std::vector &stack) const { + return GetSymbolFileDWARF().ParseVendorDWARFOpcode(op, opcodes, offset, + stack); +} + +bool DWARFUnit::ParseDWARFLocationList( +const DataExtractor &data, DWARFExpressionList *location_list) const { + location_list->Clear(); labath wrote: Let's change this to a reference while we're here. ```suggestion bool DWARFUnit::ParseDWARFLocationList( const DataExtractor &data, DWARFExpressionList &location_list) const { location_list.Clear(); ``` https://github.com/llvm/llvm-project/pull/131645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)
@@ -37,7 +36,6 @@ #include "lldb/Target/StackID.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h" #include "llvm/DebugInfo/DWARF/DWARFExpression.h" #include "Plugins/SymbolFile/DWARF/DWARFUnit.h" labath wrote: Does all this mean this header can be removed now? https://github.com/llvm/llvm-project/pull/131645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/131645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)
labath wrote: Okay, and what are those conditions? We could come up with a reasonable way to split this file in two (though I think it'd be better to do what Jonas suggested), but I don't think we can/should rely on those conditions continuing to hold in the face of future changes, if we don't know what they are. And we can't continue splitting files just because someone's compiler/linker makes better code that way. https://github.com/llvm/llvm-project/pull/132274 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][debugserver][MacOSX] Work around sanitizer misaligned address errors when reading exception data (PR #132193)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/132193 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f89a7fa - [lldb] Ignore registers that the debugserver fails to read (#132122)
Author: Robert O'Callahan Date: 2025-03-21T10:10:54+01:00 New Revision: f89a7fa319ccd903a9db69a9e32e1e63d866c5f8 URL: https://github.com/llvm/llvm-project/commit/f89a7fa319ccd903a9db69a9e32e1e63d866c5f8 DIFF: https://github.com/llvm/llvm-project/commit/f89a7fa319ccd903a9db69a9e32e1e63d866c5f8.diff LOG: [lldb] Ignore registers that the debugserver fails to read (#132122) On Mac x86-64, the debugserver reports a register ('ds' at least) but returns an error when we try to read it. Just skip storing such registers in snapshots so we won't try to restore them. Added: Modified: lldb/packages/Python/lldbsuite/test/lldbreverse.py lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py Removed: diff --git a/lldb/packages/Python/lldbsuite/test/lldbreverse.py b/lldb/packages/Python/lldbsuite/test/lldbreverse.py index a42cc7cac15d3..d9a8daba3772d 100644 --- a/lldb/packages/Python/lldbsuite/test/lldbreverse.py +++ b/lldb/packages/Python/lldbsuite/test/lldbreverse.py @@ -300,7 +300,10 @@ def capture_snapshot(self): for index in sorted(self.general_purpose_register_info.keys()): reply = self.pass_through(f"p{index:x};thread:{thread_id:x};") if reply == "" or reply[0] == "E": -raise ValueError("Can't read register") +# Mac debugserver tells us about registers that it won't let +# us actually read. Ignore those registers. +self.logger.debug(f"Failed to read register {index:x}") +continue registers[index] = reply thread_snapshot = ThreadSnapshot(thread_id, registers) thread_sp = self.get_register( diff --git a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py index 1ff645b94d2eb..a159e0f716dbe 100644 --- a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py +++ b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueBreakpoints.py @@ -11,13 +11,11 @@ class TestReverseContinueBreakpoints(ReverseTestBase): @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_reverse_continue(self): self.reverse_continue_internal(async_mode=False) @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_reverse_continue_async(self): self.reverse_continue_internal(async_mode=True) @@ -47,13 +45,11 @@ def reverse_continue_internal(self, async_mode): @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_reverse_continue_breakpoint(self): self.reverse_continue_breakpoint_internal(async_mode=False) @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_reverse_continue_breakpoint_async(self): self.reverse_continue_breakpoint_internal(async_mode=True) @@ -72,13 +68,11 @@ def reverse_continue_breakpoint_internal(self, async_mode): @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_reverse_continue_skip_breakpoint(self): self.reverse_continue_skip_breakpoint_internal(async_mode=False) @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_reverse_continue_skip_breakpoint_async(self): self.reverse_continue_skip_breakpoint_internal(async_mode=True) @@ -104,13 +98,11 @@ def reverse_continue_skip_breakpoint_internal(self, async_mode): @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_continue_preserves_direction(self): self.continue_preserves_direction_internal(async_mode=False) @skipIfRemote @skipIf(macos_version=["<", "15.0"]) -@skipIf(oslist=lldbplatformutil.getDarwinOSTriples(), archs=["x86_64"]) def test_continue_preserves_direction_asyhc(self): self.continue_preserves_direction_internal(async_mode=True) diff --git a/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py b/lldb/test/API/functionalities/reverse-execution/TestReverseContinueWatchpoints.py index 519f1cb23604d..c942f2a0386e5 100644 --- a/lldb/test/API/functionalities/reverse-execution/TestRe
[Lldb-commits] [lldb] 387f3e8 - [lldb] s/ValidRange/ValidRanges in UnwindPlan (#127661)
Author: Pavel Labath Date: 2025-03-21T10:46:48+01:00 New Revision: 387f3e8f986d53067a68aa0d7b058a0ce81ec941 URL: https://github.com/llvm/llvm-project/commit/387f3e8f986d53067a68aa0d7b058a0ce81ec941 DIFF: https://github.com/llvm/llvm-project/commit/387f3e8f986d53067a68aa0d7b058a0ce81ec941.diff LOG: [lldb] s/ValidRange/ValidRanges in UnwindPlan (#127661) To be able to describe discontinuous functions, this patch changes the UnwindPlan to accept more than one address range. I've also squeezed in a couple improvements/modernizations, for example using the lower_bound function instead of a linear scan. Added: lldb/unittests/Symbol/UnwindPlanTest.cpp Modified: lldb/include/lldb/Symbol/UnwindPlan.h lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp lldb/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp lldb/source/Symbol/CompactUnwindInfo.cpp lldb/source/Symbol/DWARFCallFrameInfo.cpp lldb/source/Symbol/UnwindPlan.cpp lldb/unittests/Symbol/CMakeLists.txt lldb/unittests/UnwindAssembly/x86/Testx86AssemblyInspectionEngine.cpp Removed: diff --git a/lldb/include/lldb/Symbol/UnwindPlan.h b/lldb/include/lldb/Symbol/UnwindPlan.h index 7c361bc08bcfe..db9aade93b6ba 100644 --- a/lldb/include/lldb/Symbol/UnwindPlan.h +++ b/lldb/include/lldb/Symbol/UnwindPlan.h @@ -438,7 +438,7 @@ class UnwindPlan { // Performs a deep copy of the plan, including all the rows (expensive). UnwindPlan(const UnwindPlan &rhs) - : m_plan_valid_address_range(rhs.m_plan_valid_address_range), + : m_plan_valid_ranges(rhs.m_plan_valid_ranges), m_register_kind(rhs.m_register_kind), m_return_addr_register(rhs.m_return_addr_register), m_source_name(rhs.m_source_name), @@ -492,10 +492,8 @@ class UnwindPlan { // This UnwindPlan may not be valid at every address of the function span. // For instance, a FastUnwindPlan will not be valid at the prologue setup // instructions - only in the body of the function. - void SetPlanValidAddressRange(const AddressRange &range); - - const AddressRange &GetAddressRange() const { -return m_plan_valid_address_range; + void SetPlanValidAddressRanges(std::vector ranges) { +m_plan_valid_ranges = std::move(ranges); } bool PlanValidAtAddress(Address addr); @@ -544,11 +542,11 @@ class UnwindPlan { m_plan_is_for_signal_trap = is_for_signal_trap; } - int GetRowCount() const; + int GetRowCount() const { return m_row_list.size(); } void Clear() { m_row_list.clear(); -m_plan_valid_address_range.Clear(); +m_plan_valid_ranges.clear(); m_register_kind = lldb::eRegisterKindDWARF; m_source_name.Clear(); m_plan_is_sourced_from_compiler = eLazyBoolCalculate; @@ -571,9 +569,8 @@ class UnwindPlan { } private: - typedef std::vector collection; - collection m_row_list; - AddressRange m_plan_valid_address_range; + std::vector m_row_list; + std::vector m_plan_valid_ranges; lldb::RegisterKind m_register_kind; // The RegisterKind these register numbers // are in terms of - will need to be // translated to lldb native reg nums at unwind time diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp index 459abe417035e..a7c2e4f0b8dbc 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/PECallFrameInfo.cpp @@ -495,9 +495,9 @@ bool PECallFrameInfo::GetUnwindPlan(const AddressRange &range, for (auto it = rows.rbegin(); it != rows.rend(); ++it) unwind_plan.AppendRow(std::move(*it)); - unwind_plan.SetPlanValidAddressRange(AddressRange( + unwind_plan.SetPlanValidAddressRanges({AddressRange( m_object_file.GetAddress(runtime_function->StartAddress), - runtime_function->EndAddress - runtime_function->StartAddress)); + runtime_function->EndAddress - runtime_function->StartAddress)}); unwind_plan.SetUnwindPlanValidAtAllInstructions(eLazyBoolNo); return true; diff --git a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp index 222e04a6a3464..ce2ba69be2e96 100644 --- a/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp +++ b/lldb/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp @@ -656,9 +656,9 @@ SymbolFileBreakpad::ParseCFIUnwindPlan(const Bookmark &bookmark, plan_sp->SetUnwindPlanValidAtAllInstructions(eLazyBoolNo); plan_sp->SetUnwindPlanForSignalTrap(eLazyBoolNo); plan_sp->SetSourcedFromCompiler(eLazyBoolYes); - plan_sp->SetPlanValidAddressRange( - AddressRange(base + init_record->Address, *init_record->Size, - m_objfile_sp->GetModule()->GetSectionList()));
[Lldb-commits] [compiler-rt] [libcxx] [libcxxabi] [libunwind] [lldb] [llvm] [compiler-rt] Disable LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON on AIX. (PR #131200)
@@ -223,6 +223,13 @@ endif() # This can be used to detect whether we're in the runtimes build. set(LLVM_RUNTIMES_BUILD ON) +if (LLVM_ENABLE_PER_TARGET_RUNTIME_DIR AND UNIX AND ${CMAKE_SYSTEM_NAME} MATCHES "AIX") + # Set LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=OFF as AIX doesn't support it + message(WARNING + "LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON is not supported on AIX. LLVM_ENABLE_PER_TARGET_RUNTIME_DIR is set to OFF.") + set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR OFF CACHE BOOL "" FORCE) +endif() daltenty wrote: Yeah, this argument makes a lot of sense to me as well. > we don't want to have configuration logic, especially when it's imperative, > in the CMake files IIUC it sounds like what we are say is that the CMakeLists shouldn’t be making decisions about how the target is configured. Specifying platform configuration defaults is best left to other mechanisms such as caches file (some of which already handle this option for example) That being the case, if the user specifies `LLVM_ENABLE_PER_TARGET_RUNTIME_DIR=ON` we know walking into an config we know happens to be un-implemented for the target. But they asked for what they asked for, so issuing a fatal error (rather than giving them something else) makes sense to me. https://github.com/llvm/llvm-project/pull/131200 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Fix test settings JSON check to compare expected path list. (PR #132410)
https://github.com/da-viper created https://github.com/llvm/llvm-project/pull/132410 Previously, the test compared the JSON output to `setting_value` which was incorrect. Updated the assertion to validate against the correct list of paths `[path1, path2]` to ensure accurate test behavior. Ran the test on the local computer >From 14d38f31871b4d3d11cdfdac660243643cfd0274 Mon Sep 17 00:00:00 2001 From: Ebuka Ezike Date: Fri, 21 Mar 2025 15:12:04 + Subject: [PATCH] [lldb][NFC] Fix settings JSON check to compare expected path list. Previously, the test compared the JSON output to `setting_value` which was incorrect. Updated the assertion to validate against the correct list of paths `[path1, path2]` to ensure accurate test behavior. Signed-off-by: Ebuka Ezike --- lldb/test/API/commands/settings/TestSettings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py index 2a7c852fc916d..b9b66ea953971 100644 --- a/lldb/test/API/commands/settings/TestSettings.py +++ b/lldb/test/API/commands/settings/TestSettings.py @@ -1022,7 +1022,7 @@ def test_settings_api(self): path2 = os.path.join(self.getSourceDir(), "tmp2") self.runCmd("settings set %s '%s' '%s'" % (setting_path, path1, path2)) settings_json = self.get_setting_json(setting_path) -self.assertEqual(settings_json, setting_value) +self.assertEqual(settings_json, [path1, path2]) # Test OptionValueFormatEntity setting_value = """thread #${thread.index}{, name = \\'${thread.name}\\ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Fix test settings JSON check to compare expected path list. (PR #132410)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Ebuka Ezike (da-viper) Changes Previously, the test compared the JSON output to `setting_value` which was incorrect. Updated the assertion to validate against the correct list of paths `[path1, path2]` to ensure accurate test behavior. Ran the test on the local computer --- Full diff: https://github.com/llvm/llvm-project/pull/132410.diff 1 Files Affected: - (modified) lldb/test/API/commands/settings/TestSettings.py (+1-1) ``diff diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py index 2a7c852fc916d..b9b66ea953971 100644 --- a/lldb/test/API/commands/settings/TestSettings.py +++ b/lldb/test/API/commands/settings/TestSettings.py @@ -1022,7 +1022,7 @@ def test_settings_api(self): path2 = os.path.join(self.getSourceDir(), "tmp2") self.runCmd("settings set %s '%s' '%s'" % (setting_path, path1, path2)) settings_json = self.get_setting_json(setting_path) -self.assertEqual(settings_json, setting_value) +self.assertEqual(settings_json, [path1, path2]) # Test OptionValueFormatEntity setting_value = """thread #${thread.index}{, name = \\'${thread.name}\\ `` https://github.com/llvm/llvm-project/pull/132410 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] use platform independent path separator in testSettings.py. (PR #132392)
slydiman wrote: Now https://lab.llvm.org/buildbot/#/builders/195/builds/6519 is broken too. Please fix it ASAP. https://github.com/llvm/llvm-project/pull/132392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
ilovepi wrote: The test output isn't appropriate for the commit body, so please remove that. I also see many files were changed in this PR that aren't related. Many of them seem to be changes to the line endings in files. Please double check your editor and git settings to be sure they follow the project rules https://github.com/llvm/llvm-project/blob/main/llvm/docs/GettingStarted.rst#id24 details git settings https://llvm.org/docs/DeveloperPolicy.html And https://llvm.org/docs/ProgrammersManual.html have details related to project norms and best practices. I'll take a deeper look at your PR once it only has clang-doc related changes. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)
https://github.com/slydiman updated https://github.com/llvm/llvm-project/pull/131645 >From 464460db7550673bac788ad11e3ed4d45946cd71 Mon Sep 17 00:00:00 2001 From: Dmitry Vasilyev Date: Mon, 17 Mar 2025 19:13:20 +0400 Subject: [PATCH 1/3] [LLDB][NFC] Added the interface DWARFUnitInterface to break dependencies and reduce lldb-server size This patch addresses the issue #129543. After this patch DWARFExpression does not call DWARFUnit directly and does not depend on lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp and a lot of clang code. After this patch the size of lldb-server binary (Linux Aarch64) is reduced from 42MB to 13MB with LLVM 20.0.0 and from 47MB to 17MB with LLVM 21.0.0. --- .../include/lldb/Expression/DWARFExpression.h | 23 lldb/source/Expression/DWARFExpression.cpp| 55 ++- .../SymbolFile/DWARF/DWARFFormValue.cpp | 6 +- .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 39 ++--- .../Plugins/SymbolFile/DWARF/DWARFUnit.h | 50 + 5 files changed, 101 insertions(+), 72 deletions(-) diff --git a/lldb/include/lldb/Expression/DWARFExpression.h b/lldb/include/lldb/Expression/DWARFExpression.h index 2c1e717ee32eb..cf4098f2acc51 100644 --- a/lldb/include/lldb/Expression/DWARFExpression.h +++ b/lldb/include/lldb/Expression/DWARFExpression.h @@ -23,7 +23,7 @@ namespace lldb_private { namespace plugin { namespace dwarf { -class DWARFUnit; +class DWARFUnitInterface; } // namespace dwarf } // namespace plugin @@ -65,20 +65,20 @@ class DWARFExpression { /// \return /// The address specified by the operation, if the operation exists, or /// an llvm::Error otherwise. - llvm::Expected - GetLocation_DW_OP_addr(const plugin::dwarf::DWARFUnit *dwarf_cu) const; + llvm::Expected GetLocation_DW_OP_addr( + const plugin::dwarf::DWARFUnitInterface *dwarf_cu) const; - bool Update_DW_OP_addr(const plugin::dwarf::DWARFUnit *dwarf_cu, + bool Update_DW_OP_addr(const plugin::dwarf::DWARFUnitInterface *dwarf_cu, lldb::addr_t file_addr); void UpdateValue(uint64_t const_value, lldb::offset_t const_value_byte_size, uint8_t addr_byte_size); - bool - ContainsThreadLocalStorage(const plugin::dwarf::DWARFUnit *dwarf_cu) const; + bool ContainsThreadLocalStorage( + const plugin::dwarf::DWARFUnitInterface *dwarf_cu) const; bool LinkThreadLocalStorage( - const plugin::dwarf::DWARFUnit *dwarf_cu, + const plugin::dwarf::DWARFUnitInterface *dwarf_cu, std::function const &link_address_callback); @@ -132,13 +132,14 @@ class DWARFExpression { static llvm::Expected Evaluate(ExecutionContext *exe_ctx, RegisterContext *reg_ctx, lldb::ModuleSP module_sp, const DataExtractor &opcodes, - const plugin::dwarf::DWARFUnit *dwarf_cu, + const plugin::dwarf::DWARFUnitInterface *dwarf_cu, const lldb::RegisterKind reg_set, const Value *initial_value_ptr, const Value *object_address_ptr); - static bool ParseDWARFLocationList(const plugin::dwarf::DWARFUnit *dwarf_cu, - const DataExtractor &data, - DWARFExpressionList *loc_list); + static bool + ParseDWARFLocationList(const plugin::dwarf::DWARFUnitInterface *dwarf_cu, + const DataExtractor &data, + DWARFExpressionList *loc_list); bool GetExpressionData(DataExtractor &data) const { data = m_data; diff --git a/lldb/source/Expression/DWARFExpression.cpp b/lldb/source/Expression/DWARFExpression.cpp index f48f3ab9307dd..41fbca59db60f 100644 --- a/lldb/source/Expression/DWARFExpression.cpp +++ b/lldb/source/Expression/DWARFExpression.cpp @@ -133,7 +133,7 @@ static llvm::Error ReadRegisterValueAsScalar(RegisterContext *reg_ctx, static lldb::offset_t GetOpcodeDataSize(const DataExtractor &data, const lldb::offset_t data_offset, const LocationAtom op, -const DWARFUnit *dwarf_cu) { +const DWARFUnitInterface *dwarf_cu) { lldb::offset_t offset = data_offset; switch (op) { // Only used in LLVM metadata. @@ -362,7 +362,8 @@ static lldb::offset_t GetOpcodeDataSize(const DataExtractor &data, // + LEB128 { data.Skip_LEB128(&offset); -return DWARFUnit::GetAddressByteSize(dwarf_cu) + offset - data_offset; +return DWARFUnitInterface::GetAddressByteSize(dwarf_cu) + offset - + data_offset; } case DW_OP_GNU_entry_value: @@ -393,8 +394,8 @@ static lldb::offset_t GetOpcodeDataSize(const DataExtractor &data, return LLDB_INVALID_OFFSET; } -llvm::Expected -DWARFExpression::GetLocation_DW_OP_addr(const DWARFUnit *dwarf_cu) const { +llvm::Expected DWARFExpression::GetLocation_DW_OP_add
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130169 >From c183231db80d6c97bdd5e9bd0b21d041189146e8 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 18 Mar 2025 14:05:38 -0700 Subject: [PATCH 01/10] [lldb-dap] Adding support for cancelling a request. Adding support for cancelling requests. There are two forms of request cancellation. * Preemptively cancelling a request that is in the queue. * Actively cancelling the in progress request as a best effort attempt using `SBDebugger.RequestInterrupt()`. --- lldb/test/API/tools/lldb-dap/cancel/Makefile | 3 + .../tools/lldb-dap/cancel/TestDAP_cancel.py | 101 lldb/test/API/tools/lldb-dap/cancel/main.c| 6 + .../tools/lldb-dap/launch/TestDAP_launch.py | 1 + lldb/tools/lldb-dap/CMakeLists.txt| 1 + lldb/tools/lldb-dap/DAP.cpp | 145 -- lldb/tools/lldb-dap/DAP.h | 3 + .../lldb-dap/Handler/CancelRequestHandler.cpp | 55 +++ lldb/tools/lldb-dap/Handler/RequestHandler.h | 10 ++ .../lldb-dap/Protocol/ProtocolRequests.cpp| 7 + .../lldb-dap/Protocol/ProtocolRequests.h | 20 +++ lldb/tools/lldb-dap/Transport.cpp | 37 +++-- lldb/tools/lldb-dap/Transport.h | 3 +- lldb/tools/lldb-dap/lldb-dap.cpp | 5 +- 14 files changed, 377 insertions(+), 20 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/cancel/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py create mode 100644 lldb/test/API/tools/lldb-dap/cancel/main.c create mode 100644 lldb/tools/lldb-dap/Handler/CancelRequestHandler.cpp diff --git a/lldb/test/API/tools/lldb-dap/cancel/Makefile b/lldb/test/API/tools/lldb-dap/cancel/Makefile new file mode 100644 index 0..10495940055b6 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/cancel/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := main.c + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py new file mode 100644 index 0..f3b2f9fcb7a92 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py @@ -0,0 +1,101 @@ +""" +Test lldb-dap cancel request +""" + +import time + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +import lldbdap_testcase + + +class TestDAP_launch(lldbdap_testcase.DAPTestCaseBase): +def send_async_req(self, command: str, arguments={}) -> int: +seq = self.dap_server.sequence +self.dap_server.send_packet( +{ +"type": "request", +"command": command, +"arguments": arguments, +} +) +return seq + +def async_blocking_request(self, duration: float) -> int: +""" +Sends an evaluate request that will sleep for the specified duration to +block the request handling thread. +""" +return self.send_async_req( +command="evaluate", +arguments={ +"expression": '`script import time; print("starting sleep", file=lldb.debugger.GetOutputFileHandle()); time.sleep({})'.format( +duration +), +"context": "repl", +}, +) + +def async_cancel(self, requestId: int) -> int: +return self.send_async_req(command="cancel", arguments={"requestId": requestId}) + +def test_pending_request(self): +""" +Tests cancelling a pending request. +""" +program = self.getBuildArtifact("a.out") +self.build_and_launch(program, stopOnEntry=True) +self.continue_to_next_stop() + +# Use a relatively short timeout since this is only to ensure the +# following request is queued. +blocking_seq = self.async_blocking_request(duration=1.0) +# Use a longer timeout to ensure we catch if the request was interrupted +# properly. +pending_seq = self.async_blocking_request(duration=self.timeoutval) +cancel_seq = self.async_cancel(requestId=pending_seq) + +blocking_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(blocking_resp["request_seq"], blocking_seq) +self.assertEqual(blocking_resp["command"], "evaluate") +self.assertEqual(blocking_resp["success"], True) + +pending_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(pending_resp["request_seq"], pending_seq) +self.assertEqual(pending_resp["command"], "evaluate") +self.assertEqual(pending_resp["success"], False) +self.assertEqual(pending_resp["message"], "cancelled") + +cancel_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(cancel_resp["request_seq"], cancel_seq) +self.assertEqual(cancel_resp["command"], "
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
ashgti wrote: @JDevlieghere I moved some of the cancel checking logic into the BaseRequestHandler to try to consolidate things. There are some FIXME's around cleaning it up once all the requests have moved off the LegacyRequestHandler. https://github.com/llvm/llvm-project/pull/130169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/130169 >From c183231db80d6c97bdd5e9bd0b21d041189146e8 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 18 Mar 2025 14:05:38 -0700 Subject: [PATCH 01/11] [lldb-dap] Adding support for cancelling a request. Adding support for cancelling requests. There are two forms of request cancellation. * Preemptively cancelling a request that is in the queue. * Actively cancelling the in progress request as a best effort attempt using `SBDebugger.RequestInterrupt()`. --- lldb/test/API/tools/lldb-dap/cancel/Makefile | 3 + .../tools/lldb-dap/cancel/TestDAP_cancel.py | 101 lldb/test/API/tools/lldb-dap/cancel/main.c| 6 + .../tools/lldb-dap/launch/TestDAP_launch.py | 1 + lldb/tools/lldb-dap/CMakeLists.txt| 1 + lldb/tools/lldb-dap/DAP.cpp | 145 -- lldb/tools/lldb-dap/DAP.h | 3 + .../lldb-dap/Handler/CancelRequestHandler.cpp | 55 +++ lldb/tools/lldb-dap/Handler/RequestHandler.h | 10 ++ .../lldb-dap/Protocol/ProtocolRequests.cpp| 7 + .../lldb-dap/Protocol/ProtocolRequests.h | 20 +++ lldb/tools/lldb-dap/Transport.cpp | 37 +++-- lldb/tools/lldb-dap/Transport.h | 3 +- lldb/tools/lldb-dap/lldb-dap.cpp | 5 +- 14 files changed, 377 insertions(+), 20 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/cancel/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py create mode 100644 lldb/test/API/tools/lldb-dap/cancel/main.c create mode 100644 lldb/tools/lldb-dap/Handler/CancelRequestHandler.cpp diff --git a/lldb/test/API/tools/lldb-dap/cancel/Makefile b/lldb/test/API/tools/lldb-dap/cancel/Makefile new file mode 100644 index 0..10495940055b6 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/cancel/Makefile @@ -0,0 +1,3 @@ +C_SOURCES := main.c + +include Makefile.rules diff --git a/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py new file mode 100644 index 0..f3b2f9fcb7a92 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/cancel/TestDAP_cancel.py @@ -0,0 +1,101 @@ +""" +Test lldb-dap cancel request +""" + +import time + +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +import lldbdap_testcase + + +class TestDAP_launch(lldbdap_testcase.DAPTestCaseBase): +def send_async_req(self, command: str, arguments={}) -> int: +seq = self.dap_server.sequence +self.dap_server.send_packet( +{ +"type": "request", +"command": command, +"arguments": arguments, +} +) +return seq + +def async_blocking_request(self, duration: float) -> int: +""" +Sends an evaluate request that will sleep for the specified duration to +block the request handling thread. +""" +return self.send_async_req( +command="evaluate", +arguments={ +"expression": '`script import time; print("starting sleep", file=lldb.debugger.GetOutputFileHandle()); time.sleep({})'.format( +duration +), +"context": "repl", +}, +) + +def async_cancel(self, requestId: int) -> int: +return self.send_async_req(command="cancel", arguments={"requestId": requestId}) + +def test_pending_request(self): +""" +Tests cancelling a pending request. +""" +program = self.getBuildArtifact("a.out") +self.build_and_launch(program, stopOnEntry=True) +self.continue_to_next_stop() + +# Use a relatively short timeout since this is only to ensure the +# following request is queued. +blocking_seq = self.async_blocking_request(duration=1.0) +# Use a longer timeout to ensure we catch if the request was interrupted +# properly. +pending_seq = self.async_blocking_request(duration=self.timeoutval) +cancel_seq = self.async_cancel(requestId=pending_seq) + +blocking_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(blocking_resp["request_seq"], blocking_seq) +self.assertEqual(blocking_resp["command"], "evaluate") +self.assertEqual(blocking_resp["success"], True) + +pending_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(pending_resp["request_seq"], pending_seq) +self.assertEqual(pending_resp["command"], "evaluate") +self.assertEqual(pending_resp["success"], False) +self.assertEqual(pending_resp["message"], "cancelled") + +cancel_resp = self.dap_server.recv_packet(filter_type=["response"]) +self.assertEqual(cancel_resp["request_seq"], cancel_seq) +self.assertEqual(cancel_resp["command"], "
[Lldb-commits] [lldb] 4b41984 - [lldb] Show target.debug-file-search-paths setting from python SBDebugger (#131683)
Author: Ebuka Ezike Date: 2025-03-21T11:20:35Z New Revision: 4b419840c883b0de03ae72c7d352c37f24c1932c URL: https://github.com/llvm/llvm-project/commit/4b419840c883b0de03ae72c7d352c37f24c1932c DIFF: https://github.com/llvm/llvm-project/commit/4b419840c883b0de03ae72c7d352c37f24c1932c.diff LOG: [lldb] Show target.debug-file-search-paths setting from python SBDebugger (#131683) When printing setting variables using the python SBDebugger API if the type is of OptionValueFileSpec it defaults to null as the value even if it has a value. This patch fixes that. - Signed-off-by: Ebuka Ezike Co-authored-by: Jonas Devlieghere Added: Modified: lldb/include/lldb/Interpreter/OptionValueFileSpecList.h lldb/include/lldb/Utility/FileSpec.h lldb/source/Interpreter/OptionValueFileSpecList.cpp lldb/source/Utility/FileSpec.cpp lldb/test/API/commands/settings/TestSettings.py Removed: diff --git a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h index bda6b5071d599..200ce701cb922 100644 --- a/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h +++ b/lldb/include/lldb/Interpreter/OptionValueFileSpecList.h @@ -33,6 +33,8 @@ class OptionValueFileSpecList void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override; + llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override; + Status SetValueFromString(llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override; diff --git a/lldb/include/lldb/Utility/FileSpec.h b/lldb/include/lldb/Utility/FileSpec.h index 2e867b2b40b94..3fa89b1dcff28 100644 --- a/lldb/include/lldb/Utility/FileSpec.h +++ b/lldb/include/lldb/Utility/FileSpec.h @@ -18,6 +18,7 @@ #include "llvm/ADT/StringRef.h" #include "llvm/Support/FileSystem.h" #include "llvm/Support/FormatVariadic.h" +#include "llvm/Support/JSON.h" #include "llvm/Support/Path.h" #include @@ -214,6 +215,16 @@ class FileSpec { /// The stream to which to dump the object description. void Dump(llvm::raw_ostream &s) const; + /// Convert the filespec object to a json value. + /// + /// Convert the filespec object to a json value. If the object contains a + /// valid directory name, it will be displayed followed by a directory + /// delimiter, and the filename. + /// + /// \return + /// A json value representation of a filespec. + llvm::json::Value ToJSON() const; + Style GetPathStyle() const; /// Directory string const get accessor. diff --git a/lldb/source/Interpreter/OptionValueFileSpecList.cpp b/lldb/source/Interpreter/OptionValueFileSpecList.cpp index 98f4938fc6c19..84607eb8d0595 100644 --- a/lldb/source/Interpreter/OptionValueFileSpecList.cpp +++ b/lldb/source/Interpreter/OptionValueFileSpecList.cpp @@ -41,6 +41,15 @@ void OptionValueFileSpecList::DumpValue(const ExecutionContext *exe_ctx, } } +llvm::json::Value +OptionValueFileSpecList::ToJSON(const ExecutionContext *exe_ctx) { + std::lock_guard lock(m_mutex); + llvm::json::Array array; + for (const auto &file_spec : m_current_value) +array.emplace_back(file_spec.ToJSON()); + return array; +} + Status OptionValueFileSpecList::SetValueFromString(llvm::StringRef value, VarSetOperationType op) { std::lock_guard lock(m_mutex); diff --git a/lldb/source/Utility/FileSpec.cpp b/lldb/source/Utility/FileSpec.cpp index 4bebbc9ff175f..bb2b8647342b8 100644 --- a/lldb/source/Utility/FileSpec.cpp +++ b/lldb/source/Utility/FileSpec.cpp @@ -330,6 +330,13 @@ void FileSpec::Dump(llvm::raw_ostream &s) const { s << path_separator; } +llvm::json::Value FileSpec::ToJSON() const { + std::string str; + llvm::raw_string_ostream stream(str); + this->Dump(stream); + return llvm::json::Value(std::move(str)); +} + FileSpec::Style FileSpec::GetPathStyle() const { return m_style; } void FileSpec::SetDirectory(ConstString directory) { diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py index d36e08875919a..6b89ff76a2900 100644 --- a/lldb/test/API/commands/settings/TestSettings.py +++ b/lldb/test/API/commands/settings/TestSettings.py @@ -1016,6 +1016,13 @@ def test_settings_api(self): settings_json = self.get_setting_json(setting_path) self.assertEqual(settings_json, setting_value) +# Test OptionValueFileSpec and OptionValueFileSpecList +setting_path = "target.debug-file-search-paths" +setting_value = ["/tmp" "/tmp2"] +self.runCmd("settings set %s %s" % (setting_path, " ".join(setting_value))) +settings_json = self.get_setting_json(setting_path) +self.assertEqual(settings_json, setting_value) + # Test OptionValueFormatEntity setting_va
[Lldb-commits] [lldb] [lldb] Show target.debug-file-search-paths setting from python SBDebugger (PR #131683)
slydiman wrote: Now https://lab.llvm.org/buildbot/#/builders/162/builds/18611 and https://lab.llvm.org/buildbot/#/builders/195/builds/6519 are broken too. Please fix them ASAP. https://github.com/llvm/llvm-project/pull/131683 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Adjust language type for conflicting Objective-C++ forward declarations (PR #130768)
Michael137 wrote: Interestingly [this alternative stop-gap](https://github.com/swiftlang/llvm-project/pull/new/lldb/mixed-objcxx-decls-to-20240723) (where we just bail from `CompleteRecordType`) on our Swift fork, seems to print the objective-C++ just fine. I'm a bit confused as to why tbh... https://github.com/llvm/llvm-project/pull/130768 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
@@ -0,0 +1,32 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s +// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass + +#define DECLARE_METHODS \ +/** + * @brief Declare a method to calculate the sum of two numbers + */ \ +int Add(int a, int b) \ +{ \ +return a + b; \ +} + +// MD-MyClass: ### Add +// MD-MyClass: *public int Add(int a, int b)* +// MD-MyClass: **brief** Declare a method to calculate the sum of two numbers + +// HTML-MyClass: public int Add(int a, int b) +// HTML-MyClass: brief +// HTML-MyClass: Declare a method to calculate the sum of two numbers + + +class MyClass { ZhongUncle wrote: If I didn't use this class, in this style comment, generated content will no this macro, both html and markdown. That why I use a . And again, I try to restore issue example in issue, so I use this style comment. I also think this class shouldn't be here, but I don't know how to implement a macro function like in issue. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Adding support for cancelling a request. (PR #130169)
@@ -671,8 +695,33 @@ void DAP::SetTarget(const lldb::SBTarget target) { } } -bool DAP::HandleObject(const protocol::Message &M) { - if (const auto *req = std::get_if(&M)) { +bool DAP::HandleObject(const Message &M) { + if (const auto *req = std::get_if(&M)) { +{ + std::lock_guard lock(m_active_request_mutex); + m_active_request = req; +} + +auto cleanup = llvm::make_scope_exit([&]() { + std::scoped_lock active_request_lock(m_active_request_mutex); + m_active_request = nullptr; +}); + +{ + // If there is a pending cancelled request, preempt the request and mark + // it cancelled. + std::lock_guard lock(m_cancelled_requests_mutex); + if (m_cancelled_requests.find(req->seq) != m_cancelled_requests.end()) { +Response cancelled = CancelledResponse(req->seq, req->command); +Send(cancelled); +return true; + } +} + +// Clear interrupt marker prior to handling the next request. +if (debugger.InterruptRequested()) + debugger.CancelInterruptRequest(); ashgti wrote: Moved this up to 702 https://github.com/llvm/llvm-project/pull/130169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
ZhongUncle wrote: > I'll take a deeper look at your PR once it only has clang-doc related changes. This is my problem, sorry, I should put the `build` in external directory. I `cmake` a `build` directory in `llvm-project and I use Mac build it in remote PC. It will create or change some files. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang-doc] Add regression test for test comments in macros (PR #132360)
https://github.com/ZhongUncle edited https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang-doc] Add regression test for test comments in macros (PR #132360)
https://github.com/ZhongUncle edited https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang-doc] Add regression test for test comments in macros (PR #132360)
https://github.com/ZhongUncle edited https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
@@ -0,0 +1,32 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s +// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass + +#define DECLARE_METHODS \ +/** + * @brief Declare a method to calculate the sum of two numbers + */ \ +int Add(int a, int b) \ +{ \ +return a + b; \ +} + +// MD-MyClass: ### Add ilovepi wrote: ```suggestion // MD-MYCLASS: ### Add ``` Use all caps for check prefixes https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
@@ -0,0 +1,32 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s +// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass + +#define DECLARE_METHODS \ +/** + * @brief Declare a method to calculate the sum of two numbers + */ \ +int Add(int a, int b) \ +{ \ +return a + b; \ +} + +// MD-MyClass: ### Add +// MD-MyClass: *public int Add(int a, int b)* +// MD-MyClass: **brief** Declare a method to calculate the sum of two numbers + +// HTML-MyClass: public int Add(int a, int b) +// HTML-MyClass: brief +// HTML-MyClass: Declare a method to calculate the sum of two numbers + + +class MyClass { ilovepi wrote: What is this class testing? It's not clear what property you're trying to exercise. I see you expect the macro to expand in the class, but I don't think you're testing what you think you are. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
@@ -0,0 +1,32 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s +// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass + +#define DECLARE_METHODS \ +/** + * @brief Declare a method to calculate the sum of two numbers ZhongUncle wrote: Yes, I intend to do it, because I try to restore code in issue. And I test some comment styles in this position, like `///`(not work, because new line symbol not work well), `/**/`(works well) and `/**`(works, this is also format in issue, but if I use `\` in each line end, it will output 2 `\` and blank in gnerated markdown). https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][lldb-dap] Added support for "WriteMemory" request. (PR #131820)
santhoshe447 wrote: Hi Every, I really appreciate the time and effort you have put into reviewing my changes. I am working on addressing all the comments accordingly. The implementation was verified through API tests, but when I tried check it using the VSCode IDE GUI, I did not see the "writeMemory" request at all. I have reported this to VSCode [https://github.com/microsoft/vscode/issues/244277]. It would be grateful if someone could guide me on this. Thanks https://github.com/llvm/llvm-project/pull/131820 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
https://github.com/Michael137 commented: LLDB changes LGTM https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix tests to resolve symlinks when checking paths (PR #132053)
https://github.com/dmpots closed https://github.com/llvm/llvm-project/pull/132053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f8865aa - [lldb] Fix tests to resolve symlinks when checking paths (#132053)
Author: David Peixotto Date: 2025-03-21T09:02:27-07:00 New Revision: f8865aa876a663a26d0b9ce5d26c9d6df6b9d18f URL: https://github.com/llvm/llvm-project/commit/f8865aa876a663a26d0b9ce5d26c9d6df6b9d18f DIFF: https://github.com/llvm/llvm-project/commit/f8865aa876a663a26d0b9ce5d26c9d6df6b9d18f.diff LOG: [lldb] Fix tests to resolve symlinks when checking paths (#132053) The inferior used in the process launch test prints out its working directory using the `getcwd` function, which is not allowed to return symbolic links in the path components. When testing against the output from `getcwd` we should resolve the full path to match the expected output. The source manager test sets a breakpoint on a main-copy.c file that is copied into the build output directory. The source manager resolves this path to its real location. When testing the output from the source cache we need to resolve the expected path in the test to remove symlinks. Added: Modified: lldb/test/API/commands/process/launch/TestProcessLaunch.py lldb/test/API/source-manager/TestSourceManager.py Removed: diff --git a/lldb/test/API/commands/process/launch/TestProcessLaunch.py b/lldb/test/API/commands/process/launch/TestProcessLaunch.py index 2d23c0a48960e..92d0c468741e5 100644 --- a/lldb/test/API/commands/process/launch/TestProcessLaunch.py +++ b/lldb/test/API/commands/process/launch/TestProcessLaunch.py @@ -220,7 +220,7 @@ def test_target_launch_working_dir_prop(self): mywd = "my_working_dir" out_file_name = "my_working_dir_test.out" -my_working_dir_path = self.getBuildArtifact(mywd) +my_working_dir_path = Path(self.getBuildArtifact(mywd)).resolve() lldbutil.mkdir_p(my_working_dir_path) out_file_path = os.path.join(my_working_dir_path, out_file_name) another_working_dir_path = Path( diff --git a/lldb/test/API/source-manager/TestSourceManager.py b/lldb/test/API/source-manager/TestSourceManager.py index eca0dd5e6159f..3500dded815b9 100644 --- a/lldb/test/API/source-manager/TestSourceManager.py +++ b/lldb/test/API/source-manager/TestSourceManager.py @@ -35,7 +35,7 @@ def setUp(self): # Call super's setUp(). TestBase.setUp(self) # Find the line number to break inside main(). -self.file = self.getBuildArtifact("main-copy.c") +self.file = os.path.realpath(self.getBuildArtifact("main-copy.c")) self.line = line_number("main.c", "// Set break point at this line.") def modify_content(self): ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang-doc] Add regression test for test comments in macros (PR #132360)
@@ -0,0 +1,32 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s +// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass + +#define DECLARE_METHODS \ +/** + * @brief Declare a method to calculate the sum of two numbers ilovepi wrote: > I also rarely see this kind comment in comments, whether in books or in real > projects. But this issue display like this. Maybe I understood this wrongly. ah, no, I've confused this with a different issue. Apologies. I should take my own advice not to review code first thing in the morning XD. Lets just make it syntactically correct using trailing `\`. If the markdown comes out w/ an extra `\`, we can file a bug for that and handle that separately. You can confirm what's going on by dumping the AST from clang, or by using some of the debug output from clang-doc. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fa4bf3a - [lldb][NFC] Fix test settings JSON check to compare expected path list. (#132410)
Author: Ebuka Ezike Date: 2025-03-21T15:44:41Z New Revision: fa4bf3a11a42a098cae63cc81d99b262d34479fb URL: https://github.com/llvm/llvm-project/commit/fa4bf3a11a42a098cae63cc81d99b262d34479fb DIFF: https://github.com/llvm/llvm-project/commit/fa4bf3a11a42a098cae63cc81d99b262d34479fb.diff LOG: [lldb][NFC] Fix test settings JSON check to compare expected path list. (#132410) Previously, the test compared the JSON output to `setting_value` which was incorrect. Updated the assertion to validate against the correct list of paths `[path1, path2]` to ensure accurate test behavior. Ran the test on the local computer Signed-off-by: Ebuka Ezike Added: Modified: lldb/test/API/commands/settings/TestSettings.py Removed: diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py index 2a7c852fc916d..b9b66ea953971 100644 --- a/lldb/test/API/commands/settings/TestSettings.py +++ b/lldb/test/API/commands/settings/TestSettings.py @@ -1022,7 +1022,7 @@ def test_settings_api(self): path2 = os.path.join(self.getSourceDir(), "tmp2") self.runCmd("settings set %s '%s' '%s'" % (setting_path, path1, path2)) settings_json = self.get_setting_json(setting_path) -self.assertEqual(settings_json, setting_value) +self.assertEqual(settings_json, [path1, path2]) # Test OptionValueFormatEntity setting_value = """thread #${thread.index}{, name = \\'${thread.name}\\ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Fix test settings JSON check to compare expected path list. (PR #132410)
https://github.com/da-viper closed https://github.com/llvm/llvm-project/pull/132410 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] Reland: [clang] preserve class type sugar when taking pointer to member (PR #132401)
https://github.com/mizvekov closed https://github.com/llvm/llvm-project/pull/132401 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
ilovepi wrote: Also, please change the PR title to ``` [clang-doc] Add regression test for test comments in macros ``` The body should contain `Fixes #59819. The underlying problem was fixed in https://reviews.llvm.org/D142560, but this patch adds a proper regression test.` https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] [clang-doc] Add regression test for test comments in macros (PR #132360)
@@ -0,0 +1,32 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s +// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass + +#define DECLARE_METHODS \ +/** + * @brief Declare a method to calculate the sum of two numbers ZhongUncle wrote: Make sense. I will report something as new issues, or maybe I can write it in my GSoC proposal? I will fix these files after wake up, because it is already early morning here, and I think I broken up something in the project, so I re-cloned entire project, and even though I used `--depth 1`, it still takes a very long time when git updating files. I am very happy to get your help and learn new knowledge on the first day of contacting the project, even though I messed up some things. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][NFC] Added the interface DWARFExpression::Delegate to break dependencies and reduce lldb-server size (PR #131645)
@@ -37,7 +36,6 @@ #include "lldb/Target/StackID.h" #include "lldb/Target/Target.h" #include "lldb/Target/Thread.h" -#include "llvm/DebugInfo/DWARF/DWARFDebugLoc.h" #include "llvm/DebugInfo/DWARF/DWARFExpression.h" #include "Plugins/SymbolFile/DWARF/DWARFUnit.h" slydiman wrote: Yes, because the code which is required this header has been moved to DWARFUnit.cpp https://github.com/llvm/llvm-project/pull/131645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
ZhongUncle wrote: @ilovepi Hey, This is my test to https://github.com/llvm/llvm-project/issues/59819. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][debugserver][MacOSX] Work around sanitizer misaligned address errors when reading exception data (PR #132193)
https://github.com/Michael137 updated https://github.com/llvm/llvm-project/pull/132193 >From 64d8c3e31c4b9d5b7c2cd87eb56eb067b2d01f25 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 20 Mar 2025 11:46:45 + Subject: [PATCH 1/3] [lldb][debugserver][MacOSX] Work around sanitizer misaligned address errors when reading exception data We've been dealing with UBSAN issues around this code for some time now (see `9c36859b33b386fbfa9599646de1e2ae01158180` and `1a2122e9e9d1d495fdf337a4a9445b61ca56df6f`). On recent macOS versions, a UBSAN-enabled debugserver will crash when performing a `memcpy` of the input `mach_exception_data_t`. The pointer to the beginning of the exception data may not be aligned on a doubleword boundary, leading to UBSAN failures such as: ``` $ ./bin/debugserver 0.0.0.0: /Volumes/SSD/llvm-builds/llvm-worktrees/clang-work/build-sanitized-release/tools/lldb/test/Shell/Recognizer/Output/verbose_trap.test.tmp.out /Volumes/SSD/llvm-builds/llvm-worktrees/clang-work/lldb/tools/debugserver/source/MacOSX/MachException.cpp:35:12: runtime error: store to misaligned address 0x00016ddfa634 for type 'mach_exception_data_type_t *' (aka 'long long *'), which requires 8 byte alignment 0x00016ddfa634: note: pointer points here 02 00 00 00 03 00 01 00 00 00 00 00 11 00 00 00 00 00 00 00 00 00 00 00 08 00 00 00 00 00 00 00 ^ SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /Volumes/SSD/llvm-builds/llvm-worktrees/clang-work/lldb/tools/debugserver/source/MacOSX/MachException.cpp:35:12 ``` Work around these failures by pretending the input data is a `char*` buffer. Drive-by changes: * I factored out some duplicated code into a static `AppendExceptionData` and made the types consistent --- .../source/MacOSX/MachException.cpp | 38 --- .../debugserver/source/MacOSX/MachException.h | 9 - 2 files changed, 25 insertions(+), 22 deletions(-) diff --git a/lldb/tools/debugserver/source/MacOSX/MachException.cpp b/lldb/tools/debugserver/source/MacOSX/MachException.cpp index 659fb2ff8186d..10323767fc972 100644 --- a/lldb/tools/debugserver/source/MacOSX/MachException.cpp +++ b/lldb/tools/debugserver/source/MacOSX/MachException.cpp @@ -18,9 +18,25 @@ #include "PThreadMutex.h" #include "SysSignal.h" #include +#include #include #include +static void AppendExceptionData(std::vector &out, +mach_exception_data_t Data, +mach_msg_type_number_t Count) { + mach_exception_data_type_t Buf; + for (mach_msg_type_number_t i = 0; i < Count; ++i) { +// The input Data we receive need not be aligned correctly. +// Perform an unaligned copy by pretending we're dealing with +// a char* buffer. This is required to work around UBSAN/ASAN +// "misaligned address" errors. +auto * src = reinterpret_cast(Data + i); +memcpy(&Buf, src, sizeof(mach_exception_data_type_t)); +out.push_back(Buf); + } +} + // Routine mach_exception_raise extern "C" kern_return_t catch_mach_exception_raise(mach_port_t exception_port, mach_port_t thread, @@ -95,20 +111,16 @@ catch_mach_exception_raise(mach_port_t exc_port, mach_port_t thread_port, mach_exception_data_t exc_data, mach_msg_type_number_t exc_data_count) { if (DNBLogCheckLogBit(LOG_EXCEPTIONS)) { -std::vector exc_datas; -uint64_t tmp; -for (unsigned i = 0; i < exc_data_count; ++i) { - // Perform an unaligned copy. - memcpy(&tmp, &exc_data[i], sizeof(uint64_t)); - exc_datas.push_back(tmp); -} +std::vector exc_datas; +AppendExceptionData(exc_datas, exc_data, exc_data_count); DNBLogThreaded("::%s ( exc_port = 0x%4.4x, thd_port = 0x%4.4x, tsk_port = " - "0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { 0x%llx, " - "0x%llx })", + "0x%4.4x, exc_type = %d ( %s ), exc_data[%d] = { 0x%" PRIx64 + ", " + "0x%" PRIx64 " })", __FUNCTION__, exc_port, thread_port, task_port, exc_type, MachException::Name(exc_type), exc_data_count, - (uint64_t)(exc_data_count > 0 ? exc_datas[0] : 0xBADDBADD), - (uint64_t)(exc_data_count > 1 ? exc_datas[1] : 0xBADDBADD)); + (exc_data_count > 0 ? exc_datas[0] : 0xBADDBADD), + (exc_data_count > 1 ? exc_datas[1] : 0xBADDBADD)); } g_message->exc_type = 0; g_message->exc_data.clear(); @@ -117,7 +129,7 @@ catch_mach_exception_raise(mach_port_t exc_port, mach_port_t thread_port, g_message->task_port = task_port; g_message->thread_port = thread_port; g_message->exc_type = exc_type; -g_message->AppendExceptionData(exc_data, exc_data_count); +AppendExceptionData(g_message->exc_data, exc_data, exc_data_count); return KERN_SUCCESS; } else if (!MachTask::IsValid(g_message->task_po
[Lldb-commits] [lldb] [LLDB][NFC] Move CPlusPlusLanguage methods used in Core/Module.cpp to a separated module to break lldb-server dependencies (PR #132274)
slydiman wrote: > What kind of a build (OS, compiler, etc.) is this exactly? I used the latest clang from mainline on Windows x86 and Linux x86 hosts. lldb-server is built for Linux Aarch64. As I mentioned here https://github.com/llvm/llvm-project/issues/129543#issuecomment-2734280226 lldb-server does not depend on the plugin TypeSystemClang and clang code, but it is linked. The size of the binary will be reduced if TypeSystemClang.cpp is just empty. And there is no any link errors. Actually it is enough to move out only the one static helper `CPlusPlusLanguage::IsCPPMangledName()` but I have moved all code used by Module.cpp to be sure. https://github.com/llvm/llvm-project/pull/132274 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [lldb] [llvm] Add test to clang-doc, it can test comments in macro. Original issue is #59819. (PR #132360)
@@ -0,0 +1,32 @@ +// RUN: rm -rf %t && mkdir -p %t +// RUN: clang-doc --format=md --doxygen --output=%t --executor=standalone %s +// RUN: clang-doc --format=html --doxygen --output=%t --executor=standalone %s +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.md --check-prefix=MD-MyClass +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass-LINE +// RUN: FileCheck %s < %t/GlobalNamespace/MyClass.html --check-prefix=HTML-MyClass + +#define DECLARE_METHODS \ +/** + * @brief Declare a method to calculate the sum of two numbers ZhongUncle wrote: I also rarely see this kind comment in comments, whether in books or in real projects. But this issue display like this. Maybe I understood this wrongly. If just regular comment, I think I can write a series test like enum.cpp. Maybe I'm overcomplicating the problem. https://github.com/llvm/llvm-project/pull/132360 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make ELF files able to load section headers from memory. (PR #129166)
@@ -1477,32 +1506,32 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers, } if (idx < section_headers.size()) section_headers.resize(idx); + // Sometimes we are able to read the section header memory from an in memory clayborg wrote: We actually want this to work for ELF files when we don't have the file and it is only in memory. GPU debugging often has images that are in memory only and we need those section headers. I agree with you that normal binaries loaded by the dynamic loader have this issue, but if we have JIT solutions that produce ELF files in memory, or GPU stuff that will compile things on the fly and point debuggers to ELF files in memory, then we should allow for this somehow. I guess we will need to modify the SBModule from memory API to take a size so that it can be specified, though this can still be wrong for most linux binaries. My example's section headers were in the dynamic section: ``` (lldb) image lookup --verbose --address 0x4000+0x3f88 Address: a.out[0x3f88] (a.out.PT_LOAD[3]..dynamic + 448) Summary: a.out`_DYNAMIC + 448 Module: file = "/home/gclayton/local/args/a.out", arch = "x86_64" Symbol: id = {0x0033}, range = [0x7dc8-0x7fd8), name="_DYNAMIC" ``` Let me know what you think of being able to specify the size of the ELF data in memory as a fix? By default if anyone loads something from memory from say a core file, they shouldn't specify the size of the range and we would avoid reading the section headers. But if they do specify it, then we would try to read them, but only if they are contained within the data buffer for the object file? Ack, neither sounds great. https://github.com/llvm/llvm-project/pull/129166 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make ELF files able to load section headers from memory. (PR #129166)
@@ -1477,32 +1506,32 @@ size_t ObjectFileELF::GetSectionHeaderInfo(SectionHeaderColl §ion_headers, } if (idx < section_headers.size()) section_headers.resize(idx); + // Sometimes we are able to read the section header memory from an in memory clayborg wrote: Maybe we need a boolean to specify the object file is fully mapped into memory? Or that the memory image is "complete"? We would then need to specify this when loading the image. JIT and GPU ELF images that are in memory only would use this flag, and ELF core files and loading an image from program memory from the dynamic loader would avoid setting this flag. https://github.com/llvm/llvm-project/pull/129166 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits