[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
https://github.com/wangleiat edited https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
@@ -36,9 +36,32 @@ 0xa03 /* LoongArch Advanced SIMD eXtension registers */ #endif +#ifndef NT_LOONGARCH_HW_BREAK +#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */ +#endif + +#ifndef NT_LOONGARCH_HW_WATCH +#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ +#endif + #define REG_CONTEXT_SIZE \ (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx)) +/* + * In order to avoid undefined or redefined error, just add a new struct + * loongarch_user_watch_state in LLDB which is same with the uapi struct + * user_watch_state_v2. + */ wangleiat wrote: https://llvm.org/docs/CodingStandards.html#comment-formatting In general, prefer C++-style comments // . https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
https://github.com/wangleiat approved this pull request. LGTM, execpt for the comment style. https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Breakpoint] Allow whitespace in breakpoint address expression (PR #126053)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/126053 Setting a breakpoint on ` + ` used to work until `2c76e88e9eb284d17cf409851fb01f1d583bb22a`, where this regex was reworked. Now we only accept `+ `. This patch fixes the regression by adding yet another `[[:space:]]*` component to the regex. One could probably simplify the regex (or even replace the regex by just calling the relevent `consumeXXX` APIs on `llvm::StringRef`). Though I left that for the future. rdar://130780342 >From 659a383f00011ecbf88163d15719eff9661742a7 Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Thu, 6 Feb 2025 11:44:50 + Subject: [PATCH] [lldb][Breakpoint] Allow whitespace in breakpoint address expression Setting a breakpoint on ` + ` used to work until `2c76e88e9eb284d17cf409851fb01f1d583bb22a`, where this regex was reworked. Now we only accept `+ `. This patch fixes the regression by adding yet another `[[:space:]]*` component to the regex. One could probably simplify the regex (or even replace the regex by just calling the relevent `consumeXXX` APIs on `llvm::StringRef`). Though I left that for the future. rdar://130780342 --- lldb/source/Interpreter/OptionArgParser.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp index 800f22b6169dc62..2d393a57452ee56 100644 --- a/lldb/source/Interpreter/OptionArgParser.cpp +++ b/lldb/source/Interpreter/OptionArgParser.cpp @@ -262,8 +262,10 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, // 3: The symbol/reg name if there is an offset // 4: +/- // 5: The offset value. + // clang-format off static RegularExpression g_symbol_plus_offset_regex( - "^(\\$[^ +-]+)|(([^ +-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$"); + "^(\\$[^ +-]+)|(([^ +-]+)[[:space:]]*([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$"); + // clang-format on llvm::SmallVector matches; if (g_symbol_plus_offset_regex.Execute(sref, &matches)) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Breakpoint] Allow whitespace in breakpoint address expression (PR #126053)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes Setting a breakpoint on `+ ` used to work until `2c76e88e9eb284d17cf409851fb01f1d583bb22a`, where this regex was reworked. Now we only accept ` + `. This patch fixes the regression by adding yet another `[[:space:]]*` component to the regex. One could probably simplify the regex (or even replace the regex by just calling the relevent `consumeXXX` APIs on `llvm::StringRef`). Though I left that for the future. rdar://130780342 --- Full diff: https://github.com/llvm/llvm-project/pull/126053.diff 1 Files Affected: - (modified) lldb/source/Interpreter/OptionArgParser.cpp (+3-1) ``diff diff --git a/lldb/source/Interpreter/OptionArgParser.cpp b/lldb/source/Interpreter/OptionArgParser.cpp index 800f22b6169dc62..2d393a57452ee56 100644 --- a/lldb/source/Interpreter/OptionArgParser.cpp +++ b/lldb/source/Interpreter/OptionArgParser.cpp @@ -262,8 +262,10 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, // 3: The symbol/reg name if there is an offset // 4: +/- // 5: The offset value. + // clang-format off static RegularExpression g_symbol_plus_offset_regex( - "^(\\$[^ +-]+)|(([^ +-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$"); + "^(\\$[^ +-]+)|(([^ +-]+)[[:space:]]*([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$"); + // clang-format on llvm::SmallVector matches; if (g_symbol_plus_offset_regex.Execute(sref, &matches)) { `` https://github.com/llvm/llvm-project/pull/126053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
@@ -36,9 +36,30 @@ 0xa03 /* LoongArch Advanced SIMD eXtension registers */ #endif +#ifndef NT_LOONGARCH_HW_BREAK +#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */ +#endif + +#ifndef NT_LOONGARCH_HW_WATCH +#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ +#endif + #define REG_CONTEXT_SIZE \ (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx)) +// In order to avoid undefined or redefined error, just add a new struct +// loongarch_user_watch_state in LLDB which is same with the uapi struct +// user_watch_state_v2. +struct loongarch_user_watch_state { SixWeining wrote: Seems the code indent is inappropriate. https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
https://github.com/SixWeining commented: LGTM with a nit. LLVM uses squash merge. If you'd to keep the 2 commits, please summit 2 PRs. https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
https://github.com/SixWeining edited https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] feb5a77 - [lldb] Add SymbolContext::GetFunctionOrSymbolAddress (#123340)
Author: Pavel Labath Date: 2025-02-06T09:12:44+01:00 New Revision: feb5a77d700f46d6638f073d411cbe0d8a924fdf URL: https://github.com/llvm/llvm-project/commit/feb5a77d700f46d6638f073d411cbe0d8a924fdf DIFF: https://github.com/llvm/llvm-project/commit/feb5a77d700f46d6638f073d411cbe0d8a924fdf.diff LOG: [lldb] Add SymbolContext::GetFunctionOrSymbolAddress (#123340) Many uses of SC::GetAddressRange were not interested in the range, but in the address of the function/symbol contained inside the symbol context. They were getting that by calling the GetBaseAddress on the returned range, which worked well enough so far, but isn't compatible with discontinuous functions, whose address (entry point) may not be the lowest address in the range. To resolve this problem, this PR creates a new function whose purpose is return the address of the function or symbol inside the symbol context. It also changes all of the callers of GetAddressRange which do not actually care about the range to call this function instead. Added: Modified: lldb/include/lldb/Symbol/SymbolContext.h lldb/source/Commands/CommandObjectTarget.cpp lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp lldb/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp lldb/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp lldb/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp lldb/source/Plugins/SystemRuntime/MacOSX/SystemRuntimeMacOSX.cpp lldb/source/Symbol/SymbolContext.cpp Removed: diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index 07769cd8dffae7e..69fbe544c73cd25 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -165,8 +165,8 @@ class SymbolContext { /// eSymbolContextSymbol is set in \a scope /// /// \param[in] scope - /// A mask of symbol context bits telling this function which - /// address ranges it can use when trying to extract one from + /// A mask bits from the \b SymbolContextItem enum telling this function + /// which address ranges it can use when trying to extract one from /// the valid (non-nullptr) symbol context classes. /// /// \param[in] range_idx @@ -192,6 +192,13 @@ class SymbolContext { bool GetAddressRange(uint32_t scope, uint32_t range_idx, bool use_inline_block_range, AddressRange &range) const; + /// Get the address of the function or symbol represented by this symbol + /// context. + /// + /// If both fields are present, the address of the function is returned. If + /// both are empty, the result is an invalid address. + Address GetFunctionOrSymbolAddress() const; + llvm::Error GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range); diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index d8265e41a7384eb..d0092c237b4c963 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -1621,12 +1621,15 @@ static void DumpSymbolContextList( if (!first_module) strm.EOL(); -AddressRange range; - -sc.GetAddressRange(eSymbolContextEverything, 0, true, range); +Address addr; +if (sc.line_entry.IsValid()) + addr = sc.line_entry.range.GetBaseAddress(); +else if (sc.block && sc.block->GetContainingInlinedBlock()) + sc.block->GetContainingInlinedBlock()->GetStartAddress(addr); +else + addr = sc.GetFunctionOrSymbolAddress(); -DumpAddress(exe_scope, range.GetBaseAddress(), verbose, all_ranges, strm, -settings); +DumpAddress(exe_scope, addr, verbose, all_ranges, strm, settings); first_module = false; } strm.IndentLess(); @@ -3570,16 +3573,13 @@ class CommandObjectTargetModulesShowUnwind : public CommandObjectParsed { continue; if (!sc.module_sp || sc.module_sp->GetObjectFile() == nullptr) continue; - AddressRange range; - if (!sc.GetAddressRange(eSymbolContextFunction | eSymbolContextSymbol, 0, - false, range)) -continue; - if (!range.GetBaseAddress().IsValid()) + Address addr = sc.GetFunctionOrSymbolAddress(); + if (!addr.IsValid()) continue; ConstString funcname(sc.GetFunctionName()); if (funcname.IsEmpty()) continue; - addr_t start_addr = range.GetBaseAddress().GetLoadAddress(target); + addr_t start_addr = addr.GetLoadAddress(target); if (abi) start_addr = abi->FixCodeAddress(start_addr); diff --git a/lldb/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp b/lldb/source/Pl
[Lldb-commits] [lldb] [lldb] Add SymbolContext::GetFunctionOrSymbolAddress (PR #123340)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/123340 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Breakpoint] Allow whitespace in breakpoint address expression (PR #126053)
https://github.com/Michael137 edited https://github.com/llvm/llvm-project/pull/126053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
https://github.com/seehearfeel updated https://github.com/llvm/llvm-project/pull/126020 >From 26442e37bf33c529b3177bf81bf59df644ad0af9 Mon Sep 17 00:00:00 2001 From: Tiezhu Yang Date: Thu, 23 Jan 2025 15:30:20 +0800 Subject: [PATCH 1/2] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK,WATCH} On some OS distros such as LoongArch Fedora 38 mate-5 [1], there are no macro definitions NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH in the system header, then there exist some errors when building LLDB on LoongArch. (1) Description of Problem: llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:529:16: error: 'NT_LOONGARCH_HW_WATCH' was not declared in this scope; did you mean 'NT_LOONGARCH_LBT'? 529 | int regset = NT_LOONGARCH_HW_WATCH; |^ |NT_LOONGARCH_LBT llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:543:12: error: 'NT_LOONGARCH_HW_BREAK' was not declared in this scope; did you mean 'NT_LOONGARCH_CSR'? 543 | regset = NT_LOONGARCH_HW_BREAK; |^ |NT_LOONGARCH_CSR (2) Steps to Reproduce: git clone https://github.com/llvm/llvm-project.git mkdir -p llvm-project/llvm/build && cd llvm-project/llvm/build cmake .. -G "Ninja" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_BUILD_RUNTIME=OFF \ -DLLVM_ENABLE_PROJECTS="clang;lldb" \ -DCMAKE_INSTALL_PREFIX=/usr/local/llvm \ -DLLVM_TARGETS_TO_BUILD="LoongArch" \ -DLLVM_HOST_TRIPLE=loongarch64-redhat-linux ninja (3) Additional Info: Maybe there are no problems on the OS distros with newer glibc devel library, so this issue is related with OS distros. (4) Root Cause Analysis: This is because the related Linux kernel commit [2] was merged in 2023-02-25 and the glibc devel library has some delay with kernel, the glibc version of specified OS distros is not updated in time. (5) Final Solution: One way is to ask the maintainer of OS distros to update glibc devel library, but it is better to not depend on the glibc version. In order to avoid the build errors, just define NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH in LLDB if there are no these definitions in the system header. [1] https://mirrors.wsyu.edu.cn/fedora/linux/development/rawhide/Everything/loongarch64/iso/livecd-fedora-mate-5.loongarch64.iso [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a69f7a161a7 Signed-off-by: Tiezhu Yang --- .../Linux/NativeRegisterContextLinux_loongarch64.cpp | 8 1 file changed, 8 insertions(+) diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp index b04018ee243fd7d..889c2083aa5b9b2 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp @@ -36,6 +36,14 @@ 0xa03 /* LoongArch Advanced SIMD eXtension registers */ #endif +#ifndef NT_LOONGARCH_HW_BREAK +#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */ +#endif + +#ifndef NT_LOONGARCH_HW_WATCH +#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ +#endif + #define REG_CONTEXT_SIZE \ (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx)) >From 4d0c7f40803a8ba67295d68b5836f233d642962c Mon Sep 17 00:00:00 2001 From: Tiezhu Yang Date: Thu, 6 Feb 2025 15:10:59 +0800 Subject: [PATCH 2/2] [LLDB][LoongArch] Extend the maximum number of watchpoints The maximum number of load/store watchpoints and fetch instruction watchpoints is 14 each according to LoongArch Reference Manual [1], so extend the maximum number of watchpoints from 8 to 14 for ptrace. A new struct user_watch_state_v2 was added into uapi in the related kernel commit 531936dee53e ("LoongArch: Extend the maximum number of watchpoints") [2], but there may be no struct user_watch_state_v2 in the system header in time. In order to avoid undefined or redefined error, just add a new struct loongarch_user_watch_state in LLDB which is same with the uapi struct user_watch_state_v2, then replace the current user_watch_state with loongarch_user_watch_state. [1] https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html#control-and-status-registers-related-to-watchpoints [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=531936dee53e Signed-off-by: Tiezhu Yang --- .../NativeRegisterContextLinux_loongarch64.cpp | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_
[Lldb-commits] [lldb] [llvm] [NFC][DebugInfo] Make some block-start-position methods return iterators (PR #124287)
SLTozer wrote: The approach sounds reasonable enough to me that it's probably best to open a PR and continue discussion there - the C API is a bit of a special case, so it might warrant bringing in people who know more about it (and actually consume it) if a change is necessary, but I suspect the best option will be to just make them compile without deprecation warnings (as you've done) and try to ensure that consumers are warned of how to not use them incorrectly. https://github.com/llvm/llvm-project/pull/124287 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] s/GetAddressRange().GetBaseAddress()/GetAddress() (PR #125847)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/125847 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0cfb98f - [lldb] s/GetAddressRange().GetBaseAddress()/GetAddress() (#125847)
Author: Pavel Labath Date: 2025-02-06T09:17:50+01:00 New Revision: 0cfb98f871b6bc82691b5aa85b20703de1621875 URL: https://github.com/llvm/llvm-project/commit/0cfb98f871b6bc82691b5aa85b20703de1621875 DIFF: https://github.com/llvm/llvm-project/commit/0cfb98f871b6bc82691b5aa85b20703de1621875.diff LOG: [lldb] s/GetAddressRange().GetBaseAddress()/GetAddress() (#125847) Three more cases where it's obvious that the code is looking for the address of the function entry point. Added: Modified: lldb/source/API/SBFunction.cpp lldb/source/Core/FormatEntity.cpp lldb/source/Core/SourceManager.cpp Removed: diff --git a/lldb/source/API/SBFunction.cpp b/lldb/source/API/SBFunction.cpp index d07594c2e8c0105..19861f6af3645e4 100644 --- a/lldb/source/API/SBFunction.cpp +++ b/lldb/source/API/SBFunction.cpp @@ -144,7 +144,7 @@ SBAddress SBFunction::GetStartAddress() { SBAddress addr; if (m_opaque_ptr) -addr.SetAddress(m_opaque_ptr->GetAddressRange().GetBaseAddress()); +addr.SetAddress(m_opaque_ptr->GetAddress()); return addr; } diff --git a/lldb/source/Core/FormatEntity.cpp b/lldb/source/Core/FormatEntity.cpp index fb7043ac74b8ddc..7fe22994d7f7ee5 100644 --- a/lldb/source/Core/FormatEntity.cpp +++ b/lldb/source/Core/FormatEntity.cpp @@ -450,7 +450,7 @@ static bool DumpAddressOffsetFromFunction(Stream &s, const SymbolContext *sc, if (sc) { if (sc->function) { -func_addr = sc->function->GetAddressRange().GetBaseAddress(); +func_addr = sc->function->GetAddress(); if (sc->block && !concrete_only) { // Check to make sure we aren't in an inline function. If we are, use // the inline block range that contains "format_addr" since blocks @@ -468,7 +468,7 @@ static bool DumpAddressOffsetFromFunction(Stream &s, const SymbolContext *sc, if (func_addr.IsValid()) { const char *addr_offset_padding = no_padding ? "" : " "; - if (func_addr.GetSection() == format_addr.GetSection()) { + if (func_addr.GetModule() == format_addr.GetModule()) { addr_t func_file_addr = func_addr.GetFileAddress(); addr_t addr_file_addr = format_addr.GetFileAddress(); if (addr_file_addr > func_file_addr || diff --git a/lldb/source/Core/SourceManager.cpp b/lldb/source/Core/SourceManager.cpp index 27a9edeef4249e0..d63d42de14e8019 100644 --- a/lldb/source/Core/SourceManager.cpp +++ b/lldb/source/Core/SourceManager.cpp @@ -435,9 +435,8 @@ SourceManager::GetDefaultFileAndLine() { for (const SymbolContext &sc : sc_list) { if (sc.function) { lldb_private::LineEntry line_entry; -if (sc.function->GetAddressRange() -.GetBaseAddress() -.CalculateSymbolContextLineEntry(line_entry)) { +if (sc.function->GetAddress().CalculateSymbolContextLineEntry( +line_entry)) { SetDefaultFileAndLine(line_entry.file_sp, line_entry.line); return SupportFileAndLine(line_entry.file_sp, m_last_line); } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
https://github.com/DavidSpickett requested changes to this pull request. I see that the basics of this were added 2 years ago - https://github.com/torvalds/linux/commit/1a69f7a161a78aead07cd4b811d796950e892fa4. So I assume the build error here is not that NT_LOONGARCH_HW_BREAK is not defined, it's that user_watch_state got redefined? Please explain all this in the PR *description*. GitHub does not use the contents of the commit messages for the final commit. Link to kernel commits as well, that will be easier than writing out the same justifications again. Also include something in the title so it's like "Fix build errors with user_watch_v2". If you need to find this commit again, that will help you a lot. I'd like to know what your intent is with supporting older kernels, if at all. Given that this new structure is not the same size as the other one, or is it? A `pad` was added but perhaps that just made the existing compiler padding explicit? (I don't care if you do support older kernels or not, but let's get the intent documented) https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
https://github.com/DavidSpickett edited https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
@@ -36,9 +36,30 @@ 0xa03 /* LoongArch Advanced SIMD eXtension registers */ #endif +#ifndef NT_LOONGARCH_HW_BREAK +#define NT_LOONGARCH_HW_BREAK 0xa05 /* LoongArch hardware breakpoint registers */ +#endif + +#ifndef NT_LOONGARCH_HW_WATCH +#define NT_LOONGARCH_HW_WATCH 0xa06 /* LoongArch hardware watchpoint registers */ +#endif + #define REG_CONTEXT_SIZE \ (GetGPRSize() + GetFPRSize() + sizeof(m_lsx) + sizeof(m_lasx)) +// In order to avoid undefined or redefined error, just add a new struct +// loongarch_user_watch_state in LLDB which is same with the uapi struct +// user_watch_state_v2. DavidSpickett wrote: This comment needs to give more context, explain what came before, which one lldb uses and the consequences of that re. support for older kernels or not. https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors and extend watchpoint numbers (PR #126020)
DavidSpickett wrote: > So I assume the build error here is not that NT_LOONGARCH_HW_BREAK is not > defined, it's that user_watch_state got redefined? And if so, why are you adding a redefinition of it? This would only help if you are building lldb against kernel headers from before a time where the kernel had hardware watchpoint support. Which could be a valid use case, I'm not sure. But is that in fact the use case here? https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)
hokein wrote: Heads-up: this patch triggers a MSAN failure in an lldb test (`lldb/test/API/commands/expression/call-function/TestCallStdStringFunction.py`), the stacktrace: ``` ==5633==WARNING: MemorySanitizer: use-of-uninitialized-value #0 in decltype(auto) clang::ASTNodeImporter::CallOverloadedCreateFun::operator()&, bool, clang::ClassTemplateSpecializationDecl*&>(clang::ASTContext&, clang::TagTypeKind&&, clang::DeclContext*&, clang::SourceLocation&, clang::SourceLocation&, clang::ClassTemplateDecl*&, llvm::SmallVector&, bool&&, clang::ClassTemplateSpecializationDecl*&) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:234:16 #1 in bool clang::ASTNodeImporter::GetImportedOrCreateSpecialDecl, clang::ClassTemplateSpecializationDecl, clang::ASTContext&, clang::TagTypeKind, clang::DeclContext*&, clang::SourceLocation&, clang::SourceLocation&, clang::ClassTemplateDecl*&, llvm::SmallVector&, bool, clang::ClassTemplateSpecializationDecl*&>(clang::ClassTemplateSpecializationDecl*&, clang::ASTNodeImporter::CallOverloadedCreateFun, clang::ClassTemplateSpecializationDecl*, clang::ASTContext&, clang::TagTypeKind&&, clang::DeclContext*&, clang::SourceLocation&, clang::SourceLocation&, clang::ClassTemplateDecl*&, llvm::SmallVector&, bool&&, clang::ClassTemplateSpecializationDecl*&) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:281:13 #2 in GetImportedOrCreateDecl &, bool, clang::ClassTemplateSpecializationDecl *&> llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:251:14 #3 in clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:6323:9 #4 in clang::declvisitor::Base>::Visit(clang::Decl*) llvm/llvm-project/clang/include/clang/AST/DeclNodes.inc #5 in clang::ASTImporter::ImportImpl(clang::Decl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9126:19 #6 in lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) llvm/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:1134:23 #7 in clang::ASTImporter::Import(clang::Decl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9521:27 #8 in std::__msan::conditional, llvm::Expected, llvm::Expected>::type clang::ASTNodeImporter::import(clang::RecordDecl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:203:31 #9 in clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:1559:40 #10 in clang::TypeVisitor>::Visit(clang::Type const*) llvm/llvm-project/clang/include/clang/AST/TypeNodes.inc:76:1 #11 in clang::ASTImporter::Import(clang::Type const*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9157:36 #12 in clang::ASTImporter::Import(clang::QualType) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9171:31 #13 in import llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:217:23 #14 in llvm::Expected clang::ASTNodeImporter::import(clang::TemplateArgument const&) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:832:32 #15 in clang::ASTNodeImporter::ImportTemplateArguments(llvm::ArrayRef, llvm::SmallVectorImpl&) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:2453:24 #16 in clang::ASTNodeImporter::VisitClassTemplateSpecializationDecl(clang::ClassTemplateSpecializationDecl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:6219:11 #17 in clang::declvisitor::Base>::Visit(clang::Decl*) llvm/llvm-project/clang/include/clang/AST/DeclNodes.inc #18 in clang::ASTImporter::ImportImpl(clang::Decl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9126:19 #19 in lldb_private::ClangASTImporter::ASTImporterDelegate::ImportImpl(clang::Decl*) llvm/llvm-project/lldb/source/Plugins/ExpressionParser/Clang/ClangASTImporter.cpp:1134:23 #20 in clang::ASTImporter::Import(clang::Decl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9521:27 #21 in std::__msan::conditional, llvm::Expected, llvm::Expected>::type clang::ASTNodeImporter::import(clang::RecordDecl*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:203:31 #22 in clang::ASTNodeImporter::VisitRecordType(clang::RecordType const*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:1559:40 #23 in clang::TypeVisitor>::Visit(clang::Type const*) llvm/llvm-project/clang/include/clang/AST/TypeNodes.inc:76:1 #24 in clang::ASTImporter::Import(clang::Type const*) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9157:36 #25 in clang::ASTImporter::Import(clang::QualType) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:9171:31 #26 in import llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:217:23 #27 in clang::QualType clang::ASTNodeImporter::importChecked(llvm::Error&, clang::QualType const&) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:692:30 #28 in clang::ASTNodeImporter::VisitTypedefNameDecl(clang::TypedefNameDecl*, bool) llvm/llvm-project/clang/lib/AST/ASTImporter.cpp:2823:27 #29 in VisitTyped
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/116392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)
@@ -5058,72 +5018,187 @@ int main(int argc, char *argv[]) { auto terminate_debugger = llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); }); - StreamDescriptor input; - StreamDescriptor output; - std::FILE *redirectOut = nullptr; - std::FILE *redirectErr = nullptr; - if (portno != -1) { -printf("Listening on port %i...\n", portno); -SOCKET socket_fd = AcceptConnection(log.get(), portno); -if (socket_fd < 0) + std::vector pre_init_commands; + for (const std::string &arg : + input_args.getAllArgValues(OPT_pre_init_command)) { +pre_init_commands.push_back(arg); + } + + if (!connection.empty()) { +auto maybeProtoclAndName = validateConnection(connection); +if (auto Err = maybeProtoclAndName.takeError()) { + llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), + "Invalid connection: "); return EXIT_FAILURE; +} -input = StreamDescriptor::from_socket(socket_fd, true); -output = StreamDescriptor::from_socket(socket_fd, false); - } else { -#if defined(_WIN32) -// Windows opens stdout and stdin in text mode which converts \n to 13,10 -// while the value is just 10 on Darwin/Linux. Setting the file mode to -// binary fixes this. -int result = _setmode(fileno(stdout), _O_BINARY); -assert(result); -result = _setmode(fileno(stdin), _O_BINARY); -UNUSED_IF_ASSERT_DISABLED(result); -assert(result); -#endif +Socket::SocketProtocol protocol; +std::string name; +std::tie(protocol, name) = *maybeProtoclAndName; -int stdout_fd = DuplicateFileDescriptor(fileno(stdout)); -if (stdout_fd == -1) { - llvm::logAllUnhandledErrors( - llvm::errorCodeToError(llvm::errnoAsErrorCode()), llvm::errs(), - "Failed to configure stdout redirect: "); +Status error; +static std::unique_ptr listener = Socket::Create(protocol, error); +if (error.Fail()) { + llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(), + "Failed to create socket listener: "); return EXIT_FAILURE; } -redirectOut = stdout; -redirectErr = stderr; +error = listener->Listen(name, /*backlog=*/5); +if (error.Fail()) { + llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(), + "Failed to listen for connections: "); + return EXIT_FAILURE; +} + +std::string address = +llvm::join(listener->GetListeningConnectionURI(), ", "); +if (log) + *log << "started with connection listeners " << address << "\n"; + +llvm::outs() << "Listening for: " << address << "\n"; +// Ensure listening address are flushed for calles to retrieve the resolve +// address. +llvm::outs().flush(); + +static lldb_private::MainLoop g_loop; +llvm::sys::SetInterruptFunction([]() { + g_loop.AddPendingCallback( + [](lldb_private::MainLoopBase &loop) { loop.RequestTermination(); }); +}); +std::mutex active_dap_sessions_mutext; +std::set active_dap_sessions; +unsigned int clientCount = 0; +auto handle = listener->Accept(g_loop, [=, &active_dap_sessions_mutext, +&active_dap_sessions, &clientCount, +log = log.get()]( + std::unique_ptr sock) { + std::string name = llvm::formatv("client_{0}", clientCount++).str(); + if (log) { +auto now = std::chrono::duration( +std::chrono::system_clock::now().time_since_epoch()); +*log << llvm::formatv("{0:f9}", now.count()).str() + << " client connected: " << name << "\n"; + } + + // Move the client into a background thread to unblock accepting the next + // client. + std::thread client([=, &active_dap_sessions_mutext, &active_dap_sessions, + sock = std::move(sock)]() { +llvm::set_thread_name(name + ".runloop"); +StreamDescriptor input = +StreamDescriptor::from_socket(sock->GetNativeSocket(), false); +// Close the output last for the best chance at error reporting. +StreamDescriptor output = +StreamDescriptor::from_socket(sock->GetNativeSocket(), false); +DAP dap = DAP(name, program_path, log, std::move(input), + std::move(output), default_repl_mode, pre_init_commands); + +if (auto Err = dap.ConfigureIO()) { + llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), + "Failed to configure stdout redirect: "); + return; +} + +RegisterRequestCallbacks(dap); + +{ + std::scoped_lock lock(active_dap_sessions_mutext); + active_dap_sessions.insert(&dap); +} + +if (auto Err = dap.Loop()) { + llvm::logAllUnhandledErrors(std::move(Err), l
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)
@@ -5058,72 +5018,187 @@ int main(int argc, char *argv[]) { auto terminate_debugger = llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); }); - StreamDescriptor input; - StreamDescriptor output; - std::FILE *redirectOut = nullptr; - std::FILE *redirectErr = nullptr; - if (portno != -1) { -printf("Listening on port %i...\n", portno); -SOCKET socket_fd = AcceptConnection(log.get(), portno); -if (socket_fd < 0) + std::vector pre_init_commands; + for (const std::string &arg : + input_args.getAllArgValues(OPT_pre_init_command)) { +pre_init_commands.push_back(arg); + } + + if (!connection.empty()) { +auto maybeProtoclAndName = validateConnection(connection); +if (auto Err = maybeProtoclAndName.takeError()) { + llvm::logAllUnhandledErrors(std::move(Err), llvm::errs(), + "Invalid connection: "); return EXIT_FAILURE; +} -input = StreamDescriptor::from_socket(socket_fd, true); -output = StreamDescriptor::from_socket(socket_fd, false); - } else { -#if defined(_WIN32) -// Windows opens stdout and stdin in text mode which converts \n to 13,10 -// while the value is just 10 on Darwin/Linux. Setting the file mode to -// binary fixes this. -int result = _setmode(fileno(stdout), _O_BINARY); -assert(result); -result = _setmode(fileno(stdin), _O_BINARY); -UNUSED_IF_ASSERT_DISABLED(result); -assert(result); -#endif +Socket::SocketProtocol protocol; +std::string name; +std::tie(protocol, name) = *maybeProtoclAndName; -int stdout_fd = DuplicateFileDescriptor(fileno(stdout)); -if (stdout_fd == -1) { - llvm::logAllUnhandledErrors( - llvm::errorCodeToError(llvm::errnoAsErrorCode()), llvm::errs(), - "Failed to configure stdout redirect: "); +Status error; +static std::unique_ptr listener = Socket::Create(protocol, error); +if (error.Fail()) { + llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(), + "Failed to create socket listener: "); return EXIT_FAILURE; } -redirectOut = stdout; -redirectErr = stderr; +error = listener->Listen(name, /*backlog=*/5); +if (error.Fail()) { + llvm::logAllUnhandledErrors(error.takeError(), llvm::errs(), + "Failed to listen for connections: "); + return EXIT_FAILURE; +} + +std::string address = +llvm::join(listener->GetListeningConnectionURI(), ", "); +if (log) + *log << "started with connection listeners " << address << "\n"; + +llvm::outs() << "Listening for: " << address << "\n"; +// Ensure listening address are flushed for calles to retrieve the resolve +// address. +llvm::outs().flush(); + +static lldb_private::MainLoop g_loop; +llvm::sys::SetInterruptFunction([]() { + g_loop.AddPendingCallback( + [](lldb_private::MainLoopBase &loop) { loop.RequestTermination(); }); +}); +std::mutex active_dap_sessions_mutext; labath wrote: ```suggestion std::mutex active_dap_sessions_mutex; ``` https://github.com/llvm/llvm-project/pull/116392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)
https://github.com/labath commented: Apart from the comment, this looks good to me. @vogelsgesang, @walter-erquinigo, any thoughts from you? https://github.com/llvm/llvm-project/pull/116392 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInvalid = 0, oontvoo wrote: done https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)
mizvekov wrote: > > > Actually, @mizvekov, can we make the > > > `ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl(ASTContext > > > &C, Kind DK)` constructor default initialize the `StrictPackMatch` > > > member to false? In that case users of `CreateDeserialized` wouldn't need > > > to worry about it being potentially uninitialized? Otherwise we'll have > > > to expose a setter and call it from LLDB > > > > > > On the ASTReader, we don't need a setter because it's friends with the > > class. > > > > > > I'd worry a little bit about leaving it always set to a fixed value, this > > could be a hard to track bug in the future for the lldb folks, even if it's > > probably not observable right now. > > > > Yea that's fair. Would you prefer us adding a setter for it then? And set it > to a fixed value from LLDB (until we have a better way to deal with it)? Sure, a setter is fine for me. I am not sure from what data you are populating the decl, but if it's like the ast import case, you can forward the flag from the original decl. If it's being formed from matching as-written template arguments, you can forward the result from CheckTemplateArgument. Otherwise if it's fully synthetic, I guess you can leave a comment explaining it. https://github.com/llvm/llvm-project/pull/125791 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)
Michael137 wrote: Actually, @mizvekov, can we make `ClassTemplatePartialSpecializationDecl(ASTContext&)` default initialize the `StrictPackMatch` member to false? In that case users of `CreateDeserialized` wouldn't need to worry about it being potentially uninitialized? Otherwise we'll have to expose a setter and call it from LLDB https://github.com/llvm/llvm-project/pull/125791 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)
mizvekov wrote: > Actually, @mizvekov, can we make the > `ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl(ASTContext > &C, Kind DK)` constructor default initialize the `StrictPackMatch` member to > false? In that case users of `CreateDeserialized` wouldn't need to worry > about it being potentially uninitialized? Otherwise we'll have to expose a > setter and call it from LLDB On the ASTReader, we don't need a setter because it's friends with the class. I'd worry a little bit about leaving it always set to a fixed value, this could be a hard to track bug in the future for the lldb folks, even if it's probably not observable right now. https://github.com/llvm/llvm-project/pull/125791 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)
Michael137 wrote: > > Actually, @mizvekov, can we make the > > `ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl(ASTContext > > &C, Kind DK)` constructor default initialize the `StrictPackMatch` member > > to false? In that case users of `CreateDeserialized` wouldn't need to worry > > about it being potentially uninitialized? Otherwise we'll have to expose a > > setter and call it from LLDB > > On the ASTReader, we don't need a setter because it's friends with the class. > > I'd worry a little bit about leaving it always set to a fixed value, this > could be a hard to track bug in the future for the lldb folks, even if it's > probably not observable right now. Yea that's fair. Would you prefer us adding a setter for it then? And set it to a fixed value from LLDB (until we have a better way to deal with it)? https://github.com/llvm/llvm-project/pull/125791 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add missing return statements in ThreadMemory (PR #126128)
https://github.com/felipepiovezan created https://github.com/llvm/llvm-project/pull/126128 These prevented ThreadMemory from correctly returning the Name/Queue/Info of the backing thread. Note about testing: this test only finds regressions if the system sets a name or queue for the backing thread. While this may not be true everywhere, it still provides coverage in some systems, e.g. in Apple platforms. >From 8f9cc6d461c1297633d41f4b05a4572a693c018c Mon Sep 17 00:00:00 2001 From: Felipe de Azevedo Piovezan Date: Thu, 6 Feb 2025 12:38:34 -0800 Subject: [PATCH] [lldb] Add missing return statements in ThreadMemory These prevented ThreadMemory from correctly returning the Name/Queue/Info of the backing thread. Note about testing: this test only finds regressions if the system sets a name or queue for the backing thread. While this may not be true everywhere, it still provides coverage in some systems, e.g. in Apple platforms. --- lldb/source/Plugins/Process/Utility/ThreadMemory.h | 6 +++--- .../plugins/python_os_plugin/TestPythonOSPlugin.py | 6 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h b/lldb/source/Plugins/Process/Utility/ThreadMemory.h index 1e309671e85c653..cebb31538eaf20c 100644 --- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h +++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h @@ -33,7 +33,7 @@ class ThreadMemory : public lldb_private::Thread { const char *GetInfo() override { if (m_backing_thread_sp) - m_backing_thread_sp->GetInfo(); + return m_backing_thread_sp->GetInfo(); return nullptr; } @@ -41,7 +41,7 @@ class ThreadMemory : public lldb_private::Thread { if (!m_name.empty()) return m_name.c_str(); if (m_backing_thread_sp) - m_backing_thread_sp->GetName(); + return m_backing_thread_sp->GetName(); return nullptr; } @@ -49,7 +49,7 @@ class ThreadMemory : public lldb_private::Thread { if (!m_queue.empty()) return m_queue.c_str(); if (m_backing_thread_sp) - m_backing_thread_sp->GetQueueName(); + return m_backing_thread_sp->GetQueueName(); return nullptr; } diff --git a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py index 3ad7539018d5d83..fe78edd98f4d4be 100644 --- a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py @@ -160,6 +160,8 @@ def run_python_os_step(self): ) self.assertTrue(process, PROCESS_IS_VALID) +core_thread_zero = process.GetThreadAtIndex(0) + # Make sure there are no OS plug-in created thread when we first stop # at our breakpoint in main thread = process.GetThreadByID(0x1) @@ -183,6 +185,10 @@ def run_python_os_step(self): thread.IsValid(), "Make sure there is a thread 0x1 after we load the python OS plug-in", ) +# This OS plugin does not set thread names / queue names, so it should +# inherit the core thread's name. +self.assertEqual(core_thread_zero.GetName(), thread.GetName()) +self.assertEqual(core_thread_zero.GetQueueName(), thread.GetQueueName()) frame = thread.GetFrameAtIndex(0) self.assertTrue( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add missing return statements in ThreadMemory (PR #126128)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Felipe de Azevedo Piovezan (felipepiovezan) Changes These prevented ThreadMemory from correctly returning the Name/Queue/Info of the backing thread. Note about testing: this test only finds regressions if the system sets a name or queue for the backing thread. While this may not be true everywhere, it still provides coverage in some systems, e.g. in Apple platforms. --- Full diff: https://github.com/llvm/llvm-project/pull/126128.diff 2 Files Affected: - (modified) lldb/source/Plugins/Process/Utility/ThreadMemory.h (+3-3) - (modified) lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py (+6) ``diff diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h b/lldb/source/Plugins/Process/Utility/ThreadMemory.h index 1e309671e85c653..cebb31538eaf20c 100644 --- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h +++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h @@ -33,7 +33,7 @@ class ThreadMemory : public lldb_private::Thread { const char *GetInfo() override { if (m_backing_thread_sp) - m_backing_thread_sp->GetInfo(); + return m_backing_thread_sp->GetInfo(); return nullptr; } @@ -41,7 +41,7 @@ class ThreadMemory : public lldb_private::Thread { if (!m_name.empty()) return m_name.c_str(); if (m_backing_thread_sp) - m_backing_thread_sp->GetName(); + return m_backing_thread_sp->GetName(); return nullptr; } @@ -49,7 +49,7 @@ class ThreadMemory : public lldb_private::Thread { if (!m_queue.empty()) return m_queue.c_str(); if (m_backing_thread_sp) - m_backing_thread_sp->GetQueueName(); + return m_backing_thread_sp->GetQueueName(); return nullptr; } diff --git a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py index 3ad7539018d5d83..fe78edd98f4d4be 100644 --- a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py @@ -160,6 +160,8 @@ def run_python_os_step(self): ) self.assertTrue(process, PROCESS_IS_VALID) +core_thread_zero = process.GetThreadAtIndex(0) + # Make sure there are no OS plug-in created thread when we first stop # at our breakpoint in main thread = process.GetThreadByID(0x1) @@ -183,6 +185,10 @@ def run_python_os_step(self): thread.IsValid(), "Make sure there is a thread 0x1 after we load the python OS plug-in", ) +# This OS plugin does not set thread names / queue names, so it should +# inherit the core thread's name. +self.assertEqual(core_thread_zero.GetName(), thread.GetName()) +self.assertEqual(core_thread_zero.GetQueueName(), thread.GetQueueName()) frame = thread.GetFrameAtIndex(0) self.assertTrue( `` https://github.com/llvm/llvm-project/pull/126128 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/oontvoo deleted https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)
https://github.com/augusto2112 updated https://github.com/llvm/llvm-project/pull/125143 >From ceb193ba178a3ec71824f8137ea648d70a5b0a79 Mon Sep 17 00:00:00 2001 From: Augusto Noronha Date: Thu, 30 Jan 2025 16:33:09 -0800 Subject: [PATCH] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host buffer ValueObjectDynamicValue::UpdateValue() assumes that the dynamic type found by GetDynamicTypeAndAddress() would return an address in the inferior. This commit makes it so it can deal with being passed a host address instead. This is needed downstream by the Swift fork. rdar://143357274 --- lldb/include/lldb/Target/LanguageRuntime.h| 16 +- lldb/include/lldb/ValueObject/ValueObject.h | 12 + .../ItaniumABI/ItaniumABILanguageRuntime.cpp | 2 +- .../ItaniumABI/ItaniumABILanguageRuntime.h| 4 +- .../AppleObjCRuntime/AppleObjCRuntime.cpp | 2 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntime.h | 4 +- .../AppleObjCRuntime/AppleObjCRuntimeV1.cpp | 2 +- .../AppleObjCRuntime/AppleObjCRuntimeV1.h | 4 +- .../AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 2 +- .../AppleObjCRuntime/AppleObjCRuntimeV2.h | 4 +- .../GNUstepObjCRuntime/GNUstepObjCRuntime.cpp | 2 +- .../GNUstepObjCRuntime/GNUstepObjCRuntime.h | 4 +- lldb/source/ValueObject/ValueObject.cpp | 16 ++ .../ValueObject/ValueObjectDynamicValue.cpp | 44 +++- .../TestingSupport/Symbol/ClangTestUtils.h| 22 +- lldb/unittests/ValueObject/CMakeLists.txt | 1 + .../DynamicValueObjectLocalBuffer.cpp | 244 ++ 17 files changed, 344 insertions(+), 41 deletions(-) create mode 100644 lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index 4a0214b04e235e6..f9ae2dc5896329c 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -105,12 +105,16 @@ class LanguageRuntime : public Runtime, public PluginInterface { "language doesn't support getting vtable information"); } - // this call should return true if it could set the name and/or the type - virtual bool GetDynamicTypeAndAddress(ValueObject &in_value, -lldb::DynamicValueType use_dynamic, -TypeAndOrName &class_type_or_name, -Address &address, -Value::ValueType &value_type) = 0; + /// This call should return true if it could set the name and/or the type + /// Sets address to the address of the dynamic type if value_type is set to + /// a file or load address. Sets local_buffer to a buffer containing the data + /// of the dynamic type if value_type is set to a host address. Callers should + /// copy local_buffer over into their own buffer if they want to keep the data + /// alive. + virtual bool GetDynamicTypeAndAddress( + ValueObject &in_value, lldb::DynamicValueType use_dynamic, + TypeAndOrName &class_type_or_name, Address &address, + Value::ValueType &value_type, llvm::ArrayRef &local_buffer) = 0; // This call should return a CompilerType given a generic type name and an // ExecutionContextScope in which one can actually fetch any specialization diff --git a/lldb/include/lldb/ValueObject/ValueObject.h b/lldb/include/lldb/ValueObject/ValueObject.h index 4f77384bb8f1361..c8d5c2723106d6d 100644 --- a/lldb/include/lldb/ValueObject/ValueObject.h +++ b/lldb/include/lldb/ValueObject/ValueObject.h @@ -865,6 +865,18 @@ class ValueObject { virtual void SetLanguageFlags(uint64_t flags) { m_language_flags = flags; } + /// Returns the size of the local buffer if it's available. + /// \return + /// The size of the local buffer if this value object's value points to a + /// host address, and if that size can be determined. Otherwise, returns + /// LLDB_INVALID_ADDRESS. + /// + /// TODO: Because a ValueObject's Value can point to any arbitrary memory + /// location, it is possible that the size of the local buffer can't be + /// determined at all. See the comment in Value::m_value for a more thorough + /// explanation of why that is. + uint64_t GetLocalBufferSize(); + protected: typedef ClusterManager ValueObjectManager; diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 66cdab1307ce9b9..8faf7135217acfa 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -289,7 +289,7 @@ llvm::Expected bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress( ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_
[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)
https://github.com/augusto2112 updated https://github.com/llvm/llvm-project/pull/125143 >From e8124c1949a1957befd58a045c0e36f4f6e09274 Mon Sep 17 00:00:00 2001 From: Augusto Noronha Date: Thu, 30 Jan 2025 16:33:09 -0800 Subject: [PATCH] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host buffer ValueObjectDynamicValue::UpdateValue() assumes that the dynamic type found by GetDynamicTypeAndAddress() would return an address in the inferior. This commit makes it so it can deal with being passed a host address instead. This is needed downstream by the Swift fork. rdar://143357274 --- lldb/include/lldb/Target/LanguageRuntime.h| 16 +- lldb/include/lldb/ValueObject/ValueObject.h | 12 + .../ItaniumABI/ItaniumABILanguageRuntime.cpp | 2 +- .../ItaniumABI/ItaniumABILanguageRuntime.h| 4 +- .../AppleObjCRuntime/AppleObjCRuntime.cpp | 2 +- .../ObjC/AppleObjCRuntime/AppleObjCRuntime.h | 4 +- .../AppleObjCRuntime/AppleObjCRuntimeV1.cpp | 2 +- .../AppleObjCRuntime/AppleObjCRuntimeV1.h | 4 +- .../AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 2 +- .../AppleObjCRuntime/AppleObjCRuntimeV2.h | 4 +- .../GNUstepObjCRuntime/GNUstepObjCRuntime.cpp | 2 +- .../GNUstepObjCRuntime/GNUstepObjCRuntime.h | 4 +- lldb/source/ValueObject/ValueObject.cpp | 16 ++ .../ValueObject/ValueObjectDynamicValue.cpp | 44 +++- .../TestingSupport/Symbol/ClangTestUtils.h| 22 +- lldb/unittests/ValueObject/CMakeLists.txt | 1 + .../DynamicValueObjectLocalBuffer.cpp | 243 ++ 17 files changed, 343 insertions(+), 41 deletions(-) create mode 100644 lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp diff --git a/lldb/include/lldb/Target/LanguageRuntime.h b/lldb/include/lldb/Target/LanguageRuntime.h index 4a0214b04e235e6..f9ae2dc5896329c 100644 --- a/lldb/include/lldb/Target/LanguageRuntime.h +++ b/lldb/include/lldb/Target/LanguageRuntime.h @@ -105,12 +105,16 @@ class LanguageRuntime : public Runtime, public PluginInterface { "language doesn't support getting vtable information"); } - // this call should return true if it could set the name and/or the type - virtual bool GetDynamicTypeAndAddress(ValueObject &in_value, -lldb::DynamicValueType use_dynamic, -TypeAndOrName &class_type_or_name, -Address &address, -Value::ValueType &value_type) = 0; + /// This call should return true if it could set the name and/or the type + /// Sets address to the address of the dynamic type if value_type is set to + /// a file or load address. Sets local_buffer to a buffer containing the data + /// of the dynamic type if value_type is set to a host address. Callers should + /// copy local_buffer over into their own buffer if they want to keep the data + /// alive. + virtual bool GetDynamicTypeAndAddress( + ValueObject &in_value, lldb::DynamicValueType use_dynamic, + TypeAndOrName &class_type_or_name, Address &address, + Value::ValueType &value_type, llvm::ArrayRef &local_buffer) = 0; // This call should return a CompilerType given a generic type name and an // ExecutionContextScope in which one can actually fetch any specialization diff --git a/lldb/include/lldb/ValueObject/ValueObject.h b/lldb/include/lldb/ValueObject/ValueObject.h index 4f77384bb8f1361..c8d5c2723106d6d 100644 --- a/lldb/include/lldb/ValueObject/ValueObject.h +++ b/lldb/include/lldb/ValueObject/ValueObject.h @@ -865,6 +865,18 @@ class ValueObject { virtual void SetLanguageFlags(uint64_t flags) { m_language_flags = flags; } + /// Returns the size of the local buffer if it's available. + /// \return + /// The size of the local buffer if this value object's value points to a + /// host address, and if that size can be determined. Otherwise, returns + /// LLDB_INVALID_ADDRESS. + /// + /// TODO: Because a ValueObject's Value can point to any arbitrary memory + /// location, it is possible that the size of the local buffer can't be + /// determined at all. See the comment in Value::m_value for a more thorough + /// explanation of why that is. + uint64_t GetLocalBufferSize(); + protected: typedef ClusterManager ValueObjectManager; diff --git a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp index 66cdab1307ce9b9..8faf7135217acfa 100644 --- a/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp @@ -289,7 +289,7 @@ llvm::Expected bool ItaniumABILanguageRuntime::GetDynamicTypeAndAddress( ValueObject &in_value, lldb::DynamicValueType use_dynamic, TypeAndOrName &class_type_or_
[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)
https://github.com/jimingham approved this pull request. Thanks for making that work! LGTM https://github.com/llvm/llvm-project/pull/125143 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)
mizvekov wrote: > > > > > Actually, @mizvekov, can we make the > > > > > `ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl(ASTContext > > > > > &C, Kind DK)` constructor default initialize the `StrictPackMatch` > > > > > member to false? In that case users of `CreateDeserialized` wouldn't > > > > > need to worry about it being potentially uninitialized? Otherwise > > > > > we'll have to expose a setter and call it from LLDB > > > > > > > > > > > > > > > > > > > > > > > > > > On the ASTReader, we don't need a setter because it's friends with the > > > > class. > > > > > > > > > > > > > > > > > > > > > > > > > > I'd worry a little bit about leaving it always set to a fixed value, > > > > this could be a hard to track bug in the future for the lldb folks, > > > > even if it's probably not observable right now. > > > > > > > > > > > > Yea that's fair. Would you prefer us adding a setter for it then? And set > > > it to a fixed value from LLDB (until we have a better way to deal with > > > it)? > > > > > > Sure, a setter is fine for me. I am not sure from what data you are > > populating the decl, but if it's like the ast import case, you can forward > > the flag from the original decl. > > > > > > If it's being formed from matching as-written template arguments, you can > > forward the result from CheckTemplateArgument. > > > > > > Otherwise if it's fully synthetic, I guess you can leave a comment > > explaining it. > > > > Yea we're creating it from debug-info. Haven't thought about whether we can > infer this field from debug-info, but either way, I'll go the setter approach > then, thanks! I see. It looks like you would need to call CheckTemplateArgument with the arguments you get from debug info anyway, otherwise some things wouldn't work, like pack parameters. You can use the result from this call to get the value for the flag. Otherwise if you don't currently check the arguments, you could leave a FIXME. https://github.com/llvm/llvm-project/pull/125791 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. (PR #116392)
https://github.com/ashgti updated https://github.com/llvm/llvm-project/pull/116392 >From 88a8522f1b29b2ff392974322acdb722b7e00b70 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 28 Jan 2025 12:39:38 -0800 Subject: [PATCH 1/4] [lldb-dap] Refactoring lldb-dap port listening mode to allow multiple connections. This adjusts the lldb-dap listening mode to accept multiple clients. Each client initializes a new instance of DAP and an associated `lldb::SBDebugger` instance. The listening mode is configured with the `--connection` option and supports listening on a port or a unix socket on supported platforms. --- .../test/tools/lldb-dap/dap_server.py | 74 - .../test/tools/lldb-dap/lldbdap_testcase.py | 6 +- lldb/test/API/tools/lldb-dap/server/Makefile | 3 + .../tools/lldb-dap/server/TestDAP_server.py | 77 + lldb/test/API/tools/lldb-dap/server/main.c| 10 + lldb/test/Shell/DAP/TestOptions.test | 4 +- lldb/tools/lldb-dap/DAP.cpp | 18 +- lldb/tools/lldb-dap/DAP.h | 6 +- lldb/tools/lldb-dap/DAPForward.h | 2 + lldb/tools/lldb-dap/Options.td| 22 +- lldb/tools/lldb-dap/lldb-dap.cpp | 283 +++--- 11 files changed, 358 insertions(+), 147 deletions(-) create mode 100644 lldb/test/API/tools/lldb-dap/server/Makefile create mode 100644 lldb/test/API/tools/lldb-dap/server/TestDAP_server.py create mode 100644 lldb/test/API/tools/lldb-dap/server/main.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 c29992ce9c7848e..6d765e10236733a 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 @@ -903,7 +903,7 @@ def request_setBreakpoints(self, file_path, line_array, data=None): "sourceModified": False, } if line_array is not None: -args_dict["lines"] = "%s" % line_array +args_dict["lines"] = line_array breakpoints = [] for i, line in enumerate(line_array): breakpoint_data = None @@ -1150,11 +1150,12 @@ def request_setInstructionBreakpoints(self, memory_reference=[]): } return self.send_recv(command_dict) + class DebugAdaptorServer(DebugCommunication): def __init__( self, executable=None, -port=None, +connection=None, init_commands=[], log_file=None, env=None, @@ -1167,21 +1168,62 @@ def __init__( if log_file: adaptor_env["LLDBDAP_LOG"] = log_file +args = [executable] + +if connection is not None: +args.append("--connection") +args.append(connection) + self.process = subprocess.Popen( -[executable], +args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, env=adaptor_env, ) + +if connection is not None: +# If the process was also launched, parse the connection from the +# resolved connection. For example, if the connection +# `connection://localhost:0` was specified then the OS would pick a +# random port for listening and lldb-dap would print the listening +# port to stdout. +if self.process is not None: +# lldb-dap will print the listening address once the listener is +# made to stdout. The listener is formatted like +# `connection://host:port` or `unix-connection:///path`. +expected_prefix = "Listening for: " +out = self.process.stdout.readline().decode() +if not out.startswith(expected_prefix): +self.process.kill() +raise ValueError( +"lldb-dap failed to print listening address, expected '{}', got '{}'".format( +expected_prefix, out +) +) + +# If the listener expanded into multiple addresses, use the first. +connection = ( + out.removeprefix(expected_prefix).rstrip("\r\n").split(",", 1)[0] +) + +scheme, address = connection.split("://") +if scheme == "unix-connect": # unix-connect:///path +s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) +s.connect(address) +elif scheme == "connection": # connection://[host]:port +host, port = address.rsplit(":", 1) +# create_connection with try both ipv4 and ipv6. +s = socket.create_connection((host.strip("[]"), int(port))) +
[Lldb-commits] [lldb] 18bd118 - [lldb][NFC] Add documentation for SBFrame::GetRegisters (#125969)
Author: Jason Molenda Date: 2025-02-06T09:19:22-08:00 New Revision: 18bd11889386a653edb1ef5eb501c6af0094478f URL: https://github.com/llvm/llvm-project/commit/18bd11889386a653edb1ef5eb501c6af0094478f DIFF: https://github.com/llvm/llvm-project/commit/18bd11889386a653edb1ef5eb501c6af0094478f.diff LOG: [lldb][NFC] Add documentation for SBFrame::GetRegisters (#125969) SBFrame::GetRegisters() (and the .registers / .regs extensions in Python) returns an array of register-set's, not registers like you might expect from the API name. Document this. - Co-authored-by: Will Hawkins Added: Modified: lldb/bindings/interface/SBFrameDocstrings.i lldb/bindings/interface/SBFrameExtensions.i Removed: diff --git a/lldb/bindings/interface/SBFrameDocstrings.i b/lldb/bindings/interface/SBFrameDocstrings.i index 05a876a685a9127..723c1da7c26e2dc 100644 --- a/lldb/bindings/interface/SBFrameDocstrings.i +++ b/lldb/bindings/interface/SBFrameDocstrings.i @@ -78,6 +78,22 @@ See also SBThread." See also GetFunctionName()." ) lldb::SBFrame::IsInlined; +%feature("docstring", " +Returns an SBValueList which is an array of one or more register +sets that exist for this thread. +Each SBValue in the SBValueList represents one register-set. +The first register-set will be the general purpose registers -- +the registers printed by the `register read` command-line in lldb, with +no additional arguments. +The register-set SBValue will have a name, e.g. +SBFrame::GetRegisters().GetValueAtIndex(0).GetName() +By convention, certain stubs choose to name their general-purpose register-set the 'General Purpose Registers', but that is not required. +register-set may not use that exact name, it is only a convention +used by some stubs. +A register-set SBValue will have children, one child per register +in the register-set." +) lldb::SBFrame::GetRegisters; + %feature("docstring", " Return true if this frame is artificial (e.g a frame synthesized to capture a tail call). Local variables may not be available in an artificial diff --git a/lldb/bindings/interface/SBFrameExtensions.i b/lldb/bindings/interface/SBFrameExtensions.i index e0472280666ab9c..38d03abaee8f09e 100644 --- a/lldb/bindings/interface/SBFrameExtensions.i +++ b/lldb/bindings/interface/SBFrameExtensions.i @@ -87,8 +87,8 @@ STRING_EXTENSION_OUTSIDE(SBFrame) args = property(get_arguments, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the argument variables in this stack frame.''') arguments = property(get_arguments, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the argument variables in this stack frame.''') statics = property(get_statics, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the static variables in this stack frame.''') -registers = property(GetRegisters, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the CPU registers for this stack frame.''') -regs = property(GetRegisters, None, doc='''A read only property that returns a list() that contains a collection of lldb.SBValue objects that represent the CPU registers for this stack frame.''') +registers = property(GetRegisters, None, doc='''Returns the register sets for this thread as a list(). See SBFrame::GetRegisters() for details.''') +regs = property(GetRegisters, None, doc='''Returns the register sets for this thread as a list(). See SBFrame::GetRegisters() for details.''') register = property(get_registers_access, None, doc='''A read only property that returns an helper object providing a flattened indexable view of the CPU registers for this stack frame.''') reg = property(get_registers_access, None, doc='''A read only property that returns an helper object providing a flattened indexable view of the CPU registers for this stack frame''') parent = property(get_parent_frame, None, doc='''A read only property that returns the parent (caller) frame of the current frame.''') ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Add documentation for SBFrame::GetRegisters (PR #125969)
https://github.com/jasonmolenda closed https://github.com/llvm/llvm-project/pull/125969 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,100 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +using llvm::telemetry::Destination; oontvoo wrote: So putting everthng under `lldb_private::telemetry`? https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/JDevlieghere commented: I left a bunch of nits but the core looks good. https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public llvm::telemetry::TelemetryInfo { + EventStats stats; + + std::optional exit_desc; JDevlieghere wrote: Okay, this answers my previous question. It seems like the meaning of the exit code is sufficiently different (debugger and target have a process exit code, which is meaningful based on the OS) but commands and client request infos share nothing with that. It seems like separate enums would be appropriate for the latter. In other words, I think `debugger-info` and `target-info` each can have an exit code field (or an ExitDescription) member. The other 3 should have their own dedicated enum. https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. JDevlieghere wrote: ```suggestion /// Various time statistics of an event. /// TODO: Extend with memory statistics. ``` I know what you mean, but the current comment is just confusion: does it contain memory or not? I think a `TODO` is how such things are usually expressed. Or you could omit it and put the todo where you have the `TBD`. https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// JDevlieghere wrote: ```suggestion //===-- Telemetry.h ---===// // // 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 // //===--===// ``` (I believe we had an RFC about not doing the `*- C++ -*` anymore) https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; JDevlieghere wrote: The `std::optional` already conveys that it's optional. ```suggestion /// End time of an event - may be empty if not meaningful. std::optional end; ``` https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; JDevlieghere wrote: ```suggestion struct LLDBEntryKind : public ::llvm::telemetry::EntryKind { static const llvm::telemetry::KindType BaseInfo = 0b11000; }; ``` ```suggestion struct LldbEntryKind : public ::llvm::telemetry::EntryKind { static const llvm::telemetry::KindType BaseInfo = 0b11000; }; ``` I don't think we use `Lldb` anywhere. https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; JDevlieghere wrote: ```suggestion /// Start time of an event SteadyTimePoint start; ``` This says `REQUIRED` but there's a default constructor that doesn't initialize it? https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { JDevlieghere wrote: [begin bikeshedding] Given the current implementation, I don't think there are "stats". How about just `EventData` or `Data`. IIUC, this class is meant to represent data that all the LLDB TelemetryInfo will contain. Is there a reason that even needs to be its own class? [end bikeshedding] https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. JDevlieghere wrote: I don't know what `the exit signal of an event` means. Do you mean the exit signal of a process? Of LLDB itself? https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/119716 >From b7216d7c3edd5974d84612586fbabdef19037387 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Thu, 26 Dec 2024 20:50:40 -0500 Subject: [PATCH 1/8] Implement LLDB Telemetry (Part 1) This contains only the concrete implementation of the framework to be used but no usages yet. This is a subset of PR/98528. I plan to send a few follow-up patches: part2 : includes changes in the plugin-manager to set up the plugin stuff (ie., how to create a default vs vendor impl) part3 (all of the following can be done in parallel): * part 3_a: define DebuggerTelemetryInfo and related methods to collect data about debugger startup/exit * part 3_b: define TargetTelemetryInfo and related methods to collect data about debug target(s) * part 3_c: define CommandTelemetryInfo and related methods to collect data about debug-commands * part 3_d: define ClientTelemtryInfo and related methods to collect data about lldb-dap/any other client --- lldb/include/lldb/Core/Telemetry.h| 101 ++ lldb/include/lldb/lldb-enumerations.h | 4 +- lldb/source/Core/CMakeLists.txt | 2 + lldb/source/Core/Telemetry.cpp| 92 +++ lldb/test/CMakeLists.txt | 3 + 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 lldb/include/lldb/Core/Telemetry.h create mode 100644 lldb/source/Core/Telemetry.cpp diff --git a/lldb/include/lldb/Core/Telemetry.h b/lldb/include/lldb/Core/Telemetry.h new file mode 100644 index 000..882511efd804d23 --- /dev/null +++ b/lldb/include/lldb/Core/Telemetry.h @@ -0,0 +1,101 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include +#include +#include +#include +#include +#include + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" + +namespace lldb_private { + +using llvm::telemetry::Destination; +using llvm::telemetry::KindType; +using llvm::telemetry::Serializer; +using llvm::telemetry::TelemetryInfo; + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public TelemetryInfo { + EventStats stats; + + std::optional exit_desc; + + Debugger *debugger; + + // For dyn_cast, isa, etc operations. + KindType getKind() const override { return LldbEntryKind::BaseInfo; } + + static bool classof(const TelemetryInfo *t) { +// Subclasses of this is also acceptable. +return (t->getKind() & LldbEntryKind::BaseInfo) == LldbEntryKind::BaseInfo; + } + + void serialize(Serializer &serializer) const override; +}; + +/// The base Telemetry manager instance in LLDB +/// This class declares additional instrumentation points +/// applicable to LLDB. +class TelemetryManager : public llvm::telemetry::Manager { +public: + TelemetryManager(std::unique_ptr config); + + llvm::Error dispatch(TelemetryInfo *entry) override; + + void addDestination(std::unique_ptr destination) override; + +private: + std::unique_ptr m_config; + const std::string m_session_uuid; + std::vector> m_destinations; +}; + +} // namespace lldb_private +#endif // LLDB_CORE_TELEMETRY_H diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 0094fcd596fdf70..f63e446b6042f62 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInvali
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -17,6 +17,15 @@ if (LLDB_ENABLE_CURSES) endif() # TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbCore +set(LLDB_CORE_SRCS + +) + oontvoo wrote: done https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/119716 >From b7216d7c3edd5974d84612586fbabdef19037387 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Thu, 26 Dec 2024 20:50:40 -0500 Subject: [PATCH 1/9] Implement LLDB Telemetry (Part 1) This contains only the concrete implementation of the framework to be used but no usages yet. This is a subset of PR/98528. I plan to send a few follow-up patches: part2 : includes changes in the plugin-manager to set up the plugin stuff (ie., how to create a default vs vendor impl) part3 (all of the following can be done in parallel): * part 3_a: define DebuggerTelemetryInfo and related methods to collect data about debugger startup/exit * part 3_b: define TargetTelemetryInfo and related methods to collect data about debug target(s) * part 3_c: define CommandTelemetryInfo and related methods to collect data about debug-commands * part 3_d: define ClientTelemtryInfo and related methods to collect data about lldb-dap/any other client --- lldb/include/lldb/Core/Telemetry.h| 101 ++ lldb/include/lldb/lldb-enumerations.h | 4 +- lldb/source/Core/CMakeLists.txt | 2 + lldb/source/Core/Telemetry.cpp| 92 +++ lldb/test/CMakeLists.txt | 3 + 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 lldb/include/lldb/Core/Telemetry.h create mode 100644 lldb/source/Core/Telemetry.cpp diff --git a/lldb/include/lldb/Core/Telemetry.h b/lldb/include/lldb/Core/Telemetry.h new file mode 100644 index 000..882511efd804d23 --- /dev/null +++ b/lldb/include/lldb/Core/Telemetry.h @@ -0,0 +1,101 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include +#include +#include +#include +#include +#include + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" + +namespace lldb_private { + +using llvm::telemetry::Destination; +using llvm::telemetry::KindType; +using llvm::telemetry::Serializer; +using llvm::telemetry::TelemetryInfo; + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public TelemetryInfo { + EventStats stats; + + std::optional exit_desc; + + Debugger *debugger; + + // For dyn_cast, isa, etc operations. + KindType getKind() const override { return LldbEntryKind::BaseInfo; } + + static bool classof(const TelemetryInfo *t) { +// Subclasses of this is also acceptable. +return (t->getKind() & LldbEntryKind::BaseInfo) == LldbEntryKind::BaseInfo; + } + + void serialize(Serializer &serializer) const override; +}; + +/// The base Telemetry manager instance in LLDB +/// This class declares additional instrumentation points +/// applicable to LLDB. +class TelemetryManager : public llvm::telemetry::Manager { +public: + TelemetryManager(std::unique_ptr config); + + llvm::Error dispatch(TelemetryInfo *entry) override; + + void addDestination(std::unique_ptr destination) override; + +private: + std::unique_ptr m_config; + const std::string m_session_uuid; + std::vector> m_destinations; +}; + +} // namespace lldb_private +#endif // LLDB_CORE_TELEMETRY_H diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 0094fcd596fdf70..f63e446b6042f62 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInvali
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (PR #126020)
https://github.com/seehearfeel edited https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/119716 >From b7216d7c3edd5974d84612586fbabdef19037387 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Thu, 26 Dec 2024 20:50:40 -0500 Subject: [PATCH 01/10] Implement LLDB Telemetry (Part 1) This contains only the concrete implementation of the framework to be used but no usages yet. This is a subset of PR/98528. I plan to send a few follow-up patches: part2 : includes changes in the plugin-manager to set up the plugin stuff (ie., how to create a default vs vendor impl) part3 (all of the following can be done in parallel): * part 3_a: define DebuggerTelemetryInfo and related methods to collect data about debugger startup/exit * part 3_b: define TargetTelemetryInfo and related methods to collect data about debug target(s) * part 3_c: define CommandTelemetryInfo and related methods to collect data about debug-commands * part 3_d: define ClientTelemtryInfo and related methods to collect data about lldb-dap/any other client --- lldb/include/lldb/Core/Telemetry.h| 101 ++ lldb/include/lldb/lldb-enumerations.h | 4 +- lldb/source/Core/CMakeLists.txt | 2 + lldb/source/Core/Telemetry.cpp| 92 +++ lldb/test/CMakeLists.txt | 3 + 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 lldb/include/lldb/Core/Telemetry.h create mode 100644 lldb/source/Core/Telemetry.cpp diff --git a/lldb/include/lldb/Core/Telemetry.h b/lldb/include/lldb/Core/Telemetry.h new file mode 100644 index 000..882511efd804d23 --- /dev/null +++ b/lldb/include/lldb/Core/Telemetry.h @@ -0,0 +1,101 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include +#include +#include +#include +#include +#include + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" + +namespace lldb_private { + +using llvm::telemetry::Destination; +using llvm::telemetry::KindType; +using llvm::telemetry::Serializer; +using llvm::telemetry::TelemetryInfo; + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public TelemetryInfo { + EventStats stats; + + std::optional exit_desc; + + Debugger *debugger; + + // For dyn_cast, isa, etc operations. + KindType getKind() const override { return LldbEntryKind::BaseInfo; } + + static bool classof(const TelemetryInfo *t) { +// Subclasses of this is also acceptable. +return (t->getKind() & LldbEntryKind::BaseInfo) == LldbEntryKind::BaseInfo; + } + + void serialize(Serializer &serializer) const override; +}; + +/// The base Telemetry manager instance in LLDB +/// This class declares additional instrumentation points +/// applicable to LLDB. +class TelemetryManager : public llvm::telemetry::Manager { +public: + TelemetryManager(std::unique_ptr config); + + llvm::Error dispatch(TelemetryInfo *entry) override; + + void addDestination(std::unique_ptr destination) override; + +private: + std::unique_ptr m_config; + const std::string m_session_uuid; + std::vector> m_destinations; +}; + +} // namespace lldb_private +#endif // LLDB_CORE_TELEMETRY_H diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 0094fcd596fdf70..f63e446b6042f62 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInva
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/119716 >From b7216d7c3edd5974d84612586fbabdef19037387 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Thu, 26 Dec 2024 20:50:40 -0500 Subject: [PATCH 01/11] Implement LLDB Telemetry (Part 1) This contains only the concrete implementation of the framework to be used but no usages yet. This is a subset of PR/98528. I plan to send a few follow-up patches: part2 : includes changes in the plugin-manager to set up the plugin stuff (ie., how to create a default vs vendor impl) part3 (all of the following can be done in parallel): * part 3_a: define DebuggerTelemetryInfo and related methods to collect data about debugger startup/exit * part 3_b: define TargetTelemetryInfo and related methods to collect data about debug target(s) * part 3_c: define CommandTelemetryInfo and related methods to collect data about debug-commands * part 3_d: define ClientTelemtryInfo and related methods to collect data about lldb-dap/any other client --- lldb/include/lldb/Core/Telemetry.h| 101 ++ lldb/include/lldb/lldb-enumerations.h | 4 +- lldb/source/Core/CMakeLists.txt | 2 + lldb/source/Core/Telemetry.cpp| 92 +++ lldb/test/CMakeLists.txt | 3 + 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 lldb/include/lldb/Core/Telemetry.h create mode 100644 lldb/source/Core/Telemetry.cpp diff --git a/lldb/include/lldb/Core/Telemetry.h b/lldb/include/lldb/Core/Telemetry.h new file mode 100644 index 000..882511efd804d23 --- /dev/null +++ b/lldb/include/lldb/Core/Telemetry.h @@ -0,0 +1,101 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include +#include +#include +#include +#include +#include + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" + +namespace lldb_private { + +using llvm::telemetry::Destination; +using llvm::telemetry::KindType; +using llvm::telemetry::Serializer; +using llvm::telemetry::TelemetryInfo; + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public TelemetryInfo { + EventStats stats; + + std::optional exit_desc; + + Debugger *debugger; + + // For dyn_cast, isa, etc operations. + KindType getKind() const override { return LldbEntryKind::BaseInfo; } + + static bool classof(const TelemetryInfo *t) { +// Subclasses of this is also acceptable. +return (t->getKind() & LldbEntryKind::BaseInfo) == LldbEntryKind::BaseInfo; + } + + void serialize(Serializer &serializer) const override; +}; + +/// The base Telemetry manager instance in LLDB +/// This class declares additional instrumentation points +/// applicable to LLDB. +class TelemetryManager : public llvm::telemetry::Manager { +public: + TelemetryManager(std::unique_ptr config); + + llvm::Error dispatch(TelemetryInfo *entry) override; + + void addDestination(std::unique_ptr destination) override; + +private: + std::unique_ptr m_config; + const std::string m_session_uuid; + std::vector> m_destinations; +}; + +} // namespace lldb_private +#endif // LLDB_CORE_TELEMETRY_H diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 0094fcd596fdf70..f63e446b6042f62 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInva
[Lldb-commits] [lldb] c4d75b1 - [lldb][DWARFASTParser][NFC] Fix doxygen comment
Author: Michael Buch Date: 2025-02-06T19:12:26Z New Revision: c4d75b1e9b9c22577032ba68b7560481027b4b8a URL: https://github.com/llvm/llvm-project/commit/c4d75b1e9b9c22577032ba68b7560481027b4b8a DIFF: https://github.com/llvm/llvm-project/commit/c4d75b1e9b9c22577032ba68b7560481027b4b8a.diff LOG: [lldb][DWARFASTParser][NFC] Fix doxygen comment Added: Modified: lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h Removed: diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h index d1eb2bcc2592ed5..36fb381d3e291db 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h @@ -564,10 +564,10 @@ struct ParsedDWARFTypeAttributes { uint32_t bit_stride = 0; uint32_t byte_stride = 0; uint32_t encoding = 0; - clang::RefQualifierKind ref_qual = - clang::RQ_None; ///< Indicates ref-qualifier of - ///< C++ member function if present. - ///< Is RQ_None otherwise. + + ///< Indicates ref-qualifier of C++ member function if present. + ///< Is RQ_None otherwise. + clang::RefQualifierKind ref_qual = clang::RQ_None; }; #endif // LLDB_SOURCE_PLUGINS_SYMBOLFILE_DWARF_DWARFASTPARSERCLANG_H ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][TypeSystem] Ensure that ParmVarDecls have the correct DeclContext (PR #124279)
@@ -3205,6 +3199,8 @@ void DWARFASTParserClang::ParseChildParameters( break; } } + + assert(function_param_names.size() == function_param_names.size()); klensy wrote: This looks like typo? Comparing with self. https://github.com/llvm/llvm-project/pull/124279 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][TypeSystem] Ensure that ParmVarDecls have the correct DeclContext (PR #124279)
@@ -3205,6 +3199,8 @@ void DWARFASTParserClang::ParseChildParameters( break; } } + + assert(function_param_names.size() == function_param_names.size()); Michael137 wrote: hah good catch! yea that's meant to say: ``` assert(function_param_types.size() == function_param_names.size()); ``` https://github.com/llvm/llvm-project/pull/124279 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [lldb] Reland: [clang] fix P3310 overload resolution flag propagation (PR #125791)
Michael137 wrote: > > > > Actually, @mizvekov, can we make the > > > > `ClassTemplateSpecializationDecl::ClassTemplateSpecializationDecl(ASTContext > > > > &C, Kind DK)` constructor default initialize the `StrictPackMatch` > > > > member to false? In that case users of `CreateDeserialized` wouldn't > > > > need to worry about it being potentially uninitialized? Otherwise we'll > > > > have to expose a setter and call it from LLDB > > > > > > > > > > > > > > On the ASTReader, we don't need a setter because it's friends with the > > > class. > > > > > > > > > > > > > > I'd worry a little bit about leaving it always set to a fixed value, this > > > could be a hard to track bug in the future for the lldb folks, even if > > > it's probably not observable right now. > > > > > > Yea that's fair. Would you prefer us adding a setter for it then? And set > > it to a fixed value from LLDB (until we have a better way to deal with it)? > > Sure, a setter is fine for me. I am not sure from what data you are > populating the decl, but if it's like the ast import case, you can forward > the flag from the original decl. > > If it's being formed from matching as-written template arguments, you can > forward the result from CheckTemplateArgument. > > Otherwise if it's fully synthetic, I guess you can leave a comment explaining > it. Yea we're creating it from debug-info. Haven't thought about whether we can infer this field from debug-info, but either way, I'll go the setter approach then, thanks! https://github.com/llvm/llvm-project/pull/125791 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/oontvoo updated https://github.com/llvm/llvm-project/pull/119716 >From b7216d7c3edd5974d84612586fbabdef19037387 Mon Sep 17 00:00:00 2001 From: Vy Nguyen Date: Thu, 26 Dec 2024 20:50:40 -0500 Subject: [PATCH 01/14] Implement LLDB Telemetry (Part 1) This contains only the concrete implementation of the framework to be used but no usages yet. This is a subset of PR/98528. I plan to send a few follow-up patches: part2 : includes changes in the plugin-manager to set up the plugin stuff (ie., how to create a default vs vendor impl) part3 (all of the following can be done in parallel): * part 3_a: define DebuggerTelemetryInfo and related methods to collect data about debugger startup/exit * part 3_b: define TargetTelemetryInfo and related methods to collect data about debug target(s) * part 3_c: define CommandTelemetryInfo and related methods to collect data about debug-commands * part 3_d: define ClientTelemtryInfo and related methods to collect data about lldb-dap/any other client --- lldb/include/lldb/Core/Telemetry.h| 101 ++ lldb/include/lldb/lldb-enumerations.h | 4 +- lldb/source/Core/CMakeLists.txt | 2 + lldb/source/Core/Telemetry.cpp| 92 +++ lldb/test/CMakeLists.txt | 3 + 5 files changed, 200 insertions(+), 2 deletions(-) create mode 100644 lldb/include/lldb/Core/Telemetry.h create mode 100644 lldb/source/Core/Telemetry.cpp diff --git a/lldb/include/lldb/Core/Telemetry.h b/lldb/include/lldb/Core/Telemetry.h new file mode 100644 index 000..882511efd804d23 --- /dev/null +++ b/lldb/include/lldb/Core/Telemetry.h @@ -0,0 +1,101 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include +#include +#include +#include +#include +#include + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" + +namespace lldb_private { + +using llvm::telemetry::Destination; +using llvm::telemetry::KindType; +using llvm::telemetry::Serializer; +using llvm::telemetry::TelemetryInfo; + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public TelemetryInfo { + EventStats stats; + + std::optional exit_desc; + + Debugger *debugger; + + // For dyn_cast, isa, etc operations. + KindType getKind() const override { return LldbEntryKind::BaseInfo; } + + static bool classof(const TelemetryInfo *t) { +// Subclasses of this is also acceptable. +return (t->getKind() & LldbEntryKind::BaseInfo) == LldbEntryKind::BaseInfo; + } + + void serialize(Serializer &serializer) const override; +}; + +/// The base Telemetry manager instance in LLDB +/// This class declares additional instrumentation points +/// applicable to LLDB. +class TelemetryManager : public llvm::telemetry::Manager { +public: + TelemetryManager(std::unique_ptr config); + + llvm::Error dispatch(TelemetryInfo *entry) override; + + void addDestination(std::unique_ptr destination) override; + +private: + std::unique_ptr m_config; + const std::string m_session_uuid; + std::vector> m_destinations; +}; + +} // namespace lldb_private +#endif // LLDB_CORE_TELEMETRY_H diff --git a/lldb/include/lldb/lldb-enumerations.h b/lldb/include/lldb/lldb-enumerations.h index 0094fcd596fdf70..f63e446b6042f62 100644 --- a/lldb/include/lldb/lldb-enumerations.h +++ b/lldb/include/lldb/lldb-enumerations.h @@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInva
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInvalid = 0, oontvoo wrote: done - removed the `:int` and `=0` https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AIX] Added PlatformAIX plugin (PR #121273)
https://github.com/DhruvSrivastavaX updated https://github.com/llvm/llvm-project/pull/121273 >From 16107a423e30cc339b7529db35a75c3c26924146 Mon Sep 17 00:00:00 2001 From: Dhruv-Srivastava Date: Sat, 28 Dec 2024 13:19:21 -0600 Subject: [PATCH 1/4] Introducing PlatformAIX from PlatformLinux --- .../Plugins/Platform/AIX/CMakeLists.txt | 13 + .../Plugins/Platform/AIX/PlatformAIX.cpp | 471 ++ .../source/Plugins/Platform/AIX/PlatformAIX.h | 74 +++ lldb/source/Plugins/Platform/CMakeLists.txt | 1 + 4 files changed, 559 insertions(+) create mode 100644 lldb/source/Plugins/Platform/AIX/CMakeLists.txt create mode 100644 lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp create mode 100644 lldb/source/Plugins/Platform/AIX/PlatformAIX.h diff --git a/lldb/source/Plugins/Platform/AIX/CMakeLists.txt b/lldb/source/Plugins/Platform/AIX/CMakeLists.txt new file mode 100644 index 000..85ff0a315eabd54 --- /dev/null +++ b/lldb/source/Plugins/Platform/AIX/CMakeLists.txt @@ -0,0 +1,13 @@ +add_definitions("-D_ALL_SOURCE") + +add_lldb_library(lldbPluginPlatformAIX PLUGIN + PlatformAIX.cpp + + LINK_LIBS +lldbBreakpoint +lldbCore +lldbHost +lldbInterpreter +lldbTarget +lldbPluginPlatformPOSIX + ) diff --git a/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp b/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp new file mode 100644 index 000..5c9447700297891 --- /dev/null +++ b/lldb/source/Plugins/Platform/AIX/PlatformAIX.cpp @@ -0,0 +1,471 @@ +//===-- PlatformAIX.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 "PlatformAIX.h" +#include "lldb/Host/Config.h" + +#include +#if LLDB_ENABLE_POSIX +#include +#endif + +#include "Utility/ARM64_DWARF_Registers.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Core/PluginManager.h" +#include "lldb/Host/HostInfo.h" +#include "lldb/Symbol/UnwindPlan.h" +#include "lldb/Target/Process.h" +#include "lldb/Target/Target.h" +#include "lldb/Utility/FileSpec.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/Log.h" +#include "lldb/Utility/State.h" +#include "lldb/Utility/Status.h" +#include "lldb/Utility/StreamString.h" + +// Define these constants from AIX mman.h for use when targeting remote aix +// systems even when host has different values. + +#if defined(_AIX) +#include +#endif + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::platform_aix; + +LLDB_PLUGIN_DEFINE(PlatformAIX) + +static uint32_t g_initialize_count = 0; + + +PlatformSP PlatformAIX::CreateInstance(bool force, const ArchSpec *arch) { + Log *log = GetLog(LLDBLog::Platform); + LLDB_LOG(log, "force = {0}, arch=({1}, {2})", force, + arch ? arch->GetArchitectureName() : "", + arch ? arch->GetTriple().getTriple() : ""); + + bool create = force; + if (!create && arch && arch->IsValid()) { +const llvm::Triple &triple = arch->GetTriple(); +switch (triple.getOS()) { +case llvm::Triple::AIX: + create = true; + break; + +default: + break; +} + } + + LLDB_LOG(log, "create = {0}", create); + if (create) { +return PlatformSP(new PlatformAIX(false)); + } + return PlatformSP(); +} + +llvm::StringRef PlatformAIX::GetPluginDescriptionStatic(bool is_host) { + if (is_host) +return "Local AIX user platform plug-in."; + return "Remote AIX user platform plug-in."; +} + +void PlatformAIX::Initialize() { + PlatformPOSIX::Initialize(); + + if (g_initialize_count++ == 0) { +#if defined(_AIX) +PlatformSP default_platform_sp(new PlatformAIX(true)); +default_platform_sp->SetSystemArchitecture(HostInfo::GetArchitecture()); +Platform::SetHostPlatform(default_platform_sp); +#endif +PluginManager::RegisterPlugin( +PlatformAIX::GetPluginNameStatic(false), +PlatformAIX::GetPluginDescriptionStatic(false), +PlatformAIX::CreateInstance, nullptr); + } +} + +void PlatformAIX::Terminate() { + if (g_initialize_count > 0) { +if (--g_initialize_count == 0) { + PluginManager::UnregisterPlugin(PlatformAIX::CreateInstance); +} + } + + PlatformPOSIX::Terminate(); +} + +/// Default Constructor +PlatformAIX::PlatformAIX(bool is_host) +: PlatformPOSIX(is_host) // This is the local host platform +{ + if (is_host) { +ArchSpec hostArch = HostInfo::GetArchitecture(HostInfo::eArchKindDefault); +m_supported_architectures.push_back(hostArch); +if (hostArch.GetTriple().isArch64Bit()) { + m_supported_architectures.push_back( + HostInfo::GetArchitecture(HostInfo::eArchKind32)); +} + } else { +m_supported_architectures = CreateArchList( +{llvm::Triple::x86_64, llvm
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
https://github.com/labath commented: I think this looks okay so far. @JDevlieghere, do you have anything to add? The interesting part will be wiring this up with initialization and all the call sites (which is now complicated by the fact that this code is conditionally compiled. Before you get too much into the plugin manager, let me say that I *don't* think it makes sense emulating the "normal" plugin setup for this functionality. It's true that this is meant to be pluggable in a way, so calling it *a* plugin sounds reasonable. However, it's a very different kind of a plugin from all of our other plugins. The complexity of those plugins comes from the fact that we have *multiple* implementations (classes) of those plugins, which can create an *arbitrary number* of instances (objects) of that class, at *arbitrary points in time* (e.g. each time we open an object file). Pretty much none of this applies here. As I understand it, we're going to have *at most one implementation* of the plugin (at most one *active* instance at least), this implementation is going to have *at most one instance* (since we're sharing it between debugger objects), and we're going to be creating it directly *at startup*. With that in mind, I think it'd be sufficient to have something like `TelemetryManager::SetInstance()`, and have that be called from the `Initialize()` static method of the plugin. (None of the fancy CreateInstance methods, callbacks, etc.) https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -17,6 +17,15 @@ if (LLDB_ENABLE_CURSES) endif() # TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbCore +set(LLDB_CORE_SRCS + +) + labath wrote: unused? https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -257,8 +257,8 @@ enum StopReason { }; /// Command Return Status Types. -enum ReturnStatus { - eReturnStatusInvalid, +enum ReturnStatus : int { + eReturnStatusInvalid = 0, labath wrote: In that case, I'd suggest working around that locally (by casting the enum to an integer type?). It's kinda weird that this is the only enum which has an explicit type specifier. https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,81 @@ +//===-- Telemetry.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 "lldb/Core/Telemetry.h" +#include "lldb/Core/Debugger.h" +#include "lldb/Target/Statistics.h" +#include "lldb/Utility/ConstString.h" +#include "lldb/Utility/LLDBLog.h" +#include "lldb/Utility/UUID.h" +#include "lldb/Version/Version.h" +#include "lldb/lldb-enumerations.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/SmallString.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/ADT/Twine.h" +#include "llvm/Support/Error.h" +#include "llvm/Support/RandomNumberGenerator.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +using ::llvm::Error; +using ::llvm::telemetry::Destination; +using ::llvm::telemetry::Serializer; +using ::llvm::telemetry::TelemetryInfo; + +static uint64_t ToNanosec(const SteadyTimePoint Point) { + return std::chrono::nanoseconds(Point.time_since_epoch()).count(); +} + +void LldbBaseTelemetryInfo::serialize(Serializer &serializer) const { + serializer.write("entry_kind", getKind()); + serializer.write("session_id", SessionId); + serializer.write("start_time", ToNanosec(stats.start)); + if (stats.end.has_value()) +serializer.write("end_time", ToNanosec(stats.end.value())); + if (exit_desc.has_value()) { +serializer.write("exit_code", exit_desc->exit_code); +serializer.write("exit_msg", exit_desc->description); + } +} + +static std::string MakeUUID(lldb_private::Debugger *debugger) { + std::string ret; + uint8_t random_bytes[16]; + if (auto ec = llvm::getRandomBytes(random_bytes, 16)) { +LLDB_LOG(GetLog(LLDBLog::Object), + "Failed to generate random bytes for UUID: {0}", ec.message()); +// fallback to using timestamp + debugger ID. +ret = llvm::formatv( +"{0}_{1}", std::chrono::steady_clock::now().time_since_epoch().count(), +debugger->GetID()); + } else { +ret = lldb_private::UUID(random_bytes).GetAsString(); + } + + return ret; labath wrote: Actually, this is even better (sorry about the churn): https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code ```suggestion uint8_t random_bytes[16]; if (auto ec = llvm::getRandomBytes(random_bytes, 16)) { LLDB_LOG(GetLog(LLDBLog::Object), "Failed to generate random bytes for UUID: {0}", ec.message()); // fallback to using timestamp + debugger ID. return llvm::formatv( "{0}_{1}", std::chrono::steady_clock::now().time_since_epoch().count(), debugger->GetID()); } return lldb_private::UUID(random_bytes).GetAsString(); ``` https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,100 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +using llvm::telemetry::Destination; labath wrote: Maybe, but if you don't want a namespace, then you should be also be careful about other names that you create. For example, `lldb_private::LldbEntryKind` is not very telling (it doesn't tell you that it has anything to do with telemetry, the string "lldb" in the name is redundant. In this setup I'd probably go with `lldb_private::TelemetryEntryKind`. Same goes for `EventStats` which sounds like it has something to do with the `Event` class in `Utility/Event.h` (it doesn't) and `SteadyTimePoint`, which could be generic, but it's suprising to see it defined in Telemetry.h. So, `TelemetryEventStats` and `TelemetryTimePoint` ? You don't have to do that, but after writing all this I'm starting to incline towards putting everything in a namespace.. Then the names can stay pretty much as they are? https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public llvm::telemetry::TelemetryInfo { + EventStats stats; + + std::optional exit_desc; labath wrote: I'm kinda surprised to see this here. I wouldn't expect this to make sense on every (or even most) of the telemetry entries. https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (PR #126020)
seehearfeel wrote: > I see that the basics of this were added 2 years ago - > [torvalds/linux@1a69f7a](https://github.com/torvalds/linux/commit/1a69f7a161a78aead07cd4b811d796950e892fa4). > > So I assume the build error here is not that NT_LOONGARCH_HW_BREAK is not > defined, it's that user_watch_state got redefined? Actually, as the commit message said, it is because NT_LOONGARCH_HW_{BREAK,WATCH} are not defined in the system header. > > Please explain all this in the PR _description_. GitHub does not use the > contents of the commit messages for the final commit. Link to kernel commits > as well, that will be easier than writing out the same justifications again. > > Also include something in the title so it's like "Fix build errors with > user_watch_v2". If you need to find this commit again, that will help you a > lot. > > I'd like to know what your intent is with supporting older kernels, if at > all. Given that this new structure is not the same size as the other one, or > is it? A `pad` was added but perhaps that just made the existing compiler > padding explicit? > > (I don't care if you do support older kernels or not, but let's get the > intent documented) This PR only has one patch now, the PR title is same with the patch title. There will be another patch to do what you said once this PR is merged. https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][telemetry] Implement LLDB Telemetry (part 1) (PR #119716)
@@ -0,0 +1,93 @@ +//===-- Telemetry.h --*- C++ +//-*-===// +// +// 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 +// +//===--===// + +#ifndef LLDB_CORE_TELEMETRY_H +#define LLDB_CORE_TELEMETRY_H + +#include "lldb/Core/StructuredDataImpl.h" +#include "lldb/Interpreter/CommandReturnObject.h" +#include "lldb/Utility/StructuredData.h" +#include "lldb/lldb-forward.h" +#include "llvm/ADT/StringExtras.h" +#include "llvm/ADT/StringRef.h" +#include "llvm/Support/JSON.h" +#include "llvm/Telemetry/Telemetry.h" +#include +#include +#include +#include +#include +#include + +namespace lldb_private { + +struct LldbEntryKind : public ::llvm::telemetry::EntryKind { + static const llvm::telemetry::KindType BaseInfo = 0b11000; +}; + +/// Defines a convenient type for timestamp of various events. +/// This is used by the EventStats below. +using SteadyTimePoint = std::chrono::time_point; + +/// Various time (and possibly memory) statistics of an event. +struct EventStats { + // REQUIRED: Start time of an event + SteadyTimePoint start; + // OPTIONAL: End time of an event - may be empty if not meaningful. + std::optional end; + // TBD: could add some memory stats here too? + + EventStats() = default; + EventStats(SteadyTimePoint start) : start(start) {} + EventStats(SteadyTimePoint start, SteadyTimePoint end) + : start(start), end(end) {} +}; + +/// Describes the exit signal of an event. +struct ExitDescription { + int exit_code; + std::string description; +}; + +struct LldbBaseTelemetryInfo : public llvm::telemetry::TelemetryInfo { + EventStats stats; + + std::optional exit_desc; oontvoo wrote: We're going to have 5 types of entries.I think the exit status (or more accurately "return status" for the command-info case) is applicable to the first 4 entries: - debugger-info (whether LLDB terminates successfully) - target-info (whether the main executable exits successfully) - command-info (whether the command executed successfully) - client-request-info (whether the request completed successfully) - misc-info (optionall) So that's 4 out of 5, which is why I thought it made sense to hoist it into the common class. https://github.com/llvm/llvm-project/pull/119716 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Breakpoint] Allow whitespace in breakpoint address expression (PR #126053)
https://github.com/adrian-prantl approved this pull request. https://github.com/llvm/llvm-project/pull/126053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Breakpoint] Allow whitespace in breakpoint address expression (PR #126053)
@@ -262,8 +262,10 @@ OptionArgParser::DoToAddress(const ExecutionContext *exe_ctx, llvm::StringRef s, // 3: The symbol/reg name if there is an offset // 4: +/- // 5: The offset value. + // clang-format off static RegularExpression g_symbol_plus_offset_regex( - "^(\\$[^ +-]+)|(([^ +-]+)([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$"); + "^(\\$[^ +-]+)|(([^ +-]+)[[:space:]]*([-\\+])[[:space:]]*(0x[0-9A-Fa-f]+|[0-9]+)[[:space:]]*)$"); adrian-prantl wrote: this is using ` ` (in `[^ +-]`)and `:space:` in the same regex, which seems oddly inconsistent? Apart from Pavel's comment, this seems fine. https://github.com/llvm/llvm-project/pull/126053 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b800293 - [lldb] Add missing return statements in ThreadMemory (#126128)
Author: Felipe de Azevedo Piovezan Date: 2025-02-06T15:59:43-08:00 New Revision: b8002933e92f89600521be420376ec111ad367f1 URL: https://github.com/llvm/llvm-project/commit/b8002933e92f89600521be420376ec111ad367f1 DIFF: https://github.com/llvm/llvm-project/commit/b8002933e92f89600521be420376ec111ad367f1.diff LOG: [lldb] Add missing return statements in ThreadMemory (#126128) These prevented ThreadMemory from correctly returning the Name/Queue/Info of the backing thread. Note about testing: this test only finds regressions if the system sets a name or queue for the backing thread. While this may not be true everywhere, it still provides coverage in some systems, e.g. in Apple platforms. Added: Modified: lldb/source/Plugins/Process/Utility/ThreadMemory.h lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py Removed: diff --git a/lldb/source/Plugins/Process/Utility/ThreadMemory.h b/lldb/source/Plugins/Process/Utility/ThreadMemory.h index 1e309671e85c653..cebb31538eaf20c 100644 --- a/lldb/source/Plugins/Process/Utility/ThreadMemory.h +++ b/lldb/source/Plugins/Process/Utility/ThreadMemory.h @@ -33,7 +33,7 @@ class ThreadMemory : public lldb_private::Thread { const char *GetInfo() override { if (m_backing_thread_sp) - m_backing_thread_sp->GetInfo(); + return m_backing_thread_sp->GetInfo(); return nullptr; } @@ -41,7 +41,7 @@ class ThreadMemory : public lldb_private::Thread { if (!m_name.empty()) return m_name.c_str(); if (m_backing_thread_sp) - m_backing_thread_sp->GetName(); + return m_backing_thread_sp->GetName(); return nullptr; } @@ -49,7 +49,7 @@ class ThreadMemory : public lldb_private::Thread { if (!m_queue.empty()) return m_queue.c_str(); if (m_backing_thread_sp) - m_backing_thread_sp->GetQueueName(); + return m_backing_thread_sp->GetQueueName(); return nullptr; } diff --git a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py index 3ad7539018d5d83..fe78edd98f4d4be 100644 --- a/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py +++ b/lldb/test/API/functionalities/plugins/python_os_plugin/TestPythonOSPlugin.py @@ -160,6 +160,8 @@ def run_python_os_step(self): ) self.assertTrue(process, PROCESS_IS_VALID) +core_thread_zero = process.GetThreadAtIndex(0) + # Make sure there are no OS plug-in created thread when we first stop # at our breakpoint in main thread = process.GetThreadByID(0x1) @@ -183,6 +185,10 @@ def run_python_os_step(self): thread.IsValid(), "Make sure there is a thread 0x1 after we load the python OS plug-in", ) +# This OS plugin does not set thread names / queue names, so it should +# inherit the core thread's name. +self.assertEqual(core_thread_zero.GetName(), thread.GetName()) +self.assertEqual(core_thread_zero.GetQueueName(), thread.GetQueueName()) frame = thread.GetFrameAtIndex(0) self.assertTrue( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add missing return statements in ThreadMemory (PR #126128)
https://github.com/felipepiovezan closed https://github.com/llvm/llvm-project/pull/126128 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (PR #126020)
https://github.com/SixWeining approved this pull request. https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)
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 16 "test-check-lldb-unit". Full details are available at: https://lab.llvm.org/buildbot/#/builders/197/builds/1717 Here is the relevant piece of the build log for the reference ``` Step 16 (test-check-lldb-unit) failure: Test just built components: check-lldb-unit completed (failure) ... 7.024 [32/37/217]Building CXX object tools\lldb\unittests\Language\Highlighting\CMakeFiles\HighlighterTests.dir\HighlighterTest.cpp.obj 7.198 [32/36/218]Building CXX object tools\lldb\unittests\DataFormatter\CMakeFiles\LLDBFormatterTests.dir\FormattersContainerTest.cpp.obj 7.628 [32/35/219]Building CXX object tools\lldb\unittests\DataFormatter\CMakeFiles\LLDBFormatterTests.dir\FormatManagerTests.cpp.obj 8.403 [32/34/220]Building CXX object tools\lldb\unittests\Language\ObjC\CMakeFiles\LanguageObjCTests.dir\ObjCLanguageTest.cpp.obj 8.630 [32/33/221]Linking CXX executable tools\lldb\unittests\Callback\LLDBCallbackTests.exe 9.394 [31/33/222]Linking CXX executable tools\lldb\unittests\Instruction\EmulatorTests.exe 9.643 [30/33/223]Building CXX object tools\lldb\unittests\Language\CPlusPlus\CMakeFiles\LanguageCPlusPlusTests.dir\CPlusPlusLanguageTest.cpp.obj 10.025 [30/32/224]Linking CXX executable tools\lldb\unittests\ObjectFile\ELF\ObjectFileELFTests.exe 10.065 [29/32/225]Linking CXX executable tools\lldb\unittests\Interpreter\InterpreterTests.exe 10.364 [28/32/226]Building CXX object tools\lldb\unittests\ValueObject\CMakeFiles\LLDBValueObjectTests.dir\DynamicValueObjectLocalBuffer.cpp.obj FAILED: tools/lldb/unittests/ValueObject/CMakeFiles/LLDBValueObjectTests.dir/DynamicValueObjectLocalBuffer.cpp.obj ccache C:\PROGRA~1\MICROS~1\2022\COMMUN~1\VC\Tools\MSVC\1441~1.341\bin\Hostx64\x64\cl.exe /nologo /TP -DGTEST_HAS_RTTI=0 -DLLVM_BUILD_STATIC -DUNICODE -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_ENABLE_EXTENDED_ALIGNED_STORAGE -D_GLIBCXX_ASSERTIONS -D_HAS_EXCEPTIONS=0 -D_SCL_SECURE_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS -D_UNICODE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\unittests\ValueObject -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\ValueObject -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\include -IC:\Python312\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\llvm\..\clang\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\build\tools\lldb\..\clang\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\source -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\third-party\unittest\googletest\include -IC:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\third-party\unittest\googlemock\include -D__OPTIMIZE__ /Zc:inline /Zc:preprocessor /Zc:__cplusplus /Oi /bigobj /permissive- /W4 -wd4141 -wd4146 -wd4244 -wd4267 -wd4291 -wd4351 -wd4456 -wd4457 -wd4458 -wd4459 -wd4503 -wd4624 -wd4722 -wd4100 -wd4127 -wd4512 -wd4505 -wd4610 -wd4510 -wd4702 -wd4245 -wd4706 -wd4310 -wd4701 -wd4703 -wd4389 -wd4611 -wd4805 -wd4204 -wd4577 -wd4091 -wd4592 -wd4319 -wd4709 -wd5105 -wd4324 -wd4251 -wd4275 -w14062 -we4238 /Gw /O2 /Ob2 -MD -wd4018 -wd4068 -wd4150 -wd4201 -wd4251 -wd4521 -wd4530 -wd4589 /EHs-c- /GR- -UNDEBUG -std:c++17 /showIncludes /Fotools\lldb\unittests\ValueObject\CMakeFiles\LLDBValueObjectTests.dir\DynamicValueObjectLocalBuffer.cpp.obj /Fdtools\lldb\unittests\ValueObject\CMakeFiles\LLDBValueObjectTests.dir\ /FS -c C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\ValueObject\DynamicValueObjectLocalBuffer.cpp C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\ValueObject\DynamicValueObjectLocalBuffer.cpp(221): error C2065: 'u_int8_t': undeclared identifier C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\ValueObject\DynamicValueObjectLocalBuffer.cpp(221): error C2146: syntax error: missing ';' before identifier 'value' C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\ValueObject\DynamicValueObjectLocalBuffer.cpp(221): error C2065: 'value': undeclared identifier C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\ValueObject\DynamicValueObjectLocalBuffer.cpp(223): error C2065: 'value': undeclared identifier C:\buildbot\as-builder-10\lldb-x-aarch64\llvm-project\lldb\unittests\ValueObject\DynamicValueObjectLocalBuffer.cpp(223): error C2065: 'value': undeclared identifier 10.451 [28/31/227]Linking CXX executable tools\lldb\unittests\Process\gdb-remo
[Lldb-commits] [lldb] [lldb][NFC] Remove old skipIfOutOfTreeDebugserver's (PR #126144)
https://github.com/jasonmolenda created https://github.com/llvm/llvm-project/pull/126144 When a test depends on a new debugserver feature/fix, the API test must be marked @skipIfOutOfTreeDebugserver because the macOS CI bots test using the latest Xcode release debugserver. But over time all of these fixes & new features are picked up in the Xcode debugserver and these skips can be removed. We may see unexpected test failures from removing all of these 1+ year old skips, but that's likely a separate reason the test is failing that is being papered over by this skip. >From ad8661a23e96d7e13c2d6f4a049007876b95f756 Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 6 Feb 2025 14:12:24 -0800 Subject: [PATCH] [lldb][NFC] Remove old skipIfOutOfTreeDebugserver's When a test depends on a new debugserver feature/fix, the API test must be marked @skipIfOutOfTreeDebugserver because the macOS CI bots test using the latest Xcode release debugserver. But over time all of these fixes & new features are picked up in the Xcode debugserver and these skips can be removed. We may see unexpected test failures from removing all of these 1+ year old skips, but that's likely a separate reason the test is failing that is being papered over by this skip. --- .../register/register_command/TestRegisters.py | 1 - .../unaligned-watchpoint/TestUnalignedWatchpoint.py | 1 - .../TestHWBreakMultiThread.py| 2 -- .../scripted_process/TestStackCoreScriptedProcess.py | 1 - .../TestConcurrentManyBreakpoints.py | 1 - .../concurrent_events/TestConcurrentManyCrash.py | 1 - .../concurrent_events/TestConcurrentManySignals.py | 1 - .../TestConcurrentManyWatchpoints.py | 1 - .../large-watchpoint/TestLargeWatchpoint.py | 1 - .../TestUnalignedSpanningDwords.py | 1 - .../TestCorefileExceptionReason.py | 1 - .../debugserver-exit-code/TestDebugServerExitCode.py | 1 - .../early-process-launch/TestEarlyProcessLaunch.py | 1 - .../ignore_exceptions/TestIgnoredExceptions.py | 1 - .../profile_vrs_detach/TestDetachVrsProfile.py | 1 - .../API/macosx/simulator/TestSimulatorPlatform.py| 12 .../API/macosx/skinny-corefile/TestSkinnyCorefile.py | 1 - .../API/macosx/stack-corefile/TestStackCorefile.py | 1 - .../unregistered-macho/TestUnregisteredMacho.py | 1 - .../register-reading/TestGdbRemoteGPacket.py | 1 - 20 files changed, 32 deletions(-) diff --git a/lldb/test/API/commands/register/register/register_command/TestRegisters.py b/lldb/test/API/commands/register/register/register_command/TestRegisters.py index 99290e02cd2b04f..5bf7aa5dee9c4a8 100644 --- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py +++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py @@ -111,7 +111,6 @@ def test_fp_register_write(self): # "register read fstat" always return 0x @expectedFailureAndroid(archs=["i386"]) @skipIf(archs=no_match(["amd64", "i386", "x86_64"])) -@skipIfOutOfTreeDebugserver @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995") def test_fp_special_purpose_register_read(self): """Test commands that read fpu special purpose registers.""" diff --git a/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py b/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py index 68f239668cf0885..5f9e52855da1688 100644 --- a/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py +++ b/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py @@ -16,7 +16,6 @@ class UnalignedWatchpointTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True -@skipIfOutOfTreeDebugserver def test_unaligned_watchpoint(self): """Test an unaligned watchpoint triggered by a larger aligned write.""" self.build() diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py index 6fe74a8a3fb8c94..1a0515aa04c0799 100644 --- a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py +++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py @@ -15,14 +15,12 @@ class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase): def does_not_support_hw_breakpoints(self): return not super().supports_hw_breakpoints() -@skipIfOutOfTreeDebugserver @skipTestIfFn(does_not_support_hw_breakpoints) def test_hw_break_set_delete_multi_thread_macos(self): self.build()
[Lldb-commits] [lldb] [lldb] Add missing return statements in ThreadMemory (PR #126128)
https://github.com/jimingham approved this pull request. Yeah, that was clearly wrong. Thanks for adding the test. https://github.com/llvm/llvm-project/pull/126128 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use Lambda to simplify repeptitive code in DynamicLoaderDarwin (NFC) (PR #126175)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jonas Devlieghere (JDevlieghere) Changes I suggested using a lambda in #126171 but I think @jasonmolenda missed it. --- Full diff: https://github.com/llvm/llvm-project/pull/126175.diff 1 Files Affected: - (modified) lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp (+11-9) ``diff diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index af873339e002ec..d512d6143639cd 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1212,23 +1212,25 @@ bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) { llvm::VersionTuple version = process->GetHostOSVersion(); if (!version.empty()) { -const llvm::Triple::OSType os_type = +using namespace llvm; +const Triple::OSType os_type = process->GetTarget().GetArchitecture().GetTriple().getOS(); -// Older than macOS 10.12 -if (os_type == llvm::Triple::MacOSX && version < llvm::VersionTuple(10, 12)) +auto OlderThan = [os_type, version](llvm::Triple::OSType o, +llvm::VersionTuple v) -> bool { + return os_type == o && version < v; +}; + +if (OlderThan(Triple::MacOSX, VersionTuple(10, 12))) use_new_spi_interface = false; -// Older than iOS 10 -if (os_type == llvm::Triple::IOS && version < llvm::VersionTuple(10)) +if (OlderThan(Triple::IOS, VersionTuple(10))) use_new_spi_interface = false; -// Older than tvOS 10 -if (os_type == llvm::Triple::TvOS && version < llvm::VersionTuple(10)) +if (OlderThan(Triple::TvOS, VersionTuple(10))) use_new_spi_interface = false; -// Older than watchOS 3 -if (os_type == llvm::Triple::WatchOS && version < llvm::VersionTuple(3)) +if (OlderThan(Triple::WatchOS, VersionTuple(3))) use_new_spi_interface = false; // llvm::Triple::BridgeOS and llvm::Triple::XROS always use the new `` https://github.com/llvm/llvm-project/pull/126175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use Lambda to simplify repeptitive code in DynamicLoaderDarwin (NFC) (PR #126175)
https://github.com/JDevlieghere created https://github.com/llvm/llvm-project/pull/126175 I suggested using a lambda in #126171 but I think @jasonmolenda missed it. >From 11e390143d7097b7d99383b18bc96b08d7502838 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Thu, 6 Feb 2025 20:24:05 -0800 Subject: [PATCH] [lldb] Use Lambda to simplify repeptitive code in DynamicLoaderDarwin (NFC) I suggested using a lambda in #126171 but I think Jason missed it. --- .../MacOSX-DYLD/DynamicLoaderDarwin.cpp | 20 ++- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index af873339e002ec..d512d6143639cd 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1212,23 +1212,25 @@ bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) { llvm::VersionTuple version = process->GetHostOSVersion(); if (!version.empty()) { -const llvm::Triple::OSType os_type = +using namespace llvm; +const Triple::OSType os_type = process->GetTarget().GetArchitecture().GetTriple().getOS(); -// Older than macOS 10.12 -if (os_type == llvm::Triple::MacOSX && version < llvm::VersionTuple(10, 12)) +auto OlderThan = [os_type, version](llvm::Triple::OSType o, +llvm::VersionTuple v) -> bool { + return os_type == o && version < v; +}; + +if (OlderThan(Triple::MacOSX, VersionTuple(10, 12))) use_new_spi_interface = false; -// Older than iOS 10 -if (os_type == llvm::Triple::IOS && version < llvm::VersionTuple(10)) +if (OlderThan(Triple::IOS, VersionTuple(10))) use_new_spi_interface = false; -// Older than tvOS 10 -if (os_type == llvm::Triple::TvOS && version < llvm::VersionTuple(10)) +if (OlderThan(Triple::TvOS, VersionTuple(10))) use_new_spi_interface = false; -// Older than watchOS 3 -if (os_type == llvm::Triple::WatchOS && version < llvm::VersionTuple(3)) +if (OlderThan(Triple::WatchOS, VersionTuple(3))) use_new_spi_interface = false; // llvm::Triple::BridgeOS and llvm::Triple::XROS always use the new ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (PR #126020)
seehearfeel wrote: By now, the format of pr and patch seem no problems, but my email setting of GitHub is not correct, I will update the comment once it is OK, please wait some time before merging it, thank you. https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI (PR #126171)
https://github.com/jasonmolenda closed https://github.com/llvm/llvm-project/pull/126171 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 50ae1c7 - [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (#126020)
Author: Tiezhu Yang Date: 2025-02-07T11:18:40+08:00 New Revision: 50ae1c7bf40ba50aaf3132fa869eda8f06648155 URL: https://github.com/llvm/llvm-project/commit/50ae1c7bf40ba50aaf3132fa869eda8f06648155 DIFF: https://github.com/llvm/llvm-project/commit/50ae1c7bf40ba50aaf3132fa869eda8f06648155.diff LOG: [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK,WATCH} (#126020) On some OS distros such as LoongArch Fedora 38 mate-5 [1], there are no macro definitions NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH in the system header, then there exist some errors when building LLDB on LoongArch. (1) Description of Problem: ``` llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:529:16: error: 'NT_LOONGARCH_HW_WATCH' was not declared in this scope; did you mean 'NT_LOONGARCH_LBT'? 529 | int regset = NT_LOONGARCH_HW_WATCH; |^ |NT_LOONGARCH_LBT llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:543:12: error: 'NT_LOONGARCH_HW_BREAK' was not declared in this scope; did you mean 'NT_LOONGARCH_CSR'? 543 | regset = NT_LOONGARCH_HW_BREAK; |^ |NT_LOONGARCH_CSR ``` (2) Steps to Reproduce: ``` git clone https://github.com/llvm/llvm-project.git mkdir -p llvm-project/llvm/build && cd llvm-project/llvm/build cmake .. -G "Ninja" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_BUILD_RUNTIME=OFF \ -DLLVM_ENABLE_PROJECTS="clang;lldb" \ -DCMAKE_INSTALL_PREFIX=/usr/local/llvm \ -DLLVM_TARGETS_TO_BUILD="LoongArch" \ -DLLVM_HOST_TRIPLE=loongarch64-redhat-linux ninja ``` (3) Additional Info: Maybe there are no problems on the OS distros with newer glibc devel library, so this issue is related with OS distros. (4) Root Cause Analysis: This is because the related Linux kernel commit [2] was merged in 2023-02-25 and the glibc devel library has some delay with kernel, the glibc version of specified OS distros is not updated in time. (5) Final Solution: One way is to ask the maintainer of OS distros to update glibc devel library, but it is better to not depend on the glibc version. In order to avoid the build errors, just define NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH in LLDB if there are no these definitions in the system header. By the way, in order to fit within 80 columns, use C++-style comments for the new added NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH. While at it, for consistency, just modify the current NT_LOONGARCH_LSX and NT_LOONGARCH_LASX to C++-style comments too. [1] https://mirrors.wsyu.edu.cn/fedora/linux/development/rawhide/Everything/loongarch64/iso/livecd-fedora-mate-5.loongarch64.iso [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a69f7a161a7 Signed-off-by: Tiezhu Yang Added: Modified: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp Removed: diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp index b04018ee243fd7d..601dde250094892 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp @@ -27,13 +27,24 @@ // struct iovec definition #include +// LoongArch SIMD eXtension registers #ifndef NT_LOONGARCH_LSX -#define NT_LOONGARCH_LSX 0xa02 /* LoongArch SIMD eXtension registers */ +#define NT_LOONGARCH_LSX 0xa02 #endif +// LoongArch Advanced SIMD eXtension registers #ifndef NT_LOONGARCH_LASX -#define NT_LOONGARCH_LASX \ - 0xa03 /* LoongArch Advanced SIMD eXtension registers */ +#define NT_LOONGARCH_LASX 0xa03 +#endif + +// LoongArch hardware breakpoint registers +#ifndef NT_LOONGARCH_HW_BREAK +#define NT_LOONGARCH_HW_BREAK 0xa05 +#endif + +// LoongArch hardware watchpoint registers +#ifndef NT_LOONGARCH_HW_WATCH +#define NT_LOONGARCH_HW_WATCH 0xa06 #endif #define REG_CONTEXT_SIZE \ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (PR #126020)
https://github.com/SixWeining closed https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Make ValueObjectDynamicValue::UpdateValue() point to a host b… (PR #125143)
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/11097 Here is the relevant piece of the build log for the reference ``` Step 6 (test) failure: build (failure) ... 23.053 [7/11/245] Building CXX object tools/lldb/unittests/Symbol/CMakeFiles/SymbolTests.dir/TestTypeSystemClang.cpp.o 23.305 [7/10/246] Building CXX object tools/lldb/unittests/Platform/Android/CMakeFiles/AdbClientTests.dir/PlatformAndroidTest.cpp.o 23.977 [6/10/247] Linking CXX executable tools/lldb/unittests/Target/TargetTests 24.187 [6/9/248] Linking CXX executable bin/lldb-test 24.378 [6/8/249] Linking CXX executable tools/lldb/unittests/Platform/Android/AdbClientTests 24.666 [6/7/250] Building CXX object tools/lldb/unittests/Expression/CMakeFiles/ExpressionTests.dir/DWARFExpressionTest.cpp.o 26.214 [6/6/251] Building CXX object tools/lldb/unittests/Symbol/CMakeFiles/SymbolTests.dir/TestClangASTImporter.cpp.o 26.575 [6/5/252] Building CXX object tools/lldb/unittests/Symbol/CMakeFiles/SymbolTests.dir/TestLineEntry.cpp.o 28.325 [5/5/253] Linking CXX executable tools/lldb/unittests/Symbol/SymbolTests 28.330 [5/4/254] Building CXX object tools/lldb/unittests/ValueObject/CMakeFiles/LLDBValueObjectTests.dir/DynamicValueObjectLocalBuffer.cpp.o FAILED: tools/lldb/unittests/ValueObject/CMakeFiles/LLDBValueObjectTests.dir/DynamicValueObjectLocalBuffer.cpp.o /usr/local/bin/c++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -DLLVM_BUILD_STATIC -D_DEBUG -D_FILE_OFFSET_BITS=64 -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/unittests/ValueObject -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/unittests/ValueObject -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/llvm/include -I/usr/include/python3.10 -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/llvm/../clang/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/build/tools/lldb/../clang/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/source -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/unittests -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/third-party/unittest/googletest/include -I/home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/third-party/unittest/googlemock/include -isystem /usr/include/libxml2 -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Wno-unknown-pragmas -Wno-strict-aliasing -Wno-vla-extension -O3 -DNDEBUG -std=c++17 -Wno-variadic-macros -Wno-gnu-zero-variadic-macro-arguments -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -Wno-suggest-override -MD -MT tools/lldb/unittests/ValueObject/CMakeFiles/LLDBValueObjectTests.dir/DynamicValueObjectLocalBuffer.cpp.o -MF tools/lldb/unittests/ValueObject/CMakeFiles/LLDBValueObjectTests.dir/DynamicValueObjectLocalBuffer.cpp.o.d -o tools/lldb/unittests/ValueObject/CMakeFiles/LLDBValueObjectTests.dir/DynamicValueObjectLocalBuffer.cpp.o -c /home/tcwg-buildbot/worker/lldb-arm-ubuntu/llvm-project/lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp ../llvm-project/lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp:71:21: error: non-constant-expression cannot be narrowed from type 'uint64_t' (aka 'unsigned long long') to 'size_t' (aka 'unsigned int') in initializer list [-Wc++11-narrowing] 71 | in_value.GetLocalBufferSize()}; | ^ ../llvm-project/lldb/unittests/ValueObject/DynamicValueObjectLocalBuffer.cpp:71:21: note: insert an explicit cast to silence this issue 71 | in_value.GetLocalBufferSize()}; | ^ | static_cast( ) 1 error generated. 29.149 [5/3/255] Building CXX object tools/lldb/unittests/SymbolFile/DWARF/CMakeFiles/SymbolFileDWARFTests.dir/DWARFASTParserClangTests.cpp.o 30.595 [5/2/256] Building CXX object tools/lldb/unittests/Thread/CMakeFiles/ThreadTests.dir/ThreadTest.cpp.o 32.565 [5/1/257] Building CXX object tools/lldb/uni
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (PR #126020)
github-actions[bot] wrote: @seehearfeel Congratulations on having your first Pull Request (PR) merged into the LLVM Project! Your changes will be combined with recent changes from other authors, then tested by our [build bots](https://lab.llvm.org/buildbot/). If there is a problem with a build, you may receive a report in an email or a comment on this PR. Please check whether problems have been caused by your change specifically, as the builds can include changes from many authors. It is not uncommon for your change to be included in a build that fails due to someone else's changes, or infrastructure issues. How to do this, and the rest of the post-merge process, is covered in detail [here](https://llvm.org/docs/MyFirstTypoFix.html#myfirsttypofix-issues-after-landing-your-pr). If your change does cause a problem, it may be reverted, or you can revert it yourself. This is a normal part of [LLVM development](https://llvm.org/docs/DeveloperPolicy.html#patch-reversion-policy). You can fix your changes and open a new PR to merge them again. If you don't get any reports, no action is required from you. Your changes are working as expected, well done! https://github.com/llvm/llvm-project/pull/126020 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 003a2bf - [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI (#126171)
Author: Jason Molenda Date: 2025-02-06T19:11:23-08:00 New Revision: 003a2bf95415afef74d2c3d4a44c3f2ad1fe582d URL: https://github.com/llvm/llvm-project/commit/003a2bf95415afef74d2c3d4a44c3f2ad1fe582d DIFF: https://github.com/llvm/llvm-project/commit/003a2bf95415afef74d2c3d4a44c3f2ad1fe582d.diff LOG: [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI (#126171) In Sep 2016 and newer Darwin releases, debugserver uses libdyld SPI to gather information about the binaries loaded in a process. Before Sep 2016, lldb would inspect the dyld internal data structures directly itself to find this information. DynamicLoaderDarwin::UseDYLDSPI currently defaults to the old inspect-dyld-internal-structures method for binaries (DynamicLoaderMacOSXDYLD). If it detects that the Process' host OS version is new enough, it enables the newer libdyld SPI methods in debugserver (DynamicLoaderMacOS). This patch changes the default to use the new libdyld SPI interfaces. If the Process has a HostOS and it is one of the four specific OSes that existed in 2015 (Mac OS X, iOS, tvOS, watchOS) with an old version number, then we will enable the old DynamicLoader plugin. If this debug session is a corefile, we will always use the old DynamicLoader plugin -- the libdyld SPI cannot run against a corefile, lldb must read metadata or the dyld internal data structures in the corefile to find the loaded binaries. Added: Modified: lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp Removed: diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index b5cf0d62b976f19..af873339e002eca 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1208,35 +1208,44 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp, bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) { Log *log = GetLog(LLDBLog::DynamicLoader); - bool use_new_spi_interface = false; + bool use_new_spi_interface = true; llvm::VersionTuple version = process->GetHostOSVersion(); if (!version.empty()) { const llvm::Triple::OSType os_type = process->GetTarget().GetArchitecture().GetTriple().getOS(); -// macOS 10.12 and newer -if (os_type == llvm::Triple::MacOSX && -version >= llvm::VersionTuple(10, 12)) - use_new_spi_interface = true; +// Older than macOS 10.12 +if (os_type == llvm::Triple::MacOSX && version < llvm::VersionTuple(10, 12)) + use_new_spi_interface = false; -// iOS 10 and newer -if (os_type == llvm::Triple::IOS && version >= llvm::VersionTuple(10)) - use_new_spi_interface = true; +// Older than iOS 10 +if (os_type == llvm::Triple::IOS && version < llvm::VersionTuple(10)) + use_new_spi_interface = false; -// tvOS 10 and newer -if (os_type == llvm::Triple::TvOS && version >= llvm::VersionTuple(10)) - use_new_spi_interface = true; +// Older than tvOS 10 +if (os_type == llvm::Triple::TvOS && version < llvm::VersionTuple(10)) + use_new_spi_interface = false; -// watchOS 3 and newer -if (os_type == llvm::Triple::WatchOS && version >= llvm::VersionTuple(3)) - use_new_spi_interface = true; +// Older than watchOS 3 +if (os_type == llvm::Triple::WatchOS && version < llvm::VersionTuple(3)) + use_new_spi_interface = false; -// NEED_BRIDGEOS_TRIPLE // Any BridgeOS -// NEED_BRIDGEOS_TRIPLE if (os_type == llvm::Triple::BridgeOS) -// NEED_BRIDGEOS_TRIPLE use_new_spi_interface = true; +// llvm::Triple::BridgeOS and llvm::Triple::XROS always use the new +// libdyld SPI interface. + } else { +// We could not get an OS version string, we are likely not +// connected to debugserver and the packets to call the libdyld SPI +// will not exist. +use_new_spi_interface = false; } + // Corefiles cannot use the libdyld SPI to get the inferior's + // binaries, we must find it through metadata or a scan + // of the corefile memory. + if (!process->IsLiveDebugSession()) +use_new_spi_interface = false; + if (log) { if (use_new_spi_interface) LLDB_LOGF( ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 163ccfa - [lldb][NFC] whitespace reflow
Author: Jason Molenda Date: 2025-02-06T15:04:29-08:00 New Revision: 163ccfac33201948eb430db6fac38d265958cfaa URL: https://github.com/llvm/llvm-project/commit/163ccfac33201948eb430db6fac38d265958cfaa DIFF: https://github.com/llvm/llvm-project/commit/163ccfac33201948eb430db6fac38d265958cfaa.diff LOG: [lldb][NFC] whitespace reflow Added: Modified: lldb/bindings/interface/SBFrameDocstrings.i Removed: diff --git a/lldb/bindings/interface/SBFrameDocstrings.i b/lldb/bindings/interface/SBFrameDocstrings.i index 723c1da7c26e2d..f6fb774111a16e 100644 --- a/lldb/bindings/interface/SBFrameDocstrings.i +++ b/lldb/bindings/interface/SBFrameDocstrings.i @@ -87,9 +87,8 @@ See also SBThread." no additional arguments. The register-set SBValue will have a name, e.g. SBFrame::GetRegisters().GetValueAtIndex(0).GetName() -By convention, certain stubs choose to name their general-purpose register-set the 'General Purpose Registers', but that is not required. -register-set may not use that exact name, it is only a convention -used by some stubs. +By convention, certain stubs choose to name their general-purpose +register-set the 'General Purpose Registers', but that is not required. A register-set SBValue will have children, one child per register in the register-set." ) lldb::SBFrame::GetRegisters; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK, WATCH} (PR #126020)
https://github.com/seehearfeel updated https://github.com/llvm/llvm-project/pull/126020 >From 7adde90f84cd43fe47c30a094a483b68fafe9bef Mon Sep 17 00:00:00 2001 From: Tiezhu Yang Date: Thu, 23 Jan 2025 15:30:20 +0800 Subject: [PATCH] [LLDB][LoongArch] Fix build errors about NT_LOONGARCH_HW_{BREAK,WATCH} On some OS distros such as LoongArch Fedora 38 mate-5 [1], there are no macro definitions NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH in the system header, then there exist some errors when building LLDB on LoongArch. (1) Description of Problem: llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:529:16: error: 'NT_LOONGARCH_HW_WATCH' was not declared in this scope; did you mean 'NT_LOONGARCH_LBT'? 529 | int regset = NT_LOONGARCH_HW_WATCH; |^ |NT_LOONGARCH_LBT llvm-project/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:543:12: error: 'NT_LOONGARCH_HW_BREAK' was not declared in this scope; did you mean 'NT_LOONGARCH_CSR'? 543 | regset = NT_LOONGARCH_HW_BREAK; |^ |NT_LOONGARCH_CSR (2) Steps to Reproduce: git clone https://github.com/llvm/llvm-project.git mkdir -p llvm-project/llvm/build && cd llvm-project/llvm/build cmake .. -G "Ninja" \ -DCMAKE_BUILD_TYPE=Release \ -DLLVM_BUILD_RUNTIME=OFF \ -DLLVM_ENABLE_PROJECTS="clang;lldb" \ -DCMAKE_INSTALL_PREFIX=/usr/local/llvm \ -DLLVM_TARGETS_TO_BUILD="LoongArch" \ -DLLVM_HOST_TRIPLE=loongarch64-redhat-linux ninja (3) Additional Info: Maybe there are no problems on the OS distros with newer glibc devel library, so this issue is related with OS distros. (4) Root Cause Analysis: This is because the related Linux kernel commit [2] was merged in 2023-02-25 and the glibc devel library has some delay with kernel, the glibc version of specified OS distros is not updated in time. (5) Final Solution: One way is to ask the maintainer of OS distros to update glibc devel library, but it is better to not depend on the glibc version. In order to avoid the build errors, just define NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH in LLDB if there are no these definitions in the system header. By the way, in order to fit within 80 columns, use C++-style comments for the new added NT_LOONGARCH_HW_BREAK and NT_LOONGARCH_HW_WATCH. While at it, for consistency, just modify the current NT_LOONGARCH_LSX and NT_LOONGARCH_LASX to C++-style comments too. [1] https://mirrors.wsyu.edu.cn/fedora/linux/development/rawhide/Everything/loongarch64/iso/livecd-fedora-mate-5.loongarch64.iso [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1a69f7a161a7 Signed-off-by: Tiezhu Yang --- .../NativeRegisterContextLinux_loongarch64.cpp | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp index b04018ee243fd7d..601dde250094892 100644 --- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp +++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp @@ -27,13 +27,24 @@ // struct iovec definition #include +// LoongArch SIMD eXtension registers #ifndef NT_LOONGARCH_LSX -#define NT_LOONGARCH_LSX 0xa02 /* LoongArch SIMD eXtension registers */ +#define NT_LOONGARCH_LSX 0xa02 #endif +// LoongArch Advanced SIMD eXtension registers #ifndef NT_LOONGARCH_LASX -#define NT_LOONGARCH_LASX \ - 0xa03 /* LoongArch Advanced SIMD eXtension registers */ +#define NT_LOONGARCH_LASX 0xa03 +#endif + +// LoongArch hardware breakpoint registers +#ifndef NT_LOONGARCH_HW_BREAK +#define NT_LOONGARCH_HW_BREAK 0xa05 +#endif + +// LoongArch hardware watchpoint registers +#ifndef NT_LOONGARCH_HW_WATCH +#define NT_LOONGARCH_HW_WATCH 0xa06 #endif #define REG_CONTEXT_SIZE \ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Remove old skipIfOutOfTreeDebugserver's (PR #126144)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Jason Molenda (jasonmolenda) Changes When a test depends on a new debugserver feature/fix, the API test must be marked @skipIfOutOfTreeDebugserver because the macOS CI bots test using the latest Xcode release debugserver. But over time all of these fixes & new features are picked up in the Xcode debugserver and these skips can be removed. We may see unexpected test failures from removing all of these 1+ year old skips, but that's likely a separate reason the test is failing that is being papered over by this skip. --- Full diff: https://github.com/llvm/llvm-project/pull/126144.diff 20 Files Affected: - (modified) lldb/test/API/commands/register/register/register_command/TestRegisters.py (-1) - (modified) lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py (-1) - (modified) lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py (-2) - (modified) lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py (-1) - (modified) lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py (-1) - (modified) lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py (-1) - (modified) lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManySignals.py (-1) - (modified) lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py (-1) - (modified) lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py (-1) - (modified) lldb/test/API/functionalities/watchpoint/unaligned-spanning-two-dwords/TestUnalignedSpanningDwords.py (-1) - (modified) lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py (-1) - (modified) lldb/test/API/macosx/debugserver-exit-code/TestDebugServerExitCode.py (-1) - (modified) lldb/test/API/macosx/early-process-launch/TestEarlyProcessLaunch.py (-1) - (modified) lldb/test/API/macosx/ignore_exceptions/TestIgnoredExceptions.py (-1) - (modified) lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py (-1) - (modified) lldb/test/API/macosx/simulator/TestSimulatorPlatform.py (-12) - (modified) lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py (-1) - (modified) lldb/test/API/macosx/stack-corefile/TestStackCorefile.py (-1) - (modified) lldb/test/API/macosx/unregistered-macho/TestUnregisteredMacho.py (-1) - (modified) lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py (-1) ``diff diff --git a/lldb/test/API/commands/register/register/register_command/TestRegisters.py b/lldb/test/API/commands/register/register/register_command/TestRegisters.py index 99290e02cd2b04f..5bf7aa5dee9c4a8 100644 --- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py +++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py @@ -111,7 +111,6 @@ def test_fp_register_write(self): # "register read fstat" always return 0x @expectedFailureAndroid(archs=["i386"]) @skipIf(archs=no_match(["amd64", "i386", "x86_64"])) -@skipIfOutOfTreeDebugserver @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995") def test_fp_special_purpose_register_read(self): """Test commands that read fpu special purpose registers.""" diff --git a/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py b/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py index 68f239668cf0885..5f9e52855da1688 100644 --- a/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py +++ b/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py @@ -16,7 +16,6 @@ class UnalignedWatchpointTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True -@skipIfOutOfTreeDebugserver def test_unaligned_watchpoint(self): """Test an unaligned watchpoint triggered by a larger aligned write.""" self.build() diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py index 6fe74a8a3fb8c94..1a0515aa04c0799 100644 --- a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py +++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py @@ -15,14 +15,12 @@ class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase): def does_not_support_hw_breakpoints(self): return not super().supports_hw_breakpoints() -@skipIfOutOfTreeDebugserver @skipTestIfFn(does_not_
[Lldb-commits] [lldb] 8b65411 - [lldb][NFC] Remove old skipIfOutOfTreeDebugserver's (#126144)
Author: Jason Molenda Date: 2025-02-06T14:50:09-08:00 New Revision: 8b65411b006cbe302dea7d00ff79abddd1403061 URL: https://github.com/llvm/llvm-project/commit/8b65411b006cbe302dea7d00ff79abddd1403061 DIFF: https://github.com/llvm/llvm-project/commit/8b65411b006cbe302dea7d00ff79abddd1403061.diff LOG: [lldb][NFC] Remove old skipIfOutOfTreeDebugserver's (#126144) When a test depends on a new debugserver feature/fix, the API test must be marked @skipIfOutOfTreeDebugserver because the macOS CI bots test using the latest Xcode release debugserver. But over time all of these fixes & new features are picked up in the Xcode debugserver and these skips can be removed. We may see unexpected test failures from removing all of these 1+ year old skips, but that's likely a separate reason the test is failing that is being papered over by this skip. Added: Modified: lldb/test/API/commands/register/register/register_command/TestRegisters.py lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py lldb/test/API/functionalities/scripted_process/TestStackCoreScriptedProcess.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyBreakpoints.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyCrash.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManySignals.py lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentManyWatchpoints.py lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py lldb/test/API/functionalities/watchpoint/unaligned-spanning-two-dwords/TestUnalignedSpanningDwords.py lldb/test/API/macosx/corefile-exception-reason/TestCorefileExceptionReason.py lldb/test/API/macosx/debugserver-exit-code/TestDebugServerExitCode.py lldb/test/API/macosx/early-process-launch/TestEarlyProcessLaunch.py lldb/test/API/macosx/ignore_exceptions/TestIgnoredExceptions.py lldb/test/API/macosx/profile_vrs_detach/TestDetachVrsProfile.py lldb/test/API/macosx/simulator/TestSimulatorPlatform.py lldb/test/API/macosx/skinny-corefile/TestSkinnyCorefile.py lldb/test/API/macosx/stack-corefile/TestStackCorefile.py lldb/test/API/macosx/unregistered-macho/TestUnregisteredMacho.py lldb/test/API/tools/lldb-server/register-reading/TestGdbRemoteGPacket.py Removed: diff --git a/lldb/test/API/commands/register/register/register_command/TestRegisters.py b/lldb/test/API/commands/register/register/register_command/TestRegisters.py index 99290e02cd2b04f..5bf7aa5dee9c4a8 100644 --- a/lldb/test/API/commands/register/register/register_command/TestRegisters.py +++ b/lldb/test/API/commands/register/register/register_command/TestRegisters.py @@ -111,7 +111,6 @@ def test_fp_register_write(self): # "register read fstat" always return 0x @expectedFailureAndroid(archs=["i386"]) @skipIf(archs=no_match(["amd64", "i386", "x86_64"])) -@skipIfOutOfTreeDebugserver @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr37995") def test_fp_special_purpose_register_read(self): """Test commands that read fpu special purpose registers.""" diff --git a/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py b/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py index 68f239668cf0885..5f9e52855da1688 100644 --- a/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py +++ b/lldb/test/API/commands/watchpoints/unaligned-watchpoint/TestUnalignedWatchpoint.py @@ -16,7 +16,6 @@ class UnalignedWatchpointTestCase(TestBase): NO_DEBUG_INFO_TESTCASE = True -@skipIfOutOfTreeDebugserver def test_unaligned_watchpoint(self): """Test an unaligned watchpoint triggered by a larger aligned write.""" self.build() diff --git a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py index 6fe74a8a3fb8c94..1a0515aa04c0799 100644 --- a/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py +++ b/lldb/test/API/functionalities/breakpoint/hardware_breakpoints/hardware_breakpoint_on_multiple_threads/TestHWBreakMultiThread.py @@ -15,14 +15,12 @@ class HardwareBreakpointMultiThreadTestCase(HardwareBreakpointTestBase): def does_not_support_hw_breakpoints(self): return not super().supports_hw_breakpoints() -@skipIfOutOfTreeDebugserver @skipTestIfFn(does_not_support_hw_breakpoints) de
[Lldb-commits] [lldb] [lldb][NFC] Remove old skipIfOutOfTreeDebugserver's (PR #126144)
https://github.com/jasonmolenda closed https://github.com/llvm/llvm-project/pull/126144 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][NFC] Remove old skipIfOutOfTreeDebugserver's (PR #126144)
jasonmolenda wrote: The Xcode installed on the macOS CI bots was updated to Xcode 16.2 a few weeks ago, so we've got a pretty recent debugserver being used on them now. https://github.com/llvm/llvm-project/pull/126144 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI (PR #126171)
https://github.com/jasonmolenda created https://github.com/llvm/llvm-project/pull/126171 In Sep 2016 and newer Darwin releases, debugserver uses libdyld SPI to gather information about the binaries loaded in a process. Before Sep 2016, lldb would inspect the dyld internal data structures directly itself to find this information. DynamicLoaderDarwin::UseDYLDSPI currently defaults to the old inspect-dyld-internal-structures method for binaries (DynamicLoaderMacOSXDYLD). If it detects that the Process' host OS version is new enough, it enables the newer libdyld SPI methods in debugserver (DynamicLoaderMacOS). This patch changes the default to use the new libdyld SPI interfaces. If the Process has a HostOS and it is one of the four specific OSes that existed in 2015 (Mac OS X, iOS, tvOS, watchOS) with an old version number, then we will enable the old DynamicLoader plugin. If this debug session is a corefile, we will always use the old DynamicLoader plugin -- the libdyld SPI cannot run against a corefile, lldb must read metadata or the dyld internal data structures in the corefile to find the loaded binaries. >From af2fa2e17ceb527dd9a2b8c5d7e72da374b4512b Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Thu, 6 Feb 2025 18:48:02 -0800 Subject: [PATCH] [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI In Sep 2016 and newer Darwin releases, debugserver uses libdyld SPI to gather information about the binaries loaded in a process. Before Sep 2016, lldb would inspect the dyld internal data structures directly itself to find this information. DynamicLoaderDarwin::UseDYLDSPI currently defaults to the old inspect-dyld-internal-structures method for binaries (DynamicLoaderMacOSXDYLD). If it detects that the Process' host OS version is new enough, it enables the newer libdyld SPI methods in debugserver (DynamicLoaderMacOS). This patch changes the default to use the new libdyld SPI interfaces. If the Process has a HostOS and it is one of the four specific OSes that existed in 2015 (Mac OS X, iOS, tvOS, watchOS) with an old version number, then we will enable the old DynamicLoader plugin. If this debug session is a corefile, we will always use the old DynamicLoader plugin -- the libdyld SPI cannot run against a corefile, lldb must read metadata or the dyld internal data structures in the corefile to find the loaded binaries. --- .../MacOSX-DYLD/DynamicLoaderDarwin.cpp | 43 +++ 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp index b5cf0d62b976f19..6362d0ca6027afc 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderDarwin.cpp @@ -1208,35 +1208,44 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp, bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) { Log *log = GetLog(LLDBLog::DynamicLoader); - bool use_new_spi_interface = false; + bool use_new_spi_interface = true; llvm::VersionTuple version = process->GetHostOSVersion(); if (!version.empty()) { const llvm::Triple::OSType os_type = process->GetTarget().GetArchitecture().GetTriple().getOS(); -// macOS 10.12 and newer -if (os_type == llvm::Triple::MacOSX && -version >= llvm::VersionTuple(10, 12)) - use_new_spi_interface = true; +// Older than macOS 10.12 +if (os_type == llvm::Triple::MacOSX && version < llvm::VersionTuple(10, 12)) + use_new_spi_interface = false; -// iOS 10 and newer -if (os_type == llvm::Triple::IOS && version >= llvm::VersionTuple(10)) - use_new_spi_interface = true; +// Older than iOS 10 +if (os_type == llvm::Triple::IOS && version < llvm::VersionTuple(10)) + use_new_spi_interface = false; -// tvOS 10 and newer -if (os_type == llvm::Triple::TvOS && version >= llvm::VersionTuple(10)) - use_new_spi_interface = true; +// Older than tvOS 10 +if (os_type == llvm::Triple::TvOS && version < llvm::VersionTuple(10)) + use_new_spi_interface = false; -// watchOS 3 and newer -if (os_type == llvm::Triple::WatchOS && version >= llvm::VersionTuple(3)) - use_new_spi_interface = true; +// Older than watchOS 3 +if (os_type == llvm::Triple::WatchOS && version < llvm::VersionTuple(3)) + use_new_spi_interface = false; -// NEED_BRIDGEOS_TRIPLE // Any BridgeOS -// NEED_BRIDGEOS_TRIPLE if (os_type == llvm::Triple::BridgeOS) -// NEED_BRIDGEOS_TRIPLE use_new_spi_interface = true; +// llvm::Triple::BridgeOS and llvm::Triple::XROS always use the new +// libdyld SPI interface. + } else { +// We could not get an OS version string, we are likely not +// connected to debugserver and the packets to call the libdyld SPI +// will not exist. +use_new_spi_in
[Lldb-commits] [lldb] d8e0b13 - [lldb][NFC] Small comment fix in Process.h
Author: Jason Molenda Date: 2025-02-06T18:54:30-08:00 New Revision: d8e0b130bd7b2dd168642a82056b8eca21c49f9f URL: https://github.com/llvm/llvm-project/commit/d8e0b130bd7b2dd168642a82056b8eca21c49f9f DIFF: https://github.com/llvm/llvm-project/commit/d8e0b130bd7b2dd168642a82056b8eca21c49f9f.diff LOG: [lldb][NFC] Small comment fix in Process.h Added: Modified: lldb/include/lldb/Target/Process.h Removed: diff --git a/lldb/include/lldb/Target/Process.h b/lldb/include/lldb/Target/Process.h index a184e6dd891affa..c3622a29bc772d7 100644 --- a/lldb/include/lldb/Target/Process.h +++ b/lldb/include/lldb/Target/Process.h @@ -1491,10 +1491,11 @@ class Process : public std::enable_shared_from_this, /// otherwise. virtual bool IsAlive(); + /// Check if a process is a live debug session, or a corefile/post-mortem. virtual bool IsLiveDebugSession() const { return true; }; /// Provide a way to retrieve the core dump file that is loaded for debugging. - /// Only available if IsLiveDebugSession() returns true. + /// Only available if IsLiveDebugSession() returns false. /// /// \return /// File path to the core file. ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI (PR #126171)
jasonmolenda wrote: I originally removed the old DynamicLoader plugin except for corefiles. But it seemed unnecessary to break lldb from working on old macOS for no reason. I should probably remove the iOS/watchOS/tvOS cases, it's years outside Xcode's supported OS versions. https://github.com/llvm/llvm-project/pull/126171 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI (PR #126171)
https://github.com/JDevlieghere edited https://github.com/llvm/llvm-project/pull/126171 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Darwin] Change DynamicLoaderDarwin to default to new SPI (PR #126171)
@@ -1208,35 +1208,44 @@ DynamicLoaderDarwin::GetThreadLocalData(const lldb::ModuleSP module_sp, bool DynamicLoaderDarwin::UseDYLDSPI(Process *process) { Log *log = GetLog(LLDBLog::DynamicLoader); - bool use_new_spi_interface = false; + bool use_new_spi_interface = true; llvm::VersionTuple version = process->GetHostOSVersion(); if (!version.empty()) { const llvm::Triple::OSType os_type = process->GetTarget().GetArchitecture().GetTriple().getOS(); -// macOS 10.12 and newer -if (os_type == llvm::Triple::MacOSX && -version >= llvm::VersionTuple(10, 12)) - use_new_spi_interface = true; +// Older than macOS 10.12 +if (os_type == llvm::Triple::MacOSX && version < llvm::VersionTuple(10, 12)) JDevlieghere wrote: This seems ripe for a helper or lambda that takes a triple and an unsigned version :-) https://github.com/llvm/llvm-project/pull/126171 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits