[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
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 HEAD~1 HEAD --extensions h,cpp -- lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp b/lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp index 67897d32f..07b65f99a 100644 --- a/lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp +++ b/lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp @@ -301,7 +301,8 @@ bool lldb_rpc_gen::TypeIsCallbackFunctionPointer(QualType T) { return T->isFunctionPointerType(); } -bool lldb_rpc_gen::MethodIsDisallowed(ASTContext &Context, CXXMethodDecl *MDecl) { +bool lldb_rpc_gen::MethodIsDisallowed(ASTContext &Context, + CXXMethodDecl *MDecl) { std::string MangledName = lldb_rpc_gen::GetMangledName(Context, MDecl); if (llvm::is_contained(DisallowedMethods, MangledName)) return true; diff --git a/lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp b/lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp index 3e145e94b..f6e729ddf 100644 --- a/lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp +++ b/lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp @@ -118,7 +118,8 @@ public: for (CXXMethodDecl *MDecl : RDecl->methods()) { const std::string MangledName = lldb_rpc_gen::GetMangledName(Context, MDecl); - const bool IsDisallowed = lldb_rpc_gen::MethodIsDisallowed(Context, MDecl); + const bool IsDisallowed = + lldb_rpc_gen::MethodIsDisallowed(Context, MDecl); const bool HasCallbackParameter = lldb_rpc_gen::HasCallbackParameter(MDecl); SupportLevel MethodSupportLevel = GetMethodSupportLevel(MDecl); `` https://github.com/llvm/llvm-project/pull/138031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (jimingham) Changes When an intra-module jump doesn't fit in the immediate branch slot, the Darwin linker inserts "branch island" symbols, and emits code to jump from branch island to branch island till it makes it to the actual function. The previous submissions failed because in that environment the linker was putting the `foo.island` symbol at the same address as the `padding` symbol we we emitting to make our faked-up large binary. This submission jams a byte after the padding symbol so that the other symbols can't overlap it. --- Full diff: https://github.com/llvm/llvm-project/pull/139301.diff 9 Files Affected: - (modified) lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (+25-7) - (added) lldb/test/API/macosx/branch-islands/Makefile (+16) - (added) lldb/test/API/macosx/branch-islands/TestBranchIslands.py (+35) - (added) lldb/test/API/macosx/branch-islands/foo.c (+6) - (added) lldb/test/API/macosx/branch-islands/main.c (+6) - (added) lldb/test/API/macosx/branch-islands/padding1.s (+5) - (added) lldb/test/API/macosx/branch-islands/padding2.s (+5) - (added) lldb/test/API/macosx/branch-islands/padding3.s (+5) - (added) lldb/test/API/macosx/branch-islands/padding4.s (+5) ``diff diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index e25c4ff55e408..578ab12268ea3 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -26,6 +26,7 @@ #include "lldb/Target/Thread.h" #include "lldb/Target/ThreadPlanCallFunction.h" #include "lldb/Target/ThreadPlanRunToAddress.h" +#include "lldb/Target/ThreadPlanStepInstruction.h" #include "lldb/Utility/DataBuffer.h" #include "lldb/Utility/DataBufferHeap.h" #include "lldb/Utility/LLDBLog.h" @@ -923,15 +924,15 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread, if (current_symbol != nullptr) { std::vector addresses; +ConstString current_name = +current_symbol->GetMangled().GetName(Mangled::ePreferMangled); if (current_symbol->IsTrampoline()) { - ConstString trampoline_name = - current_symbol->GetMangled().GetName(Mangled::ePreferMangled); - if (trampoline_name) { + if (current_name) { const ModuleList &images = target_sp->GetImages(); SymbolContextList code_symbols; -images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeCode, +images.FindSymbolsWithNameAndType(current_name, eSymbolTypeCode, code_symbols); for (const SymbolContext &context : code_symbols) { Address addr = context.GetFunctionOrSymbolAddress(); @@ -945,8 +946,8 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread, } SymbolContextList reexported_symbols; -images.FindSymbolsWithNameAndType( -trampoline_name, eSymbolTypeReExported, reexported_symbols); +images.FindSymbolsWithNameAndType(current_name, eSymbolTypeReExported, + reexported_symbols); for (const SymbolContext &context : reexported_symbols) { if (context.symbol) { Symbol *actual_symbol = @@ -968,7 +969,7 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread, } SymbolContextList indirect_symbols; -images.FindSymbolsWithNameAndType(trampoline_name, eSymbolTypeResolver, +images.FindSymbolsWithNameAndType(current_name, eSymbolTypeResolver, indirect_symbols); for (const SymbolContext &context : indirect_symbols) { @@ -1028,6 +1029,23 @@ DynamicLoaderDarwin::GetStepThroughTrampolinePlan(Thread &thread, thread_plan_sp = std::make_shared( thread, load_addrs, stop_others); } +// One more case we have to consider is "branch islands". These are regular +// TEXT symbols but their names end in .island plus maybe a .digit suffix. +// They are to allow arm64 code to branch further than the size of the +// address slot allows. We just need to single-instruction step in that +// case. +static const char *g_branch_island_pattern = "\\.island\\.?[0-9]*$"; +static RegularExpression g_branch_island_regex(g_branch_island_pattern); + +bool is_branch_island = g_branch_island_regex.Execute(current_name); +if (!thread_plan_sp && is_branch_island) { + thread_plan_sp = std::make_shared( + thread, + /* step_over= */ false, /* stop_others */ false, eVoteNoOpinion, + eVoteNoOpinion); + LLDB_LOG(log, "Stepping one instruction over branch island: '{0}'.", + current_name); +} } else { LLDB_LOGF(log, "Could not find symbol for st
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
royitaqi wrote: > Could we test this in `TestSimulatorPlatform.py`? @JDevlieghere Thanks for pointer. It seems the tests in that file are all **skipped** because of this bug number: `rdar://76995109`. > UNSUPPORTED: LLDB (/Users/royshi/public_llvm/build/bin/clang-arm64) :: > test_ios (TestSimulatorPlatform.TestSimulatorPlatformLaunching) (skipping > unconditionally [rdar://76995109]) Did a bit internet search and couldn't find how to find more info about this bug or why these tests are all skipped. Not sure if I should un-skip them. What's your advice on my next steps? https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
@@ -0,0 +1,12 @@ +C_SOURCES := main.c + +interrupt-and-trap-funcs.o: interrupt-and-trap-funcs.s + $(CC) $(CFLAGS) -c -o interrupt-and-trap-funcs.o $(SRCDIR)/interrupt-and-trap-funcs.s jasonmolenda wrote: ach, that reminds me I need to skip this test unless arm64. https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)
https://github.com/jimingham created https://github.com/llvm/llvm-project/pull/139301 When an intra-module jump doesn't fit in the immediate branch slot, the Darwin linker inserts "branch island" symbols, and emits code to jump from branch island to branch island till it makes it to the actual function. The previous submissions failed because in that environment the linker was putting the `foo.island` symbol at the same address as the `padding` symbol we we emitting to make our faked-up large binary. This submission jams a byte after the padding symbol so that the other symbols can't overlap it. Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [NFC] Separate high-level-dependent portions of DWARFExpression (PR #139175)
https://github.com/Sterling-Augustine updated https://github.com/llvm/llvm-project/pull/139175 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
@@ -0,0 +1,12 @@ +C_SOURCES := main.c + +interrupt-and-trap-funcs.o: interrupt-and-trap-funcs.s + $(CC) $(CFLAGS) -c -o interrupt-and-trap-funcs.o $(SRCDIR)/interrupt-and-trap-funcs.s JDevlieghere wrote: Should this pass a triple? I assume this works locally because you're on an arm64 host? https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
https://github.com/JDevlieghere approved this pull request. Thanks for taking the time to com up with this test case. Pavel already signed off on the implementation so I think this is good to merge. https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)
https://github.com/felipepiovezan approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/139301 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [NFC] Separate high-level-dependent portions of DWARFExpression (PR #139175)
dwblaikie wrote: @jmorse DWARF expressions might be your wheelhouse/you know someone who'd be up for reviewing this? https://github.com/llvm/llvm-project/pull/139175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/139324 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/139324 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 7517a1b - [LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in bytes (#138169)
Author: Jacob Lalonde Date: 2025-05-09T15:49:54-07:00 New Revision: 7517a1bb486f397d45a776e127445596e00c55eb URL: https://github.com/llvm/llvm-project/commit/7517a1bb486f397d45a776e127445596e00c55eb DIFF: https://github.com/llvm/llvm-project/commit/7517a1bb486f397d45a776e127445596e00c55eb.diff LOG: [LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in bytes (#138169) My current internal work requires some sensitivity to IO usage. I had a work around to calculate the expected size of a Minidump, but I've added this PR so an automated system could look at the expected size of an LLDB generated Minidump and then choose if it has the space or wants to generate it. There are some prerequisites to calculating the correct size, so I have the API take a reference for an SBError, I originally tried to return an SBError and instead take a uint64_t reference, but this made the API very difficult to use in python. Added a test case as well. Added: Modified: lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i lldb/include/lldb/API/SBSaveCoreOptions.h lldb/include/lldb/Symbol/SaveCoreOptions.h lldb/source/API/SBSaveCoreOptions.cpp lldb/source/Symbol/SaveCoreOptions.cpp lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py lldb/test/API/python_api/sbsavecoreoptions/basic_minidump.yaml Removed: diff --git a/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i b/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i index 6efbe45d2d3ab..6907164a1b95c 100644 --- a/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i +++ b/lldb/bindings/interface/SBSaveCoreOptionsDocstrings.i @@ -63,6 +63,11 @@ Note that currently ELF Core files are not supported." Get an SBThreadCollection of all threads marked to be saved. This collection is not sorted according to insertion order." ) lldb::SBSaveCoreOptions::GetThreadsToSave; +%feature("docstring", " +Get the current total number of bytes the core is expected to have, excluding the overhead of the core file format. +Requires both a Process and a Style to be specified. An error will be returned if the provided options would result in no data being saved." +) lldb::SBSaveCoreOptions::GetCurrentSizeInBytes; + %feature("docstring", " Unset all options." ) lldb::SBSaveCoreOptions::Clear; diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h b/lldb/include/lldb/API/SBSaveCoreOptions.h index c6d2ab6099b3c..37552c13d0f36 100644 --- a/lldb/include/lldb/API/SBSaveCoreOptions.h +++ b/lldb/include/lldb/API/SBSaveCoreOptions.h @@ -119,6 +119,19 @@ class LLDB_API SBSaveCoreOptions { /// an empty collection will be returned. SBThreadCollection GetThreadsToSave() const; + /// Get the current total number of bytes the core is expected to have + /// excluding the overhead of the core file format. Requires a Process and + /// Style to be specified. + /// + /// \note + /// This can cause some modification of the underlying data store + /// as regions with no permissions, or invalid permissions will be removed + /// and stacks will be minified up to their stack pointer + the redzone. + /// + /// \returns + /// The expected size of the data contained in the core in bytes. + uint64_t GetCurrentSizeInBytes(SBError &error); + /// Reset all options. void Clear(); diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h b/lldb/include/lldb/Symbol/SaveCoreOptions.h index bcf0087fbea5c..da66b184745db 100644 --- a/lldb/include/lldb/Symbol/SaveCoreOptions.h +++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h @@ -49,6 +49,8 @@ class SaveCoreOptions { lldb_private::ThreadCollection::collection GetThreadsToSave() const; + llvm::Expected GetCurrentSizeInBytes(); + void Clear(); private: diff --git a/lldb/source/API/SBSaveCoreOptions.cpp b/lldb/source/API/SBSaveCoreOptions.cpp index 35b9da569dfa1..e101f6a25783c 100644 --- a/lldb/source/API/SBSaveCoreOptions.cpp +++ b/lldb/source/API/SBSaveCoreOptions.cpp @@ -114,6 +114,20 @@ void SBSaveCoreOptions::Clear() { m_opaque_up->Clear(); } +uint64_t SBSaveCoreOptions::GetCurrentSizeInBytes(SBError &error) { + LLDB_INSTRUMENT_VA(this, error); + llvm::Expected expected_bytes = + m_opaque_up->GetCurrentSizeInBytes(); + if (!expected_bytes) { +error = +SBError(lldb_private::Status::FromError(expected_bytes.takeError())); +return 0; + } + // Clear the error, so if the clearer uses it we set it to success. + error.Clear(); + return *expected_bytes; +} + lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const { return *m_opaque_up.get(); } diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp b/lldb/source/Symbol/SaveCoreOptions.cpp index c9f6efeb25d22..e51ae27954934 100644 --- a/lldb/source/Symbol/SaveCoreOptions.cpp +++ b/lldb/source/Symbol/SaveCoreOptions.cpp @@ -145,6 +145,27 @@ SaveCo
[Lldb-commits] [lldb] [lldb-dap] Minor visual changes to the modules UI (PR #139328)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/139328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
jasonmolenda wrote: Ah, lldb-server doesn't secretly migrate the pc past a builtin_debugtrap() BRK instruction on linux like debugserver does, the test will inf loop never advancing past the BRK. https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
https://github.com/jasonmolenda closed https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
https://github.com/ashgti approved this pull request. One question about the logic, but otherwise LGTM https://github.com/llvm/llvm-project/pull/139324 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
@@ -47,6 +48,10 @@ class LLDB_API SBStream { void Print(const char *str); + bool HasColor(); + + void FormatAnsiTerminalCodes(llvm::StringRef format); JDevlieghere wrote: IIUC we don't need any changes to the SBStream class anymore, right? https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/138805 >From 4fc9acd03a58a3617b113352c48e5dd2fdb58eda Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 6 May 2025 22:37:17 -0700 Subject: [PATCH 01/16] [lldb] Provide lr value in faulting frame on arm64 When a frameless function faults or is interrupted asynchronously, the UnwindPlan MAY have no register location rule for the return address register (lr on arm64); the value is simply live in the lr register when it was interrupted, and the frame below this on the stack -- e.g. sigtramp on a Unix system -- has the full register context, including that register. RegisterContextUnwind::SavedLocationForRegister, when asked to find the caller's pc value, will first see if there is a pc register location. If there isn't, on a Return Address Register architecture like arm/mips/riscv, we rewrite the register request from "pc" to "RA register", and search for a location. On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may have no register location rule for the RA Reg, that is valid. A frameless function that never calls another may simply keep the return address in the live register the whole way. Our instruction emulation unwind plans explicitly add a rule (see Pavel's May 2024 change https://github.com/llvm/llvm-project/pull/91321 ), but an UnwindPlan sourced from debug_frame may not. I've got a case where this exactly happens - clang debug_frame for arm64 where there is no register location for the lr in a frameless function. There is a fault in the middle of this frameless function and we only get the lr value from the fault handler below this frame if lr has a register location of `IsSame`, in line with Pavel's 2024 change. Similar to how we see a request of the RA Reg from frame 0 after failing to find an unwind location for the pc register, the same style of special casing is needed when this is a function that was interrupted. Without this change, we can find the pc of the frame that was executing when it was interrupted, but we need $lr to find its caller, and we don't descend down to the trap handler to get that value, truncating the stack. rdar://145614545 --- lldb/source/Target/RegisterContextUnwind.cpp | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp index 3ed49e12476dd..23a86bee2518b 100644 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -1377,6 +1377,7 @@ RegisterContextUnwind::SavedLocationForRegister( } } + // Check if the active_row has a register location listed. if (regnum.IsValid() && active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind), unwindplan_regloc)) { @@ -1390,11 +1391,10 @@ RegisterContextUnwind::SavedLocationForRegister( // This is frame 0 and we're retrieving the PC and it's saved in a Return // Address register and it hasn't been saved anywhere yet -- that is, // it's still live in the actual register. Handle this specially. - if (!have_unwindplan_regloc && return_address_reg.IsValid() && - IsFrameZero()) { -if (return_address_reg.GetAsKind(eRegisterKindLLDB) != -LLDB_INVALID_REGNUM) { + return_address_reg.GetAsKind(eRegisterKindLLDB) != + LLDB_INVALID_REGNUM) { +if (IsFrameZero()) { lldb_private::UnwindLLDB::ConcreteRegisterLocation new_regloc; new_regloc.type = UnwindLLDB::ConcreteRegisterLocation:: eRegisterInLiveRegisterContext; @@ -1408,6 +1408,17 @@ RegisterContextUnwind::SavedLocationForRegister( return_address_reg.GetAsKind(eRegisterKindLLDB), return_address_reg.GetAsKind(eRegisterKindLLDB)); return UnwindLLDB::RegisterSearchResult::eRegisterFound; +} else if (BehavesLikeZerothFrame()) { + // This function was interrupted asynchronously -- it faulted, + // an async interrupt, a timer fired, a debugger expression etc. + // The caller's pc is in the Return Address register, but the + // UnwindPlan for this function may have no location rule for + // the RA reg. + // This means that the caller's return address is in the RA reg + // when the function was interrupted--descend down one stack frame + // to retrieve it from the trap handler's saved context. + unwindplan_regloc.SetSame(); + have_unwindplan_regloc = true; } } >From b10162deb49ecddca6439665c2b8ea1995fdd81f Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 7 May 2025 23:24:17 -0700 Subject: [PATCH 02/16] Add the sources for an API test case to be written --- .../interrupt-and-trap-funcs.s| 92 +++
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] a230bb0 - Revert "[lldb] Provide lr value in faulting frame on arm64 (#138805)"
Author: Jason Molenda Date: 2025-05-09T20:41:15-07:00 New Revision: a230bb029813b2988019dce342e2e622af14bd1d URL: https://github.com/llvm/llvm-project/commit/a230bb029813b2988019dce342e2e622af14bd1d DIFF: https://github.com/llvm/llvm-project/commit/a230bb029813b2988019dce342e2e622af14bd1d.diff LOG: Revert "[lldb] Provide lr value in faulting frame on arm64 (#138805)" This test is failing on the LLDB Incremental bot (arm64), which is running an older set of tools (Xcode 15.2) and OS (macOS 14.1) and the CFI directives must not be emitted correctly by either the tools or the OS. I will need to reproduce how this is compiling on that older setup and see what the issue is. Reverting for now so the bots are not blocked. This reverts commit e897cb139ee6ef5c145fed5394c4d96baa658e6b. Added: Modified: lldb/source/Target/RegisterContextUnwind.cpp Removed: lldb/test/API/functionalities/unwind/frameless-faulted/Makefile lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py lldb/test/API/functionalities/unwind/frameless-faulted/interrupt-and-trap-funcs.c lldb/test/API/functionalities/unwind/frameless-faulted/main.c diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp index cf4b96c6eda9f..4c760b84e45a5 100644 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -248,7 +248,6 @@ void RegisterContextUnwind::InitializeZerothFrame() { active_row = m_full_unwind_plan_sp->GetRowForFunctionOffset(m_current_offset); row_register_kind = m_full_unwind_plan_sp->GetRegisterKind(); -PropagateTrapHandlerFlagFromUnwindPlan(m_full_unwind_plan_sp); if (active_row && log) { StreamString active_row_strm; active_row->Dump(active_row_strm, m_full_unwind_plan_sp.get(), &m_thread, @@ -1376,7 +1375,6 @@ RegisterContextUnwind::SavedLocationForRegister( } } - // Check if the active_row has a register location listed. if (regnum.IsValid() && active_row && active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind), unwindplan_regloc)) { @@ -1390,10 +1388,11 @@ RegisterContextUnwind::SavedLocationForRegister( // This is frame 0 and we're retrieving the PC and it's saved in a Return // Address register and it hasn't been saved anywhere yet -- that is, // it's still live in the actual register. Handle this specially. + if (!have_unwindplan_regloc && return_address_reg.IsValid() && - return_address_reg.GetAsKind(eRegisterKindLLDB) != - LLDB_INVALID_REGNUM) { -if (IsFrameZero()) { + IsFrameZero()) { +if (return_address_reg.GetAsKind(eRegisterKindLLDB) != +LLDB_INVALID_REGNUM) { lldb_private::UnwindLLDB::ConcreteRegisterLocation new_regloc; new_regloc.type = UnwindLLDB::ConcreteRegisterLocation:: eRegisterInLiveRegisterContext; @@ -1407,17 +1406,6 @@ RegisterContextUnwind::SavedLocationForRegister( return_address_reg.GetAsKind(eRegisterKindLLDB), return_address_reg.GetAsKind(eRegisterKindLLDB)); return UnwindLLDB::RegisterSearchResult::eRegisterFound; -} else if (BehavesLikeZerothFrame()) { - // This function was interrupted asynchronously -- it faulted, - // an async interrupt, a timer fired, a debugger expression etc. - // The caller's pc is in the Return Address register, but the - // UnwindPlan for this function may have no location rule for - // the RA reg. - // This means that the caller's return address is in the RA reg - // when the function was interrupted--descend down one stack frame - // to retrieve it from the trap handler's saved context. - unwindplan_regloc.SetSame(); - have_unwindplan_regloc = true; } } @@ -1934,7 +1922,6 @@ void RegisterContextUnwind::PropagateTrapHandlerFlagFromUnwindPlan( } m_frame_type = eTrapHandlerFrame; - UnwindLogMsg("This frame is marked as a trap handler via its UnwindPlan"); if (m_current_offset_backed_up_one != m_current_offset) { // We backed up the pc by 1 to compute the symbol context, but diff --git a/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile b/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile deleted file mode 100644 index fca47ae47491c..0 --- a/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile +++ /dev/null @@ -1,13 +0,0 @@ -C_SOURCES := main.c - -interrupt-and-trap-funcs.o: interrupt-and-trap-funcs.c - $(CC) $(CFLAGS) -E -o interrupt-and-trap-funcs.s $(SRCDIR)/interrupt-and-trap-funcs.c - $(CC) $(CFLAGS) -c -o interrupt-and-
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-x86_64-debian` running on `lldb-x86_64-debian` while building `lldb` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/162/builds/22097 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... UNSUPPORTED: lldb-shell :: Register/x86-zmm-write.test (2882 of 2895) UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/breakpoint_callback.test (2883 of 2895) UNSUPPORTED: lldb-shell :: ScriptInterpreter/Python/Crashlog/altered_threadState.test (2884 of 2895) UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/bindings.test (2885 of 2895) UNSUPPORTED: lldb-shell :: Unwind/windows-unaligned-x86_64.test (2886 of 2895) UNSUPPORTED: lldb-shell :: Heap/heap-cstr.test (2887 of 2895) PASS: lldb-unit :: Utility/./UtilityTests/116/129 (2888 of 2895) UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/persistent_state.test (2889 of 2895) UNSUPPORTED: lldb-shell :: ScriptInterpreter/Lua/io.test (2890 of 2895) UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (2891 of 2895) TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED Script: -- /usr/bin/python3 /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./lib --env LLVM_INCLUDE_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/include --env LLVM_TOOLS_DIR=/home/worker/2.0.1/lldb-x86_64-debian/build/./bin --arch x86_64 --build-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex --lldb-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/worker/2.0.1/lldb-x86_64-debian/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/lldb --compiler /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/clang --dsymutil /home/worker/2.0.1/lldb-x86_64-debian/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./bin --lldb-obj-root /home/worker/2.0.1/lldb-x86_64-debian/build/tools/lldb --lldb-libs-dir /home/worker/2.0.1/lldb-x86_64-debian/build/./lib -t /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision e897cb139ee6ef5c145fed5394c4d96baa658e6b) clang revision e897cb139ee6ef5c145fed5394c4d96baa658e6b llvm revision e897cb139ee6ef5c145fed5394c4d96baa658e6b Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] -- Command Output (stderr): -- Change dir to: /home/worker/2.0.1/lldb-x86_64-debian/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted runCmd: settings clear --all output: runCmd: settings set symbols.enable-external-lookup false output: runCmd: settings set target.inherit-tcc true output: runCmd: settings set target.disable-aslr false output: runCmd: settings set target.detach-on-error false output: runCmd: settings set target.auto-apply-fixits false ``` https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fbcde15 - [lldb-dap] Minor visual changes to the modules UI (#139328)
Author: Jonas Devlieghere Date: 2025-05-09T16:49:05-07:00 New Revision: fbcde15978ef060dfc59314d77447b984f863039 URL: https://github.com/llvm/llvm-project/commit/fbcde15978ef060dfc59314d77447b984f863039 DIFF: https://github.com/llvm/llvm-project/commit/fbcde15978ef060dfc59314d77447b984f863039.diff LOG: [lldb-dap] Minor visual changes to the modules UI (#139328) Small assortment of changes to the modules UI after trying it out: - Print the load address as hexadecimal. - Remove spurious space before colon. - Drop "Module" prefix from tooltip title. - Capitalize bold list items. Added: Modified: lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts Removed: diff --git a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts index 5af3d52e9870c..478c162de8878 100644 --- a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts +++ b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts @@ -25,23 +25,25 @@ export class ModulesDataProvider } const tooltip = new vscode.MarkdownString(); -tooltip.appendMarkdown(`# Module '${module.name}'\n\n`); -tooltip.appendMarkdown(`- **id** : ${module.id}\n`); +tooltip.appendMarkdown(`# ${module.name}\n\n`); +tooltip.appendMarkdown(`- **ID**: ${module.id}\n`); if (module.addressRange) { - tooltip.appendMarkdown(`- **load address** : ${module.addressRange}\n`); + tooltip.appendMarkdown( +`- **Load address**: 0x${Number(module.addressRange).toString(16)}\n`, + ); } if (module.path) { - tooltip.appendMarkdown(`- **path** : ${module.path}\n`); + tooltip.appendMarkdown(`- **Path**: ${module.path}\n`); } if (module.version) { - tooltip.appendMarkdown(`- **version** : ${module.version}\n`); + tooltip.appendMarkdown(`- **Version**: ${module.version}\n`); } if (module.symbolStatus) { - tooltip.appendMarkdown(`- **symbol status** : ${module.symbolStatus}\n`); + tooltip.appendMarkdown(`- **Symbol status**: ${module.symbolStatus}\n`); } if (module.symbolFilePath) { tooltip.appendMarkdown( -`- **symbol file path** : ${module.symbolFilePath}\n`, +`- **Symbol file path**: ${module.symbolFilePath}\n`, ); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] e897cb1 - [lldb] Provide lr value in faulting frame on arm64 (#138805)
Author: Jason Molenda Date: 2025-05-09T20:07:12-07:00 New Revision: e897cb139ee6ef5c145fed5394c4d96baa658e6b URL: https://github.com/llvm/llvm-project/commit/e897cb139ee6ef5c145fed5394c4d96baa658e6b DIFF: https://github.com/llvm/llvm-project/commit/e897cb139ee6ef5c145fed5394c4d96baa658e6b.diff LOG: [lldb] Provide lr value in faulting frame on arm64 (#138805) When a frameless function faults or is interrupted asynchronously, the UnwindPlan MAY have no register location rule for the return address register (lr on arm64); the value is simply live in the lr register when it was interrupted, and the frame below this on the stack -- e.g. sigtramp on a Unix system -- has the full register context, including that register. RegisterContextUnwind::SavedLocationForRegister, when asked to find the caller's pc value, will first see if there is a pc register location. If there isn't, on a Return Address Register architecture like arm/mips/riscv, we rewrite the register request from "pc" to "RA register", and search for a location. On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may have no register location rule for the RA Reg, that is valid. A frameless function that never calls another may simply keep the return address in the live register the whole way. Our instruction emulation unwind plans explicitly add a rule (see Pavel's May 2024 change https://github.com/llvm/llvm-project/pull/91321 ), but an UnwindPlan sourced from debug_frame may not. I've got a case where this exactly happens - clang debug_frame for arm64 where there is no register location for the lr in a frameless function. There is a fault in the middle of this frameless function and we only get the lr value from the fault handler below this frame if lr has a register location of `IsSame`, in line with Pavel's 2024 change. Similar to how we see a request of the RA Reg from frame 0 after failing to find an unwind location for the pc register, the same style of special casing is needed when this is a function that was interrupted. Without this change, we can find the pc of the frame that was executing when it was interrupted, but we need $lr to find its caller, and we don't descend down to the trap handler to get that value, truncating the stack. rdar://145614545 Added: lldb/test/API/functionalities/unwind/frameless-faulted/Makefile lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py lldb/test/API/functionalities/unwind/frameless-faulted/interrupt-and-trap-funcs.c lldb/test/API/functionalities/unwind/frameless-faulted/main.c Modified: lldb/source/Target/RegisterContextUnwind.cpp Removed: diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp index 4c760b84e45a5..cf4b96c6eda9f 100644 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -248,6 +248,7 @@ void RegisterContextUnwind::InitializeZerothFrame() { active_row = m_full_unwind_plan_sp->GetRowForFunctionOffset(m_current_offset); row_register_kind = m_full_unwind_plan_sp->GetRegisterKind(); +PropagateTrapHandlerFlagFromUnwindPlan(m_full_unwind_plan_sp); if (active_row && log) { StreamString active_row_strm; active_row->Dump(active_row_strm, m_full_unwind_plan_sp.get(), &m_thread, @@ -1375,6 +1376,7 @@ RegisterContextUnwind::SavedLocationForRegister( } } + // Check if the active_row has a register location listed. if (regnum.IsValid() && active_row && active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind), unwindplan_regloc)) { @@ -1388,11 +1390,10 @@ RegisterContextUnwind::SavedLocationForRegister( // This is frame 0 and we're retrieving the PC and it's saved in a Return // Address register and it hasn't been saved anywhere yet -- that is, // it's still live in the actual register. Handle this specially. - if (!have_unwindplan_regloc && return_address_reg.IsValid() && - IsFrameZero()) { -if (return_address_reg.GetAsKind(eRegisterKindLLDB) != -LLDB_INVALID_REGNUM) { + return_address_reg.GetAsKind(eRegisterKindLLDB) != + LLDB_INVALID_REGNUM) { +if (IsFrameZero()) { lldb_private::UnwindLLDB::ConcreteRegisterLocation new_regloc; new_regloc.type = UnwindLLDB::ConcreteRegisterLocation:: eRegisterInLiveRegisterContext; @@ -1406,6 +1407,17 @@ RegisterContextUnwind::SavedLocationForRegister( return_address_reg.GetAsKind(eRegisterKindLLDB), return_address_reg.GetAsKind(eRegisterKindLLDB)); return UnwindLLDB::RegisterSearchResult::eRegisterFound; +} else if (BehavesLikeZerothFrame()) { + // This functio
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-aarch64-ubuntu` running on `linaro-lldb-aarch64-ubuntu` while building `lldb` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/59/builds/17444 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... UNSUPPORTED: lldb-api :: functionalities/tsan/thread_numbers/TestTsanThreadNumbers.py (685 of 2165) UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (686 of 2165) PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (687 of 2165) PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (688 of 2165) PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (689 of 2165) UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (690 of 2165) UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (691 of 2165) UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (692 of 2165) PASS: lldb-api :: functionalities/statusline/TestStatusline.py (693 of 2165) UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (694 of 2165) TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED Script: -- /usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --arch aarch64 --build-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision e897cb139ee6ef5c145fed5394c4d96baa658e6b) clang revision e897cb139ee6ef5c145fed5394c4d96baa658e6b llvm revision e897cb139ee6ef5c145fed5394c4d96baa658e6b Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] -- Command Output (stderr): -- FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang-aarch64) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted) == ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted) -- Error when building test subject. Build Command: /usr/bin/gmake VPATH=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -C /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind -I /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -f /home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile all ARCH=aarch64 CC=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang CC_TYPE=clang CXX=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/bin/clang++ LLVM_AR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-ar AR=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-ar OBJCOPY=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-objcopy STRIP=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-strip ARCHIVER=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-ar DWP=/home/tcwg-buildbot/worker/lldb-aarch64-ubuntu/build/./bin/llvm-dwp CLANG_MODULE_CACHE_D
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
@@ -1566,18 +1556,43 @@ void DAP::EventThread() { event_mask & lldb::SBTarget::eBroadcastBitModulesUnloaded || event_mask & lldb::SBTarget::eBroadcastBitSymbolsLoaded || event_mask & lldb::SBTarget::eBroadcastBitSymbolsChanged) { - llvm::StringRef reason = GetModuleEventReason(event_mask); const uint32_t num_modules = lldb::SBTarget::GetNumModulesFromEvent(event); for (uint32_t i = 0; i < num_modules; ++i) { lldb::SBModule module = lldb::SBTarget::GetModuleAtIndexFromEvent(i, event); if (!module.IsValid()) continue; +llvm::StringRef module_id = module.GetUUIDString(); +if (module_id.empty()) + continue; + +llvm::StringRef reason; +bool id_only = false; +{ + std::lock_guard guard(modules_mutex); ashgti wrote: Should we grab this lock while we iterate the entire list of modules from the event? I think we could we get a modules request in the middle of processing this list, which might be a bit inconsistent when we get back to handling the events. https://github.com/llvm/llvm-project/pull/139324 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Minor visual changes to the modules UI (PR #139328)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/139328 >From e2f9bc83de4ed72dd4025de195372813a034e0e7 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 9 May 2025 14:31:30 -0700 Subject: [PATCH 1/2] [lldb-dap] Minor visual changes to the modules UI Small assortment of changes to the modules UI after trying it out: - Print the load address as hexadecimal. - Remove spurious space before colon. - Drop "Module" prefix from tooltip title. - Capitalize bold list items. --- .../lldb-dap/src-ts/ui/modules-data-provider.ts | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts index 5af3d52e9870c..07b89b267b536 100644 --- a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts +++ b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts @@ -25,23 +25,25 @@ export class ModulesDataProvider } const tooltip = new vscode.MarkdownString(); -tooltip.appendMarkdown(`# Module '${module.name}'\n\n`); -tooltip.appendMarkdown(`- **id** : ${module.id}\n`); +tooltip.appendMarkdown(`# ${module.name}\n\n`); +tooltip.appendMarkdown(`- **ID** : ${module.id}\n`); if (module.addressRange) { - tooltip.appendMarkdown(`- **load address** : ${module.addressRange}\n`); + tooltip.appendMarkdown( +`- **Load address**: 0x${Number(module.addressRange).toString(16)}\n`, + ); } if (module.path) { - tooltip.appendMarkdown(`- **path** : ${module.path}\n`); + tooltip.appendMarkdown(`- **Path**: ${module.path}\n`); } if (module.version) { - tooltip.appendMarkdown(`- **version** : ${module.version}\n`); + tooltip.appendMarkdown(`- **Version**: ${module.version}\n`); } if (module.symbolStatus) { - tooltip.appendMarkdown(`- **symbol status** : ${module.symbolStatus}\n`); + tooltip.appendMarkdown(`- **Symbol status**: ${module.symbolStatus}\n`); } if (module.symbolFilePath) { tooltip.appendMarkdown( -`- **symbol file path** : ${module.symbolFilePath}\n`, +`- **Symbol file path**: ${module.symbolFilePath}\n`, ); } >From f8ade5ac2f75c6bd9da699e117ff477759333c5c Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 9 May 2025 16:04:11 -0700 Subject: [PATCH 2/2] Nit on whitespace. --- lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts index 07b89b267b536..478c162de8878 100644 --- a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts +++ b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts @@ -26,7 +26,7 @@ export class ModulesDataProvider const tooltip = new vscode.MarkdownString(); tooltip.appendMarkdown(`# ${module.name}\n\n`); -tooltip.appendMarkdown(`- **ID** : ${module.id}\n`); +tooltip.appendMarkdown(`- **ID**: ${module.id}\n`); if (module.addressRange) { tooltip.appendMarkdown( `- **Load address**: 0x${Number(module.addressRange).toString(16)}\n`, ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-arm-ubuntu` running on `linaro-lldb-arm-ubuntu` while building `lldb` at step 6 "test". Full details are available at: https://lab.llvm.org/buildbot/#/builders/18/builds/15782 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (689 of 3022) PASS: lldb-api :: functionalities/thread/thread_specific_break_plus_condition/TestThreadSpecificBpPlusCondition.py (690 of 3022) PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (691 of 3022) PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (692 of 3022) UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (693 of 3022) UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (694 of 3022) PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (695 of 3022) UNSUPPORTED: lldb-api :: functionalities/unwind/aarch64_unwind_pac/TestAArch64UnwindPAC.py (696 of 3022) UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (697 of 3022) UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (698 of 3022) TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED Script: -- /usr/bin/python3.10 /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --arch armv8l --build-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/lldb --compiler /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/clang --dsymutil /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin --lldb-obj-root /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb --lldb-libs-dir /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./lib /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision e897cb139ee6ef5c145fed5394c4d96baa658e6b) clang revision e897cb139ee6ef5c145fed5394c4d96baa658e6b llvm revision e897cb139ee6ef5c145fed5394c4d96baa658e6b Skipping the following test categories: ['libc++', 'dsym', 'gmodules', 'debugserver', 'objc'] -- Command Output (stderr): -- FAIL: LLDB (/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang-arm) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted) == ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted) -- Error when building test subject. Build Command: /usr/bin/gmake VPATH=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -C /home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.noindex/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.test_frameless_faulted_unwind -I /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -I /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/make -f /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted/Makefile all ARCH=armv8l CC=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang CC_TYPE=clang CXX=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/bin/clang++ LLVM_AR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-ar AR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-ar OBJCOPY=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-objcopy STRIP=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-strip ARCHIVER=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-ar DWP=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/./bin/llvm-dwp CLANG_MODULE_CACHE_DIR=/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/lldb-test-build.n
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-ubuntu` running on `as-builder-9` while building `lldb` at step 16 "test-check-lldb-api". Full details are available at: https://lab.llvm.org/buildbot/#/builders/195/builds/8813 Here is the relevant piece of the build log for the reference ``` Step 16 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure) ... UNSUPPORTED: lldb-api :: functionalities/tty/TestTerminal.py (685 of 1267) UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (686 of 1267) PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (687 of 1267) PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (688 of 1267) PASS: lldb-api :: functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py (689 of 1267) UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (690 of 1267) PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (691 of 1267) UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (692 of 1267) UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (693 of 1267) UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (694 of 1267) TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED Script: -- /usr/bin/python3.12 /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --env LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include --env LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --libcxx-include-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1 --libcxx-include-target-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1 --libcxx-library-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu --arch aarch64 --build-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex --lldb-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api --clang-module-cache-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api --executable /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb --compiler /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang --dsymutil /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil --make /usr/bin/gmake --llvm-tools-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin --lldb-obj-root /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb --lldb-libs-dir /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib --platform-url connect://jetson-agx-2198.lab.llvm.org:1234 --platform-working-dir /home/ubuntu/lldb-tests --sysroot /mnt/fs/jetson-agx-ubuntu --env ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux --skip-category=lldb-server /home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/unwind/frameless-faulted -p TestUnwindFramelessFaulted.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision e897cb139ee6ef5c145fed5394c4d96baa658e6b) clang revision e897cb139ee6ef5c145fed5394c4d96baa658e6b llvm revision e897cb139ee6ef5c145fed5394c4d96baa658e6b Setting up remote platform 'remote-linux' Connecting to remote platform 'remote-linux' at 'connect://jetson-agx-2198.lab.llvm.org:1234'... Connected. Setting remote platform working directory to '/home/ubuntu/lldb-tests'... Skipping the following test categories: ['lldb-server', 'dsym', 'gmodules', 'debugserver', 'objc', 'lldb-dap'] -- Command Output (stderr): -- WARNING:root:Custom libc++ is not supported for remote runs: ignoring --libcxx arguments FAIL: LLDB (/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind) == ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind) -- Error when building test subject. Build Command: /usr/bin/gmake VPATH=/home/buildbot/worker/a
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-win` running on `as-builder-10` while building `lldb` at step 17 "test-check-lldb-api". Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/5139 Here is the relevant piece of the build log for the reference ``` Step 17 (test-check-lldb-api) failure: Test just built components: check-lldb-api completed (failure) ... UNSUPPORTED: lldb-api :: functionalities/tty/TestTerminal.py (685 of 1267) UNSUPPORTED: lldb-api :: functionalities/type_lookup/TestTypeLookup.py (686 of 1267) PASS: lldb-api :: functionalities/type_find_first/TestFindFirstType.py (687 of 1267) PASS: lldb-api :: functionalities/type_get_module/TestTypeGetModule.py (688 of 1267) PASS: lldb-api :: functionalities/type_types/TestFindTypes.py (689 of 1267) UNSUPPORTED: lldb-api :: functionalities/ubsan/basic/TestUbsanBasic.py (690 of 1267) UNSUPPORTED: lldb-api :: functionalities/ubsan/user-expression/TestUbsanUserExpression.py (691 of 1267) PASS: lldb-api :: functionalities/thread/thread_specific_break/TestThreadSpecificBreakpoint.py (692 of 1267) UNSUPPORTED: lldb-api :: functionalities/unwind/ehframe/TestEhFrameUnwind.py (693 of 1267) UNRESOLVED: lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py (694 of 1267) TEST 'lldb-api :: functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py' FAILED Script: -- C:/Python312/python.exe C:/buildbot/as-builder-10/lldb-x-aarch64/llvm-project/lldb\test\API\dotest.py -u CXXFLAGS -u CFLAGS --env LLVM_LIBS_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --env LLVM_INCLUDE_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/include --env LLVM_TOOLS_DIR=C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --arch aarch64 --build-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex --lldb-module-cache-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex/module-cache-lldb\lldb-api --clang-module-cache-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/lldb-test-build.noindex/module-cache-clang\lldb-api --executable C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/lldb.exe --compiler C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/clang.exe --dsymutil C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin/dsymutil.exe --make C:/ninja/make.exe --llvm-tools-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/./bin --lldb-obj-root C:/buildbot/as-builder-10/lldb-x-aarch64/build/tools/lldb --lldb-libs-dir C:/buildbot/as-builder-10/lldb-x-aarch64/build/./lib --platform-url connect://jetson-agx-0086.lab.llvm.org:1234 --platform-working-dir /home/ubuntu/lldb-tests --sysroot c:/buildbot/fs/jetson-agx-ubuntu --env ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux --skip-category=lldb-server C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\test\API\functionalities\unwind\frameless-faulted -p TestUnwindFramelessFaulted.py -- Exit Code: 1 Command Output (stdout): -- lldb version 21.0.0git (https://github.com/llvm/llvm-project.git revision e897cb139ee6ef5c145fed5394c4d96baa658e6b) clang revision e897cb139ee6ef5c145fed5394c4d96baa658e6b llvm revision e897cb139ee6ef5c145fed5394c4d96baa658e6b Setting up remote platform 'remote-linux' Connecting to remote platform 'remote-linux' at 'connect://jetson-agx-0086.lab.llvm.org:1234'... Connected. Setting remote platform working directory to '/home/ubuntu/lldb-tests'... Skipping the following test categories: ['lldb-server', 'dsym', 'gmodules', 'debugserver', 'objc', 'lldb-dap'] -- Command Output (stderr): -- FAIL: LLDB (C:\buildbot\as-builder-10\lldb-x-aarch64\build\bin\clang.exe-aarch64) :: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind) == ERROR: test_frameless_faulted_unwind (TestUnwindFramelessFaulted.TestUnwindFramelessFaulted.test_frameless_faulted_unwind) -- Error when building test subject. Build Command: ``` https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 76f0f4c - Stop running test on Linux for now
Author: Jason Molenda Date: 2025-05-09T20:20:51-07:00 New Revision: 76f0f4cdf4bf9ebf476af99ad9911c687910d66d URL: https://github.com/llvm/llvm-project/commit/76f0f4cdf4bf9ebf476af99ad9911c687910d66d DIFF: https://github.com/llvm/llvm-project/commit/76f0f4cdf4bf9ebf476af99ad9911c687910d66d.diff LOG: Stop running test on Linux for now Failed at compile time lldb-aarch64-ubuntu bot. It did clang -E -o interrupt-and-trap-funcs.s interrupt-and-trap-funcs.c and that added a bunch of standard C header typedefs to the output .s file which then turn into compile errors when it tries to compile the .s file as assembly. Never saw that behavior in my testing on an ubuntu 24.04 system. It would have been nice to have the test run on Linux as well as Darwin, but it's not essential. Added: Modified: lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py Removed: diff --git a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py index f1fce8535ca35..53c5e1182cf24 100644 --- a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py +++ b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py @@ -10,7 +10,7 @@ class TestUnwindFramelessFaulted(TestBase): NO_DEBUG_INFO_TESTCASE = True -@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"])) +@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples()])) @skipIf(archs=no_match(["aarch64", "arm64", "arm64e"])) def test_frameless_faulted_unwind(self): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
jasonmolenda wrote: I had two commits to address bots. The first was my skipIf to run the test only darwin/linux only for arm64/aarch64 acted like an or so it could run on either of those. Second, the aarch64-ubuntu bot failed when I had it my assembly file named ".c" and did `clang -E -o interrupt-and-trap-funcs.s interrupt-and-trap-funcs.c` to run it through the preprocessor - clang on that system when run by the API tests injected a bunch of C headers and it failed to compile as assembly then. For now, I changed the test to only run on Darwin. https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b7c449a - [lldb-dap] Don't emit a removed module event for unseen modules (#139324)
Author: Jonas Devlieghere Date: 2025-05-09T23:34:05-07:00 New Revision: b7c449ac0b0c4ccbe99937052c9428960cea7664 URL: https://github.com/llvm/llvm-project/commit/b7c449ac0b0c4ccbe99937052c9428960cea7664 DIFF: https://github.com/llvm/llvm-project/commit/b7c449ac0b0c4ccbe99937052c9428960cea7664.diff LOG: [lldb-dap] Don't emit a removed module event for unseen modules (#139324) Added: lldb/test/API/tools/lldb-dap/module-event/Makefile lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py lldb/test/API/tools/lldb-dap/module-event/main.cpp lldb/test/API/tools/lldb-dap/module-event/other.c Modified: lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/test/API/tools/lldb-dap/module/TestDAP_module.py lldb/tools/lldb-dap/DAP.cpp lldb/tools/lldb-dap/DAP.h lldb/tools/lldb-dap/Handler/ModulesRequestHandler.cpp lldb/tools/lldb-dap/JSONUtils.cpp lldb/tools/lldb-dap/JSONUtils.h Removed: diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e10342b72f4f0..c974866306d2a 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -134,7 +134,6 @@ def __init__(self, recv, send, init_commands, log_file=None): self.thread_stop_reasons = {} self.progress_events = [] self.reverse_requests = [] -self.module_events = [] self.sequence = 1 self.threads = None self.recv_thread.start() @@ -248,11 +247,6 @@ def handle_recv_packet(self, packet): # and 'progressEnd' events. Keep these around in case test # cases want to verify them. self.progress_events.append(packet) -elif event == "module": -# Module events indicate that some information about a module has changed. -self.module_events.append(packet) -# no need to add 'module' event packets to our packets list -return keepGoing elif packet_type == "response": if packet["command"] == "disconnect": diff --git a/lldb/test/API/tools/lldb-dap/module-event/Makefile b/lldb/test/API/tools/lldb-dap/module-event/Makefile new file mode 100644 index 0..99d79b8053878 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/module-event/Makefile @@ -0,0 +1,12 @@ +CXX_SOURCES := main.cpp +LD_EXTRAS := -Wl,-rpath "-Wl,$(shell pwd)" +USE_LIBDL :=1 + +a.out: libother + +include Makefile.rules + +# The following shared library will be used to test breakpoints under dynamic loading +libother: other.c + "$(MAKE)" -f $(MAKEFILE_RULES) \ + DYLIB_ONLY=YES DYLIB_C_SOURCES=other.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py new file mode 100644 index 0..c216b5d92823c --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py @@ -0,0 +1,54 @@ +import dap_server +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +import lldbdap_testcase +import re + + +class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase): +def test_module_event(self): +program = self.getBuildArtifact("a.out") +self.build_and_launch(program, stopOnEntry=True) + +source = "main.cpp" +breakpoint1_line = line_number(source, "// breakpoint 1") +breakpoint2_line = line_number(source, "// breakpoint 2") +breakpoint3_line = line_number(source, "// breakpoint 3") + +breakpoint_ids = self.set_source_breakpoints( +source, [breakpoint1_line, breakpoint2_line, breakpoint3_line] +) +self.continue_to_breakpoints(breakpoint_ids) + +# We're now stopped at breakpoint 1 before the dlopen. Flush all the module events. +event = self.dap_server.wait_for_event("module", 0.25) +while event is not None: +event = self.dap_server.wait_for_event("module", 0.25) + +# Continue to the second breakpoint, before the dlclose. +self.continue_to_breakpoints(breakpoint_ids) + +# Make sure we got a module event for libother. +event = self.dap_server.wait_for_event("module", 5) +self.assertTrue(event, "didn't get a module event") +module_name = event["body"]["module"]["name"] +module_id = event["body"]["module"]["id"] +self.assertEqual(event["body"]["reason"], "new") +self.assertIn("libother", module_name) + +# Continue to the third breakpoint, after the dlclose. +self.continue_to_breakpoints(breakpoint_ids) + +# Make sure we got a module ev
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/139324 ___ 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] Disable more tests on Windows (PR #139251)
https://github.com/DavidSpickett closed https://github.com/llvm/llvm-project/pull/139251 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] print a notice when `source list` paging reaches the end of th… (PR #137515)
DavidSpickett wrote: Yes please. https://github.com/llvm/llvm-project/pull/137515 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix crash after second run when set a previous watchpoint. (PR #136682)
https://github.com/hapee closed https://github.com/llvm/llvm-project/pull/136682 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Improving tests logging to understand CI failures. (PR #139311)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: John Harrison (ashgti) Changes To improve logging this adjusts two properties of the existing tests: * Forwards stderr from lldb-dap to the process in case errors are reported to stderr. * Adjusts `DebugAdapterServer.terminate` to close stdin and wait for the process to exit instead of sending SIGTERM. Additionally, if we end up with a non-zero exit status we now raise an error to note the unexpected exit status. With these changes, I did find one test case in `TestDAP_console.test_diagnositcs` that was not waiting to ensure the expected event had arrived by the time it performed an assert. --- Full diff: https://github.com/llvm/llvm-project/pull/139311.diff 3 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (+30-6) - (modified) lldb/test/API/tools/lldb-dap/console/TestDAP_console.py (+3-2) - (modified) lldb/test/API/tools/lldb-dap/io/TestDAP_io.py (-4) ``diff diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e10342b72f4f0..292209f8ab042 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -8,6 +8,7 @@ import socket import string import subprocess +import signal import sys import threading import time @@ -1269,7 +1270,7 @@ def launch(cls, /, executable, env=None, log_file=None, connection=None): args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, -stderr=subprocess.PIPE, +stderr=sys.stderr, env=adapter_env, ) @@ -1302,14 +1303,37 @@ def get_pid(self): def terminate(self): super(DebugAdapterServer, self).terminate() if self.process is not None: -self.process.terminate() +process = self.process +self.process = None try: -self.process.wait(timeout=20) +# When we close stdin it should signal the lldb-dap that no +# new messages will arrive and it should shutdown on its own. +process.stdin.close() +process.wait(timeout=20) except subprocess.TimeoutExpired: -self.process.kill() -self.process.wait() -self.process = None +process.kill() +process.wait() +if process.returncode != 0: +raise DebugAdapterProcessError(process.returncode) + +class DebugAdapterError(Exception): pass + +class DebugAdapterProcessError(DebugAdapterError): +"""Raised when the lldb-dap process exits with a non-zero exit status. +""" + +def __init__(self, returncode): +self.returncode = returncode + +def __str__(self): +if self.returncode and self.returncode < 0: +try: +return f"lldb-dap died with {signal.Signals(-self.returncode).name}." +except ValueError: +return f"lldb-dap died with unknown signal {-self.returncode}." +else: +return f"lldb-dap returned non-zero exit status {self.returncode}." def attach_options_specified(options): if options.pid is not None: diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index 8642e317f9b3a..f6809c0cdcb60 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -176,9 +176,10 @@ def test_diagnositcs(self): f"target create --core {core}", context="repl" ) -output = self.get_important() +diag_message = self.collect_important(timeout_secs=self.timeoutval, pattern="minidump file") + self.assertIn( "warning: unable to retrieve process ID from minidump file", -output, +diag_message, "diagnostic found in important output", ) diff --git a/lldb/test/API/tools/lldb-dap/io/TestDAP_io.py b/lldb/test/API/tools/lldb-dap/io/TestDAP_io.py index f05f876e57b49..b72b98de412b4 100644 --- a/lldb/test/API/tools/lldb-dap/io/TestDAP_io.py +++ b/lldb/test/API/tools/lldb-dap/io/TestDAP_io.py @@ -22,13 +22,9 @@ def cleanup(): process.terminate() process.wait() stdout_data = process.stdout.read().decode() -stderr_data = process.stderr.read().decode() print("= STDOUT =", file=sys.stderr) print(stdout_data, file=sys.stderr) print("= END =", file=sys.stderr) -print("= STDERR =", file=sys.stderr) -print(stderr_data, file=sys.stderr) -print("= END =", file=sys.stderr) pri
[Lldb-commits] [lldb] [lldb-dap] Improving tests logging to understand CI failures. (PR #139311)
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/139311 To improve logging this adjusts two properties of the existing tests: * Forwards stderr from lldb-dap to the process in case errors are reported to stderr. * Adjusts `DebugAdapterServer.terminate` to close stdin and wait for the process to exit instead of sending SIGTERM. Additionally, if we end up with a non-zero exit status we now raise an error to note the unexpected exit status. With these changes, I did find one test case in `TestDAP_console.test_diagnositcs` that was not waiting to ensure the expected event had arrived by the time it performed an assert. >From abb7aad60e314fadb235e370f431112fa078e023 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Fri, 9 May 2025 11:58:35 -0700 Subject: [PATCH] [lldb-dap] Improving tests logging to understand CI failures. To improve logging this adjusts two properties of the existing tests: * Forwards stderr from lldb-dap to the process in case errors are reported to stderr. * Adjusts `DebugAdapterServer.terminate` to close stdin and wait for the process to exit instead of sending SIGTERM. Additionally, if we end up with a non-zero exit status we now raise an error to note the unexpected exit status. With these changes, I did find one test case in `TestDAP_console.test_diagnositcs` that was not waiting to ensure the expected event had arrived by the time it performed an assert. --- .../test/tools/lldb-dap/dap_server.py | 36 +++ .../tools/lldb-dap/console/TestDAP_console.py | 5 +-- lldb/test/API/tools/lldb-dap/io/TestDAP_io.py | 4 --- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e10342b72f4f0..292209f8ab042 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -8,6 +8,7 @@ import socket import string import subprocess +import signal import sys import threading import time @@ -1269,7 +1270,7 @@ def launch(cls, /, executable, env=None, log_file=None, connection=None): args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, -stderr=subprocess.PIPE, +stderr=sys.stderr, env=adapter_env, ) @@ -1302,14 +1303,37 @@ def get_pid(self): def terminate(self): super(DebugAdapterServer, self).terminate() if self.process is not None: -self.process.terminate() +process = self.process +self.process = None try: -self.process.wait(timeout=20) +# When we close stdin it should signal the lldb-dap that no +# new messages will arrive and it should shutdown on its own. +process.stdin.close() +process.wait(timeout=20) except subprocess.TimeoutExpired: -self.process.kill() -self.process.wait() -self.process = None +process.kill() +process.wait() +if process.returncode != 0: +raise DebugAdapterProcessError(process.returncode) + +class DebugAdapterError(Exception): pass + +class DebugAdapterProcessError(DebugAdapterError): +"""Raised when the lldb-dap process exits with a non-zero exit status. +""" + +def __init__(self, returncode): +self.returncode = returncode + +def __str__(self): +if self.returncode and self.returncode < 0: +try: +return f"lldb-dap died with {signal.Signals(-self.returncode).name}." +except ValueError: +return f"lldb-dap died with unknown signal {-self.returncode}." +else: +return f"lldb-dap returned non-zero exit status {self.returncode}." def attach_options_specified(options): if options.pid is not None: diff --git a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py index 8642e317f9b3a..f6809c0cdcb60 100644 --- a/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py +++ b/lldb/test/API/tools/lldb-dap/console/TestDAP_console.py @@ -176,9 +176,10 @@ def test_diagnositcs(self): f"target create --core {core}", context="repl" ) -output = self.get_important() +diag_message = self.collect_important(timeout_secs=self.timeoutval, pattern="minidump file") + self.assertIn( "warning: unable to retrieve process ID from minidump file", -output, +diag_message, "diagnostic found in important output", ) diff --git a/lldb/test/API/tools/lldb-dap/io/TestDAP_io.py b/lldb/test/API/tools/lldb-dap/io/TestDAP_io.py index f05f876e57b49..b72b98de412b4 100644 --- a/lldb
[Lldb-commits] [lldb] [lldb-dap] Improving tests logging to understand CI failures. (PR #139311)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/test/API/tools/lldb-dap/console/TestDAP_console.py lldb/test/API/tools/lldb-dap/io/TestDAP_io.py `` View the diff from darker here. ``diff --- packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2025-05-09 18:58:35.00 + +++ packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py 2025-05-09 19:01:13.215268 + @@ -1304,26 +1304,27 @@ super(DebugAdapterServer, self).terminate() if self.process is not None: process = self.process self.process = None try: -# When we close stdin it should signal the lldb-dap that no +# When we close stdin it should signal the lldb-dap that no # new messages will arrive and it should shutdown on its own. process.stdin.close() process.wait(timeout=20) except subprocess.TimeoutExpired: process.kill() process.wait() if process.returncode != 0: raise DebugAdapterProcessError(process.returncode) -class DebugAdapterError(Exception): pass +class DebugAdapterError(Exception): +pass + class DebugAdapterProcessError(DebugAdapterError): -"""Raised when the lldb-dap process exits with a non-zero exit status. -""" +"""Raised when the lldb-dap process exits with a non-zero exit status.""" def __init__(self, returncode): self.returncode = returncode def __str__(self): --- test/API/tools/lldb-dap/console/TestDAP_console.py 2025-05-09 18:58:35.00 + +++ test/API/tools/lldb-dap/console/TestDAP_console.py 2025-05-09 19:01:13.291647 + @@ -174,11 +174,13 @@ self.yaml2obj("minidump.yaml", core) self.dap_server.request_evaluate( f"target create --core {core}", context="repl" ) -diag_message = self.collect_important(timeout_secs=self.timeoutval, pattern="minidump file") +diag_message = self.collect_important( +timeout_secs=self.timeoutval, pattern="minidump file" +) self.assertIn( "warning: unable to retrieve process ID from minidump file", diag_message, "diagnostic found in important output", `` https://github.com/llvm/llvm-project/pull/139311 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fd8b84e - [lldb][test] Skip beginning/end of file tests on Windows
Author: David Spickett Date: 2025-05-09T10:31:17Z New Revision: fd8b84ea0fa1eb1da105257f419d926278dc0445 URL: https://github.com/llvm/llvm-project/commit/fd8b84ea0fa1eb1da105257f419d926278dc0445 DIFF: https://github.com/llvm/llvm-project/commit/fd8b84ea0fa1eb1da105257f419d926278dc0445.diff LOG: [lldb][test] Skip beginning/end of file tests on Windows Added in https://github.com/llvm/llvm-project/pull/137515, as the source uses unistd.h which isn't present there. | C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Commands/Inputs/sigchld.c:4:10: fatal error: 'unistd.h' file not found | 4 | #include | | ^~ | 1 error generated. Added: Modified: lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test lldb/test/Shell/Commands/command-list-reach-end-of-file.test Removed: diff --git a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test index 5ca1b5c2306a7..fa4a93e5904aa 100644 --- a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test +++ b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test @@ -1,3 +1,5 @@ +# Source uses unistd.h. +# UNSUPPORTED: system-windows # RUN: %clang_host -g -O0 %S/Inputs/sigchld.c -o %t.out # RUN: %lldb %t.out -b -s %s 2>&1 | FileCheck %s diff --git a/lldb/test/Shell/Commands/command-list-reach-end-of-file.test b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test index c5e9c8169e7d9..edf4c521a9e76 100644 --- a/lldb/test/Shell/Commands/command-list-reach-end-of-file.test +++ b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test @@ -1,3 +1,5 @@ +# Source uses unistd.h. +# UNSUPPORTED: system-windows # RUN: %clang_host -g -O0 %S/Inputs/sigchld.c -o %t.out # RUN: %lldb %t.out -b -s %s 2>&1 | FileCheck %s @@ -23,4 +25,4 @@ list # CHECK: note: Reached end of the file, no more to page list -# CHECK: note: Reached end of the file, no more to page \ No newline at end of file +# CHECK: note: Reached end of the file, no more to page ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/139324 On macOS, lldb-dap is sending module events with reason "removed" for modules that we never told the client about in the first place. This is because when we create a target with a binary, by default we load all of its dependent libraries too. When we start executing and see the that the binary and dyld are loaded, we throw away the image list and let dyld tell us about the correct binaries to load. This PR addresses the issue by keeping track which modules the DAP client knows about. Clients can find out about modules either through the modules request, or through module events. Only when we have told a client about a module, we send module changed or module removed events. This PR also reduces the amount of data sent for removed module events. The DAP specification [1] says that for removed module events, only the ID is used. It also makes the testing more robust. Fixes #139323 [1] https://microsoft.github.io/debug-adapter-protocol/specification#Events_Module Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py lldb/test/API/tools/lldb-dap/module/TestDAP_module.py `` View the diff from darker here. ``diff --- test/API/tools/lldb-dap/module-event/TestDAP_module_event.py 2025-05-09 20:26:39.00 + +++ test/API/tools/lldb-dap/module-event/TestDAP_module_event.py 2025-05-09 20:37:04.183047 + @@ -5,11 +5,10 @@ import lldbdap_testcase import re class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase): - def test_module_event(self): program = self.getBuildArtifact("a.out") self.build_and_launch(program, stopOnEntry=True) source = "main.cpp" `` https://github.com/llvm/llvm-project/pull/139324 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Avoid an assertion failure in dwim-print (PR #139197)
https://github.com/igorkudrin updated https://github.com/llvm/llvm-project/pull/139197 >From 3faf0c0a4a19d7e1d503c31a684d79295e414be4 Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Thu, 8 May 2025 18:37:34 -0700 Subject: [PATCH 1/2] [lldb][NFC] Avoid an assertion failure in dwim-print In a Debug build on Windows, printing inline diagnostics resulted in an error, for example: ``` > cd llvm-project\lldb\test\API\functionalities\postmortem\elf-core > lldb.exe -c altmain.core > p dummy LLDB diagnostics will be written to ... Please include the directory content when filing a bug report Exception Code: 0x8003 0x7FF8FD6633EC, C:\llvm\build\bin\liblldb.dll(0x7FF8FC2C) + 0x13A33EC byte(s), std::_Vector_const_iterator > >::_Compat() + 0x6C byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\vector, line 202 + 0x5D byte(s) 0x7FF8FD662ABE, C:\llvm\build\bin\liblldb.dll(0x7FF8FC2C) + 0x13A2ABE byte(s), std::_Vector_const_iterator > >::operator==() + 0x1E byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\vector, line 166 + 0x0 byte(s) 0x7FF8FD662B2E, C:\llvm\build\\bin\liblldb.dll(0x7FF8FC2C) + 0x13A2B2E byte(s), std::_Vector_const_iterator > >::operator!=() + 0x1E byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\vector, line 176 + 0xF byte(s) 0x7FF8FD65EE1C, C:\llvm\build\\bin\liblldb.dll(0x7FF8FC2C) + 0x139EE1C byte(s), std::operator!= > >,std::_Vector_iterator > > >() + 0x3C byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\xutility, line 1947 + 0x0 byte(s) 0x7FF8FD65D4E5, C:\llvm\build\\bin\liblldb.dll(0x7FF8FC2C) + 0x139D4E5 byte(s), lldb_private::RenderDiagnosticDetails() + 0x8F5 byte(s), C:\llvm\src\llvm-project\lldb\source\Utility\DiagnosticsRendering.cpp, line 189 + 0x25 byte(s) ... ``` The comparison operator of the iterators checks that they belong to the same container, but `remaining_details.pop_back()` invalidates `detail` making it incompatible with `remaining_details.rend()`. --- lldb/source/Utility/DiagnosticsRendering.cpp | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lldb/source/Utility/DiagnosticsRendering.cpp b/lldb/source/Utility/DiagnosticsRendering.cpp index 368e2199b749f..c43b39b6b8fe9 100644 --- a/lldb/source/Utility/DiagnosticsRendering.cpp +++ b/lldb/source/Utility/DiagnosticsRendering.cpp @@ -185,9 +185,8 @@ void RenderDiagnosticDetails(Stream &stream, // Work through each detail in reverse order using the vector/stack. bool did_print = false; - for (auto detail = remaining_details.rbegin(); - detail != remaining_details.rend(); - ++detail, remaining_details.pop_back()) { + for (; !remaining_details.empty(); remaining_details.pop_back()) { +auto &detail = remaining_details.back(); // Get the information to print this detail and remove it from the stack. // Print all the lines for all the other messages first. stream << std::string(padding, ' '); @@ -196,7 +195,7 @@ void RenderDiagnosticDetails(Stream &stream, llvm::ArrayRef(remaining_details).drop_back(1)) { uint16_t column = remaining_detail.source_location->column; // Is this a note with the same column as another diagnostic? - if (column == detail->source_location->column) + if (column == detail.source_location->column) continue; if (column >= x_pos) { @@ -205,16 +204,16 @@ void RenderDiagnosticDetails(Stream &stream, } } -uint16_t column = detail->source_location->column; +uint16_t column = detail.source_location->column; // Print the line connecting the ^ with the error message. if (column >= x_pos) stream << std::string(column - x_pos, ' ') << joint << hbar << spacer; // Print a colorized string based on the message's severity type. -PrintSeverity(stream, detail->severity); +PrintSeverity(stream, detail.severity); // Finally, print the message and start a new line. -stream << detail->message << '\n'; +stream << detail.message << '\n'; did_print = true; } >From 169c3401717ccff0d28c18318a9b433165076d4b Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Fri, 9 May 2025 13:36:20 -0700 Subject: [PATCH 2/2] Update lldb/source/Utility/DiagnosticsRendering.cpp Co-authored-by: Michael Buch --- lldb/source/Utility/DiagnosticsRendering.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Utility/DiagnosticsRendering.cpp b/lldb/source/Utility/DiagnosticsRendering.cpp index c43b39b6b8fe9..e73d688bb4be5 100644 --- a/lldb/source/Utility/DiagnosticsRendering.cpp +++ b/lldb/source/Utility/DiagnosticsRendering.cpp @@ -186,7 +186,7 @@ void RenderDiagnosticDetails(Stream &stream, // Work through each detail in re
[Lldb-commits] [lldb] [lldb-dap] Improving tests logging to understand CI failures. (PR #139311)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/139311 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][plugin] Clear in same thread as set (PR #139252)
https://github.com/jpienaar updated https://github.com/llvm/llvm-project/pull/139252 >From c5ffbd84f8b68bae2112e8cec68803cefe571a72 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Fri, 9 May 2025 05:23:00 -0700 Subject: [PATCH 1/2] [lldb][plugin] Clear in same thread as set Here we were initializing & locking a mutex in a thread, while releasing it in the parent which may/often turned out to be a different thread (shared_mutex::unlock_shared is undefined behavior if called from a thread that doesn't hold the lock). I'm not quite sure what the expectation is here as the variable is never used, so instead I've just reset in same thread as which it was set to ensure its freed in thread holding lock. --- lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index 523820874752a..0f0226ea9650c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -121,6 +121,7 @@ void ManualDWARFIndex::Index() { units_to_index.size()); for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) { clear_cu_dies[idx] = unit->ExtractDIEsScoped(); +ckear_cu_duex[idx].reset(); }); // Now index all DWARF unit in parallel. >From 5f5b8dc0deae4f63ddb83e0dfab96ab3a9e0cc80 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Fri, 9 May 2025 08:15:26 -0700 Subject: [PATCH 2/2] Fix typo --- lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index 0f0226ea9650c..6139d005b4f2e 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -121,7 +121,7 @@ void ManualDWARFIndex::Index() { units_to_index.size()); for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) { clear_cu_dies[idx] = unit->ExtractDIEsScoped(); -ckear_cu_duex[idx].reset(); +ckear_cu_dies[idx].reset(); }); // Now index all DWARF unit in parallel. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb]Make `list` command work with headers when possible. (PR #139002)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/139002 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][TypeSystemClang] Allow arrays to be dereferenced in C/C++. (PR #135843)
https://github.com/kuilpd updated https://github.com/llvm/llvm-project/pull/135843 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][TypeSystemClang] Allow arrays to be dereferenced in C/C++. (PR #135843)
@@ -2794,47 +2794,31 @@ ValueObjectSP ValueObject::Dereference(Status &error) { if (m_deref_valobj) return m_deref_valobj->GetSP(); - const bool is_pointer_or_reference_type = IsPointerOrReferenceType(); - if (is_pointer_or_reference_type) { -bool omit_empty_base_classes = true; -bool ignore_array_bounds = false; - -std::string child_name_str; -uint32_t child_byte_size = 0; -int32_t child_byte_offset = 0; -uint32_t child_bitfield_bit_size = 0; -uint32_t child_bitfield_bit_offset = 0; -bool child_is_base_class = false; -bool child_is_deref_of_parent = false; -const bool transparent_pointers = false; -CompilerType compiler_type = GetCompilerType(); -uint64_t language_flags = 0; + std::string child_name_str; + uint32_t child_byte_size = 0; kuilpd wrote: You're right, I didn't notice this. `GetDereferencedType` arguments should also start with `deref`. https://github.com/llvm/llvm-project/pull/135843 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Don't create instance of `SymbolFileDWARFDebugMap` for non-Mach-O files (PR #139170)
royitaqi wrote: @JDevlieghere I see your point (some learning questions below about the principle). However, I feel `ObjectFile::SupportsDebugMap()` is still closely tied to a specific plugin (not through compilation, but semantics). Imagine each plugin needs to add such a method into the `ObjectFile` class, then the class will be filled with plugin-specific methods like this, which I feel breaks the API scalability the plugin system wanted. Instead, maybe it's better if we frame "DebugMap" as an `ObjectFileCapability` enum. Other capabilities can be added, too, e.g. does the object file imply split dwarf, etc. Then the API will be `ObjectFile::GetSupportedCapabilities()`. WDYT? (Note: I am trying to think about how does this relate to the `CalculateAbilities()` function in those `SymbolFile` subclasses. I feel they are different, so it should be okay.) -- (my learning question about the principle of "Plugins shouldn't depend on each other") -- I guess I'm missing a lot of context here. From my limited and naive view, there *are* natural connections between different kinds of plugins because how they usually work together in existing systems. E.g. macOS usually use Mach-O files and can use either `SymbolFileDWARF` and `SymbolFileDWARFDebugMap`, but never split-DWARF (dwp/dwo). I don't understand the design principle of "Plugins shouldn't depend on each other". It feels like it's trying to ignore the natural connection between these plugins. I'm guessing we have that principle so as to avoid having to model a complex (and dynamic) dependency problem? (E.g. "A and B" and "B and C" should always work together, but "A and C" should never work together.) https://github.com/llvm/llvm-project/pull/139170 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
JDevlieghere wrote: Could we test this in `TestSimulatorPlatform.py`? https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb]Make `list` command work with headers when possible. (PR #139002)
@@ -0,0 +1,57 @@ +## Test that `list header.h:` works correctly when header is available. +## +# RUN: split-file %s %t + +# RUN: %clang_host -g %t/main_with_inlined.cc %t/foo.cc -o %t/main_with_inlined.out +# RUN: %clang_host -g %t/main_no_inlined.cc %t/foo.cc -o %t/main_no_inlined.out + +# RUN: %lldb %t/main_with_inlined.out -o "list foo.h:2" -o "exit" 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-INLINED + +## Would be nice if this listed the header too - but probably not something +## we want to support right now. +# RUN: echo quit | %lldb %t/main_no_inlined.out -o "list foo.h:2" -o "exit" 2>&1 \ +# RUN: | FileCheck %s --check-prefix=CHECK-NO-INLINED + +# CHECK-INLINED: 2 extern int* ptr; +# CHECK-INLINED: 3 void f(int x); +# CHECK-INLINED: 4 +# CHECK-INLINED: 5 inline void g(int x) { +# CHECK-INLINED: 6 *ptr = x; // should raise a SIGILL oontvoo wrote: the function shoud have something in its body (executable) so better demonstrate the test case. sure - can update the comment https://github.com/llvm/llvm-project/pull/139002 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix beginning/end of file test failed on Windows (PR #139278)
https://github.com/hapee created https://github.com/llvm/llvm-project/pull/139278 As @DavidSpickett mentioned, this change fixed the test failure introduced in [#137515](https://github.com/llvm/llvm-project/pull/137515#issuecomment-2866632780), which was caused by the use of platform-specific headers not available on Windows. This PR does not modify any functional code; it only updates the test cases. Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][test] Fix beginning/end of file test failed on Windows (PR #139278)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Zax (hapee) Changes As @DavidSpickett mentioned, this change fixed the test failure introduced in [#137515](https://github.com/llvm/llvm-project/pull/137515#issuecomment-2866632780), which was caused by the use of platform-specific headers not available on Windows. This PR does not modify any functional code; it only updates the test cases. --- Full diff: https://github.com/llvm/llvm-project/pull/139278.diff 3 Files Affected: - (added) lldb/test/Shell/Commands/Inputs/cross_platform.c (+31) - (modified) lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test (+5-7) - (modified) lldb/test/Shell/Commands/command-list-reach-end-of-file.test (+2-7) ``diff diff --git a/lldb/test/Shell/Commands/Inputs/cross_platform.c b/lldb/test/Shell/Commands/Inputs/cross_platform.c new file mode 100644 index 0..bcc484eb36ac5 --- /dev/null +++ b/lldb/test/Shell/Commands/Inputs/cross_platform.c @@ -0,0 +1,31 @@ +#include +void bubbleSort(int arr[], int n) { + for (int i = 0; i < n - 1; i++) { +int swapped = 0; +for (int j = 0; j < n - i - 1; j++) { + if (arr[j] > arr[j + 1]) { +int temp = arr[j]; +arr[j] = arr[j + 1]; +arr[j + 1] = temp; +swapped = 1; + } +} +if (!swapped) + break; + } +} + +int main() { + int arr[] = {64, 34, 25, 12, 22, 11, 90}; + int n = sizeof(arr) / sizeof(arr[0]); + + for (int i = 0; i < n; i++) +printf("%d ", arr[i]); + printf("\n"); + + bubbleSort(arr, n); + for (int i = 0; i < n; i++) +printf("%d ", arr[i]); + printf("\n"); + return 0; +} diff --git a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test index fa4a93e5904aa..29c33f6fe105e 100644 --- a/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test +++ b/lldb/test/Shell/Commands/command-list-reach-beginning-of-file.test @@ -1,6 +1,4 @@ -# Source uses unistd.h. -# UNSUPPORTED: system-windows -# RUN: %clang_host -g -O0 %S/Inputs/sigchld.c -o %t.out +# RUN: %clang_host -g -O0 %S/Inputs/cross_platform.c -o %t.out # RUN: %lldb %t.out -b -s %s 2>&1 | FileCheck %s list @@ -13,13 +11,13 @@ r # CHECK: int main() list -# CHECK: if (child_pid == 0) +# CHECK: bubbleSort(arr, n); list - # CHECK: int main() -list -10 -# CHECK: #include +list -20 +# CHECK: #include list - # CHECK: note: Reached beginning of the file, no more to page @@ -28,4 +26,4 @@ list - # CHECK: note: Reached beginning of the file, no more to page list -# CHECK: int main() +# CHECK: bubbleSort(arr, n); diff --git a/lldb/test/Shell/Commands/command-list-reach-end-of-file.test b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test index edf4c521a9e76..d6909b85a390b 100644 --- a/lldb/test/Shell/Commands/command-list-reach-end-of-file.test +++ b/lldb/test/Shell/Commands/command-list-reach-end-of-file.test @@ -1,6 +1,4 @@ -# Source uses unistd.h. -# UNSUPPORTED: system-windows -# RUN: %clang_host -g -O0 %S/Inputs/sigchld.c -o %t.out +# RUN: %clang_host -g -O0 %S/Inputs/cross_platform.c -o %t.out # RUN: %lldb %t.out -b -s %s 2>&1 | FileCheck %s list @@ -13,10 +11,7 @@ r # CHECK: int main() list -# CHECK: if (child_pid == 0) - -list -# CHECK: printf("signo = %d\n", SIGCHLD); +# CHECK: bubbleSort(arr, n); list # CHECK: return 0; `` https://github.com/llvm/llvm-project/pull/139278 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] d71b6cf - [lldb][NFC] Avoid an assertion failure in dwim-print (#139197)
Author: Igor Kudrin Date: 2025-05-09T13:46:35-07:00 New Revision: d71b6cf6a54cd0e39a70b039b489fab27274280a URL: https://github.com/llvm/llvm-project/commit/d71b6cf6a54cd0e39a70b039b489fab27274280a DIFF: https://github.com/llvm/llvm-project/commit/d71b6cf6a54cd0e39a70b039b489fab27274280a.diff LOG: [lldb][NFC] Avoid an assertion failure in dwim-print (#139197) With a debug build on Windows, printing inline diagnostics resulted in an error, for example: ``` > cd llvm-project\lldb\test\API\functionalities\postmortem\elf-core > lldb.exe -c altmain.core > p dummy LLDB diagnostics will be written to ... Please include the directory content when filing a bug report Exception Code: 0x8003 0x7FF8FD6633EC, C:\llvm\build\bin\liblldb.dll(0x7FF8FC2C) + 0x13A33EC byte(s), std::_Vector_const_iterator > >::_Compat() + 0x6C byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\vector, line 202 + 0x5D byte(s) 0x7FF8FD662ABE, C:\llvm\build\bin\liblldb.dll(0x7FF8FC2C) + 0x13A2ABE byte(s), std::_Vector_const_iterator > >::operator==() + 0x1E byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\vector, line 166 + 0x0 byte(s) 0x7FF8FD662B2E, C:\llvm\build\\bin\liblldb.dll(0x7FF8FC2C) + 0x13A2B2E byte(s), std::_Vector_const_iterator > >::operator!=() + 0x1E byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\vector, line 176 + 0xF byte(s) 0x7FF8FD65EE1C, C:\llvm\build\\bin\liblldb.dll(0x7FF8FC2C) + 0x139EE1C byte(s), std::operator!= > >,std::_Vector_iterator > > >() + 0x3C byte(s), C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Tools\MSVC\14.43.34808\include\xutility, line 1947 + 0x0 byte(s) 0x7FF8FD65D4E5, C:\llvm\build\\bin\liblldb.dll(0x7FF8FC2C) + 0x139D4E5 byte(s), lldb_private::RenderDiagnosticDetails() + 0x8F5 byte(s), C:\llvm\src\llvm-project\lldb\source\Utility\DiagnosticsRendering.cpp, line 189 + 0x25 byte(s) ... ``` The comparison operator of the iterators checks that they belong to the same container, but `remaining_details.pop_back()` invalidates `detail` making it incompatible with `remaining_details.rend()`. - Co-authored-by: Michael Buch Added: Modified: lldb/source/Utility/DiagnosticsRendering.cpp Removed: diff --git a/lldb/source/Utility/DiagnosticsRendering.cpp b/lldb/source/Utility/DiagnosticsRendering.cpp index 368e2199b749f..6f276a81fbc8e 100644 --- a/lldb/source/Utility/DiagnosticsRendering.cpp +++ b/lldb/source/Utility/DiagnosticsRendering.cpp @@ -185,9 +185,8 @@ void RenderDiagnosticDetails(Stream &stream, // Work through each detail in reverse order using the vector/stack. bool did_print = false; - for (auto detail = remaining_details.rbegin(); - detail != remaining_details.rend(); - ++detail, remaining_details.pop_back()) { + for (; !remaining_details.empty(); remaining_details.pop_back()) { +const auto &detail = remaining_details.back(); // Get the information to print this detail and remove it from the stack. // Print all the lines for all the other messages first. stream << std::string(padding, ' '); @@ -196,7 +195,7 @@ void RenderDiagnosticDetails(Stream &stream, llvm::ArrayRef(remaining_details).drop_back(1)) { uint16_t column = remaining_detail.source_location->column; // Is this a note with the same column as another diagnostic? - if (column == detail->source_location->column) + if (column == detail.source_location->column) continue; if (column >= x_pos) { @@ -205,16 +204,16 @@ void RenderDiagnosticDetails(Stream &stream, } } -uint16_t column = detail->source_location->column; +uint16_t column = detail.source_location->column; // Print the line connecting the ^ with the error message. if (column >= x_pos) stream << std::string(column - x_pos, ' ') << joint << hbar << spacer; // Print a colorized string based on the message's severity type. -PrintSeverity(stream, detail->severity); +PrintSeverity(stream, detail.severity); // Finally, print the message and start a new line. -stream << detail->message << '\n'; +stream << detail.message << '\n'; did_print = true; } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Avoid an assertion failure in dwim-print (PR #139197)
https://github.com/igorkudrin closed https://github.com/llvm/llvm-project/pull/139197 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/138031 >From ad185638b6369aea18848bcdbb38bd502d75ff71 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Wed, 30 Apr 2025 14:15:39 -0700 Subject: [PATCH] [lldb][RPC] Upstream lldb-rpc-gen tool This commit upstreams the `lldb-rpc-gen` tool, a ClangTool that generates the LLDB RPC client and server interfaces. https://discourse.llvm.org/t/rfc-upstreaming-lldb-rpc/85804 --- .../tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp | 546 ++ lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h | 107 .../lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp| 541 + 3 files changed, 1194 insertions(+) create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.h create mode 100644 lldb/tools/lldb-rpc/lldb-rpc-gen/lldb-rpc-gen.cpp diff --git a/lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp b/lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp new file mode 100644 index 0..07b65f99af84c --- /dev/null +++ b/lldb/tools/lldb-rpc/lldb-rpc-gen/RPCCommon.cpp @@ -0,0 +1,546 @@ +//===-- RPCCommon.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 "RPCCommon.h" + +#include "clang/AST/AST.h" +#include "clang/AST/Attr.h" +#include "clang/AST/DeclBase.h" +#include "clang/AST/Mangle.h" +#include "clang/Lex/Lexer.h" + +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/raw_ostream.h" + +using namespace clang; + +// We intentionally do not generate some classes because they are currently +// inconvenient, they aren't really used by most consumers, or we're not sure +// why they exist. +static constexpr llvm::StringRef DisallowedClasses[] = { +"SBCommunication", // What is this used for? +"SBInputReader",// What is this used for? +"SBCommandPluginInterface", // This is hard to support, we can do it if +// really needed though. +"SBCommand", // There's nothing too difficult about this one, but many of + // its methods take a SBCommandPluginInterface pointer so + // there's no reason to support this. +}; + +// We intentionally avoid generating certain methods either because they are +// difficult to support correctly or they aren't really used much from C++. +// NOTE: These methods are marked as deprecated using LLDB_DEPRECATED. +// Normally this macro defines to the deprecated annotation, but this +// functionality is removed in SBDefines.h when generating SWIG bindings which +// we use for testing. Because of this, there is no annotation for the tool to +// pick up on so this list will be used while we have this restriction in +// SBDefines.h. +static constexpr llvm::StringRef DisallowedMethods[] = { +// The threading functionality in SBHostOS is deprecated and thus we do not +// generate them. It would be ideal to add the annotations to the methods +// and then support not generating deprecated methods. However, without +// annotations the generator generates most things correctly. This one is +// problematic because it returns a pointer to an "opaque" structure +// (thread_t) that is not `void *`, so special casing it is more effort than +// it's worth. +"_ZN4lldb8SBHostOS10ThreadJoinEP17_opaque_pthread_tPPvPNS_7SBErrorE", +"_ZN4lldb8SBHostOS12ThreadCancelEP17_opaque_pthread_tPNS_7SBErrorE", +"_ZN4lldb8SBHostOS12ThreadCreateEPKcPFPvS3_ES3_PNS_7SBErrorE", +"_ZN4lldb8SBHostOS12ThreadDetachEP17_opaque_pthread_tPNS_7SBErrorE", +"_ZN4lldb8SBHostOS13ThreadCreatedEPKc", +}; + +static constexpr llvm::StringRef ClassesWithoutDefaultCtor[] = { +"SBHostOS", +"SBReproducer", +}; + +static constexpr llvm::StringRef ClassesWithoutCopyOperations[] = { +"SBHostOS", +"SBReproducer", +"SBStream", +"SBProgress", +}; + +static constexpr llvm::StringRef MethodsWithPointerPlusLen[] = { +"_ZN4lldb6SBData11ReadRawDataERNS_7SBErrorEyPvm", +"_ZN4lldb6SBData7SetDataERNS_7SBErrorEPKvmNS_9ByteOrderEh", +"_ZN4lldb6SBData20SetDataWithOwnershipERNS_7SBErrorEPKvmNS_9ByteOrderEh", +"_ZN4lldb6SBData25CreateDataFromUInt64ArrayENS_9ByteOrderEjPym", +"_ZN4lldb6SBData25CreateDataFromUInt32ArrayENS_9ByteOrderEjPjm", +"_ZN4lldb6SBData25CreateDataFromSInt64ArrayENS_9ByteOrderEjPxm", +"_ZN4lldb6SBData25CreateDataFromSInt32ArrayENS_9ByteOrderEjPim", +"_ZN4lldb6SBData25CreateDataFromDoubleArrayENS_9ByteOrderEjPdm", +"_ZN4lldb6SBData22SetDataFromUInt64ArrayEPym", +"
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes On macOS, lldb-dap is sending module events with reason "removed" for modules that we never told the client about in the first place. This is because when we create a target with a binary, by default we load all of its dependent libraries too. When we start executing and see the that the binary and dyld are loaded, we throw away the image list and let dyld tell us about the correct binaries to load. This PR addresses the issue by keeping track which modules the DAP client knows about. Clients can find out about modules either through the modules request, or through module events. Only when we have told a client about a module, we send module changed or module removed events. This PR also reduces the amount of data sent for removed module events. The DAP specification [1] says that for removed module events, only the ID is used. It also makes the testing more robust. Fixes #139323 [1] https://microsoft.github.io/debug-adapter-protocol/specification#Events_Module --- Full diff: https://github.com/llvm/llvm-project/pull/139324.diff 11 Files Affected: - (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py (-6) - (added) lldb/test/API/tools/lldb-dap/module-event/Makefile (+12) - (added) lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py (+55) - (added) lldb/test/API/tools/lldb-dap/module-event/main.cpp (+22) - (added) lldb/test/API/tools/lldb-dap/module-event/other.c (+5) - (modified) lldb/test/API/tools/lldb-dap/module/TestDAP_module.py (+6-4) - (modified) lldb/tools/lldb-dap/DAP.cpp (+27-12) - (modified) lldb/tools/lldb-dap/DAP.h (+8) - (modified) lldb/tools/lldb-dap/Handler/ModulesRequestHandler.cpp (+14-3) - (modified) lldb/tools/lldb-dap/JSONUtils.cpp (+6-1) - (modified) lldb/tools/lldb-dap/JSONUtils.h (+6-1) ``diff diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e10342b72f4f0..c974866306d2a 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -134,7 +134,6 @@ def __init__(self, recv, send, init_commands, log_file=None): self.thread_stop_reasons = {} self.progress_events = [] self.reverse_requests = [] -self.module_events = [] self.sequence = 1 self.threads = None self.recv_thread.start() @@ -248,11 +247,6 @@ def handle_recv_packet(self, packet): # and 'progressEnd' events. Keep these around in case test # cases want to verify them. self.progress_events.append(packet) -elif event == "module": -# Module events indicate that some information about a module has changed. -self.module_events.append(packet) -# no need to add 'module' event packets to our packets list -return keepGoing elif packet_type == "response": if packet["command"] == "disconnect": diff --git a/lldb/test/API/tools/lldb-dap/module-event/Makefile b/lldb/test/API/tools/lldb-dap/module-event/Makefile new file mode 100644 index 0..99d79b8053878 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/module-event/Makefile @@ -0,0 +1,12 @@ +CXX_SOURCES := main.cpp +LD_EXTRAS := -Wl,-rpath "-Wl,$(shell pwd)" +USE_LIBDL :=1 + +a.out: libother + +include Makefile.rules + +# The following shared library will be used to test breakpoints under dynamic loading +libother: other.c + "$(MAKE)" -f $(MAKEFILE_RULES) \ + DYLIB_ONLY=YES DYLIB_C_SOURCES=other.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py new file mode 100644 index 0..819640e5598bd --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py @@ -0,0 +1,55 @@ +import dap_server +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +import lldbdap_testcase +import re + + +class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase): + +def test_module_event(self): +program = self.getBuildArtifact("a.out") +self.build_and_launch(program, stopOnEntry=True) + +source = "main.cpp" +breakpoint1_line = line_number(source, "// breakpoint 1") +breakpoint2_line = line_number(source, "// breakpoint 2") +breakpoint3_line = line_number(source, "// breakpoint 3") + +breakpoint_ids = self.set_source_breakpoints( +source, [breakpoint1_line, breakpoint2_line, breakpoint3_line] +) +self.continue_to_breakpoints(breakpoint_ids) + +# We're now stopped at breakpoint 1 before the dlopen. Flush a
[Lldb-commits] [lldb] Support stepping through Darwin "branch islands" (PR #139301)
jimingham wrote: No, this change wasn't sufficient. There's something in the symbol table emitted on the tools on the builder that causes lldb to miscalculate the extent of the "spacing" such that its range encompasses the branch island symbols. That's why when we stop at the branch island, the stop address is attributed to the padding symbol that's at the beginning of the section and not the islands that the linker inserted at the end of this space. https://github.com/llvm/llvm-project/pull/139301 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix FindProcessImpl() for iOS simulators (PR #139174)
JDevlieghere wrote: > > Could we test this in `TestSimulatorPlatform.py`? > > @JDevlieghere Thanks for pointer. It seems the tests in that file are all > **skipped** because of this bug number: `rdar://76995109`. > > E.g. > > ``` > UNSUPPORTED: LLDB (/Users/royshi/public_llvm/build/bin/clang-arm64) :: > test_ios (TestSimulatorPlatform.TestSimulatorPlatformLaunching) (skipping > unconditionally [rdar://76995109]) > ``` > > Did a bit internet search and couldn't find how to find more info about this > bug or why these tests are all skipped. Not sure if I should un-skip them. Ha, that's my radar, and it's no longer relevant. I bisected an issue with the test suite to that particular test, but the last comment says that it wasn't the culprit after all, so there's no reason it should still be disabled. https://github.com/llvm/llvm-project/pull/139174 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][core] Fix getting summary of a variable pointing to r/o memory (PR #139196)
@@ -735,14 +735,25 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, case eAddressTypeLoad: { ExecutionContext exe_ctx(GetExecutionContextRef()); Process *process = exe_ctx.GetProcessPtr(); - if (process) { + if (process && process->IsLiveDebugSession()) { heap_buf_ptr->SetByteSize(bytes); size_t bytes_read = process->ReadMemory( addr + offset, heap_buf_ptr->GetBytes(), bytes, error); if (error.Success() || bytes_read > 0) { data.SetData(data_sp); return bytes_read; } + } else if (Target *target = exe_ctx.GetTargetPtr()) { +Address target_addr; +target_addr.SetLoadAddress(addr + offset, target); +heap_buf_ptr->SetByteSize(bytes); +size_t bytes_read = +target->ReadMemory(target_addr, heap_buf_ptr->GetBytes(), bytes, + error, /*force_live_memory=*/true); igorkudrin wrote: The difference is that with `force_live_memory==true`, `Target::ReadMemory()` tries to get the data from the process first, and resorts to reading from the file cache if that fails. With `force_live_memory==false` and if the data is in a read-only section, it reads from the file cache into a temporary buffer, and then calls `Process::ReadMemory()` anyway. So, with either setting, it prefers the data from the process, but `force_live_memory==true` seems to be just a bit more efficient. https://github.com/llvm/llvm-project/pull/139196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Minor visual changes to the modules UI (PR #139328)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/139328 Small assortment of changes to the modules UI after trying it out: - Print the load address as hexadecimal. - Remove spurious space before colon. - Drop "Module" prefix from tooltip title. - Capitalize bold list items. https://github.com/user-attachments/assets/5f902dae-87f2-4716-92f4-27e9dd3f6b37"; /> Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][TypeSystemClang] Allow arrays to be dereferenced in C/C++. (PR #135843)
https://github.com/jimingham approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/135843 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Minor visual changes to the modules UI (PR #139328)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes Small assortment of changes to the modules UI after trying it out: - Print the load address as hexadecimal. - Remove spurious space before colon. - Drop "Module" prefix from tooltip title. - Capitalize bold list items.--- Full diff: https://github.com/llvm/llvm-project/pull/139328.diff 1 Files Affected: - (modified) lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts (+9-7) ``diff diff --git a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts index 5af3d52e9870c..07b89b267b536 100644 --- a/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts +++ b/lldb/tools/lldb-dap/src-ts/ui/modules-data-provider.ts @@ -25,23 +25,25 @@ export class ModulesDataProvider } const tooltip = new vscode.MarkdownString(); -tooltip.appendMarkdown(`# Module '${module.name}'\n\n`); -tooltip.appendMarkdown(`- **id** : ${module.id}\n`); +tooltip.appendMarkdown(`# ${module.name}\n\n`); +tooltip.appendMarkdown(`- **ID** : ${module.id}\n`); if (module.addressRange) { - tooltip.appendMarkdown(`- **load address** : ${module.addressRange}\n`); + tooltip.appendMarkdown( +`- **Load address**: 0x${Number(module.addressRange).toString(16)}\n`, + ); } if (module.path) { - tooltip.appendMarkdown(`- **path** : ${module.path}\n`); + tooltip.appendMarkdown(`- **Path**: ${module.path}\n`); } if (module.version) { - tooltip.appendMarkdown(`- **version** : ${module.version}\n`); + tooltip.appendMarkdown(`- **Version**: ${module.version}\n`); } if (module.symbolStatus) { - tooltip.appendMarkdown(`- **symbol status** : ${module.symbolStatus}\n`); + tooltip.appendMarkdown(`- **Symbol status**: ${module.symbolStatus}\n`); } if (module.symbolFilePath) { tooltip.appendMarkdown( -`- **symbol file path** : ${module.symbolFilePath}\n`, +`- **Symbol file path**: ${module.symbolFilePath}\n`, ); } `` https://github.com/llvm/llvm-project/pull/139328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][core] Fix getting summary of a variable pointing to r/o memory (PR #139196)
@@ -735,14 +735,25 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, case eAddressTypeLoad: { ExecutionContext exe_ctx(GetExecutionContextRef()); Process *process = exe_ctx.GetProcessPtr(); - if (process) { + if (process && process->IsLiveDebugSession()) { heap_buf_ptr->SetByteSize(bytes); size_t bytes_read = process->ReadMemory( addr + offset, heap_buf_ptr->GetBytes(), bytes, error); if (error.Success() || bytes_read > 0) { data.SetData(data_sp); return bytes_read; } + } else if (Target *target = exe_ctx.GetTargetPtr()) { +Address target_addr; +target_addr.SetLoadAddress(addr + offset, target); +heap_buf_ptr->SetByteSize(bytes); +size_t bytes_read = +target->ReadMemory(target_addr, heap_buf_ptr->GetBytes(), bytes, + error, /*force_live_memory=*/true); +if (error.Success() || bytes_read > 0) { + data.SetData(data_sp); + return bytes_read; +} igorkudrin wrote: I think it can still be factored out, even without the `else` branch. The only difference will be that `data` will be updated if we don't have a target, and that seems negligible. Thanks for the idea. https://github.com/llvm/llvm-project/pull/139196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in bytes (PR #138169)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/138169 >From ef04502d17c36044cd5fb96f333c328c8215f354 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Thu, 1 May 2025 10:11:10 -0700 Subject: [PATCH 1/6] Add new API to expose the expected size in bytes of a core before generation --- lldb/include/lldb/API/SBSaveCoreOptions.h | 13 lldb/include/lldb/Symbol/SaveCoreOptions.h| 2 ++ lldb/source/API/SBSaveCoreOptions.cpp | 5 + lldb/source/Symbol/SaveCoreOptions.cpp| 18 .../TestSBSaveCoreOptions.py | 21 +++ .../sbsavecoreoptions/basic_minidump.yaml | 5 + 6 files changed, 64 insertions(+) diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h b/lldb/include/lldb/API/SBSaveCoreOptions.h index c6d2ab6099b3c..4c051353a714e 100644 --- a/lldb/include/lldb/API/SBSaveCoreOptions.h +++ b/lldb/include/lldb/API/SBSaveCoreOptions.h @@ -119,6 +119,19 @@ class LLDB_API SBSaveCoreOptions { /// an empty collection will be returned. SBThreadCollection GetThreadsToSave() const; + /// Get the current total number of bytes the core is expected to be but not + /// including the overhead of the core file format. Requires a Process and + /// Style to be specified. + /// + /// \note + /// This can cause some modification of the underlying data store + /// as regions with no permissions, or invalid permissions will be removed + /// and stacks will be minified up to their stack pointer + the redzone. + /// + /// \returns + /// The expected size of the data contained in the core in bytes. + uint64_t GetCurrentSizeInBytes(SBError &error); + /// Reset all options. void Clear(); diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h b/lldb/include/lldb/Symbol/SaveCoreOptions.h index bcf0087fbea5c..319d44a6b0c87 100644 --- a/lldb/include/lldb/Symbol/SaveCoreOptions.h +++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h @@ -49,6 +49,8 @@ class SaveCoreOptions { lldb_private::ThreadCollection::collection GetThreadsToSave() const; + uint64_t GetCurrentSizeInBytes(Status &error); + void Clear(); private: diff --git a/lldb/source/API/SBSaveCoreOptions.cpp b/lldb/source/API/SBSaveCoreOptions.cpp index 35b9da569dfa1..b67df513fe91b 100644 --- a/lldb/source/API/SBSaveCoreOptions.cpp +++ b/lldb/source/API/SBSaveCoreOptions.cpp @@ -114,6 +114,11 @@ void SBSaveCoreOptions::Clear() { m_opaque_up->Clear(); } +uint64_t SBSaveCoreOptions::GetCurrentSizeInBytes(SBError &error) { + LLDB_INSTRUMENT_VA(this, error); + return m_opaque_up->GetCurrentSizeInBytes(error.ref()); +} + lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const { return *m_opaque_up.get(); } diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp b/lldb/source/Symbol/SaveCoreOptions.cpp index c9f6efeb25d22..1da3e1cc9f834 100644 --- a/lldb/source/Symbol/SaveCoreOptions.cpp +++ b/lldb/source/Symbol/SaveCoreOptions.cpp @@ -145,6 +145,24 @@ SaveCoreOptions::GetThreadsToSave() const { return thread_collection; } +uint64_t SaveCoreOptions::GetCurrentSizeInBytes(Status &error) { + if (!m_process_sp) { +error = Status::FromErrorString("Requires a process to be set."); +return 0; + } + + CoreFileMemoryRanges ranges; + error = m_process_sp->CalculateCoreFileSaveRanges(*this, ranges); + if (error.Fail()) +return 0; + + uint64_t total_in_bytes = 0; + for (auto& core_range : ranges) +total_in_bytes += core_range.data.range.size(); + + return total_in_bytes; +} + void SaveCoreOptions::ClearProcessSpecificData() { // Deliberately not following the formatter style here to indicate that // this method will be expanded in the future. diff --git a/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py b/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py index ace84e8497a59..215f8440cc68a 100644 --- a/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py +++ b/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py @@ -104,3 +104,24 @@ def test_removing_and_adding_insertion_order(self): thread_collection = options.GetThreadsToSave() self.assertEqual(thread_collection.GetSize(), 3) self.assertIn(middle_thread, thread_collection) + +def test_get_total_in_bytes(self): +""" +Tests that get total in bytes properly returns an error without a process, +and the readable regions with a process. +""" + +options = lldb.SBSaveCoreOptions() +options.SetStyle(lldb.eSaveCoreCustomOnly) +process = self.get_basic_process() +memory_range = lldb.SBMemoryRegionInfo() +process.GetMemoryRegionInfo(0x7FFF12A84030, memory_range) +options.AddMemoryRegionToSave(memory_range) +error = lldb.SBError() +total = options.GetCurrentSizeInBytes(error) +self.assertTrue(error.Fail(), error.GetCString()) +
[Lldb-commits] [lldb] 8630c22 - [lldb-dap] migrate set breakpoint requests (#137448)
Author: Ely Ronnen Date: 2025-05-10T00:05:59+02:00 New Revision: 8630c22083e3ebab5955c0c46caa89b59f283fdb URL: https://github.com/llvm/llvm-project/commit/8630c22083e3ebab5955c0c46caa89b59f283fdb DIFF: https://github.com/llvm/llvm-project/commit/8630c22083e3ebab5955c0c46caa89b59f283fdb.diff LOG: [lldb-dap] migrate set breakpoint requests (#137448) - Migrate set breakpoint requests to use typed RequestHandler - `SetBreakpointsRequestHandler` - `SetDataBreakpointsRequestHandler` - `SetFunctionBreakpointsRequestHandler` - `SetInstructionBreakpointsRequestHandler` - `DataBreakpointInfoRequestHandler` - Decouple JSON from lldb-dap `Breakpoint` classes Added: Modified: lldb/tools/lldb-dap/Breakpoint.cpp lldb/tools/lldb-dap/Breakpoint.h lldb/tools/lldb-dap/BreakpointBase.cpp lldb/tools/lldb-dap/BreakpointBase.h lldb/tools/lldb-dap/DAP.cpp lldb/tools/lldb-dap/DAP.h lldb/tools/lldb-dap/FunctionBreakpoint.cpp lldb/tools/lldb-dap/FunctionBreakpoint.h lldb/tools/lldb-dap/Handler/DataBreakpointInfoRequestHandler.cpp lldb/tools/lldb-dap/Handler/RequestHandler.h lldb/tools/lldb-dap/Handler/SetBreakpointsRequestHandler.cpp lldb/tools/lldb-dap/Handler/SetDataBreakpointsRequestHandler.cpp lldb/tools/lldb-dap/Handler/SetFunctionBreakpointsRequestHandler.cpp lldb/tools/lldb-dap/Handler/SetInstructionBreakpointsRequestHandler.cpp lldb/tools/lldb-dap/Handler/TestGetTargetBreakpointsRequestHandler.cpp lldb/tools/lldb-dap/InstructionBreakpoint.cpp lldb/tools/lldb-dap/InstructionBreakpoint.h lldb/tools/lldb-dap/JSONUtils.cpp lldb/tools/lldb-dap/JSONUtils.h lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp lldb/tools/lldb-dap/Protocol/ProtocolRequests.h lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp lldb/tools/lldb-dap/Protocol/ProtocolTypes.h lldb/tools/lldb-dap/SourceBreakpoint.cpp lldb/tools/lldb-dap/SourceBreakpoint.h lldb/tools/lldb-dap/Watchpoint.cpp lldb/tools/lldb-dap/Watchpoint.h llvm/include/llvm/Support/JSON.h Removed: diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp b/lldb/tools/lldb-dap/Breakpoint.cpp index 5679fd545d53f..26d633d1d172e 100644 --- a/lldb/tools/lldb-dap/Breakpoint.cpp +++ b/lldb/tools/lldb-dap/Breakpoint.cpp @@ -14,7 +14,6 @@ #include "lldb/API/SBLineEntry.h" #include "lldb/API/SBMutex.h" #include "llvm/ADT/StringExtras.h" -#include "llvm/Support/JSON.h" #include #include #include @@ -30,13 +29,16 @@ void Breakpoint::SetHitCondition() { m_bp.SetIgnoreCount(hitCount - 1); } -void Breakpoint::CreateJsonObject(llvm::json::Object &object) { +protocol::Breakpoint Breakpoint::ToProtocolBreakpoint() { + protocol::Breakpoint breakpoint; + // Each breakpoint location is treated as a separate breakpoint for VS code. // They don't have the notion of a single breakpoint with multiple locations. if (!m_bp.IsValid()) -return; - object.try_emplace("verified", m_bp.GetNumResolvedLocations() > 0); - object.try_emplace("id", m_bp.GetID()); +return breakpoint; + + breakpoint.verified = m_bp.GetNumResolvedLocations() > 0; + breakpoint.id = m_bp.GetID(); // VS Code DAP doesn't currently allow one breakpoint to have multiple // locations so we just report the first one. If we report all locations // then the IDE starts showing the wrong line numbers and locations for @@ -60,16 +62,18 @@ void Breakpoint::CreateJsonObject(llvm::json::Object &object) { if (bp_addr.IsValid()) { std::string formatted_addr = "0x" + llvm::utohexstr(bp_addr.GetLoadAddress(m_bp.GetTarget())); -object.try_emplace("instructionReference", formatted_addr); +breakpoint.instructionReference = formatted_addr; auto line_entry = bp_addr.GetLineEntry(); const auto line = line_entry.GetLine(); if (line != UINT32_MAX) - object.try_emplace("line", line); + breakpoint.line = line; const auto column = line_entry.GetColumn(); if (column != 0) - object.try_emplace("column", column); -object.try_emplace("source", CreateSource(line_entry)); + breakpoint.column = column; +breakpoint.source = CreateSource(line_entry); } + + return breakpoint; } bool Breakpoint::MatchesName(const char *name) { diff --git a/lldb/tools/lldb-dap/Breakpoint.h b/lldb/tools/lldb-dap/Breakpoint.h index 580017125af44..c4f1fa291f181 100644 --- a/lldb/tools/lldb-dap/Breakpoint.h +++ b/lldb/tools/lldb-dap/Breakpoint.h @@ -17,14 +17,16 @@ namespace lldb_dap { class Breakpoint : public BreakpointBase { public: - Breakpoint(DAP &d, const llvm::json::Object &obj) : BreakpointBase(d, obj) {} + Breakpoint(DAP &d, const std::optional &condition, + const std::optional &hit_condition) + : BreakpointBase(d, condition, hit_condition) {} Breakpoint(DAP &d, lldb::SBBreakpoint bp) : BreakpointBase(d), m_bp(bp) {} lldb::break
[Lldb-commits] [lldb] [LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in bytes (PR #138169)
Jlalond wrote: @dmpots Thanks for the feedback, I implemented several more test cases, and fixed those typos. https://github.com/llvm/llvm-project/pull/138169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [lldb-dap] migrate set breakpoint requests (PR #137448)
https://github.com/eronnen closed https://github.com/llvm/llvm-project/pull/137448 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in bytes (PR #138169)
https://github.com/dmpots approved this pull request. LGTM. https://github.com/llvm/llvm-project/pull/138169 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][SBSaveCoreOptions] Add new API to expose the expected core size in bytes (PR #138169)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/138169 >From ef04502d17c36044cd5fb96f333c328c8215f354 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Thu, 1 May 2025 10:11:10 -0700 Subject: [PATCH 1/7] Add new API to expose the expected size in bytes of a core before generation --- lldb/include/lldb/API/SBSaveCoreOptions.h | 13 lldb/include/lldb/Symbol/SaveCoreOptions.h| 2 ++ lldb/source/API/SBSaveCoreOptions.cpp | 5 + lldb/source/Symbol/SaveCoreOptions.cpp| 18 .../TestSBSaveCoreOptions.py | 21 +++ .../sbsavecoreoptions/basic_minidump.yaml | 5 + 6 files changed, 64 insertions(+) diff --git a/lldb/include/lldb/API/SBSaveCoreOptions.h b/lldb/include/lldb/API/SBSaveCoreOptions.h index c6d2ab6099b3c..4c051353a714e 100644 --- a/lldb/include/lldb/API/SBSaveCoreOptions.h +++ b/lldb/include/lldb/API/SBSaveCoreOptions.h @@ -119,6 +119,19 @@ class LLDB_API SBSaveCoreOptions { /// an empty collection will be returned. SBThreadCollection GetThreadsToSave() const; + /// Get the current total number of bytes the core is expected to be but not + /// including the overhead of the core file format. Requires a Process and + /// Style to be specified. + /// + /// \note + /// This can cause some modification of the underlying data store + /// as regions with no permissions, or invalid permissions will be removed + /// and stacks will be minified up to their stack pointer + the redzone. + /// + /// \returns + /// The expected size of the data contained in the core in bytes. + uint64_t GetCurrentSizeInBytes(SBError &error); + /// Reset all options. void Clear(); diff --git a/lldb/include/lldb/Symbol/SaveCoreOptions.h b/lldb/include/lldb/Symbol/SaveCoreOptions.h index bcf0087fbea5c..319d44a6b0c87 100644 --- a/lldb/include/lldb/Symbol/SaveCoreOptions.h +++ b/lldb/include/lldb/Symbol/SaveCoreOptions.h @@ -49,6 +49,8 @@ class SaveCoreOptions { lldb_private::ThreadCollection::collection GetThreadsToSave() const; + uint64_t GetCurrentSizeInBytes(Status &error); + void Clear(); private: diff --git a/lldb/source/API/SBSaveCoreOptions.cpp b/lldb/source/API/SBSaveCoreOptions.cpp index 35b9da569dfa1..b67df513fe91b 100644 --- a/lldb/source/API/SBSaveCoreOptions.cpp +++ b/lldb/source/API/SBSaveCoreOptions.cpp @@ -114,6 +114,11 @@ void SBSaveCoreOptions::Clear() { m_opaque_up->Clear(); } +uint64_t SBSaveCoreOptions::GetCurrentSizeInBytes(SBError &error) { + LLDB_INSTRUMENT_VA(this, error); + return m_opaque_up->GetCurrentSizeInBytes(error.ref()); +} + lldb_private::SaveCoreOptions &SBSaveCoreOptions::ref() const { return *m_opaque_up.get(); } diff --git a/lldb/source/Symbol/SaveCoreOptions.cpp b/lldb/source/Symbol/SaveCoreOptions.cpp index c9f6efeb25d22..1da3e1cc9f834 100644 --- a/lldb/source/Symbol/SaveCoreOptions.cpp +++ b/lldb/source/Symbol/SaveCoreOptions.cpp @@ -145,6 +145,24 @@ SaveCoreOptions::GetThreadsToSave() const { return thread_collection; } +uint64_t SaveCoreOptions::GetCurrentSizeInBytes(Status &error) { + if (!m_process_sp) { +error = Status::FromErrorString("Requires a process to be set."); +return 0; + } + + CoreFileMemoryRanges ranges; + error = m_process_sp->CalculateCoreFileSaveRanges(*this, ranges); + if (error.Fail()) +return 0; + + uint64_t total_in_bytes = 0; + for (auto& core_range : ranges) +total_in_bytes += core_range.data.range.size(); + + return total_in_bytes; +} + void SaveCoreOptions::ClearProcessSpecificData() { // Deliberately not following the formatter style here to indicate that // this method will be expanded in the future. diff --git a/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py b/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py index ace84e8497a59..215f8440cc68a 100644 --- a/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py +++ b/lldb/test/API/python_api/sbsavecoreoptions/TestSBSaveCoreOptions.py @@ -104,3 +104,24 @@ def test_removing_and_adding_insertion_order(self): thread_collection = options.GetThreadsToSave() self.assertEqual(thread_collection.GetSize(), 3) self.assertIn(middle_thread, thread_collection) + +def test_get_total_in_bytes(self): +""" +Tests that get total in bytes properly returns an error without a process, +and the readable regions with a process. +""" + +options = lldb.SBSaveCoreOptions() +options.SetStyle(lldb.eSaveCoreCustomOnly) +process = self.get_basic_process() +memory_range = lldb.SBMemoryRegionInfo() +process.GetMemoryRegionInfo(0x7FFF12A84030, memory_range) +options.AddMemoryRegionToSave(memory_range) +error = lldb.SBError() +total = options.GetCurrentSizeInBytes(error) +self.assertTrue(error.Fail(), error.GetCString()) +
[Lldb-commits] [lldb] [lldb][plugin] Clear in same thread as set (PR #139252)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jacques Pienaar (jpienaar) Changes Here we were initializing & locking a shared_mutex in a thread, while releasing it in the parent which may/often turned out to be a different thread (shared_mutex::unlock_shared is undefined behavior if called from a thread that doesn't hold the lock). I'm not quite sure what the expectation is here as the variable is never used, so instead I've just reset in same thread as which it was set to ensure its freed in thread holding lock. --- Full diff: https://github.com/llvm/llvm-project/pull/139252.diff 1 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp (+1) ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index 523820874752a..0f0226ea9650c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -121,6 +121,7 @@ void ManualDWARFIndex::Index() { units_to_index.size()); for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) { clear_cu_dies[idx] = unit->ExtractDIEsScoped(); +ckear_cu_duex[idx].reset(); }); // Now index all DWARF unit in parallel. `` https://github.com/llvm/llvm-project/pull/139252 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] print a notice when `source list` paging reaches the end of th… (PR #137515)
hapee wrote: > I've > [skipped](https://github.com/llvm/llvm-project/commit/fd8b84ea0fa1eb1da105257f419d926278dc0445) > the new tests on Windows because we don't have the headers the sigchld > example uses.我跳过了 Windows 上的新测试,因为我们没有 sigchld 示例使用的头文件。 > > (no notification of the failure was sent because we were already failing some > lldb-dap tests)(没有发送失败通知,因为我们已经有一些 lldb-dap 测试失败了) The new tests are only applied to the command line, and they should be cross-platform. Maybe I should choose a more general source code for testing? https://github.com/llvm/llvm-project/pull/137515 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] c64c64d - [lldb][lldb-dap] Disable more tests on Windows (#139251)
Author: David Spickett Date: 2025-05-09T13:19:13+01:00 New Revision: c64c64db7b4b30dc5c5fad3b854f567254d1a615 URL: https://github.com/llvm/llvm-project/commit/c64c64db7b4b30dc5c5fad3b854f567254d1a615 DIFF: https://github.com/llvm/llvm-project/commit/c64c64db7b4b30dc5c5fad3b854f567254d1a615.diff LOG: [lldb][lldb-dap] Disable more tests on Windows (#139251) These are currently failing on Windows on Arm: https://lab.llvm.org/buildbot/#/builders/141/builds/8556 ``` Unresolved Tests (1): lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py Failed Tests (1): lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py ``` Added: Modified: lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py Removed: diff --git a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py index ea43fccf016a7..74062f3ab2164 100644 --- a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py +++ b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py @@ -12,6 +12,7 @@ class TestDAP_memory(lldbdap_testcase.DAPTestCaseBase): +@skipIfWindows def test_memory_refs_variables(self): """ Tests memory references for evaluate @@ -33,6 +34,7 @@ def test_memory_refs_variables(self): # Non-pointers should also have memory-references self.assertIn("memoryReference", locals["not_a_ptr"].keys()) +@skipIfWindows def test_memory_refs_evaluate(self): """ Tests memory references for evaluate @@ -52,6 +54,7 @@ def test_memory_refs_evaluate(self): self.dap_server.request_evaluate("rawptr")["body"].keys(), ) +@skipIfWindows def test_memory_refs_set_variable(self): """ Tests memory references for `setVariable` @@ -74,6 +77,7 @@ def test_memory_refs_set_variable(self): ].keys(), ) +@skipIfWindows def test_readMemory(self): """ Tests the 'readMemory' request diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py index 3b45cdc245838..296e4911f4052 100644 --- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py +++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py @@ -411,16 +411,19 @@ def do_test_scopes_variables_setVariable_evaluate( self.verify_variables(verify_locals, locals) +@skipIfWindows def test_scopes_variables_setVariable_evaluate(self): self.do_test_scopes_variables_setVariable_evaluate( enableAutoVariableSummaries=False ) +@skipIfWindows def test_scopes_variables_setVariable_evaluate_with_descriptive_summaries(self): self.do_test_scopes_variables_setVariable_evaluate( enableAutoVariableSummaries=True ) +@skipIfWindows def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: bool): """ Tests the evaluated expression expands successfully after "scopes" packets @@ -673,6 +676,7 @@ def do_test_indexedVariables(self, enableSyntheticChildDebugging: bool): ]["variables"] self.verify_variables(verify_children, children) +@skipIfWindows def test_return_variables(self): """ Test the stepping out of a function with return value show the variable correctly. ___ 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] Disable more tests on Windows (PR #139251)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: David Spickett (DavidSpickett) Changes These are currently failing on Windows on Arm: https://lab.llvm.org/buildbot/#/builders/141/builds/8556 ``` Unresolved Tests (1): lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py Failed Tests (1): lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py ``` --- Full diff: https://github.com/llvm/llvm-project/pull/139251.diff 2 Files Affected: - (modified) lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py (+4) - (modified) lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py (+4) ``diff diff --git a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py index ea43fccf016a7..74062f3ab2164 100644 --- a/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py +++ b/lldb/test/API/tools/lldb-dap/memory/TestDAP_memory.py @@ -12,6 +12,7 @@ class TestDAP_memory(lldbdap_testcase.DAPTestCaseBase): +@skipIfWindows def test_memory_refs_variables(self): """ Tests memory references for evaluate @@ -33,6 +34,7 @@ def test_memory_refs_variables(self): # Non-pointers should also have memory-references self.assertIn("memoryReference", locals["not_a_ptr"].keys()) +@skipIfWindows def test_memory_refs_evaluate(self): """ Tests memory references for evaluate @@ -52,6 +54,7 @@ def test_memory_refs_evaluate(self): self.dap_server.request_evaluate("rawptr")["body"].keys(), ) +@skipIfWindows def test_memory_refs_set_variable(self): """ Tests memory references for `setVariable` @@ -74,6 +77,7 @@ def test_memory_refs_set_variable(self): ].keys(), ) +@skipIfWindows def test_readMemory(self): """ Tests the 'readMemory' request diff --git a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py index 3b45cdc245838..296e4911f4052 100644 --- a/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py +++ b/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py @@ -411,16 +411,19 @@ def do_test_scopes_variables_setVariable_evaluate( self.verify_variables(verify_locals, locals) +@skipIfWindows def test_scopes_variables_setVariable_evaluate(self): self.do_test_scopes_variables_setVariable_evaluate( enableAutoVariableSummaries=False ) +@skipIfWindows def test_scopes_variables_setVariable_evaluate_with_descriptive_summaries(self): self.do_test_scopes_variables_setVariable_evaluate( enableAutoVariableSummaries=True ) +@skipIfWindows def do_test_scopes_and_evaluate_expansion(self, enableAutoVariableSummaries: bool): """ Tests the evaluated expression expands successfully after "scopes" packets @@ -673,6 +676,7 @@ def do_test_indexedVariables(self, enableSyntheticChildDebugging: bool): ]["variables"] self.verify_variables(verify_children, children) +@skipIfWindows def test_return_variables(self): """ Test the stepping out of a function with return value show the variable correctly. `` https://github.com/llvm/llvm-project/pull/139251 ___ 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] Disable more tests on Windows (PR #139251)
https://github.com/DavidSpickett created https://github.com/llvm/llvm-project/pull/139251 These are currently failing on Windows on Arm: https://lab.llvm.org/buildbot/#/builders/141/builds/8556 Unresolved Tests (1): lldb-api :: tools/lldb-dap/memory/TestDAP_memory.py Failed Tests (1): lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ 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] Disable more tests on Windows (PR #139251)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/139251 ___ 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] Disable more tests on Windows (PR #139251)
DavidSpickett wrote: @JDevlieghere FYI. I realise this is not the most helpful or informative action to take, but Linaro folks will be busy with other things next week so I want this bot green again soon. If you need us to investigate locally I can do that but it'll be the week of the 19th before I will have time to do so. https://github.com/llvm/llvm-project/pull/139251 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][plugin] Clear in same thread as set (PR #139252)
https://github.com/jpienaar created https://github.com/llvm/llvm-project/pull/139252 Here we were initializing & locking a shared_mutex in a thread, while releasing it in the parent which may/often turned out to be a different thread (shared_mutex::unlock_shared is undefined behavior if called from a thread that doesn't hold the lock). I'm not quite sure what the expectation is here as the variable is never used, so instead I've just reset in same thread as which it was set to ensure its freed in thread holding lock. >From c5ffbd84f8b68bae2112e8cec68803cefe571a72 Mon Sep 17 00:00:00 2001 From: Jacques Pienaar Date: Fri, 9 May 2025 05:23:00 -0700 Subject: [PATCH] [lldb][plugin] Clear in same thread as set Here we were initializing & locking a mutex in a thread, while releasing it in the parent which may/often turned out to be a different thread (shared_mutex::unlock_shared is undefined behavior if called from a thread that doesn't hold the lock). I'm not quite sure what the expectation is here as the variable is never used, so instead I've just reset in same thread as which it was set to ensure its freed in thread holding lock. --- lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp index 523820874752a..0f0226ea9650c 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp @@ -121,6 +121,7 @@ void ManualDWARFIndex::Index() { units_to_index.size()); for_each_unit([&clear_cu_dies](size_t, size_t idx, DWARFUnit *unit) { clear_cu_dies[idx] = unit->ExtractDIEsScoped(); +ckear_cu_duex[idx].reset(); }); // Now index all DWARF unit in parallel. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Expose QueueThreadPlanForStepSingleInstruction function to SBThreadPlan (PR #137904)
DavidSpickett wrote: At this time there is no pre-merge CI for Arm. If you feel like hacking something together, it is possible to use Github's Runners to test it on your own fork. I hope to make that route more user friendly at some point, and expand the automatic CI to Arm when we can. Fix ups after landing are a fact of life for the time being :) https://github.com/llvm/llvm-project/pull/137904 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] print a notice when `source list` paging reaches the end of th… (PR #137515)
hapee wrote: > That would be great if you can, there isn't one in that folder right now but > you can find another elsewhere, or add a new file. I didn't want to go > changing all the check lines myself in case I broke > something.如果你能做到那就太好了,那个文件夹里现在没有,但你可以在别处找到另一个,或者添加一个新文件。我不想自己去改所有的检查行,以免破坏了什么。 If I modified the test file, should I create a new PR to fix it? https://github.com/llvm/llvm-project/pull/137515 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] print a notice when `source list` paging reaches the end of th… (PR #137515)
DavidSpickett wrote: That would be great if you can, there isn't one in that folder right now but you can find another elsewhere, or add a new file. I didn't want to go changing all the check lines myself in case I broke something. https://github.com/llvm/llvm-project/pull/137515 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 9818120 - [lldb-dap] Migrating breakpointLocations request to use typed RequestHandler (#137426)
Author: Ely Ronnen Date: 2025-05-09T18:29:06+02:00 New Revision: 98181200db2af6e0aa43318d11c5c37e65c72845 URL: https://github.com/llvm/llvm-project/commit/98181200db2af6e0aa43318d11c5c37e65c72845 DIFF: https://github.com/llvm/llvm-project/commit/98181200db2af6e0aa43318d11c5c37e65c72845.diff LOG: [lldb-dap] Migrating breakpointLocations request to use typed RequestHandler (#137426) * Migrating breakpointLocations request to use typed RequestHandle * Preliminary step in order to implement assembly source breakpoints Added: Modified: lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp lldb/tools/lldb-dap/Handler/RequestHandler.h lldb/tools/lldb-dap/Protocol/ProtocolRequests.cpp lldb/tools/lldb-dap/Protocol/ProtocolRequests.h lldb/tools/lldb-dap/Protocol/ProtocolTypes.cpp lldb/tools/lldb-dap/Protocol/ProtocolTypes.h llvm/include/llvm/Support/JSON.h Removed: diff --git a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp index 7a477f3e97875..2ac886c3a5d2c 100644 --- a/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp +++ b/lldb/tools/lldb-dap/Handler/BreakpointLocationsHandler.cpp @@ -9,136 +9,22 @@ #include "DAP.h" #include "JSONUtils.h" #include "RequestHandler.h" +#include namespace lldb_dap { -// "BreakpointLocationsRequest": { -// "allOf": [ { "$ref": "#/definitions/Request" }, { -// "type": "object", -// "description": "The `breakpointLocations` request returns all possible -// locations for source breakpoints in a given range.\nClients should only -// call this request if the corresponding capability -// `supportsBreakpointLocationsRequest` is true.", -// "properties": { -// "command": { -// "type": "string", -// "enum": [ "breakpointLocations" ] -// }, -// "arguments": { -// "$ref": "#/definitions/BreakpointLocationsArguments" -// } -// }, -// "required": [ "command" ] -// }] -// }, -// "BreakpointLocationsArguments": { -// "type": "object", -// "description": "Arguments for `breakpointLocations` request.", -// "properties": { -// "source": { -// "$ref": "#/definitions/Source", -// "description": "The source location of the breakpoints; either -// `source.path` or `source.sourceReference` must be specified." -// }, -// "line": { -// "type": "integer", -// "description": "Start line of range to search possible breakpoint -// locations in. If only the line is specified, the request returns all -// possible locations in that line." -// }, -// "column": { -// "type": "integer", -// "description": "Start position within `line` to search possible -// breakpoint locations in. It is measured in UTF-16 code units and the -// client capability `columnsStartAt1` determines whether it is 0- or -// 1-based. If no column is given, the first position in the start line is -// assumed." -// }, -// "endLine": { -// "type": "integer", -// "description": "End line of range to search possible breakpoint -// locations in. If no end line is given, then the end line is assumed to -// be the start line." -// }, -// "endColumn": { -// "type": "integer", -// "description": "End position within `endLine` to search possible -// breakpoint locations in. It is measured in UTF-16 code units and the -// client capability `columnsStartAt1` determines whether it is 0- or -// 1-based. If no end column is given, the last position in the end line -// is assumed." -// } -// }, -// "required": [ "source", "line" ] -// }, -// "BreakpointLocationsResponse": { -// "allOf": [ { "$ref": "#/definitions/Response" }, { -// "type": "object", -// "description": "Response to `breakpointLocations` request.\nContains -// possible locations for source breakpoints.", -// "properties": { -// "body": { -// "type": "object", -// "properties": { -// "breakpoints": { -// "type": "array", -// "items": { -// "$ref": "#/definitions/BreakpointLocation" -// }, -// "description": "Sorted set of possible breakpoint locations." -// } -// }, -// "required": [ "breakpoints" ] -// } -// }, -// "required": [ "body" ] -// }] -// }, -// "BreakpointLocation": { -// "type": "object", -// "description": "Properties of a breakpoint location returned from the -// `breakpointLocations` request.", -// "properties": { -// "line": { -// "type": "integer", -// "description": "Start line of breakpoint location." -// }, -// "column": { -// "type": "integer", -// "description": "The start position of
[Lldb-commits] [lldb] [llvm] [lldb-dap] Migrating breakpointLocations request to use typed RequestHandler (PR #137426)
https://github.com/eronnen closed https://github.com/llvm/llvm-project/pull/137426 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][core] Fix getting summary of a variable pointing to r/o memory (PR #139196)
https://github.com/igorkudrin updated https://github.com/llvm/llvm-project/pull/139196 >From 499f723c3f974ff53deb8f354d879e0baaa7a9e8 Mon Sep 17 00:00:00 2001 From: Igor Kudrin Date: Wed, 7 May 2025 19:55:07 -0700 Subject: [PATCH 1/3] [lldb][core] Fix getting summary of a variable pointing to r/o memory Motivation example: ``` > lldb -c altmain2.core ... (lldb) var F (const char *) F = 0x0804a000 "" ``` The variable `F` points to a read-only memory page not dumped to the core file, so `Process::ReadMemory()` cannot read the data. The patch switches to `Target::ReadMemory()`, which can read data both from the process memory and the application binary. --- lldb/source/ValueObject/ValueObject.cpp | 13 - .../postmortem/elf-core/TestLinuxCore.py | 27 ++ .../postmortem/elf-core/altmain2.core | Bin 0 -> 40960 bytes .../postmortem/elf-core/altmain2.out | Bin 0 -> 9776 bytes 4 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 lldb/test/API/functionalities/postmortem/elf-core/altmain2.core create mode 100755 lldb/test/API/functionalities/postmortem/elf-core/altmain2.out diff --git a/lldb/source/ValueObject/ValueObject.cpp b/lldb/source/ValueObject/ValueObject.cpp index e1c66763ff0b8..aab78428d9103 100644 --- a/lldb/source/ValueObject/ValueObject.cpp +++ b/lldb/source/ValueObject/ValueObject.cpp @@ -735,7 +735,7 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, case eAddressTypeLoad: { ExecutionContext exe_ctx(GetExecutionContextRef()); Process *process = exe_ctx.GetProcessPtr(); - if (process) { + if (process && process->IsLiveDebugSession()) { heap_buf_ptr->SetByteSize(bytes); size_t bytes_read = process->ReadMemory( addr + offset, heap_buf_ptr->GetBytes(), bytes, error); @@ -743,6 +743,17 @@ size_t ValueObject::GetPointeeData(DataExtractor &data, uint32_t item_idx, data.SetData(data_sp); return bytes_read; } + } else if (Target *target = exe_ctx.GetTargetPtr()) { +Address target_addr; +target_addr.SetLoadAddress(addr + offset, target); +heap_buf_ptr->SetByteSize(bytes); +size_t bytes_read = +target->ReadMemory(target_addr, heap_buf_ptr->GetBytes(), bytes, + error, /*force_live_memory=*/true); +if (error.Success() || bytes_read > 0) { + data.SetData(data_sp); + return bytes_read; +} } } break; case eAddressTypeHost: { diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py index a287fd19ba352..d1e065a32efdc 100644 --- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py +++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py @@ -977,6 +977,33 @@ def test_get_core_file_api(self): self.assertEqual(process.GetCoreFile().GetFilename(), core_file_name) self.dbg.DeleteTarget(target) +@skipIfLLVMTargetMissing("X86") +def test_ro_cstring(self): +""" +Test that we can show the summary for a cstring variable that points +to a r/o memory page which is not dumped to a core file. +""" +target = self.dbg.CreateTarget("altmain2.out") +process = target.LoadCore("altmain2.core") +self.assertTrue(process, PROCESS_IS_VALID) + +frame = process.GetSelectedThread().GetFrameAtIndex(0) +self.assertEqual(frame.GetFunctionName(), "_start") + +var = frame.FindVariable("F") + +# The variable points to a RO segment that is not dumped to the core +# file and thus process.ReadCStringFromMemory() cannot get the value. +error = lldb.SBError() +cstr = process.ReadCStringFromMemory(var.GetValueAsUnsigned(), 256, error) +self.assertFailure(error, error_str="core file does not contain 0x804a000") +self.assertEqual(cstr, "") + +# Nevertheless, when getting the summary, the value can be read from the +# application binary. +cstr = var.GetSummary() +self.assertEqual(cstr, '"_start"') + def check_memory_regions(self, process, region_count): region_list = process.GetMemoryRegions() self.assertEqual(region_list.GetSize(), region_count) diff --git a/lldb/test/API/functionalities/postmortem/elf-core/altmain2.core b/lldb/test/API/functionalities/postmortem/elf-core/altmain2.core new file mode 100755 index ..b9dd8de08b813442037fcb5bedd08e8bbabfdc0b GIT binary patch literal 40960 zcmeHQ4^&jwnSa9!I!%cK#cib0IB9HSqA(1g2@tXp8Ij5$Wtd=M$vDi6Fme86<_(|; z6+_tg`VJeLbo*!1-R7KixAr7yY1h*llO~{6F(sCWr_zMokd!oo(v~!T)FyTI_ucp2 z%tOtlZMJ8(-FH3T-0yz(yZ3(gcfb4H_udT89k#l)I-QPFl7Z86N~u&4A}{64oKY?t zsH`Y~&;E#9A!n>A8-*T&)P#5twWFNXo5Amv>t%VSoTus^om+oN`+>Rj^Db^b`}?yb z;#NyEr~PK
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
@@ -0,0 +1,535 @@ +//===-- RPCCommon.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 "RPCCommon.h" + +#include "clang/AST/AST.h" +#include "clang/AST/Mangle.h" +#include "clang/Lex/Lexer.h" + +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/raw_ostream.h" + +using namespace clang; + +// We intentionally do not generate some classes because they are currently +// inconvenient, they aren't really used by most consumers, or we're not sure +// why they exist. +static constexpr llvm::StringRef DisallowedClasses[] = { +"SBCommunication", // What is this used for? +"SBInputReader",// What is this used for? +"SBCommandPluginInterface", // This is hard to support, we can do it if +// really needed though. +"SBCommand", // There's nothing too difficult about this one, but many of + // its methods take a SBCommandPluginInterface pointer so + // there's no reason to support this. +}; + +// We intentionally avoid generating certain methods either because they are +// difficult to support correctly or they aren't really used much from C++. +// FIXME: We should be able to annotate these methods instead of maintaining a +// list in the generator itself. +static constexpr llvm::StringRef DisallowedMethods[] = { +// The threading functionality in SBHostOS is deprecated and thus we do not +// generate them. It would be ideal to add the annotations to the methods +// and then support not generating deprecated methods. However, without +// annotations the generator generates most things correctly. This one is +// problematic because it returns a pointer to an "opaque" structure +// (thread_t) that is not `void *`, so special casing it is more effort than +// it's worth. +"_ZN4lldb8SBHostOS10ThreadJoinEP17_opaque_pthread_tPPvPNS_7SBErrorE", +"_ZN4lldb8SBHostOS12ThreadCancelEP17_opaque_pthread_tPNS_7SBErrorE", chelcassanova wrote: @bulbazord Actually, I think this preprocessor macro has its link to the `[[deprecated]]` attribute removed in SBDefines if we're generating the SWIG bindings: ``` #if defined(SWIG) || _cplusplus < 201402L #undef LLDB_DEPRECATED #undef LLDB_DEPRECATED_FIXME #define LLDB_DEPRECATED(MSG) #define LLDB_DEPRECATED_FIXME(MSG, FIX) #endif ``` and we're always generating the SWIG bindings when building RPC because of testing right? The definition for `LLDB_DEPRECATED` that ties it to the compiler's deprecated attribute is coming from `lldb-defines.h` and is overridden in `SBDefines.h` to just be blank (IIUC?). I think this means that when `lldb-rpc-gen` is reading any function that has `LLDB_DEPRECATED`, there's no actual `[[deprecated]]` attribute for the tool to pick up on. I don't currently know why we don't add the deprecated attribute when generating SWIG bindings. If that's something that cannot change, is there a better way to work around this? If not then keeping the list and adding a note; as well as adding a check for the deprecated attribute anyways in `MethodIsDisallowed` would be the way to go here. https://github.com/llvm/llvm-project/pull/138031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
jasonmolenda wrote: Minor syntax adaptations to the assembly file to build on an aarch64 unbuntu 24.04, test updated and will run on linux or darwin now. https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
lldb-commits@lists.llvm.org
Author: Jason Molenda Date: 2025-05-09T20:41:08-07:00 New Revision: d2f6ac2c10758d2bd994827610695a8c7f2625fe URL: https://github.com/llvm/llvm-project/commit/d2f6ac2c10758d2bd994827610695a8c7f2625fe DIFF: https://github.com/llvm/llvm-project/commit/d2f6ac2c10758d2bd994827610695a8c7f2625fe.diff LOG: Revert "Fix skipIf which was doing || and I need &&" This reverts commit 05a2b33f7b36d4fc91b7a957aa00100bc8e38f04. Added: Modified: lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py Removed: diff --git a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py index f1fce8535ca35..a03d994045773 100644 --- a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py +++ b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py @@ -10,8 +10,10 @@ class TestUnwindFramelessFaulted(TestBase): NO_DEBUG_INFO_TESTCASE = True -@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"])) -@skipIf(archs=no_match(["aarch64", "arm64", "arm64e"])) +@skipIf( +oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"]), +archs=no_match(["aarch64", "arm64", "arm64e"]), +) def test_frameless_faulted_unwind(self): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Minor visual changes to the modules UI (PR #139328)
https://github.com/ashgti approved this pull request. LGTM, and I didn't realize I could directly edit this, I thought I was doing a suggestion but clearly I need to learn the github pull request UI better... https://github.com/llvm/llvm-project/pull/139328 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][breakpoint] Grey out disabled breakpoints (PR #91404)
https://github.com/JDevlieghere requested changes to this pull request. I like the feautre but I think this PR can be a lot simpler: 1. I don't think you need any of the changes to `Stream` or `SBStream`. You already have to get the setting from the debugger, so just check if it has colors enabled and write the prefix (and fixed suffix) if colors are enabled. 2. I think we had settled on adding a new setting for highlighting "disabled things", with breakpoints being just one example of that. The setting should be generic, something like `disable-ansi-prefix` (*). I'm find with omitting the suffix and always issuing a clear. I can't think of a reason anyone would ever want to change that. (*) I would prefer to call the setting`disable-format`, but then it should go through FormatEntity which is definitely overkill. I think given the existing settings, `disable-ansi-prefix` is the most consistent. https://github.com/llvm/llvm-project/pull/91404 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
lldb-commits@lists.llvm.org
Author: Jason Molenda Date: 2025-05-09T20:12:56-07:00 New Revision: 05a2b33f7b36d4fc91b7a957aa00100bc8e38f04 URL: https://github.com/llvm/llvm-project/commit/05a2b33f7b36d4fc91b7a957aa00100bc8e38f04 DIFF: https://github.com/llvm/llvm-project/commit/05a2b33f7b36d4fc91b7a957aa00100bc8e38f04.diff LOG: Fix skipIf which was doing || and I need && only run this test on linux or darwin when targetting arm64/aarch64. Added: Modified: lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py Removed: diff --git a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py index a03d994045773..f1fce8535ca35 100644 --- a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py +++ b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py @@ -10,10 +10,8 @@ class TestUnwindFramelessFaulted(TestBase): NO_DEBUG_INFO_TESTCASE = True -@skipIf( -oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"]), -archs=no_match(["aarch64", "arm64", "arm64e"]), -) +@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"])) +@skipIf(archs=no_match(["aarch64", "arm64", "arm64e"])) def test_frameless_faulted_unwind(self): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Don't emit a removed module event for unseen modules (PR #139324)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/139324 >From 018bb069e873007501d639dceaf8581eb34ddbb9 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Fri, 9 May 2025 13:18:49 -0700 Subject: [PATCH 1/3] [lldb-dap] Don't emit a removed module event for unseen modules On macOS, lldb-dap is sending module events with reason "removed" for modules that we never told the client about in the first place. This is because when we create a target with a binary, by default all of its dependent libraries are loaded too. When we start executing and see the that the binary and dyld are loaded, we throw away the image list and then as dyld tell us about the correct binaries being loaded in the process, we add them. This PR addresses the issue by keeping track which modules the DAP client knows about. Clients can find out about modules either through the modules request, or through module events. Only when we have told a client about a module, we send module changed or module removed events. This PR also reduces the amount of data sent for removed module events. The DAP specification [1] says that for removed module events, only the ID is used. Fixes #139323 [1] https://microsoft.github.io/debug-adapter-protocol/specification#Events_Module --- .../test/tools/lldb-dap/dap_server.py | 6 -- .../API/tools/lldb-dap/module-event/Makefile | 12 .../module-event/TestDAP_module_event.py | 55 +++ .../API/tools/lldb-dap/module-event/main.cpp | 22 .../API/tools/lldb-dap/module-event/other.c | 5 ++ .../tools/lldb-dap/module/TestDAP_module.py | 10 ++-- lldb/tools/lldb-dap/DAP.cpp | 39 + lldb/tools/lldb-dap/DAP.h | 8 +++ .../Handler/ModulesRequestHandler.cpp | 17 +- lldb/tools/lldb-dap/JSONUtils.cpp | 7 ++- lldb/tools/lldb-dap/JSONUtils.h | 7 ++- 11 files changed, 161 insertions(+), 27 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/module-event/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py create mode 100644 lldb/test/API/tools/lldb-dap/module-event/main.cpp create mode 100644 lldb/test/API/tools/lldb-dap/module-event/other.c diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py index e10342b72f4f0..c974866306d2a 100644 --- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py +++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/dap_server.py @@ -134,7 +134,6 @@ def __init__(self, recv, send, init_commands, log_file=None): self.thread_stop_reasons = {} self.progress_events = [] self.reverse_requests = [] -self.module_events = [] self.sequence = 1 self.threads = None self.recv_thread.start() @@ -248,11 +247,6 @@ def handle_recv_packet(self, packet): # and 'progressEnd' events. Keep these around in case test # cases want to verify them. self.progress_events.append(packet) -elif event == "module": -# Module events indicate that some information about a module has changed. -self.module_events.append(packet) -# no need to add 'module' event packets to our packets list -return keepGoing elif packet_type == "response": if packet["command"] == "disconnect": diff --git a/lldb/test/API/tools/lldb-dap/module-event/Makefile b/lldb/test/API/tools/lldb-dap/module-event/Makefile new file mode 100644 index 0..99d79b8053878 --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/module-event/Makefile @@ -0,0 +1,12 @@ +CXX_SOURCES := main.cpp +LD_EXTRAS := -Wl,-rpath "-Wl,$(shell pwd)" +USE_LIBDL :=1 + +a.out: libother + +include Makefile.rules + +# The following shared library will be used to test breakpoints under dynamic loading +libother: other.c + "$(MAKE)" -f $(MAKEFILE_RULES) \ + DYLIB_ONLY=YES DYLIB_C_SOURCES=other.c DYLIB_NAME=other diff --git a/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py new file mode 100644 index 0..819640e5598bd --- /dev/null +++ b/lldb/test/API/tools/lldb-dap/module-event/TestDAP_module_event.py @@ -0,0 +1,55 @@ +import dap_server +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil +import lldbdap_testcase +import re + + +class TestDAP_module_event(lldbdap_testcase.DAPTestCaseBase): + +def test_module_event(self): +program = self.getBuildArtifact("a.out") +self.build_and_launch(program, stopOnEntry=True) + +source = "main.cpp" +breakpoint1_line = line_number(source, "// breakpoint 1") +breakpoint2_line =
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
jasonmolenda wrote: I reverted it entirely when the lldb incremental arm64 bot failed the test. On that older Xcode/OS (Xcode 15.2, macOS 14.1) there was something wrong with the CFI directives and the backtrace out of `trap()` failed. On a modern macOS system this works fine. I'll set up an older system and repo. https://github.com/llvm/llvm-project/pull/138805 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] f6ca690 - Revert "Stop running test on Linux for now"
Author: Jason Molenda Date: 2025-05-09T20:41:02-07:00 New Revision: f6ca690c4325f6c7b22eca69fae6e5fa069cc7ab URL: https://github.com/llvm/llvm-project/commit/f6ca690c4325f6c7b22eca69fae6e5fa069cc7ab DIFF: https://github.com/llvm/llvm-project/commit/f6ca690c4325f6c7b22eca69fae6e5fa069cc7ab.diff LOG: Revert "Stop running test on Linux for now" This reverts commit 76f0f4cdf4bf9ebf476af99ad9911c687910d66d. Added: Modified: lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py Removed: diff --git a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py index 53c5e1182cf24..f1fce8535ca35 100644 --- a/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py +++ b/lldb/test/API/functionalities/unwind/frameless-faulted/TestUnwindFramelessFaulted.py @@ -10,7 +10,7 @@ class TestUnwindFramelessFaulted(TestBase): NO_DEBUG_INFO_TESTCASE = True -@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples()])) +@skipIf(oslist=no_match([lldbplatformutil.getDarwinOSTriples(), "linux"])) @skipIf(archs=no_match(["aarch64", "arm64", "arm64e"])) def test_frameless_faulted_unwind(self): self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/138805 >From 4fc9acd03a58a3617b113352c48e5dd2fdb58eda Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 6 May 2025 22:37:17 -0700 Subject: [PATCH 01/14] [lldb] Provide lr value in faulting frame on arm64 When a frameless function faults or is interrupted asynchronously, the UnwindPlan MAY have no register location rule for the return address register (lr on arm64); the value is simply live in the lr register when it was interrupted, and the frame below this on the stack -- e.g. sigtramp on a Unix system -- has the full register context, including that register. RegisterContextUnwind::SavedLocationForRegister, when asked to find the caller's pc value, will first see if there is a pc register location. If there isn't, on a Return Address Register architecture like arm/mips/riscv, we rewrite the register request from "pc" to "RA register", and search for a location. On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may have no register location rule for the RA Reg, that is valid. A frameless function that never calls another may simply keep the return address in the live register the whole way. Our instruction emulation unwind plans explicitly add a rule (see Pavel's May 2024 change https://github.com/llvm/llvm-project/pull/91321 ), but an UnwindPlan sourced from debug_frame may not. I've got a case where this exactly happens - clang debug_frame for arm64 where there is no register location for the lr in a frameless function. There is a fault in the middle of this frameless function and we only get the lr value from the fault handler below this frame if lr has a register location of `IsSame`, in line with Pavel's 2024 change. Similar to how we see a request of the RA Reg from frame 0 after failing to find an unwind location for the pc register, the same style of special casing is needed when this is a function that was interrupted. Without this change, we can find the pc of the frame that was executing when it was interrupted, but we need $lr to find its caller, and we don't descend down to the trap handler to get that value, truncating the stack. rdar://145614545 --- lldb/source/Target/RegisterContextUnwind.cpp | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp index 3ed49e12476dd..23a86bee2518b 100644 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -1377,6 +1377,7 @@ RegisterContextUnwind::SavedLocationForRegister( } } + // Check if the active_row has a register location listed. if (regnum.IsValid() && active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind), unwindplan_regloc)) { @@ -1390,11 +1391,10 @@ RegisterContextUnwind::SavedLocationForRegister( // This is frame 0 and we're retrieving the PC and it's saved in a Return // Address register and it hasn't been saved anywhere yet -- that is, // it's still live in the actual register. Handle this specially. - if (!have_unwindplan_regloc && return_address_reg.IsValid() && - IsFrameZero()) { -if (return_address_reg.GetAsKind(eRegisterKindLLDB) != -LLDB_INVALID_REGNUM) { + return_address_reg.GetAsKind(eRegisterKindLLDB) != + LLDB_INVALID_REGNUM) { +if (IsFrameZero()) { lldb_private::UnwindLLDB::ConcreteRegisterLocation new_regloc; new_regloc.type = UnwindLLDB::ConcreteRegisterLocation:: eRegisterInLiveRegisterContext; @@ -1408,6 +1408,17 @@ RegisterContextUnwind::SavedLocationForRegister( return_address_reg.GetAsKind(eRegisterKindLLDB), return_address_reg.GetAsKind(eRegisterKindLLDB)); return UnwindLLDB::RegisterSearchResult::eRegisterFound; +} else if (BehavesLikeZerothFrame()) { + // This function was interrupted asynchronously -- it faulted, + // an async interrupt, a timer fired, a debugger expression etc. + // The caller's pc is in the Return Address register, but the + // UnwindPlan for this function may have no location rule for + // the RA reg. + // This means that the caller's return address is in the RA reg + // when the function was interrupted--descend down one stack frame + // to retrieve it from the trap handler's saved context. + unwindplan_regloc.SetSame(); + have_unwindplan_regloc = true; } } >From b10162deb49ecddca6439665c2b8ea1995fdd81f Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 7 May 2025 23:24:17 -0700 Subject: [PATCH 02/14] Add the sources for an API test case to be written --- .../interrupt-and-trap-funcs.s| 92 +++
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
@@ -0,0 +1,535 @@ +//===-- RPCCommon.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 "RPCCommon.h" + +#include "clang/AST/AST.h" +#include "clang/AST/Mangle.h" +#include "clang/Lex/Lexer.h" + +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringMap.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/raw_ostream.h" + +using namespace clang; + +// We intentionally do not generate some classes because they are currently +// inconvenient, they aren't really used by most consumers, or we're not sure +// why they exist. +static constexpr llvm::StringRef DisallowedClasses[] = { +"SBCommunication", // What is this used for? +"SBInputReader",// What is this used for? +"SBCommandPluginInterface", // This is hard to support, we can do it if +// really needed though. +"SBCommand", // There's nothing too difficult about this one, but many of + // its methods take a SBCommandPluginInterface pointer so + // there's no reason to support this. +}; + +// We intentionally avoid generating certain methods either because they are +// difficult to support correctly or they aren't really used much from C++. +// FIXME: We should be able to annotate these methods instead of maintaining a +// list in the generator itself. +static constexpr llvm::StringRef DisallowedMethods[] = { +// The threading functionality in SBHostOS is deprecated and thus we do not +// generate them. It would be ideal to add the annotations to the methods +// and then support not generating deprecated methods. However, without +// annotations the generator generates most things correctly. This one is +// problematic because it returns a pointer to an "opaque" structure +// (thread_t) that is not `void *`, so special casing it is more effort than +// it's worth. +"_ZN4lldb8SBHostOS10ThreadJoinEP17_opaque_pthread_tPPvPNS_7SBErrorE", +"_ZN4lldb8SBHostOS12ThreadCancelEP17_opaque_pthread_tPNS_7SBErrorE", bulbazord wrote: lldb-rpc-gen should not satisfy `defined(SWIG)` so you should have access to the `[[deprecated]]` annotation. https://github.com/llvm/llvm-project/pull/138031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Provide lr value in faulting frame on arm64 (PR #138805)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/138805 >From 4fc9acd03a58a3617b113352c48e5dd2fdb58eda Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 6 May 2025 22:37:17 -0700 Subject: [PATCH 01/15] [lldb] Provide lr value in faulting frame on arm64 When a frameless function faults or is interrupted asynchronously, the UnwindPlan MAY have no register location rule for the return address register (lr on arm64); the value is simply live in the lr register when it was interrupted, and the frame below this on the stack -- e.g. sigtramp on a Unix system -- has the full register context, including that register. RegisterContextUnwind::SavedLocationForRegister, when asked to find the caller's pc value, will first see if there is a pc register location. If there isn't, on a Return Address Register architecture like arm/mips/riscv, we rewrite the register request from "pc" to "RA register", and search for a location. On frame 0 (the live frame) and an interrupted frame, the UnwindPlan may have no register location rule for the RA Reg, that is valid. A frameless function that never calls another may simply keep the return address in the live register the whole way. Our instruction emulation unwind plans explicitly add a rule (see Pavel's May 2024 change https://github.com/llvm/llvm-project/pull/91321 ), but an UnwindPlan sourced from debug_frame may not. I've got a case where this exactly happens - clang debug_frame for arm64 where there is no register location for the lr in a frameless function. There is a fault in the middle of this frameless function and we only get the lr value from the fault handler below this frame if lr has a register location of `IsSame`, in line with Pavel's 2024 change. Similar to how we see a request of the RA Reg from frame 0 after failing to find an unwind location for the pc register, the same style of special casing is needed when this is a function that was interrupted. Without this change, we can find the pc of the frame that was executing when it was interrupted, but we need $lr to find its caller, and we don't descend down to the trap handler to get that value, truncating the stack. rdar://145614545 --- lldb/source/Target/RegisterContextUnwind.cpp | 19 +++ 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/lldb/source/Target/RegisterContextUnwind.cpp b/lldb/source/Target/RegisterContextUnwind.cpp index 3ed49e12476dd..23a86bee2518b 100644 --- a/lldb/source/Target/RegisterContextUnwind.cpp +++ b/lldb/source/Target/RegisterContextUnwind.cpp @@ -1377,6 +1377,7 @@ RegisterContextUnwind::SavedLocationForRegister( } } + // Check if the active_row has a register location listed. if (regnum.IsValid() && active_row->GetRegisterInfo(regnum.GetAsKind(unwindplan_registerkind), unwindplan_regloc)) { @@ -1390,11 +1391,10 @@ RegisterContextUnwind::SavedLocationForRegister( // This is frame 0 and we're retrieving the PC and it's saved in a Return // Address register and it hasn't been saved anywhere yet -- that is, // it's still live in the actual register. Handle this specially. - if (!have_unwindplan_regloc && return_address_reg.IsValid() && - IsFrameZero()) { -if (return_address_reg.GetAsKind(eRegisterKindLLDB) != -LLDB_INVALID_REGNUM) { + return_address_reg.GetAsKind(eRegisterKindLLDB) != + LLDB_INVALID_REGNUM) { +if (IsFrameZero()) { lldb_private::UnwindLLDB::ConcreteRegisterLocation new_regloc; new_regloc.type = UnwindLLDB::ConcreteRegisterLocation:: eRegisterInLiveRegisterContext; @@ -1408,6 +1408,17 @@ RegisterContextUnwind::SavedLocationForRegister( return_address_reg.GetAsKind(eRegisterKindLLDB), return_address_reg.GetAsKind(eRegisterKindLLDB)); return UnwindLLDB::RegisterSearchResult::eRegisterFound; +} else if (BehavesLikeZerothFrame()) { + // This function was interrupted asynchronously -- it faulted, + // an async interrupt, a timer fired, a debugger expression etc. + // The caller's pc is in the Return Address register, but the + // UnwindPlan for this function may have no location rule for + // the RA reg. + // This means that the caller's return address is in the RA reg + // when the function was interrupted--descend down one stack frame + // to retrieve it from the trap handler's saved context. + unwindplan_regloc.SetSame(); + have_unwindplan_regloc = true; } } >From b10162deb49ecddca6439665c2b8ea1995fdd81f Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Wed, 7 May 2025 23:24:17 -0700 Subject: [PATCH 02/15] Add the sources for an API test case to be written --- .../interrupt-and-trap-funcs.s| 92 +++
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/138031 Rate limit · GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji,Segoe UI Symbol; font-size: 14px; line-height: 1.5; margin: 0; } .container { margin: 50px auto; max-width: 600px; text-align: center; padding: 0 24px; } a { color: #0366d6; text-decoration: none; } a:hover { text-decoration: underline; } h1 { line-height: 60px; font-size: 48px; font-weight: 300; margin: 0px; text-shadow: 0 1px 0 #fff; } p { color: rgba(0, 0, 0, 0.5); margin: 20px 0 40px; } ul { list-style: none; margin: 25px 0; padding: 0; } li { display: table-cell; font-weight: bold; width: 1%; } .logo { display: inline-block; margin-top: 35px; } .logo-img-2x { display: none; } @media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and ( min--moz-device-pixel-ratio: 2), only screen and ( -o-min-device-pixel-ratio: 2/1), only screen and (min-device-pixel-ratio: 2), only screen and (min-resolution: 192dpi), only screen and (min-resolution: 2dppx) { .logo-img-1x { display: none; } .logo-img-2x { display: inline-block; } } #suggestions { margin-top: 35px; color: #ccc; } #suggestions a { color: #66; font-weight: 200; font-size: 14px; margin: 0 10px; } Whoa there! You have exceeded a secondary rate limit. Please wait a few minutes before you try again; in some cases this may take up to an hour. https://support.github.com/contact";>Contact Support — https://githubstatus.com";>GitHub Status — https://twitter.com/githubstatus";>@githubstatus ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][core] Fix getting summary of a variable pointing to r/o memory (PR #139196)
igorkudrin wrote: Yes, the program file contains the debug information and the read-only section with the data, so both the core and program files are required. And there are no core files with the same properties already committed. The program is built from the existing `altmain.c`. https://github.com/llvm/llvm-project/pull/139196 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits