[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Support constant index encoding of DW_AT_object_pointer (PR #144998)
slydiman wrote: > Looks like it got resolved? Yes, sorry for the inconvenience. https://github.com/llvm/llvm-project/pull/144998 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Handle core file tag segments missing tag data (PR #145338)
https://github.com/omjavaid edited https://github.com/llvm/llvm-project/pull/145338 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reland "[lldb][target] Add progress report for wait-attaching to proc… (PR #145111)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/145111 >From 9d9404b10d6f2073b89bb228079b8ee4e57534c8 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Fri, 20 Jun 2025 13:47:32 -0700 Subject: [PATCH] Reland "[lldb][target] Add progress report for wait-attaching to process" (#144810) This relands commit e0933ab5ae4856c4aa188a5ea16716b3a8d0840b. The original commit was causing the test TestCreateAfterAttach.py to fail on ARM Ubuntu bots. It's possible that this could've been happening because the test for wait-attach progress reporting is waiting on a process named "a.out" which could be too generic as multiple other tests (when run in parallel on the bots) could also be using processes named "a.out". This commit changes the wait-attach progress report test to wait on a unique process name. Original PR description: This commit adds a progress report when wait-attaching to a process as well as a test for this. Original PR link: https://github.com/llvm/llvm-project/pull/144768 --- lldb/source/Target/Target.cpp | 1 + .../TestProgressReporting.py | 23 +++ 2 files changed, 24 insertions(+) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 45a9e1196a049..8f8d2ef21cc5f 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3546,6 +3546,7 @@ llvm::Expected Target::GetTraceOrCreate() { } Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { + Progress attach_progress("Waiting to attach to process"); m_stats.SetLaunchOrAttachTime(); auto state = eStateInvalid; auto process_sp = GetProcessSP(); diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 9af53845ca1b7..c711d182c63e0 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -2,6 +2,7 @@ Test that we are able to broadcast and receive progress events from lldb """ import lldb +import threading import lldbsuite.test.lldbutil as lldbutil @@ -16,6 +17,28 @@ def setUp(self): self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) +def test_wait_attach_progress_reporting(self): +"""Test that progress reports for wait attaching work as intended.""" +target = self.dbg.CreateTarget(None) + +# The waiting to attach progress message will get emitted upon +# trying to attach, but it's not going to be the event picked +# up by checking with fetch_next_event, so go through all emitted +# progres events and check that the waiting to attach one was emitted at all. +target.AttachToProcessWithName( +self.listener, +"a.out", +False, +lldb.SBError(), +) +event = lldb.SBEvent() +events = [] +while self.listener.GetNextEventForBroadcaster(self.broadcaster, event): +progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event) +message = progress_data.GetValueForKey("message").GetStringValue(100) +events.append(message) +self.assertTrue("Waiting to attach to process" in events) + def test_dwarf_symbol_loading_progress_report(self): """Test that we are able to fetch dwarf symbol loading progress events""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
@@ -299,6 +299,8 @@ def parseOptionsAndInitTestdirs(): configuration.libcxx_library_dir = args.libcxx_library_dir configuration.cmake_build_type = args.cmake_build_type.lower() +configuration.target_triple = args.target_triple + Nerixyz wrote: In the MSVC toolchain on Clang, [there's an open FIXME](https://github.com/llvm/llvm-project/blob/fcd82f9cf3b64d8959afed4569259163da3a5afd/clang/lib/Driver/ToolChains/MSVC.cpp#L786) for supporting libc++. I feel hesitant changing the target there. If I understand you correctly, then the test would check if it's running on `*-pc-windows-*` and change it to `*-pc-windows-msvc`. In which case, it assumes to always run with MSVC's STL. That could work. Clang on MinGW uses `x86_64-w64-windows-gnu` so this wouldn't get changed, which is good. Maybe it's better to get that fixme fixed in Clang (i.e. introduce something like `-stdlib=libc++`/`-stdlib=msvcstl`). As far as I know, MSVC's STL only works on the `*-msvc` targets. https://github.com/llvm/llvm-project/pull/143177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Deploy Python DLL on Windows (PR #137467)
Nerixyz wrote: > Not quite; see > [`main`/llvm/utils/release/build_llvm_release.bat](https://github.com/llvm/llvm-project/blob/main/llvm/utils/release/build_llvm_release.bat?rgh-link-date=2025-06-23T20%3A21%3A44Z). CPack should be fine. If I remember correctly, then it should install all files to a temporary directory and package that. > Also, are those python dlls distributable, or would there be licensing > implications form including them in the installer? I'm not an expert. From https://wiki.python.org/moin/PythonSoftwareFoundationLicenseFaq and https://docs.python.org/3/license.html, it looks like it's okay to include this in the installer, but "You must retain all copyright notices found in the code you are redistributing". https://github.com/llvm/llvm-project/pull/137467 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 23b0564 - [lldb] Fix AppleObjCDeclVendor for classes which have no methods (#145452)
Author: Dave Lee Date: 2025-06-24T10:58:06-07:00 New Revision: 23b0564800f6308ae4b54f0fbf60759ab8f7eb80 URL: https://github.com/llvm/llvm-project/commit/23b0564800f6308ae4b54f0fbf60759ab8f7eb80 DIFF: https://github.com/llvm/llvm-project/commit/23b0564800f6308ae4b54f0fbf60759ab8f7eb80.diff LOG: [lldb] Fix AppleObjCDeclVendor for classes which have no methods (#145452) Fix the rare case where an ObjC class has ivars but no methods. The fix is to not early return when a class has no method list. Added: lldb/test/API/lang/objc/class-without-methods/Makefile lldb/test/API/lang/objc/class-without-methods/Point.h lldb/test/API/lang/objc/class-without-methods/Point.m lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py lldb/test/API/lang/objc/class-without-methods/main.m Modified: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp Removed: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index dac93931bab1b..cc0c9e728964e 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -552,9 +552,8 @@ bool ClassDescriptorV2::Describe( } else { std::optional base_method_list = GetMethodList(process, class_ro->m_baseMethods_ptr); - if (!base_method_list) -return false; - if (!ProcessMethodList(instance_method_func, *base_method_list)) + if (base_method_list && + !ProcessMethodList(instance_method_func, *base_method_list)) return false; } } diff --git a/lldb/test/API/lang/objc/class-without-methods/Makefile b/lldb/test/API/lang/objc/class-without-methods/Makefile new file mode 100644 index 0..f6f336c01bbc5 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Makefile @@ -0,0 +1,5 @@ +OBJC_SOURCES := Point.m main.m +include Makefile.rules + +# Only objc metadata, no debug info, for Point.m +Point.o: CFLAGS_EXTRAS += -g0 diff --git a/lldb/test/API/lang/objc/class-without-methods/Point.h b/lldb/test/API/lang/objc/class-without-methods/Point.h new file mode 100644 index 0..a352259954eff --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Point.h @@ -0,0 +1,4 @@ +#import + +@interface Point : NSObject +@end diff --git a/lldb/test/API/lang/objc/class-without-methods/Point.m b/lldb/test/API/lang/objc/class-without-methods/Point.m new file mode 100644 index 0..770a857c80dc7 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Point.m @@ -0,0 +1,7 @@ +#import "Point.h" + +@implementation Point { + float _x; + float _y; +} +@end diff --git a/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py b/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py new file mode 100644 index 0..f83b0352bf1a9 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py @@ -0,0 +1,11 @@ +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestCase(TestBase): +def test(self): +self.build() +lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m")) +self.expect("frame var -P1 p", substrs=["_x = 0", "_y = 0"]) diff --git a/lldb/test/API/lang/objc/class-without-methods/main.m b/lldb/test/API/lang/objc/class-without-methods/main.m new file mode 100644 index 0..0b6e14371bc59 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/main.m @@ -0,0 +1,7 @@ +#import "Point.h" + +int main() { + Point *p = [Point new]; + // break here + return 0; +} ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix AppleObjCDeclVendor for classes which have no methods (PR #145452)
https://github.com/kastiglione closed https://github.com/llvm/llvm-project/pull/145452 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Handle core file tag segments missing tag data (PR #145338)
https://github.com/omjavaid approved this pull request. Looks good to me. There was a comment somewhere in the core file tests which tells how to the core dump got generated. If you could update that to add information on which flags are needed to generate the attached core dump for this notags test. https://github.com/llvm/llvm-project/pull/145338 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 371f12f - Revert "[lldb] Add count for number of DWO files loaded in statistics" (#145494)
Author: Michael Buch Date: 2025-06-24T11:33:00+01:00 New Revision: 371f12f96dc0ba146a66dfb1c30198bf8555893e URL: https://github.com/llvm/llvm-project/commit/371f12f96dc0ba146a66dfb1c30198bf8555893e DIFF: https://github.com/llvm/llvm-project/commit/371f12f96dc0ba146a66dfb1c30198bf8555893e.diff LOG: Revert "[lldb] Add count for number of DWO files loaded in statistics" (#145494) Reverts llvm/llvm-project#144424 Caused CI failures. macOS CI failure was: ``` 10:20:36 FAIL: test_dwp_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the loaded dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 639, in test_dwp_dwo_file_count 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_no_debug_names_eager_loads_dwo_files (TestStats.TestCase) 10:20:36 Test the eager loading behavior of DWO files when debug_names is absent by 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 566, in test_no_debug_names_eager_loads_dwo_files 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_split_dwarf_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 588, in test_split_dwarf_dwo_file_count 10:20:36 self.assertEqual(len(debug_stats["modules"]), 1) 10:20:36 AssertionError: 42 != 1 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang ``` Added: Modified: lldb/include/lldb/Symbol/SymbolFile.h lldb/include/lldb/Target/Statistics.h lldb/packages/Python/lldbsuite/test/builders/builder.py lldb/packages/Python/lldbsuite/test/make/Makefile.rules lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h lldb/source/Target/Statistics.cpp lldb/test/API/commands/statistics/basic/TestStats.py Removed: lldb/test/API/commands/statistics/basic/baz.cpp lldb/test/API/commands/statistics/basic/third.cpp diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index b0b608d0a5e79..75c7f230ddf3d 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -472,14 +472,6 @@ class SymbolFile : public PluginInterface { return false; }; - /// Get number of loaded/parsed DWO files. This is emitted in "statistics - /// dump" - /// - /// \returns - /// A pair containing (loaded_dwo_count, total_dwo_count). If this - /// symbol file doesn't support DWO files, both counts will be 0. - virtual std::pair GetDwoFileCounts() { return {0, 0}; } - virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 42f03798c219e..2d0d25cd3c753 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -153,8 +153,6 @@ struct ModuleStats { bool symtab_stripped = false; bool debug_info_had_variable_errors = false; bool debug_info_had_incomplete_types = false; - uint32_t dwo_file_count = 0; - uint32_t loaded_dwo_file_count = 0; }; struct ConstStringStats { diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index efb1ba568e3e6..de05732469448 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,25 +247,13 @@ def getLLDBObjRoot(self): def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] - -
[Lldb-commits] [lldb] [lldb] Clean up GDBRemoteCommunication::StartDebugserverProcess (PR #145021)
https://github.com/labath updated https://github.com/llvm/llvm-project/pull/145021 >From 4e29066da132ed85a4ee5e5754bb547305759afe Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Fri, 20 Jun 2025 11:20:10 +0200 Subject: [PATCH] [lldb] Clean up GDBRemoteCommunication::StartDebugserverProcess The function was extremely messy in that it, depending on the set of arguments, it could either modify the Connection object in `this` or not. It had a lot of arguments, with each call site passing a different combination of null values. This PR: - packs "url" and "comm_fd" arguments into a variant as they are mutually exclusive - removes the "null url *and* null comm_fd" which is not used as of #145017 - marks the function as `static` to make it clear it (now) does not operate on the `this` object. --- .../gdb-remote/GDBRemoteCommunication.cpp | 169 ++ .../gdb-remote/GDBRemoteCommunication.h | 10 +- .../GDBRemoteCommunicationServerPlatform.cpp | 30 ++-- .../Process/gdb-remote/ProcessGDBRemote.cpp | 6 +- 4 files changed, 78 insertions(+), 137 deletions(-) diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 0d3ead840b080..bea2faff2330e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #if defined(__APPLE__) #define DEBUGSERVER_BASENAME "debugserver" @@ -894,11 +895,9 @@ FileSpec GDBRemoteCommunication::GetDebugserverPath(Platform *platform) { } Status GDBRemoteCommunication::StartDebugserverProcess( -const char *url, Platform *platform, ProcessLaunchInfo &launch_info, -uint16_t *port, const Args *inferior_args, shared_fd_t pass_comm_fd) { +std::variant comm, Platform *platform, +ProcessLaunchInfo &launch_info, const Args *inferior_args) { Log *log = GetLog(GDBRLog::Process); - LLDB_LOG(log, "Starting debug server: url={0}, port={1}", - url ? url : "", port ? *port : uint16_t(0)); FileSpec debugserver_file_spec = GetDebugserverPath(platform); if (!debugserver_file_spec) @@ -911,89 +910,58 @@ Status GDBRemoteCommunication::StartDebugserverProcess( #if !defined(__APPLE__) // First argument to lldb-server must be mode in which to run. - debugserver_args.AppendArgument(llvm::StringRef("gdbserver")); + debugserver_args.AppendArgument("gdbserver"); #endif - // If a url is supplied then use it - if (url && url[0]) -debugserver_args.AppendArgument(llvm::StringRef(url)); - - if (pass_comm_fd != SharedSocket::kInvalidFD) { -StreamString fd_arg; -fd_arg.Printf("--fd=%" PRIi64, (int64_t)pass_comm_fd); -debugserver_args.AppendArgument(fd_arg.GetString()); -// Send "pass_comm_fd" down to the inferior so it can use it to -// communicate back with this process. Ignored on Windows. -launch_info.AppendDuplicateFileAction((int64_t)pass_comm_fd, - (int64_t)pass_comm_fd); - } - // use native registers, not the GDB registers - debugserver_args.AppendArgument(llvm::StringRef("--native-regs")); + debugserver_args.AppendArgument("--native-regs"); if (launch_info.GetLaunchInSeparateProcessGroup()) -debugserver_args.AppendArgument(llvm::StringRef("--setsid")); +debugserver_args.AppendArgument("--setsid"); llvm::SmallString<128> named_pipe_path; // socket_pipe is used by debug server to communicate back either - // TCP port or domain socket name which it listens on. - // The second purpose of the pipe to serve as a synchronization point - + // TCP port or domain socket name which it listens on. However, we're not + // interested in the actualy value here. + // The only reason for using the pipe is to serve as a synchronization point - // once data is written to the pipe, debug server is up and running. Pipe socket_pipe; - std::unique_ptr sock_up; + // If a url is supplied then use it + if (shared_fd_t *comm_fd = std::get_if(&comm)) { +LLDB_LOG(log, "debugserver communicates over fd {0}", comm_fd); +assert(*comm_fd != SharedSocket::kInvalidFD); +debugserver_args.AppendArgument(llvm::formatv("--fd={0}", *comm_fd).str()); +// Send "comm_fd" down to the inferior so it can use it to communicate back +// with this process. +launch_info.AppendDuplicateFileAction((int64_t)*comm_fd, (int64_t)*comm_fd); + } else { +llvm::StringRef url = std::get(comm); +LLDB_LOG(log, "debugserver listens on: {0}", url); +debugserver_args.AppendArgument(url); - // port is null when debug server should listen on domain socket - we're - // not interested in port value but rather waiting for debug server to - // become available. - if (pass_comm_fd == SharedSocket::kInvalidFD) { -if (url) { -// Create a temporary file to get the stdout/stderr and redire
[Lldb-commits] [lldb] Revert "[lldb] Add count for number of DWO files loaded in statistics" (PR #145494)
https://github.com/Michael137 created https://github.com/llvm/llvm-project/pull/145494 Reverts llvm/llvm-project#144424 Caused CI failures. macOS CI failure was: ``` 10:20:36 FAIL: test_dwp_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the loaded dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 639, in test_dwp_dwo_file_count 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_no_debug_names_eager_loads_dwo_files (TestStats.TestCase) 10:20:36 Test the eager loading behavior of DWO files when debug_names is absent by 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 566, in test_no_debug_names_eager_loads_dwo_files 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_split_dwarf_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 588, in test_split_dwarf_dwo_file_count 10:20:36 self.assertEqual(len(debug_stats["modules"]), 1) 10:20:36 AssertionError: 42 != 1 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang ``` >From a935d5ab75b11f8fc1f1196e3ee4bcd15a9102ce Mon Sep 17 00:00:00 2001 From: Michael Buch Date: Tue, 24 Jun 2025 11:32:34 +0100 Subject: [PATCH] Revert "[lldb] Add count for number of DWO files loaded in statistics (#144424)" This reverts commit 3095d3a47d624b573d0748ee37f8f201d5702b63. --- lldb/include/lldb/Symbol/SymbolFile.h | 8 - lldb/include/lldb/Target/Statistics.h | 2 - .../Python/lldbsuite/test/builders/builder.py | 26 +--- .../Python/lldbsuite/test/make/Makefile.rules | 4 - .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 29 .../SymbolFile/DWARF/SymbolFileDWARF.h| 5 - lldb/source/Target/Statistics.cpp | 12 +- .../commands/statistics/basic/TestStats.py| 138 -- .../API/commands/statistics/basic/baz.cpp | 12 -- .../API/commands/statistics/basic/third.cpp | 7 - 10 files changed, 8 insertions(+), 235 deletions(-) delete mode 100644 lldb/test/API/commands/statistics/basic/baz.cpp delete mode 100644 lldb/test/API/commands/statistics/basic/third.cpp diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index b0b608d0a5e79..75c7f230ddf3d 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -472,14 +472,6 @@ class SymbolFile : public PluginInterface { return false; }; - /// Get number of loaded/parsed DWO files. This is emitted in "statistics - /// dump" - /// - /// \returns - /// A pair containing (loaded_dwo_count, total_dwo_count). If this - /// symbol file doesn't support DWO files, both counts will be 0. - virtual std::pair GetDwoFileCounts() { return {0, 0}; } - virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 42f03798c219e..2d0d25cd3c753 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -153,8 +153,6 @@ struct ModuleStats { bool symtab_stripped = false; bool debug_info_had_variable_errors = false; bool debug_info_had_incomplete_types = false; - uint32_t dwo_file_count = 0; - uint32_t loaded_dwo_file_count = 0; }; struct ConstStringStats { diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index efb1ba568e3e6..de05732469448 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,25 +247,13 @@ def getLLDBObjRoot(self):
[Lldb-commits] [lldb] 3e98d2b - [lldb] Fix windows build for #145293
Author: Pavel Labath Date: 2025-06-24T15:25:10+02:00 New Revision: 3e98d2b0311e0ccc213a28324d723bf93fe0e5b3 URL: https://github.com/llvm/llvm-project/commit/3e98d2b0311e0ccc213a28324d723bf93fe0e5b3 DIFF: https://github.com/llvm/llvm-project/commit/3e98d2b0311e0ccc213a28324d723bf93fe0e5b3.diff LOG: [lldb] Fix windows build for #145293 Added: Modified: lldb/tools/lldb-server/lldb-gdbserver.cpp Removed: diff --git a/lldb/tools/lldb-server/lldb-gdbserver.cpp b/lldb/tools/lldb-server/lldb-gdbserver.cpp index 843354147f2da..c4c321067e920 100644 --- a/lldb/tools/lldb-server/lldb-gdbserver.cpp +++ b/lldb/tools/lldb-server/lldb-gdbserver.cpp @@ -218,8 +218,8 @@ void ConnectToRemote(MainLoop &mainloop, error.AsCString()); exit(-1); } -connection_up = std::unique_ptr(new ConnectionFileDescriptor( -new TCPSocket(sockfd, /*should_close=*/true))); +connection_up = std::make_unique( +std::make_unique(sockfd, /*should_close=*/true)); #else url = llvm::formatv("fd://{0}", connection_fd).str(); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp -- lldb/source/Host/common/NativeProcessProtocol.cpp lldb/source/Plugins/Process/Utility/LinuxSignals.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index 33755e3e2..68ede9716 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -340,9 +340,10 @@ void NativeProcessProtocol::NotifyDidExec() { Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint) { - + volatile bool debug = true; - while (debug) {} + while (debug) { + } Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "addr = {0:x}, size_hint = {1}", addr, size_hint); `` https://github.com/llvm/llvm-project/pull/144800 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][AArch64] Handle core file tag segments missing tag data (PR #145338)
omjavaid wrote: How do we generate this core file? Any particular flags to avoid generating tag data.? https://github.com/llvm/llvm-project/pull/145338 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [clang] [clang-tools-extra] [flang] [libc] [libcxx] [lldb] [llvm] [mlir] Rsan (PR #145540)
Martin =?utf-8?q?Storsjö?= ,Hubert Tong ,Tom Stellard ,Tom Stellard ,Tom Stellard ,David Green ,Sam Tebbs , =?utf-8?q?Michał_Górny?= , =?utf-8?q?Michał_Górny?= ,Ben Langmuir ,Vitaly Buka ,Ben Langmuir ,Florian Hahn ,Tom Stellard ,Brad Smith ,Benjamin Maxwell ,Alexandros Lamprineas ,Tom Stellard ,Craig Topper ,Phoebe Wang ,Yingwei Zheng ,Jonas Devlieghere ,Jonas Devlieghere ,Pavel Labath ,Pavel Labath ,Mark de Wever ,"s.vgys" <83276820+samvangyse...@users.noreply.github.com>,Nikita Popov ,Nikita Popov , kadir =?utf-8?q?çetinkaya?= ,Brad Smith ,David Sherwood ,David Sherwood ,Nikita Popov ,Tom Stellard ,Phoebe Wang , kadir =?utf-8?q?çetinkaya?= ,Joseph Huber ,Peter Smith ,CarolineConcatto ,David Green ,David Spickett ,Louis Dionne ,Tom Tromey ,beetrees ,Michael Park ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Lang Hames ,Nikita Popov ,Jonas Paulsson ,Florian Hahn ,Craig Topper ,Chuanqi Xu ,Diego Caballero ,Oliver Stannard ,Amr Hesham ,Amr Hesham ,Nico Weber ,David Green ,Florian Hahn ,Fangrui Song ,Nikita Popov ,Yingwei Zheng ,Brad Smith ,Louis Dionne ,Alexey Bataev ,Benjamin Maxwell ,Benjamin Maxwell ,Louis Dionne ,Simon Pilgrim ,Nico Weber ,Daniil Kovalev ,Nikita Popov ,Nikita Popov ,Nikita Popov ,Nikolas Klauser ,Joseph Huber ,Joseph Huber ,Fangrui Song ,Joseph Huber ,higher-performance ,Chuanqi Xu , =?utf-8?q?Mikołaj_Piróg?= , =?utf-8?q?Mikołaj_Piróg?= ,Nikita Popov ,Nikita Popov ,Nikita Popov ,Nikita Popov ,Nikita Popov ,Owen Pan ,Amr Hesham ,Florian Hahn ,Vigneshwar Jayakumar ,Vigneshwar Jayakumar ,Yingwei Zheng ,Lang Hames ,Piyou Chen ,Tom Stellard ,David Green , =?utf-8?q?Michał_Górny?= ,Nikita Popov ,CarolineConcatto ,Owen Pan ,Owen Pan ,Tristan Ross ,Nathan Ridge ,Sylvestre Ledru ,Harald van Dijk ,Petr Hosek ,Haojian Wu ,Owen Pan ,Owen Pan ,Alexey Bataev ,Tom Stellard ,Lang Hames ,Florian Mayer ,Brad Smith ,Mark de Wever ,Craig Topper ,Fangrui Song ,Fangrui Song ,Fangrui Song ,Yingwei Zheng ,Jeremy Morse ,Brad Smith ,Florian Hahn ,Matheus Izvekov ,Mark de Wever ,Brian Cain ,Owen Pan ,Fraser Cormack ,Haojian Wu ,Vigneshwar Jayakumar ,Nikolas Klauser ,Louis Dionne ,Tom Stellard ,Kerry McLaughlin ,Mark de Wever ,Tom Stellard ,"A. Jiang" ,David Green ,Younan Zhang ,Zixu Wang <9819235+zix...@users.noreply.github.com>,Matheus Izvekov ,Louis Dionne ,Matt Arsenault ,Tom Stellard ,Alexander Richardson ,Mariya Podchishchaeva ,Hassnaa Hamdi ,Matheus Izvekov ,Sudharsan Veeravalli ,Matt Arsenault ,Hans Wennborg , Sebastian =?utf-8?q?Jodłowski?= ,Louis Dionne ,Louis Dionne ,Joseph Huber ,Matt Arsenault ,Alexey Bataev ,Nikita Popov ,Joseph Huber ,Chuanqi Xu ,Yingwei Zheng ,David Truby ,Younan Zhang ,Chuanqi Xu ,Yingwei Zheng ,Matt Arsenault ,Jonas Hahnfeld ,Alexandre Ganea ,Ikhlas Ajbar ,Stephen Tozer ,Amy Kwan ,Nikita Popov ,Tom Stellard ,Tom Stellard ,Tom Stellard ,Tom Stellard ,Tom Stellard ,Owen Pan ,Nathan Ridge ,Tom Stellard ,Tom Stellard ,Martin =?utf-8?q?Storsjö?= ,Elvis Wang ,Jonathan Albrecht ,Louis Dionne ,pkarveti ,Jordan R AW ,Jordan R AW ,Yingwei Zheng ,David Green ,Owen Pan ,Phoebe Wang ,Yingwei Zheng ,David Green ,David Green ,Yingwei Zheng ,Eli Friedman ,David Spickett ,DianQK ,aankit-ca ,DianQK ,Lu Weining ,Paul Osmialowski ,Joseph Huber ,Simon Pilgrim ,Jonas Paulsson ,Nikita Popov ,Younan Zhang , Daniel =?utf-8?q?Rodríguez_Troitiño?=,Matt Arsenault ,higher-performance ,yonghong-song ,Younan Zhang ,Florian Hahn ,Louis Dionne ,"A. Jiang" ,"Yaxun (Sam) Liu" ,cor3ntin ,Corentin Jabot ,Corentin Jabot ,yonghong-song ,Yingwei Zheng ,Takuto Ikuta ,Tom Stellard ,Evgenii Kudriashov , Martin =?utf-8?q?Storsjö?= ,David Green ,David Green ,Nicholas Guy ,David Tellenbach ,Alexey Karyakin ,Abinaya Saravanan =?utf-8?q?,?=Qi Zhao , Martin =?utf-8?q?Storsjö?= , Martin =?utf-8?q?Storsjö?= ,Younan Zhang ,Matheus Izvekov ,Brian Cain ,aankit-ca ,Lei Huang ,Ikhlas Ajbar ,Alexey Karyakin ,Tom Stellard ,Eli Friedman ,Owen Pan , Martin =?utf-8?q?Storsjö?= ,R-Goc ,Fangrui Song ,David Green ,Lei Huang ,Tom Stellard ,Paul Schwabauer ,ZhaoQi ,wanglei ,wanglei ,Anutosh Bhat ,Tom Stellard ,dianqk ,Utkarsh Saxena ,Mariusz Borsa ,Carlos Galvez ,Austin Schuh =?utf-8?q?,?=Louis Dionne ,Aaron Puchert ,Martin =?utf-8?q?Storsjö?= ,Tiezhu Yang ,Owen Pan ,Paul Kirth ,Owen Pan ,Stefan Schmidt ,Yingwei Zheng , Miro =?utf-8?q?Hrončok?= ,Marc Auberer ,Mariya Podchishchaeva ,Mariya Podchishchaeva ,Kazu Hirata ,Hua Tian ,Hua Tian ,Yingwei Zheng ,"Wang, Phoebe" ,Phoebe Wang ,ZhaoQi ,Pavel Labath ,Louis Dionne ,Louis Dionne ,Dominik Adamski ,Florian Hahn ,Florian Hahn ,Aaron Ballman ,Younan Zhang ,Louis Dionne ,Ikhlas Ajbar , Alex =?utf-8?q?Rønne?= Petersen ,Tom Stellard ,Nikita Popov ,aankit-ca ,leecheechen ,Nathan Ridge ,Ebuka Ezike ,D
[Lldb-commits] [lldb] Reland "[lldb] Add count for number of DWO files loaded in statistics #144424" (PR #145572)
https://github.com/qxy11 updated https://github.com/llvm/llvm-project/pull/145572 >From b10eb9f682549ddef16eda41e4cf87fe0ea63f93 Mon Sep 17 00:00:00 2001 From: Janet Yang Date: Tue, 24 Jun 2025 09:40:42 -0700 Subject: [PATCH 1/3] Reland "[lldb] Add count for number of DWO files loaded in statistics" --- lldb/include/lldb/Symbol/SymbolFile.h | 8 + lldb/include/lldb/Target/Statistics.h | 2 + .../Python/lldbsuite/test/builders/builder.py | 26 +++- .../Python/lldbsuite/test/make/Makefile.rules | 4 + .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 29 .../SymbolFile/DWARF/SymbolFileDWARF.h| 5 + lldb/source/Target/Statistics.cpp | 12 +- .../commands/statistics/basic/TestStats.py| 138 ++ .../API/commands/statistics/basic/baz.cpp | 12 ++ .../API/commands/statistics/basic/third.cpp | 7 + 10 files changed, 235 insertions(+), 8 deletions(-) create mode 100644 lldb/test/API/commands/statistics/basic/baz.cpp create mode 100644 lldb/test/API/commands/statistics/basic/third.cpp diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 75c7f230ddf3d..b0b608d0a5e79 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -472,6 +472,14 @@ class SymbolFile : public PluginInterface { return false; }; + /// Get number of loaded/parsed DWO files. This is emitted in "statistics + /// dump" + /// + /// \returns + /// A pair containing (loaded_dwo_count, total_dwo_count). If this + /// symbol file doesn't support DWO files, both counts will be 0. + virtual std::pair GetDwoFileCounts() { return {0, 0}; } + virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 2d0d25cd3c753..42f03798c219e 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -153,6 +153,8 @@ struct ModuleStats { bool symtab_stripped = false; bool debug_info_had_variable_errors = false; bool debug_info_had_incomplete_types = false; + uint32_t dwo_file_count = 0; + uint32_t loaded_dwo_file_count = 0; }; struct ConstStringStats { diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index de05732469448..efb1ba568e3e6 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,13 +247,25 @@ def getLLDBObjRoot(self): def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] -if debug_info == "dwarf": -return ["MAKE_DSYM=NO"] -if debug_info == "dwo": -return ["MAKE_DSYM=NO", "MAKE_DWO=YES"] -if debug_info == "gmodules": -return ["MAKE_DSYM=NO", "MAKE_GMODULES=YES"] -return None + +debug_options = debug_info if isinstance(debug_info, list) else [debug_info] +option_flags = { +"dwarf": {"MAKE_DSYM": "NO"}, +"dwo": {"MAKE_DSYM": "NO", "MAKE_DWO": "YES"}, +"gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"}, +"debug_names": {"MAKE_DEBUG_NAMES": "YES"}, +"dwp": {"MAKE_DSYM": "NO", "MAKE_DWP": "YES"}, +} + +# Collect all flags, with later options overriding earlier ones +flags = {} + +for option in debug_options: +if not option or option not in option_flags: +return None # Invalid options +flags.update(option_flags[option]) + +return [f"{key}={value}" for key, value in flags.items()] def getBuildCommand( self, diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 06959f226066a..58833e1b0cc78 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -276,6 +276,10 @@ ifeq "$(MAKE_DWO)" "YES" CFLAGS += -gsplit-dwarf endif +ifeq "$(MAKE_DEBUG_NAMES)" "YES" + CFLAGS += -gpubnames +endif + ifeq "$(USE_PRIVATE_MODULE_CACHE)" "YES" THE_CLANG_MODULE_CACHE_DIR := $(BUILDDIR)/private-module-cache else diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index 71f204c03a42a..c83779c40a05b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -4420,3 +4420,32 @@ void SymbolFileDWARF::GetCompileOptions( args.insert({comp_unit, Args(flags)}); } } + +std::pair SymbolFileDWARF::GetDwoFileCounts() { + uint32_t total_dwo_count = 0; + uint32_t loaded_
[Lldb-commits] [lldb] [lldb] Defend against infinite recursion in GetClassDescriptor (PR #145396)
https://github.com/adrian-prantl approved this pull request. LGTM with one comment https://github.com/llvm/llvm-project/pull/145396 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb-dap] Fix flaky test (PR #145231)
https://github.com/DrSergei updated https://github.com/llvm/llvm-project/pull/145231 >From b3b919db7333ee20bc640e1b4b5a701891cc6443 Mon Sep 17 00:00:00 2001 From: Druzhkov Sergei Date: Thu, 19 Jun 2025 15:50:27 +0300 Subject: [PATCH] [lldb-dap] Fix flaky test --- lldb/test/API/tools/lldb-dap/server/TestDAP_server.py | 4 +++- lldb/tools/lldb-dap/tool/lldb-dap.cpp | 2 -- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py index ed17044a220d4..2b0923db9cf82 100644 --- a/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py +++ b/lldb/test/API/tools/lldb-dap/server/TestDAP_server.py @@ -101,7 +101,9 @@ def test_server_interrupt(self): # Interrupt the server which should disconnect all clients. process.send_signal(signal.SIGINT) -self.dap_server.wait_for_terminated() +# Wait for both events since they can happen in any order. +self.dap_server.wait_for_event(["terminated", "exited"]) +self.dap_server.wait_for_event(["terminated", "exited"]) self.assertIsNotNone( self.dap_server.exit_status, "Process exited before interrupting lldb-dap server", diff --git a/lldb/tools/lldb-dap/tool/lldb-dap.cpp b/lldb/tools/lldb-dap/tool/lldb-dap.cpp index 9b9de5e21a742..af7080845239b 100644 --- a/lldb/tools/lldb-dap/tool/lldb-dap.cpp +++ b/lldb/tools/lldb-dap/tool/lldb-dap.cpp @@ -342,8 +342,6 @@ serveConnection(const Socket::SocketProtocol &protocol, const std::string &name, << " disconnected failed: " << llvm::toString(std::move(error)) << "\n"; } - // Close the socket to ensure the DAP::Loop read finishes. - sock->Close(); } } ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] b171ebb - [lldb] Defend against infinite recursion in GetClassDescriptor (#145396)
Author: Jonas Devlieghere Date: 2025-06-24T12:28:40-07:00 New Revision: b171ebbfffcd4b8d923734dd0fc077b02a6fe3f7 URL: https://github.com/llvm/llvm-project/commit/b171ebbfffcd4b8d923734dd0fc077b02a6fe3f7 DIFF: https://github.com/llvm/llvm-project/commit/b171ebbfffcd4b8d923734dd0fc077b02a6fe3f7.diff LOG: [lldb] Defend against infinite recursion in GetClassDescriptor (#145396) We defend against a direct cycle where a base class ValueObject is its own parent, but not against a longer base cycle. This cycle requires that some value's Type includes a base class, and that base class is in a class hierarchy that cycles back to the original base class. I wrote a test case that creates a cycle in the class hierarchy by dynamically overwriting the superclass of an object, but I can't reproduce the crash. I can't think of any other way to make a real object that behaves that way. Maybe is a type system problem in making up the type for whatever type we're trying to ingest here. While unsatisfying, without a reproducer this is the best we can do for now. rdar://140293233 Added: Modified: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h Removed: diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index e459cb281793a..4fcdebe5bac62 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1505,15 +1505,24 @@ AppleObjCRuntimeV2::GetClassDescriptorFromISA(ObjCISA isa) { ObjCLanguageRuntime::ClassDescriptorSP AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) { + ValueObjectSet seen; + return GetClassDescriptorImpl(valobj, seen); +} + +ObjCLanguageRuntime::ClassDescriptorSP +AppleObjCRuntimeV2::GetClassDescriptorImpl(ValueObject &valobj, + ValueObjectSet &seen) { + seen.insert(&valobj); + ClassDescriptorSP objc_class_sp; if (valobj.IsBaseClass()) { ValueObject *parent = valobj.GetParent(); -// if I am my own parent, bail out of here fast.. -if (parent && parent != &valobj) { - ClassDescriptorSP parent_descriptor_sp = GetClassDescriptor(*parent); - if (parent_descriptor_sp) -return parent_descriptor_sp->GetSuperclass(); -} +// Fail if there's a cycle in our parent chain. +if (!parent || seen.count(parent)) + return nullptr; +if (ClassDescriptorSP parent_descriptor_sp = +GetClassDescriptorImpl(*parent, seen)) + return parent_descriptor_sp->GetSuperclass(); return nullptr; } // if we get an invalid VO (which might still happen when playing around with diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h index 79840f9be79b3..b99bda2f7e259 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -20,6 +20,7 @@ #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/SmallSet.h" class RemoteNXMapTable; @@ -421,6 +422,10 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime { lldb::addr_t GetISAHashTablePointer(); + using ValueObjectSet = llvm::SmallPtrSet; + ClassDescriptorSP GetClassDescriptorImpl(ValueObject &valobj, + ValueObjectSet &seen); + /// Update the generation count of realized classes. This is not an exact /// count but rather a value that is incremented when new classes are realized /// or destroyed. Unlike the count in gdb_objc_realized_classes, it will ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Defend against infinite recursion in GetClassDescriptor (PR #145396)
https://github.com/JDevlieghere closed https://github.com/llvm/llvm-project/pull/145396 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Add count for number of DWO files loaded in statistics" (PR #145494)
https://github.com/Michael137 closed https://github.com/llvm/llvm-project/pull/145494 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)
slydiman wrote: [lldb-remote-linux-ubuntu](https://lab.llvm.org/buildbot/#/builders/195/builds/10876) is broken after this patch. Please update the test conditions to skip riscv tests on non-riscv platforms. https://github.com/llvm/llvm-project/pull/127505 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reland "[lldb] Add count for number of DWO files loaded in statistics #144424" (PR #145572)
https://github.com/qxy11 created https://github.com/llvm/llvm-project/pull/145572 This relands changes in #144424 for adding a count of DWO files parsed/loaded and the total number of DWO files. The previous PR was reverted in #145494 due to the newly added unit tests failing on Windows and MacOS CIs since these platforms don't support DWO. This change add an additional `@add_test_categories(["dwo"])` to the new tests to [skip](https://github.com/llvm/llvm-project/blob/cd46354dbd10820158edabe14dbd49d9f9010722/lldb/packages/Python/lldbsuite/test/test_categories.py#L56) these tests on Windows/MacOS. Original PR: #144424 ### Testing Ran unit tests ``` $ bin/lldb-dotest -p TestStats.py llvm-project/lldb/test/API/commands/statistics/basic/ -- Ran 24 tests in 211.391s OK (skipped=3) ``` >From b10eb9f682549ddef16eda41e4cf87fe0ea63f93 Mon Sep 17 00:00:00 2001 From: Janet Yang Date: Tue, 24 Jun 2025 09:40:42 -0700 Subject: [PATCH 1/2] Reland "[lldb] Add count for number of DWO files loaded in statistics" --- lldb/include/lldb/Symbol/SymbolFile.h | 8 + lldb/include/lldb/Target/Statistics.h | 2 + .../Python/lldbsuite/test/builders/builder.py | 26 +++- .../Python/lldbsuite/test/make/Makefile.rules | 4 + .../SymbolFile/DWARF/SymbolFileDWARF.cpp | 29 .../SymbolFile/DWARF/SymbolFileDWARF.h| 5 + lldb/source/Target/Statistics.cpp | 12 +- .../commands/statistics/basic/TestStats.py| 138 ++ .../API/commands/statistics/basic/baz.cpp | 12 ++ .../API/commands/statistics/basic/third.cpp | 7 + 10 files changed, 235 insertions(+), 8 deletions(-) create mode 100644 lldb/test/API/commands/statistics/basic/baz.cpp create mode 100644 lldb/test/API/commands/statistics/basic/third.cpp diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 75c7f230ddf3d..b0b608d0a5e79 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -472,6 +472,14 @@ class SymbolFile : public PluginInterface { return false; }; + /// Get number of loaded/parsed DWO files. This is emitted in "statistics + /// dump" + /// + /// \returns + /// A pair containing (loaded_dwo_count, total_dwo_count). If this + /// symbol file doesn't support DWO files, both counts will be 0. + virtual std::pair GetDwoFileCounts() { return {0, 0}; } + virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 2d0d25cd3c753..42f03798c219e 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -153,6 +153,8 @@ struct ModuleStats { bool symtab_stripped = false; bool debug_info_had_variable_errors = false; bool debug_info_had_incomplete_types = false; + uint32_t dwo_file_count = 0; + uint32_t loaded_dwo_file_count = 0; }; struct ConstStringStats { diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index de05732469448..efb1ba568e3e6 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,13 +247,25 @@ def getLLDBObjRoot(self): def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] -if debug_info == "dwarf": -return ["MAKE_DSYM=NO"] -if debug_info == "dwo": -return ["MAKE_DSYM=NO", "MAKE_DWO=YES"] -if debug_info == "gmodules": -return ["MAKE_DSYM=NO", "MAKE_GMODULES=YES"] -return None + +debug_options = debug_info if isinstance(debug_info, list) else [debug_info] +option_flags = { +"dwarf": {"MAKE_DSYM": "NO"}, +"dwo": {"MAKE_DSYM": "NO", "MAKE_DWO": "YES"}, +"gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"}, +"debug_names": {"MAKE_DEBUG_NAMES": "YES"}, +"dwp": {"MAKE_DSYM": "NO", "MAKE_DWP": "YES"}, +} + +# Collect all flags, with later options overriding earlier ones +flags = {} + +for option in debug_options: +if not option or option not in option_flags: +return None # Invalid options +flags.update(option_flags[option]) + +return [f"{key}={value}" for key, value in flags.items()] def getBuildCommand( self, diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 06959f226066a..58833e1b0cc78 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rule
[Lldb-commits] [lldb] Reland "[lldb] Add count for number of DWO files loaded in statistics #144424" (PR #145572)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: None (qxy11) Changes This relands changes in #144424 for adding a count of DWO files parsed/loaded and the total number of DWO files. The previous PR was reverted in #145494 due to the newly added unit tests failing on Windows and MacOS CIs since these platforms don't support DWO. This change add an additional `@add_test_categories(["dwo"])` to the new tests to [skip](https://github.com/llvm/llvm-project/blob/cd46354dbd10820158edabe14dbd49d9f9010722/lldb/packages/Python/lldbsuite/test/test_categories.py#L56) these tests on Windows/MacOS. Original PR: #144424 ### Testing Ran unit tests ``` $ bin/lldb-dotest -p TestStats.py llvm-project/lldb/test/API/commands/statistics/basic/ -- Ran 24 tests in 211.391s OK (skipped=3) ``` --- Full diff: https://github.com/llvm/llvm-project/pull/145572.diff 10 Files Affected: - (modified) lldb/include/lldb/Symbol/SymbolFile.h (+8) - (modified) lldb/include/lldb/Target/Statistics.h (+2) - (modified) lldb/packages/Python/lldbsuite/test/builders/builder.py (+19-7) - (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (+4) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+29) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+5) - (modified) lldb/source/Target/Statistics.cpp (+11-1) - (modified) lldb/test/API/commands/statistics/basic/TestStats.py (+143) - (added) lldb/test/API/commands/statistics/basic/baz.cpp (+12) - (added) lldb/test/API/commands/statistics/basic/third.cpp (+7) ``diff diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index 75c7f230ddf3d..b0b608d0a5e79 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -472,6 +472,14 @@ class SymbolFile : public PluginInterface { return false; }; + /// Get number of loaded/parsed DWO files. This is emitted in "statistics + /// dump" + /// + /// \returns + /// A pair containing (loaded_dwo_count, total_dwo_count). If this + /// symbol file doesn't support DWO files, both counts will be 0. + virtual std::pair GetDwoFileCounts() { return {0, 0}; } + virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 2d0d25cd3c753..42f03798c219e 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -153,6 +153,8 @@ struct ModuleStats { bool symtab_stripped = false; bool debug_info_had_variable_errors = false; bool debug_info_had_incomplete_types = false; + uint32_t dwo_file_count = 0; + uint32_t loaded_dwo_file_count = 0; }; struct ConstStringStats { diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index de05732469448..efb1ba568e3e6 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,13 +247,25 @@ def getLLDBObjRoot(self): def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] -if debug_info == "dwarf": -return ["MAKE_DSYM=NO"] -if debug_info == "dwo": -return ["MAKE_DSYM=NO", "MAKE_DWO=YES"] -if debug_info == "gmodules": -return ["MAKE_DSYM=NO", "MAKE_GMODULES=YES"] -return None + +debug_options = debug_info if isinstance(debug_info, list) else [debug_info] +option_flags = { +"dwarf": {"MAKE_DSYM": "NO"}, +"dwo": {"MAKE_DSYM": "NO", "MAKE_DWO": "YES"}, +"gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"}, +"debug_names": {"MAKE_DEBUG_NAMES": "YES"}, +"dwp": {"MAKE_DSYM": "NO", "MAKE_DWP": "YES"}, +} + +# Collect all flags, with later options overriding earlier ones +flags = {} + +for option in debug_options: +if not option or option not in option_flags: +return None # Invalid options +flags.update(option_flags[option]) + +return [f"{key}={value}" for key, value in flags.items()] def getBuildCommand( self, diff --git a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules index 06959f226066a..58833e1b0cc78 100644 --- a/lldb/packages/Python/lldbsuite/test/make/Makefile.rules +++ b/lldb/packages/Python/lldbsuite/test/make/Makefile.rules @@ -276,6 +276,10 @@ ifeq "$(MAKE_DWO)" "YES" CFLAGS += -gsplit-dwarf endif +ifeq "$(MAKE_DEBUG_NAMES)" "YES" + CFLAGS += -gpubnames +endif + ifeq "$(USE_PRIVATE_MODULE_CACHE)" "YES" THE_CLA
[Lldb-commits] [lldb] Reland "[lldb] Add count for number of DWO files loaded in statistics #144424" (PR #145572)
github-actions[bot] wrote: :warning: Python code formatter, darker found issues in your code. :warning: You can test this locally with the following command: ``bash darker --check --diff -r HEAD~1...HEAD lldb/packages/Python/lldbsuite/test/builders/builder.py lldb/test/API/commands/statistics/basic/TestStats.py `` View the diff from darker here. ``diff --- packages/Python/lldbsuite/test/builders/builder.py 2025-06-24 19:00:30.00 + +++ packages/Python/lldbsuite/test/builders/builder.py 2025-06-24 19:12:04.415972 + @@ -245,28 +245,28 @@ return ["LLDB_OBJ_ROOT={}".format(configuration.lldb_obj_root)] def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] - + debug_options = debug_info if isinstance(debug_info, list) else [debug_info] option_flags = { "dwarf": {"MAKE_DSYM": "NO"}, "dwo": {"MAKE_DSYM": "NO", "MAKE_DWO": "YES"}, "gmodules": {"MAKE_DSYM": "NO", "MAKE_GMODULES": "YES"}, "debug_names": {"MAKE_DEBUG_NAMES": "YES"}, "dwp": {"MAKE_DSYM": "NO", "MAKE_DWP": "YES"}, } - + # Collect all flags, with later options overriding earlier ones flags = {} - + for option in debug_options: if not option or option not in option_flags: -return None # Invalid options +return None # Invalid options flags.update(option_flags[option]) - + return [f"{key}={value}" for key, value in flags.items()] def getBuildCommand( self, debug_info, --- test/API/commands/statistics/basic/TestStats.py 2025-06-24 19:00:30.00 + +++ test/API/commands/statistics/basic/TestStats.py 2025-06-24 19:12:04.724587 + @@ -538,35 +538,35 @@ exe = self.getBuildArtifact("a.out") target = self.createTestTarget(file_path=exe) debug_stats = self.get_stats() self.assertIn("totalDwoFileCount", debug_stats) self.assertIn("totalLoadedDwoFileCount", debug_stats) - + # Verify that the dwo file count is zero self.assertEqual(debug_stats["totalDwoFileCount"], 0) self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 0) - + @add_test_categories(["dwo"]) def test_no_debug_names_eager_loads_dwo_files(self): """ Test the eager loading behavior of DWO files when debug_names is absent by building a split-dwarf binary without debug_names and then running "statistics dump". DWO file loading behavior: - With debug_names: DebugNamesDWARFIndex allows for lazy loading. DWO files are loaded on-demand when symbols are actually looked up - Without debug_names: ManualDWARFIndex uses eager loading. - All DWO files are loaded upfront during the first symbol lookup to build a manual index. + All DWO files are loaded upfront during the first symbol lookup to build a manual index. """ da = {"CXX_SOURCES": "third.cpp baz.cpp", "EXE": self.getBuildArtifact("a.out")} self.build(dictionary=da, debug_info=["dwo"]) self.addTearDownCleanup(dictionary=da) exe = self.getBuildArtifact("a.out") target = self.createTestTarget(file_path=exe) debug_stats = self.get_stats() self.assertIn("totalDwoFileCount", debug_stats) self.assertIn("totalLoadedDwoFileCount", debug_stats) - + # Verify that all DWO files are loaded self.assertEqual(debug_stats["totalDwoFileCount"], 2) self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 2) @add_test_categories(["dwo"]) @@ -592,44 +592,44 @@ self.assertEqual(len(debug_stats["modules"]), 1) self.assertIn("totalLoadedDwoFileCount", debug_stats) self.assertIn("totalDwoFileCount", debug_stats) self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 0) self.assertEqual(debug_stats["totalDwoFileCount"], 2) - + # Since there's only one module, module stats should have the same counts as total counts self.assertIn("dwoFileCount", debug_stats["modules"][0]) self.assertIn("loadedDwoFileCount", debug_stats["modules"][0]) self.assertEqual(debug_stats["modules"][0]["loadedDwoFileCount"], 0) self.assertEqual(debug_stats["modules"][0]["dwoFileCount"], 2) - + # 2) Setting breakpoint in main triggers loading of third.dwo (contains main function) self.runCmd("b main") debug_stats = self.get_stats() self.assertEqual(debug_stats["totalLoadedDwoFileCount"], 1) self.assertEqual(debug_stats["totalDwoFileCount"], 2) self.assertEqual(debug_stats["modules"][0]["loadedDwoFileCount"], 1) self.assertEqual(debug_stats["modules"][0]["dwoFileCoun
[Lldb-commits] [lldb] [lldb] Remove child_process_inherit argument from Pipe (PR #145516)
https://github.com/labath updated https://github.com/llvm/llvm-project/pull/145516 >From b51c03f88c7090b3898a93725d6e6b6cf19cae01 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sun, 20 Oct 2024 00:18:56 +0200 Subject: [PATCH 1/2] [lldb] Remove child_process_inherit argument from Pipe It's not necessary on posix platforms as of #126935 and it's ignored on windows as of #138896. For both platforms, we have a better way of inheriting FDs/HANDLEs. --- lldb/include/lldb/Host/PipeBase.h | 10 ++ lldb/include/lldb/Host/posix/PipePosix.h | 10 +++--- lldb/include/lldb/Host/windows/PipeWindows.h | 13 +++- lldb/source/Host/common/Socket.cpp| 2 +- .../posix/ConnectionFileDescriptorPosix.cpp | 2 +- lldb/source/Host/posix/MainLoopPosix.cpp | 2 +- lldb/source/Host/posix/PipePosix.cpp | 31 +++ .../Host/posix/ProcessLauncherPosixFork.cpp | 3 +- lldb/source/Host/windows/PipeWindows.cpp | 23 ++ lldb/source/Interpreter/ScriptInterpreter.cpp | 2 +- .../gdb-remote/GDBRemoteCommunication.cpp | 9 +++--- lldb/source/Target/Process.cpp| 2 +- lldb/tools/lldb-server/lldb-gdbserver.cpp | 2 +- lldb/unittests/Core/CommunicationTest.cpp | 3 +- lldb/unittests/Host/HostTest.cpp | 3 +- lldb/unittests/Host/PipeTest.cpp | 25 ++- lldb/unittests/Host/SocketTest.cpp| 4 +-- .../TestingSupport/Host/PipeTestUtilities.h | 4 +-- 18 files changed, 59 insertions(+), 91 deletions(-) diff --git a/lldb/include/lldb/Host/PipeBase.h b/lldb/include/lldb/Host/PipeBase.h index ed8df6bf1e511..6a37f3f2445b0 100644 --- a/lldb/include/lldb/Host/PipeBase.h +++ b/lldb/include/lldb/Host/PipeBase.h @@ -21,18 +21,14 @@ class PipeBase { public: virtual ~PipeBase(); - virtual Status CreateNew(bool child_process_inherit) = 0; - virtual Status CreateNew(llvm::StringRef name, - bool child_process_inherit) = 0; + virtual Status CreateNew() = 0; + virtual Status CreateNew(llvm::StringRef name) = 0; virtual Status CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, llvm::SmallVectorImpl &name) = 0; - virtual Status OpenAsReader(llvm::StringRef name, - bool child_process_inherit) = 0; + virtual Status OpenAsReader(llvm::StringRef name) = 0; virtual llvm::Error OpenAsWriter(llvm::StringRef name, - bool child_process_inherit, const Timeout &timeout) = 0; virtual bool CanRead() const = 0; diff --git a/lldb/include/lldb/Host/posix/PipePosix.h b/lldb/include/lldb/Host/posix/PipePosix.h index effd33fba7eb0..0bec2061f3164 100644 --- a/lldb/include/lldb/Host/posix/PipePosix.h +++ b/lldb/include/lldb/Host/posix/PipePosix.h @@ -32,14 +32,12 @@ class PipePosix : public PipeBase { ~PipePosix() override; - Status CreateNew(bool child_process_inherit) override; - Status CreateNew(llvm::StringRef name, bool child_process_inherit) override; + Status CreateNew() override; + Status CreateNew(llvm::StringRef name) override; Status CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, llvm::SmallVectorImpl &name) override; - Status OpenAsReader(llvm::StringRef name, - bool child_process_inherit) override; - llvm::Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit, + Status OpenAsReader(llvm::StringRef name) override; + llvm::Error OpenAsWriter(llvm::StringRef name, const Timeout &timeout) override; bool CanRead() const override; diff --git a/lldb/include/lldb/Host/windows/PipeWindows.h b/lldb/include/lldb/Host/windows/PipeWindows.h index 9cf591a2d4629..a8bd3cecb9afe 100644 --- a/lldb/include/lldb/Host/windows/PipeWindows.h +++ b/lldb/include/lldb/Host/windows/PipeWindows.h @@ -29,16 +29,14 @@ class PipeWindows : public PipeBase { ~PipeWindows() override; // Create an unnamed pipe. - Status CreateNew(bool child_process_inherit) override; + Status CreateNew() override; // Create a named pipe. - Status CreateNew(llvm::StringRef name, bool child_process_inherit) override; + Status CreateNew(llvm::StringRef name) override; Status CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, llvm::SmallVectorImpl &name) override; - Status OpenAsReader(llvm::StringRef name, - bool child_process_inherit) override; - llvm::Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit, + Status OpenAsReader(llvm::StringRef name) override; + llvm::Error OpenAsWriter(llvm::StringRef name, const Timeout &timeout) override; bool CanRead(
[Lldb-commits] [lldb] [lldb] Remove child_process_inherit argument from Pipe (PR #145516)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions h,cpp -- lldb/include/lldb/Host/PipeBase.h lldb/include/lldb/Host/posix/PipePosix.h lldb/include/lldb/Host/windows/PipeWindows.h lldb/source/Host/common/Socket.cpp lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/source/Host/posix/MainLoopPosix.cpp lldb/source/Host/posix/PipePosix.cpp lldb/source/Host/posix/ProcessLauncherPosixFork.cpp lldb/source/Host/windows/PipeWindows.cpp lldb/source/Interpreter/ScriptInterpreter.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/source/Target/Process.cpp lldb/tools/lldb-server/lldb-gdbserver.cpp lldb/unittests/Core/CommunicationTest.cpp lldb/unittests/Host/HostTest.cpp lldb/unittests/Host/PipeTest.cpp lldb/unittests/Host/SocketTest.cpp lldb/unittests/TestingSupport/Host/PipeTestUtilities.h `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 20cd689d7..4a1394416 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -973,8 +973,9 @@ Status GDBRemoteCommunication::StartDebugserverProcess( pipe_t write = socket_pipe.GetWritePipe(); debugserver_args.AppendArgument(llvm::StringRef("--pipe")); debugserver_args.AppendArgument(llvm::to_string(write)); - launch_info.AppendDuplicateFileAction((int64_t)socket_pipe.GetWritePipe(), - (int64_t)socket_pipe.GetWritePipe()); + launch_info.AppendDuplicateFileAction( + (int64_t)socket_pipe.GetWritePipe(), + (int64_t)socket_pipe.GetWritePipe()); #endif } else { // No host and port given, so lets listen on our end and make the `` https://github.com/llvm/llvm-project/pull/145516 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
Jlalond wrote: > It's crude but maybe just include SI_KERNEL in there? "sent by kernel > (SI_KERNEL)". Then we don't have to explain the meaning of SI_KERNEL but I > the user do have something I can look up and read about it. And if they do > have a kernel side problem, doing some reading is what they'll need to do > anyway. As @labath mentioned there are a lot of things that could cause this. So I think the crude approach is the right one! I've updated the patch. https://github.com/llvm/llvm-project/pull/144800 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/144800 >From 157b5a5177784bc2ce4e8bf952c812aedd5be258 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Wed, 18 Jun 2025 14:35:37 -0700 Subject: [PATCH 1/2] Add SI_USER and SI_KERNEL to Linux signals --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 4 1 file changed, 4 insertions(+) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 15a77ce227ec5..4c49bde936965 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -65,6 +65,10 @@ // See siginfo.h in the Linux Kernel, these codes can be sent for any signal. #define ADD_LINUX_SIGNAL(signo, name, ...) \ AddSignal(signo, name, __VA_ARGS__); \ + ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ + SignalCodePrintOption::Sender); \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel", \ + SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \ >From 8bf001190cb54b55575286e9cceb72cadbfdbf97 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Tue, 24 Jun 2025 09:39:00 -0700 Subject: [PATCH 2/2] Add SI_KERNEL into the description as well. --- lldb/source/Host/common/NativeProcessProtocol.cpp | 8 ++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index 405acbb5662d6..33755e3e25d8a 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -340,6 +340,9 @@ void NativeProcessProtocol::NotifyDidExec() { Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint) { + + volatile bool debug = true; + while (debug) {} Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "addr = {0:x}, size_hint = {1}", addr, size_hint); @@ -362,9 +365,10 @@ Status NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) { auto it = m_software_breakpoints.find(addr); if (it == m_software_breakpoints.end()) return Status::FromErrorString("Breakpoint not found."); - assert(it->second.ref_count > 0); - if (--it->second.ref_count > 0) + if (it->second.ref_count > 0) { +--it->second.ref_count; return Status(); + } // This is the last reference. Let's remove the breakpoint. Status error; ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Add count for number of DWO files loaded in statistics" (PR #145494)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `fuchsia-x86_64-linux` running on `fuchsia-debian-64-us-central1-b-1` while building `lldb` at step 4 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/17948 Here is the relevant piece of the build log for the reference ``` Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure) ... [233/2506] Copying CXX header __atomic/atomic_sync.h [234/2506] Building CXX object libc/src/strings/CMakeFiles/libc.src.strings.strcasecmp.dir/strcasecmp.cpp.obj [235/2506] Copying CXX header __algorithm/ranges_find_if.h [236/2506] Copying CXX header __chrono/parser_std_format_spec.h [237/2506] Copying CXX header __algorithm/pstl.h [238/2506] Copying CXX header __algorithm/ranges_find_end.h [239/2506] Copying CXX header __atomic/to_gcc_order.h [240/2506] Generating header strings.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/strings.yaml [241/2506] Generating header locale.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/locale.yaml [242/2506] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj FAILED: libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-2xit718x/./bin/clang++ --target=armv7em-none-eabi -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -I/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc -isystem /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-2xit718x/include/armv7em-unknown-none-eabi --target=armv7em-none-eabi -Wno-atomic-alignment "-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" -D_LIBCPP_PRINT=1 -mthumb -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 -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-2xit718x/runtimes/runtimes-armv7em-none-eabi-bins=../../../../llvm-project -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/= -no-canonical-prefixes -Os -DNDEBUG --target=armv7em-none-eabi -DLIBC_QSORT_IMPL=LIBC_QSORT_HEAP_SORT -DLIBC_TYPES_TIME_T_IS_32_BIT -DLIBC_ADD_NULL_CHECKS "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES)" -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_EXTERNAL -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj -MF libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj.d -o libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj -c /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/stdlib/memalignment.cpp /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/stdlib/memalignment.cpp:20:3: error: unknown type name 'uintptr_t' 20 | uintptr_t addr = reinterpret_cast(p); | ^ /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/stdlib/memalignment.cpp:20:37: error: unknown type name 'uintptr_t' 20 | uintptr_t addr = reinterpret_cast(p); | ^ 2 errors generated. [243/2506] Building CXX object libc/src/compiler/generic/CMakeFiles/libc.src.compiler.generic.__stack_chk_fail.dir/__stack_chk_fail.cpp.obj [244/2506] Building CXX object libc/startup/baremetal/CMakeFiles/libc.startup.baremetal.init.dir/init.cpp.obj [245/2506] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.srand.dir/srand.cpp.obj [246/2506] Generating header complex.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/complex.yaml [247/2506] Generating header inttypes.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/inttypes.yaml [248/2506] Generating header uchar.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/uchar.yaml [249/2506] Building CXX object libc/src/strings/CMakeFile
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/144800 >From 157b5a5177784bc2ce4e8bf952c812aedd5be258 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Wed, 18 Jun 2025 14:35:37 -0700 Subject: [PATCH 1/2] Add SI_USER and SI_KERNEL to Linux signals --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 4 1 file changed, 4 insertions(+) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 15a77ce227ec5..4c49bde936965 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -65,6 +65,10 @@ // See siginfo.h in the Linux Kernel, these codes can be sent for any signal. #define ADD_LINUX_SIGNAL(signo, name, ...) \ AddSignal(signo, name, __VA_ARGS__); \ + ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ + SignalCodePrintOption::Sender); \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel", \ + SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \ >From 67b397b0435aba9b6217114de09216a39cca40c5 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Tue, 24 Jun 2025 09:39:00 -0700 Subject: [PATCH 2/2] Add SI_KERNEL into the description as well. --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 4c49bde936965..5346babc18576 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -67,7 +67,7 @@ AddSignal(signo, name, __VA_ARGS__); \ ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ SignalCodePrintOption::Sender); \ - ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel", \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel (SI_KERNEL)", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Add SI_USER and SI_KERNEL to Linux signals (PR #144800)
https://github.com/Jlalond updated https://github.com/llvm/llvm-project/pull/144800 >From 157b5a5177784bc2ce4e8bf952c812aedd5be258 Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Wed, 18 Jun 2025 14:35:37 -0700 Subject: [PATCH 1/2] Add SI_USER and SI_KERNEL to Linux signals --- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 4 1 file changed, 4 insertions(+) diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 15a77ce227ec5..4c49bde936965 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -65,6 +65,10 @@ // See siginfo.h in the Linux Kernel, these codes can be sent for any signal. #define ADD_LINUX_SIGNAL(signo, name, ...) \ AddSignal(signo, name, __VA_ARGS__); \ + ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ + SignalCodePrintOption::Sender); \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel", \ + SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \ >From a3ce967d82ecc3f6174ab6b19646d45a4209ef4e Mon Sep 17 00:00:00 2001 From: Jacob Lalonde Date: Tue, 24 Jun 2025 09:39:00 -0700 Subject: [PATCH 2/2] Add SI_KERNEL into the description as well. --- lldb/source/Host/common/NativeProcessProtocol.cpp| 8 ++-- lldb/source/Plugins/Process/Utility/LinuxSignals.cpp | 2 +- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lldb/source/Host/common/NativeProcessProtocol.cpp b/lldb/source/Host/common/NativeProcessProtocol.cpp index 405acbb5662d6..33755e3e25d8a 100644 --- a/lldb/source/Host/common/NativeProcessProtocol.cpp +++ b/lldb/source/Host/common/NativeProcessProtocol.cpp @@ -340,6 +340,9 @@ void NativeProcessProtocol::NotifyDidExec() { Status NativeProcessProtocol::SetSoftwareBreakpoint(lldb::addr_t addr, uint32_t size_hint) { + + volatile bool debug = true; + while (debug) {} Log *log = GetLog(LLDBLog::Breakpoints); LLDB_LOG(log, "addr = {0:x}, size_hint = {1}", addr, size_hint); @@ -362,9 +365,10 @@ Status NativeProcessProtocol::RemoveSoftwareBreakpoint(lldb::addr_t addr) { auto it = m_software_breakpoints.find(addr); if (it == m_software_breakpoints.end()) return Status::FromErrorString("Breakpoint not found."); - assert(it->second.ref_count > 0); - if (--it->second.ref_count > 0) + if (it->second.ref_count > 0) { +--it->second.ref_count; return Status(); + } // This is the last reference. Let's remove the breakpoint. Status error; diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 4c49bde936965..5346babc18576 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -67,7 +67,7 @@ AddSignal(signo, name, __VA_ARGS__); \ ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ SignalCodePrintOption::Sender); \ - ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel", \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel (SI_KERNEL)", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove child_process_inherit argument from Pipe (PR #145516)
https://github.com/JDevlieghere approved this pull request. 🪠 https://github.com/llvm/llvm-project/pull/145516 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Update DIL to pass current 'frame var' tests. (PR #145055)
https://github.com/cmtice updated https://github.com/llvm/llvm-project/pull/145055 >From e9079e6357b933e84603997edb8d0cd27a515989 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Fri, 20 Jun 2025 08:33:14 -0700 Subject: [PATCH 1/4] [LLDB] Update DIL to pass current 'frame var' tests. As a preliminary to making DIL the default implementation for 'frame var', ran check-lldb forcing 'frame var' to always use DIL, and discovered a few failing tests. This fixes most of them. The only two remaining failing tests (once the smart pointer PR is committed) are TestVarPath.py, which fails a test case using a negative array subscript, as DIL does not yet parse negative numbers; and TestDAP_evaluate.py, which now passes a test case that the test says should fail (still investigating this). Changes in this PR: - Sets correct VariableSP, as well as returning ValueObjectSP (needed for several watchpoint tests). - Update error messages, when looking up members, to match what the rest of LLDB expects. Also update appropriate DIL tests to expect the updated error messages. - Update DIL parser to look for and accept "(anonymous namespace)::" at the front of a variable name. --- lldb/source/Target/StackFrame.cpp | 1 + lldb/source/ValueObject/DILEval.cpp | 10 ++--- lldb/source/ValueObject/DILParser.cpp | 39 --- .../MemberOf/TestFrameVarDILMemberOf.py | 2 +- .../TestFrameVarDILMemberOfAnonymousMember.py | 10 ++--- 5 files changed, 46 insertions(+), 16 deletions(-) diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index ab5cd0b27c789..f5a80efc821d5 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -562,6 +562,7 @@ ValueObjectSP StackFrame::DILGetValueForVariableExpressionPath( return ValueObjectConstResult::Create(nullptr, std::move(error)); } + var_sp = (*valobj_or_error)->GetVariable(); return *valobj_or_error; } diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp index c8cb54aa18a93..2c4d355a2c6b8 100644 --- a/lldb/source/ValueObject/DILEval.cpp +++ b/lldb/source/ValueObject/DILEval.cpp @@ -356,8 +356,8 @@ Interpreter::Visit(const MemberOfNode *node) { if (!m_use_synthetic || !field_obj) { std::string errMsg = llvm::formatv( - "no member named '{0}' in {1}", node->GetFieldName(), - base->GetCompilerType().GetFullyUnqualifiedType().TypeDescription()); + "\"{0}\" is not a member of \"({1}) {2}\"", node->GetFieldName(), + base->GetTypeName().AsCString(""), base->GetName()); return llvm::make_error( m_expr, errMsg, node->GetLocation(), node->GetFieldName().size()); } @@ -376,9 +376,9 @@ Interpreter::Visit(const MemberOfNode *node) { CompilerType base_type = base->GetCompilerType(); if (node->GetIsArrow() && base->IsPointerType()) base_type = base_type.GetPointeeType(); - std::string errMsg = - llvm::formatv("no member named '{0}' in {1}", node->GetFieldName(), -base_type.GetFullyUnqualifiedType().TypeDescription()); + std::string errMsg = llvm::formatv( + "\"{0}\" is not a member of \"({1}) {2}\"", node->GetFieldName(), + base->GetTypeName().AsCString(""), base->GetName()); return llvm::make_error( m_expr, errMsg, node->GetLocation(), node->GetFieldName().size()); } diff --git a/lldb/source/ValueObject/DILParser.cpp b/lldb/source/ValueObject/DILParser.cpp index 9667885734f21..37d5bd30fa61f 100644 --- a/lldb/source/ValueObject/DILParser.cpp +++ b/lldb/source/ValueObject/DILParser.cpp @@ -178,11 +178,40 @@ ASTNodeUP DILParser::ParsePrimaryExpression() { } if (CurToken().Is(Token::l_paren)) { -m_dil_lexer.Advance(); -auto expr = ParseExpression(); -Expect(Token::r_paren); -m_dil_lexer.Advance(); -return expr; +// Check in case this is an anonynmous namespace +if (m_dil_lexer.LookAhead(1).Is(Token::identifier) && +(m_dil_lexer.LookAhead(1).GetSpelling() == "anonymous") && +m_dil_lexer.LookAhead(2).Is(Token::identifier) && +(m_dil_lexer.LookAhead(2).GetSpelling() == "namespace") && +m_dil_lexer.LookAhead(3).Is(Token::r_paren) && +m_dil_lexer.LookAhead(4).Is(Token::coloncolon)) { + m_dil_lexer.Advance(4); + + std::string identifier = "(anonymous namespace)"; + Expect(Token::coloncolon); + // Save the source location for the diagnostics message. + uint32_t loc = CurToken().GetLocation(); + m_dil_lexer.Advance(); + assert( + (CurToken().Is(Token::identifier) || CurToken().Is(Token::l_paren)) && + "Expected an identifier or anonymous namespeace, but not found."); + std::string identifier2 = ParseNestedNameSpecifier(); + if (identifier2.empty()) { +// There was only an identifer, no more levels of nesting. Or there +// was an invalid expression sta
[Lldb-commits] [lldb] [lldb] Fix AppleObjCDeclVendor for classes which have no methods (PR #145452)
https://github.com/kastiglione updated https://github.com/llvm/llvm-project/pull/145452 >From 57857bf2749a2801e9c4fb840a984a483ced6a44 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 23 Jun 2025 20:36:38 -0700 Subject: [PATCH 1/3] [lldb] Fix AppleObjCDeclVendor for classes which have no methods Fix the rare case where an ObjC class has ivars but no methods. The fix is to not early return when a class has no method list. --- .../AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp | 7 +++ .../test/API/lang/objc/class-without-methods/Makefile | 5 + lldb/test/API/lang/objc/class-without-methods/Point.h | 8 lldb/test/API/lang/objc/class-without-methods/Point.m | 4 .../TestObjCClassWithoutMethods.py| 11 +++ lldb/test/API/lang/objc/class-without-methods/main.m | 9 + 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/lang/objc/class-without-methods/Makefile create mode 100644 lldb/test/API/lang/objc/class-without-methods/Point.h create mode 100644 lldb/test/API/lang/objc/class-without-methods/Point.m create mode 100644 lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py create mode 100644 lldb/test/API/lang/objc/class-without-methods/main.m diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index dac93931bab1b..1c120fcf2c356 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -552,10 +552,9 @@ bool ClassDescriptorV2::Describe( } else { std::optional base_method_list = GetMethodList(process, class_ro->m_baseMethods_ptr); - if (!base_method_list) -return false; - if (!ProcessMethodList(instance_method_func, *base_method_list)) -return false; + if (base_method_list) +if (!ProcessMethodList(instance_method_func, *base_method_list)) + return false; } } diff --git a/lldb/test/API/lang/objc/class-without-methods/Makefile b/lldb/test/API/lang/objc/class-without-methods/Makefile new file mode 100644 index 0..f6f336c01bbc5 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Makefile @@ -0,0 +1,5 @@ +OBJC_SOURCES := Point.m main.m +include Makefile.rules + +# Only objc metadata, no debug info, for Point.m +Point.o: CFLAGS_EXTRAS += -g0 diff --git a/lldb/test/API/lang/objc/class-without-methods/Point.h b/lldb/test/API/lang/objc/class-without-methods/Point.h new file mode 100644 index 0..85c0cd6c895b3 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Point.h @@ -0,0 +1,8 @@ +#import + +@interface Point : NSObject { +@public + float _x; + float _y; +} +@end diff --git a/lldb/test/API/lang/objc/class-without-methods/Point.m b/lldb/test/API/lang/objc/class-without-methods/Point.m new file mode 100644 index 0..eb5888e5b599f --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Point.m @@ -0,0 +1,4 @@ +#import "Point.h" + +@implementation Point +@end diff --git a/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py b/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py new file mode 100644 index 0..587f22dedadf7 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py @@ -0,0 +1,11 @@ +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestCase(TestBase): +def test(self): +self.build() +lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m")) +self.expect("frame var -P1 p", substrs=["_x = 11", "_y = 22"]) diff --git a/lldb/test/API/lang/objc/class-without-methods/main.m b/lldb/test/API/lang/objc/class-without-methods/main.m new file mode 100644 index 0..f3241f46bbe5f --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/main.m @@ -0,0 +1,9 @@ +#import "Point.h" + +int main() { + Point *p = [Point new]; + p->_x = 11; + p->_y = 22; + // break here + return 0; +} >From 039749958a76c2ab687863eee07468ca858c6f74 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Tue, 24 Jun 2025 08:46:33 -0700 Subject: [PATCH 2/3] Flatten nested if --- .../ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index 1c120fcf2c356..cc0c9e728964e 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2
[Lldb-commits] [lldb] 3bc1fc6 - [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (#127505)
Author: dlav-sc Date: 2025-06-24T19:52:38+03:00 New Revision: 3bc1fc6493240b457f5b04281c28759a6ee1b6e0 URL: https://github.com/llvm/llvm-project/commit/3bc1fc6493240b457f5b04281c28759a6ee1b6e0 DIFF: https://github.com/llvm/llvm-project/commit/3bc1fc6493240b457f5b04281c28759a6ee1b6e0.diff LOG: [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (#127505) lldb-server had limited support for single-stepping through the lr/sc atomic sequence. This patch enhances that support for all possible atomic sequences. Added: lldb/test/API/riscv/step/Makefile lldb/test/API/riscv/step/TestSoftwareStep.py lldb/test/API/riscv/step/branch.c lldb/test/API/riscv/step/incomplete_sequence_without_lr.c lldb/test/API/riscv/step/incomplete_sequence_without_sc.c lldb/test/API/riscv/step/main.c Modified: lldb/include/lldb/Core/EmulateInstruction.h lldb/source/Core/EmulateInstruction.cpp lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp lldb/source/Plugins/Instruction/ARM/EmulateInstructionARM.h lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.cpp lldb/source/Plugins/Instruction/LoongArch/EmulateInstructionLoongArch.h lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.cpp lldb/source/Plugins/Instruction/RISCV/EmulateInstructionRISCV.h lldb/source/Plugins/Process/FreeBSD/NativeProcessFreeBSD.cpp lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.cpp lldb/source/Plugins/Process/Utility/NativeProcessSoftwareSingleStep.h lldb/unittests/Instruction/LoongArch/TestLoongArchEmulator.cpp Removed: diff --git a/lldb/include/lldb/Core/EmulateInstruction.h b/lldb/include/lldb/Core/EmulateInstruction.h index b459476883fc5..a9fd4543cbbcb 100644 --- a/lldb/include/lldb/Core/EmulateInstruction.h +++ b/lldb/include/lldb/Core/EmulateInstruction.h @@ -22,6 +22,8 @@ #include "lldb/lldb-private-types.h" #include "lldb/lldb-types.h" +#include "llvm/Support/Error.h" + #include #include @@ -32,6 +34,38 @@ class RegisterValue; class Stream; class Target; class UnwindPlan; +class EmulateInstruction; + +using BreakpointLocations = std::vector; + +class SingleStepBreakpointLocationsPredictor { +public: + SingleStepBreakpointLocationsPredictor( + std::unique_ptr emulator_up) + : m_emulator_up{std::move(emulator_up)} {} + + virtual BreakpointLocations GetBreakpointLocations(Status &status); + + virtual llvm::Expected + GetBreakpointSize([[maybe_unused]] lldb::addr_t bp_addr) { +return 4; + } + + virtual ~SingleStepBreakpointLocationsPredictor() = default; + +protected: + // This function retrieves the address of the next instruction as it appears + // in the binary file. Essentially, it reads the value of the PC register, + // determines the size of the current instruction (where the PC is pointing), + // and returns the sum of these two values. + lldb::addr_t GetNextInstructionAddress(Status &error); + + lldb::addr_t GetBreakpointLocationAddress(lldb::addr_t entry_pc, +Status &error); + + std::unique_ptr m_emulator_up; + bool m_emulation_result = false; +}; /// \class EmulateInstruction EmulateInstruction.h /// "lldb/Core/EmulateInstruction.h" @@ -497,7 +531,19 @@ class EmulateInstruction : public PluginInterface { static uint32_t GetInternalRegisterNumber(RegisterContext *reg_ctx, const RegisterInfo ®_info); + static std::unique_ptr + CreateBreakpointLocationPredictor( + std::unique_ptr emulator_up); + + // Helper functions + std::optional ReadPC(); + bool WritePC(lldb::addr_t addr); + protected: + using BreakpointLocationsPredictorCreator = + std::function( + std::unique_ptr)>; + ArchSpec m_arch; void *m_baton = nullptr; ReadMemoryCallback m_read_mem_callback = &ReadMemoryDefault; @@ -508,6 +554,21 @@ class EmulateInstruction : public PluginInterface { Opcode m_opcode; private: + virtual BreakpointLocationsPredictorCreator + GetSingleStepBreakpointLocationsPredictorCreator() { +if (!m_arch.IsMIPS() && !m_arch.GetTriple().isPPC64() && +!m_arch.GetTriple().isLoongArch()) { + // Unsupported architecture + return [](std::unique_ptr emulator_up) { +return nullptr; + }; +} +return [](std::unique_ptr emulator_up) { + return std::make_unique( + std::move(emulator_up)); +}; + } + // For EmulateInstruction only EmulateInstruction(const EmulateInstruction &) = delete; const EmulateInstruction &operator=(const EmulateInstruction &) = delete; diff --git a/lldb/source/Core/EmulateInstruction.cpp b/lldb/source/Core/EmulateInstruction.cpp index d240b4d3b3310..634ce1075d54b 100644 --- a/lldb/source/Core/EmulateInstruction.cp
[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)
https://github.com/dlav-sc closed https://github.com/llvm/llvm-project/pull/127505 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)
jimingham wrote: We'd have to make the change and see to be sure, but what I would expect is that if any other thread tried to call Kill while whoever is the currently the primary process listener is handling the stop, it would immediately fail because the process is not stopped. Right now, the Kill is sometimes allowed because the public state is "stopped" even though we haven't actually finished handling the stop event. So I think what I was suggesting will fix the original problem. The race Pavel is pointing out also seems real to me, but that should be fixed at the source, rather than after the fact. Process::HijackProcessEvents should check the previous "primary event listener" to see if it has any events and if so they should be transferred to the Hijack Listener. We should also do the same thing in RestoreProcessEvents. That way we'll never drop an event when shuffling primary listeners. https://github.com/llvm/llvm-project/pull/144919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Use Socket::CreatePair for launching debugserver (PR #145017)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `llvm-x86_64-debian-dylib` running on `gribozavr4` while building `lldb` at step 5 "build-unified-tree". Full details are available at: https://lab.llvm.org/buildbot/#/builders/60/builds/31036 Here is the relevant piece of the build log for the reference ``` Step 5 (build-unified-tree) failure: build (failure) ... 52.295 [21/8/7432] Linking CXX static library lib/liblldbPluginSymbolVendorPECOFF.a 52.297 [21/7/7433] Linking CXX static library lib/liblldbPluginSymbolFileBreakpad.a 52.298 [21/6/7434] Linking CXX static library lib/liblldbPluginTraceExporterCTF.a 52.299 [21/5/7435] Linking CXX static library lib/liblldbPluginProcessLinux.a 52.305 [21/4/7436] Linking CXX static library lib/liblldbPluginProcessMachCore.a 52.309 [21/3/7437] Linking CXX static library lib/liblldbPluginProcessElfCore.a 52.324 [20/3/7438] Linking CXX static library lib/liblldbPluginDynamicLoaderPosixDYLD.a 52.354 [19/3/7439] Linking CXX static library lib/liblldbPluginProcessMinidump.a 52.399 [19/2/7440] Linking CXX executable bin/clangd 59.456 [19/1/7441] Building CXX object tools/lldb/source/Plugins/Process/gdb-remote/CMakeFiles/lldbPluginProcessGDBRemote.dir/ProcessGDBRemote.cpp.o FAILED: tools/lldb/source/Plugins/Process/gdb-remote/CMakeFiles/lldbPluginProcessGDBRemote.dir/ProcessGDBRemote.cpp.o CCACHE_CPP2=yes CCACHE_HASHDIR=yes CCACHE_SLOPPINESS=pch_defines,time_macros /usr/bin/ccache /usr/bin/clang++ -DGTEST_HAS_RTTI=0 -DHAVE_ROUND -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/source/Plugins/Process/gdb-remote -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/Process/gdb-remote -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/include -I/b/1/llvm-x86_64-debian-dylib/build/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/llvm/../clang/include -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/../clang/include -I/b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source -I/b/1/llvm-x86_64-debian-dylib/build/tools/lldb/source -isystem /usr/include/libxml2 -fPIC -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 -fno-exceptions -funwind-tables -fno-rtti -UNDEBUG -std=c++17 -MD -MT tools/lldb/source/Plugins/Process/gdb-remote/CMakeFiles/lldbPluginProcessGDBRemote.dir/ProcessGDBRemote.cpp.o -MF tools/lldb/source/Plugins/Process/gdb-remote/CMakeFiles/lldbPluginProcessGDBRemote.dir/ProcessGDBRemote.cpp.o.d -o tools/lldb/source/Plugins/Process/gdb-remote/CMakeFiles/lldbPluginProcessGDBRemote.dir/ProcessGDBRemote.cpp.o -c /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp In file included from /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:26: In file included from /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/include/lldb/Breakpoint/Watchpoint.h:12: In file included from /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/memory:83: /usr/bin/../lib/gcc/x86_64-linux-gnu/10/../../../../include/c++/10/bits/unique_ptr.h:962:34: error: no matching constructor for initialization of 'lldb_private::ConnectionFileDescriptor' { return unique_ptr<_Tp>(new _Tp(std::forward<_Args>(__args)...)); } ^ ~~~ /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp:3514:33: note: in instantiation of function template specialization 'std::make_unique' requested here m_gdb_comm.SetConnection(std::make_unique( ^ /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h:35:3: note: candidate constructor not viable: no known conversion from 'lldb_private::Socket *' to 'std::unique_ptr' for 1st argument ConnectionFileDescriptor(std::unique_ptr socket_up); ^ /b/1/llvm-x86_64-debian-dylib/llvm-project/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h:136:3: note: candidate constructor not viable: no known conversion from 'lldb_private::Socket *' to 'const lldb_private::ConnectionFileDescriptor' for 1st argument ConnectionFileDescriptor(const ConnectionFileDescriptor &) = delet
[Lldb-commits] [lldb] [LLDB] Add type summaries for MSVC STL strings (PR #143177)
@@ -299,6 +299,8 @@ def parseOptionsAndInitTestdirs(): configuration.libcxx_library_dir = args.libcxx_library_dir configuration.cmake_build_type = args.cmake_build_type.lower() +configuration.target_triple = args.target_triple + labath wrote: That's better, though it would be even better if we could run these tests even if msvcstl was not the default clang target (similar to how we can run libc++ tests even when clang targets libstdc++ by default). >From what I gather, this behavior is controlled by the target triple. Would >manually changing the target triple by appending something to CFLAGS (take >`self.dbg.GetSelectedPlatform().GetTriple()` and append "-msvc" or something) >be a terrible idea? (FWIW, >[this](https://github.com/llvm/llvm-project/blob/6dad1e87fb7a8de7033a315f5dd5d7c95dab32f6/lldb/packages/Python/lldbsuite/test/make/Makefile.rules#L371) > is where we append libc++ flags. https://github.com/llvm/llvm-project/pull/143177 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove GDBRemoteCommunication::ConnectLocally (PR #145293)
antmox wrote: Hi @labath, Looks like the build failure is not completely fixed : https://lab.llvm.org/buildbot/#/builders/141/builds/9634 https://github.com/llvm/llvm-project/pull/145293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Update DIL to handle smart pointers; add more tests. (PR #143786)
@@ -0,0 +1,25 @@ +#include + +int main(int argc, char **argv) { + + struct NodeU { +std::unique_ptr next; +int value; + }; + auto ptr_node = std::unique_ptr(new NodeU{nullptr, 2}); + ptr_node = std::unique_ptr(new NodeU{std::move(ptr_node), 1}); + + std::unique_ptr ptr_null; + auto ptr_int = std::make_unique(1); + auto ptr_float = std::make_unique(1.1f); + + auto deleter = [](void const *data) { +delete static_cast(data); + }; + std::unique_ptr ptr_void(new int(42), deleter); + + // TestUniquePtr + // TestUniquePtrDeref + // TestUniquePtrCompare labath wrote: ? https://github.com/llvm/llvm-project/pull/143786 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [LLDB] Update DIL to handle smart pointers; add more tests. (PR #143786)
https://github.com/labath approved this pull request. Thanks. Could you also merge them into the existing tests (as a separate test method)? The existing tests are of the same type ("break and inspect a bunch of variables") so it should be easy enough and this way one can see all tests for a type in single place. https://github.com/llvm/llvm-project/pull/143786 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove child_process_inherit argument from Pipe (PR #145516)
https://github.com/labath created https://github.com/llvm/llvm-project/pull/145516 It's not necessary on posix platforms as of #126935 and it's ignored on windows as of #138896. For both platforms, we have a better way of inheriting FDs/HANDLEs. >From b51c03f88c7090b3898a93725d6e6b6cf19cae01 Mon Sep 17 00:00:00 2001 From: Pavel Labath Date: Sun, 20 Oct 2024 00:18:56 +0200 Subject: [PATCH] [lldb] Remove child_process_inherit argument from Pipe It's not necessary on posix platforms as of #126935 and it's ignored on windows as of #138896. For both platforms, we have a better way of inheriting FDs/HANDLEs. --- lldb/include/lldb/Host/PipeBase.h | 10 ++ lldb/include/lldb/Host/posix/PipePosix.h | 10 +++--- lldb/include/lldb/Host/windows/PipeWindows.h | 13 +++- lldb/source/Host/common/Socket.cpp| 2 +- .../posix/ConnectionFileDescriptorPosix.cpp | 2 +- lldb/source/Host/posix/MainLoopPosix.cpp | 2 +- lldb/source/Host/posix/PipePosix.cpp | 31 +++ .../Host/posix/ProcessLauncherPosixFork.cpp | 3 +- lldb/source/Host/windows/PipeWindows.cpp | 23 ++ lldb/source/Interpreter/ScriptInterpreter.cpp | 2 +- .../gdb-remote/GDBRemoteCommunication.cpp | 9 +++--- lldb/source/Target/Process.cpp| 2 +- lldb/tools/lldb-server/lldb-gdbserver.cpp | 2 +- lldb/unittests/Core/CommunicationTest.cpp | 3 +- lldb/unittests/Host/HostTest.cpp | 3 +- lldb/unittests/Host/PipeTest.cpp | 25 ++- lldb/unittests/Host/SocketTest.cpp| 4 +-- .../TestingSupport/Host/PipeTestUtilities.h | 4 +-- 18 files changed, 59 insertions(+), 91 deletions(-) diff --git a/lldb/include/lldb/Host/PipeBase.h b/lldb/include/lldb/Host/PipeBase.h index ed8df6bf1e511..6a37f3f2445b0 100644 --- a/lldb/include/lldb/Host/PipeBase.h +++ b/lldb/include/lldb/Host/PipeBase.h @@ -21,18 +21,14 @@ class PipeBase { public: virtual ~PipeBase(); - virtual Status CreateNew(bool child_process_inherit) = 0; - virtual Status CreateNew(llvm::StringRef name, - bool child_process_inherit) = 0; + virtual Status CreateNew() = 0; + virtual Status CreateNew(llvm::StringRef name) = 0; virtual Status CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, llvm::SmallVectorImpl &name) = 0; - virtual Status OpenAsReader(llvm::StringRef name, - bool child_process_inherit) = 0; + virtual Status OpenAsReader(llvm::StringRef name) = 0; virtual llvm::Error OpenAsWriter(llvm::StringRef name, - bool child_process_inherit, const Timeout &timeout) = 0; virtual bool CanRead() const = 0; diff --git a/lldb/include/lldb/Host/posix/PipePosix.h b/lldb/include/lldb/Host/posix/PipePosix.h index effd33fba7eb0..0bec2061f3164 100644 --- a/lldb/include/lldb/Host/posix/PipePosix.h +++ b/lldb/include/lldb/Host/posix/PipePosix.h @@ -32,14 +32,12 @@ class PipePosix : public PipeBase { ~PipePosix() override; - Status CreateNew(bool child_process_inherit) override; - Status CreateNew(llvm::StringRef name, bool child_process_inherit) override; + Status CreateNew() override; + Status CreateNew(llvm::StringRef name) override; Status CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, llvm::SmallVectorImpl &name) override; - Status OpenAsReader(llvm::StringRef name, - bool child_process_inherit) override; - llvm::Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit, + Status OpenAsReader(llvm::StringRef name) override; + llvm::Error OpenAsWriter(llvm::StringRef name, const Timeout &timeout) override; bool CanRead() const override; diff --git a/lldb/include/lldb/Host/windows/PipeWindows.h b/lldb/include/lldb/Host/windows/PipeWindows.h index 9cf591a2d4629..a8bd3cecb9afe 100644 --- a/lldb/include/lldb/Host/windows/PipeWindows.h +++ b/lldb/include/lldb/Host/windows/PipeWindows.h @@ -29,16 +29,14 @@ class PipeWindows : public PipeBase { ~PipeWindows() override; // Create an unnamed pipe. - Status CreateNew(bool child_process_inherit) override; + Status CreateNew() override; // Create a named pipe. - Status CreateNew(llvm::StringRef name, bool child_process_inherit) override; + Status CreateNew(llvm::StringRef name) override; Status CreateWithUniqueName(llvm::StringRef prefix, - bool child_process_inherit, llvm::SmallVectorImpl &name) override; - Status OpenAsReader(llvm::StringRef name, - bool child_process_inherit) override; - llvm::Error OpenAsWriter(llvm::StringRef name, bool child_process_inherit, + Status OpenAsReader(
[Lldb-commits] [lldb] 353f754 - [LLDB] Add SI_USER and SI_KERNEL to Linux signals (#144800)
Author: Jacob Lalonde Date: 2025-06-24T09:54:14-07:00 New Revision: 353f75410a19328c57a2c91969e239a1f3c33a02 URL: https://github.com/llvm/llvm-project/commit/353f75410a19328c57a2c91969e239a1f3c33a02 DIFF: https://github.com/llvm/llvm-project/commit/353f75410a19328c57a2c91969e239a1f3c33a02.diff LOG: [LLDB] Add SI_USER and SI_KERNEL to Linux signals (#144800) @dmpots and I were investigating a crash when he was developing LLDB earlier. When I loaded the core I was surprised to see LLDB didn't have information for the SI_CODE. Upon inspection we had an si_code of `128`, which is the decimal of SI_KERNEL at `0x80`. These were overlooked in my last addition of the negative si_codes, and this patch adds SI_USER and SI_KERNEL to the list, covering us for all the codes available to all signals. [Linux reference link](https://github.com/torvalds/linux/blob/74b4cc9b8780bfe8a3992c9ac0033bf22ac01f19/include/uapi/asm-generic/siginfo.h#L175)  I kept the code naming the same as what is defined in the Linux source code. SI_KERNEL to my understanding usually indicates something went awry in the Kernel itself, but I think adding that additional detail would not be helpful to most users. @DavidSpickett I'd appreciate your insight into that. Added: Modified: lldb/source/Plugins/Process/Utility/LinuxSignals.cpp Removed: diff --git a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp index 15a77ce227ec5..5346babc18576 100644 --- a/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp +++ b/lldb/source/Plugins/Process/Utility/LinuxSignals.cpp @@ -65,6 +65,10 @@ // See siginfo.h in the Linux Kernel, these codes can be sent for any signal. #define ADD_LINUX_SIGNAL(signo, name, ...) \ AddSignal(signo, name, __VA_ARGS__); \ + ADD_SIGCODE(signo, signo, SI_USER, 0, "sent by kill, sigsend or raise", \ + SignalCodePrintOption::Sender); \ + ADD_SIGCODE(signo, signo, SI_KERNEL, 0x80, "sent by kernel (SI_KERNEL)", \ + SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_QUEUE, -1, "sent by sigqueue", \ SignalCodePrintOption::Sender); \ ADD_SIGCODE(signo, signo, SI_TIMER, -2, "sent by timer expiration", \ ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Defend against infinite recursion in GetClassDescriptor (PR #145396)
https://github.com/JDevlieghere updated https://github.com/llvm/llvm-project/pull/145396 >From 1da01acdb21fd7d7a58de8d19175479394f727d2 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Mon, 23 Jun 2025 14:26:03 -0500 Subject: [PATCH 1/2] [lldb] Defend against infinite recursion in GetClassDescriptor We defend against a direct cycle where a base class ValueObject is its own parent, but not against a longer base cycle. This cycle requires that some value's Type includes a base class, and that base class is in a class hierarchy that cycles back to the original base class. I wrote a test case that creates a cycle in the class hierarchy by dynamically overwriting the superclass of an object, but I can't reproduce the crash. I can't think of any other way to make a real object that behaves that way. Maybe is a type system problem in making up the type for whatever type we're trying to ingest here. While unsatisfying, without a reproducer this is the best we can do for now. rdar://140293233 --- .../AppleObjCRuntime/AppleObjCRuntimeV2.cpp | 21 +-- .../AppleObjCRuntime/AppleObjCRuntimeV2.h | 5 + 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index e459cb281793a..4fcdebe5bac62 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -1505,15 +1505,24 @@ AppleObjCRuntimeV2::GetClassDescriptorFromISA(ObjCISA isa) { ObjCLanguageRuntime::ClassDescriptorSP AppleObjCRuntimeV2::GetClassDescriptor(ValueObject &valobj) { + ValueObjectSet seen; + return GetClassDescriptorImpl(valobj, seen); +} + +ObjCLanguageRuntime::ClassDescriptorSP +AppleObjCRuntimeV2::GetClassDescriptorImpl(ValueObject &valobj, + ValueObjectSet &seen) { + seen.insert(&valobj); + ClassDescriptorSP objc_class_sp; if (valobj.IsBaseClass()) { ValueObject *parent = valobj.GetParent(); -// if I am my own parent, bail out of here fast.. -if (parent && parent != &valobj) { - ClassDescriptorSP parent_descriptor_sp = GetClassDescriptor(*parent); - if (parent_descriptor_sp) -return parent_descriptor_sp->GetSuperclass(); -} +// Fail if there's a cycle in our parent chain. +if (!parent || seen.count(parent)) + return nullptr; +if (ClassDescriptorSP parent_descriptor_sp = +GetClassDescriptorImpl(*parent, seen)) + return parent_descriptor_sp->GetSuperclass(); return nullptr; } // if we get an invalid VO (which might still happen when playing around with diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h index 79840f9be79b3..e5dba5bddf936 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -20,6 +20,7 @@ #include "Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h" #include "llvm/ADT/BitVector.h" +#include "llvm/ADT/SmallSet.h" class RemoteNXMapTable; @@ -421,6 +422,10 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime { lldb::addr_t GetISAHashTablePointer(); + using ValueObjectSet = llvm::SmallSet; + ClassDescriptorSP GetClassDescriptorImpl(ValueObject &valobj, + ValueObjectSet &seen); + /// Update the generation count of realized classes. This is not an exact /// count but rather a value that is incremented when new classes are realized /// or destroyed. Unlike the count in gdb_objc_realized_classes, it will >From 69bb4e713ebbde210bc52abe51753dc82402f509 Mon Sep 17 00:00:00 2001 From: Jonas Devlieghere Date: Tue, 24 Jun 2025 10:25:20 -0700 Subject: [PATCH 2/2] Use llvm::SmallPtrSet --- .../LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h index e5dba5bddf936..b99bda2f7e259 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.h @@ -422,7 +422,7 @@ class AppleObjCRuntimeV2 : public AppleObjCRuntime { lldb::addr_t GetISAHashTablePointer(); - using ValueObjectSet = llvm::SmallSet; + using ValueObjectSet = llvm::SmallPtrSet; ClassDescriptorSP GetClassDescriptorImpl(ValueObject &valobj, ValueObjectSet &seen); ___
[Lldb-commits] [lldb] [lldb] Remove GDBRemoteCommunication::ConnectLocally (PR #145293)
labath wrote: Thanks. I just noticed the windows failure. https://github.com/llvm/llvm-project/commit/3e98d2b0311e0ccc213a28324d723bf93fe0e5b3 ought to take care of it. https://github.com/llvm/llvm-project/pull/145293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Fix AppleObjCDeclVendor for classes which have no methods (PR #145452)
https://github.com/kastiglione updated https://github.com/llvm/llvm-project/pull/145452 >From 57857bf2749a2801e9c4fb840a984a483ced6a44 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Mon, 23 Jun 2025 20:36:38 -0700 Subject: [PATCH 1/2] [lldb] Fix AppleObjCDeclVendor for classes which have no methods Fix the rare case where an ObjC class has ivars but no methods. The fix is to not early return when a class has no method list. --- .../AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp | 7 +++ .../test/API/lang/objc/class-without-methods/Makefile | 5 + lldb/test/API/lang/objc/class-without-methods/Point.h | 8 lldb/test/API/lang/objc/class-without-methods/Point.m | 4 .../TestObjCClassWithoutMethods.py| 11 +++ lldb/test/API/lang/objc/class-without-methods/main.m | 9 + 6 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 lldb/test/API/lang/objc/class-without-methods/Makefile create mode 100644 lldb/test/API/lang/objc/class-without-methods/Point.h create mode 100644 lldb/test/API/lang/objc/class-without-methods/Point.m create mode 100644 lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py create mode 100644 lldb/test/API/lang/objc/class-without-methods/main.m diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index dac93931bab1b..1c120fcf2c356 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp @@ -552,10 +552,9 @@ bool ClassDescriptorV2::Describe( } else { std::optional base_method_list = GetMethodList(process, class_ro->m_baseMethods_ptr); - if (!base_method_list) -return false; - if (!ProcessMethodList(instance_method_func, *base_method_list)) -return false; + if (base_method_list) +if (!ProcessMethodList(instance_method_func, *base_method_list)) + return false; } } diff --git a/lldb/test/API/lang/objc/class-without-methods/Makefile b/lldb/test/API/lang/objc/class-without-methods/Makefile new file mode 100644 index 0..f6f336c01bbc5 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Makefile @@ -0,0 +1,5 @@ +OBJC_SOURCES := Point.m main.m +include Makefile.rules + +# Only objc metadata, no debug info, for Point.m +Point.o: CFLAGS_EXTRAS += -g0 diff --git a/lldb/test/API/lang/objc/class-without-methods/Point.h b/lldb/test/API/lang/objc/class-without-methods/Point.h new file mode 100644 index 0..85c0cd6c895b3 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Point.h @@ -0,0 +1,8 @@ +#import + +@interface Point : NSObject { +@public + float _x; + float _y; +} +@end diff --git a/lldb/test/API/lang/objc/class-without-methods/Point.m b/lldb/test/API/lang/objc/class-without-methods/Point.m new file mode 100644 index 0..eb5888e5b599f --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/Point.m @@ -0,0 +1,4 @@ +#import "Point.h" + +@implementation Point +@end diff --git a/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py b/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py new file mode 100644 index 0..587f22dedadf7 --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/TestObjCClassWithoutMethods.py @@ -0,0 +1,11 @@ +import lldb +from lldbsuite.test.decorators import * +from lldbsuite.test.lldbtest import * +from lldbsuite.test import lldbutil + + +class TestCase(TestBase): +def test(self): +self.build() +lldbutil.run_to_source_breakpoint(self, "break here", lldb.SBFileSpec("main.m")) +self.expect("frame var -P1 p", substrs=["_x = 11", "_y = 22"]) diff --git a/lldb/test/API/lang/objc/class-without-methods/main.m b/lldb/test/API/lang/objc/class-without-methods/main.m new file mode 100644 index 0..f3241f46bbe5f --- /dev/null +++ b/lldb/test/API/lang/objc/class-without-methods/main.m @@ -0,0 +1,9 @@ +#import "Point.h" + +int main() { + Point *p = [Point new]; + p->_x = 11; + p->_y = 22; + // break here + return 0; +} >From 039749958a76c2ab687863eee07468ca858c6f74 Mon Sep 17 00:00:00 2001 From: Dave Lee Date: Tue, 24 Jun 2025 08:46:33 -0700 Subject: [PATCH 2/2] Flatten nested if --- .../ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp| 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp index 1c120fcf2c356..cc0c9e728964e 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2
[Lldb-commits] [lldb] [LLDB] Update DIL to pass current 'frame var' tests. (PR #145055)
cmtice wrote: > If the test you found the anonymous namespace issue it is explicitly testing > the handling of anonymous namespaces, then this is fine. However, if it's > doing that as a side-effect of testing something else, then it may be nice to > have an explicit test case for it. (Particularly as the anonymous namespace > thing can appear in other positions as well (`ns1::(anonymous > namespace)::foo`, `(anonymous namespace)::ns::(anonymous namespace)::foo`, > etc.) The test I found is lldb-api :: lang/cpp/namespace/TestNamespace.py, which does a basic test of '(anonymous namespace)' at the start of a variable name, but not embedded in the variable name. I agree that we should test it in other positions as well. I will add that to one of the DIL tests. https://github.com/llvm/llvm-project/pull/145055 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Revert "[lldb] Add count for number of DWO files loaded in statistics" (PR #145494)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Michael Buch (Michael137) Changes Reverts llvm/llvm-project#144424 Caused CI failures. macOS CI failure was: ``` 10:20:36 FAIL: test_dwp_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the loaded dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 639, in test_dwp_dwo_file_count 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_no_debug_names_eager_loads_dwo_files (TestStats.TestCase) 10:20:36 Test the eager loading behavior of DWO files when debug_names is absent by 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 566, in test_no_debug_names_eager_loads_dwo_files 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_split_dwarf_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 588, in test_split_dwarf_dwo_file_count 10:20:36 self.assertEqual(len(debug_stats["modules"]), 1) 10:20:36 AssertionError: 42 != 1 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang ``` --- Full diff: https://github.com/llvm/llvm-project/pull/145494.diff 10 Files Affected: - (modified) lldb/include/lldb/Symbol/SymbolFile.h (-8) - (modified) lldb/include/lldb/Target/Statistics.h (-2) - (modified) lldb/packages/Python/lldbsuite/test/builders/builder.py (+7-19) - (modified) lldb/packages/Python/lldbsuite/test/make/Makefile.rules (-4) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (-29) - (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (-5) - (modified) lldb/source/Target/Statistics.cpp (+1-11) - (modified) lldb/test/API/commands/statistics/basic/TestStats.py (-138) - (removed) lldb/test/API/commands/statistics/basic/baz.cpp (-12) - (removed) lldb/test/API/commands/statistics/basic/third.cpp (-7) ``diff diff --git a/lldb/include/lldb/Symbol/SymbolFile.h b/lldb/include/lldb/Symbol/SymbolFile.h index b0b608d0a5e79..75c7f230ddf3d 100644 --- a/lldb/include/lldb/Symbol/SymbolFile.h +++ b/lldb/include/lldb/Symbol/SymbolFile.h @@ -472,14 +472,6 @@ class SymbolFile : public PluginInterface { return false; }; - /// Get number of loaded/parsed DWO files. This is emitted in "statistics - /// dump" - /// - /// \returns - /// A pair containing (loaded_dwo_count, total_dwo_count). If this - /// symbol file doesn't support DWO files, both counts will be 0. - virtual std::pair GetDwoFileCounts() { return {0, 0}; } - virtual lldb::TypeSP MakeType(lldb::user_id_t uid, ConstString name, std::optional byte_size, SymbolContextScope *context, diff --git a/lldb/include/lldb/Target/Statistics.h b/lldb/include/lldb/Target/Statistics.h index 42f03798c219e..2d0d25cd3c753 100644 --- a/lldb/include/lldb/Target/Statistics.h +++ b/lldb/include/lldb/Target/Statistics.h @@ -153,8 +153,6 @@ struct ModuleStats { bool symtab_stripped = false; bool debug_info_had_variable_errors = false; bool debug_info_had_incomplete_types = false; - uint32_t dwo_file_count = 0; - uint32_t loaded_dwo_file_count = 0; }; struct ConstStringStats { diff --git a/lldb/packages/Python/lldbsuite/test/builders/builder.py b/lldb/packages/Python/lldbsuite/test/builders/builder.py index efb1ba568e3e6..de05732469448 100644 --- a/lldb/packages/Python/lldbsuite/test/builders/builder.py +++ b/lldb/packages/Python/lldbsuite/test/builders/builder.py @@ -247,25 +247,13 @@ def getLLDBObjRoot(self): def _getDebugInfoArgs(self, debug_info): if debug_info is None: return [] - -debug_options = debug_info if isinstance(debug_info, list) else [debug_info] -option_flags = { -"dwarf": {"MAKE_DSYM": "NO"}, -
[Lldb-commits] [lldb] [lldb][DWARF64] Enable support for DWARF64 format handling (PR #145645)
https://github.com/HemangGadhavi updated https://github.com/llvm/llvm-project/pull/145645 >From a85d648ce62b69b870dda306dbdc2d412ed89d33 Mon Sep 17 00:00:00 2001 From: HemangGadhavi Date: Wed, 25 Jun 2025 02:06:05 -0400 Subject: [PATCH] [lldb][DWARF64] Enable support for DWARF64 format handling --- .../SymbolFile/DWARF/DWARFFormValue.cpp | 47 --- .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 15 +- .../Plugins/SymbolFile/DWARF/DWARFUnit.h | 1 + 3 files changed, 33 insertions(+), 30 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index fd3d45cef4c5e..d0cc5edc6678a 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -77,7 +77,10 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, case DW_FORM_strp: case DW_FORM_line_strp: case DW_FORM_sec_offset: - m_value.uval = data.GetMaxU64(offset_ptr, 4); + if (m_unit->GetFormat() == DwarfFormat::DWARF32) +m_value.uval = data.GetMaxU64(offset_ptr, 4); + else if (m_unit->GetFormat() == DwarfFormat::DWARF64) +m_value.uval = data.GetMaxU64(offset_ptr, 8); break; case DW_FORM_addrx1: case DW_FORM_strx1: @@ -121,8 +124,12 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, assert(m_unit); if (m_unit->GetVersion() <= 2) ref_addr_size = m_unit->GetAddressByteSize(); - else -ref_addr_size = 4; + else { +if (m_unit->GetFormat() == DwarfFormat::DWARF32) + ref_addr_size = 4; +else if (m_unit->GetFormat() == DwarfFormat::DWARF64) + ref_addr_size = 8; + } m_value.uval = data.GetMaxU64(offset_ptr, ref_addr_size); break; case DW_FORM_indirect: @@ -165,17 +172,18 @@ static FormSize g_form_sizes[] = { {1, 1}, // 0x0b DW_FORM_data1 {1, 1}, // 0x0c DW_FORM_flag {0, 0}, // 0x0d DW_FORM_sdata -{1, 4}, // 0x0e DW_FORM_strp +{0, 0}, // 0x0e DW_FORM_strp (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x0f DW_FORM_udata {0, 0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes // for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later -{1, 1}, // 0x11 DW_FORM_ref1 -{1, 2}, // 0x12 DW_FORM_ref2 -{1, 4}, // 0x13 DW_FORM_ref4 -{1, 8}, // 0x14 DW_FORM_ref8 -{0, 0}, // 0x15 DW_FORM_ref_udata -{0, 0}, // 0x16 DW_FORM_indirect -{1, 4}, // 0x17 DW_FORM_sec_offset +{1, 1}, // 0x11 DW_FORM_ref1 +{1, 2}, // 0x12 DW_FORM_ref2 +{1, 4}, // 0x13 DW_FORM_ref4 +{1, 8}, // 0x14 DW_FORM_ref8 +{0, 0}, // 0x15 DW_FORM_ref_udata +{0, 0}, // 0x16 DW_FORM_indirect +{0, + 0}, // 0x17 DW_FORM_sec_offset (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x18 DW_FORM_exprloc {1, 0}, // 0x19 DW_FORM_flag_present {0, 0}, // 0x1a DW_FORM_strx (ULEB128) @@ -183,8 +191,8 @@ static FormSize g_form_sizes[] = { {1, 4}, // 0x1c DW_FORM_ref_sup4 {0, 0}, // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64) {1, 16}, // 0x1e DW_FORM_data16 -{1, 4}, // 0x1f DW_FORM_line_strp -{1, 8}, // 0x20 DW_FORM_ref_sig8 +{0, 0}, // 0x1f DW_FORM_line_strp (4 bytes for DWARF32, 8 bytes for DWARF64) +{1, 8}, // 0x20 DW_FORM_ref_sig8 }; std::optional DWARFFormValue::GetFixedSize(dw_form_t form, @@ -251,8 +259,12 @@ bool DWARFFormValue::SkipValue(dw_form_t form, // get this wrong if (unit->GetVersion() <= 2) ref_addr_size = unit->GetAddressByteSize(); -else - ref_addr_size = 4; +else { + if (unit->GetFormat() == DwarfFormat::DWARF32) +ref_addr_size = 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +ref_addr_size = 8; +} *offset_ptr += ref_addr_size; return true; @@ -288,7 +300,10 @@ bool DWARFFormValue::SkipValue(dw_form_t form, case DW_FORM_sec_offset: case DW_FORM_strp: case DW_FORM_line_strp: - *offset_ptr += 4; + if (unit->GetFormat() == DwarfFormat::DWARF32) +*offset_ptr += 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +*offset_ptr += 8; return true; // 4 byte values diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index ffd6f1dd52aff..f216ab13e8936 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -1073,20 +1073,7 @@ const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const { : m_dwarf.GetDWARFContext().getOrLoadDebugInfoData(); } -uint32_t DWARFUnit::GetHeaderByteSize() const { - switch (m_header.getUnitType()) { - case llvm::dwarf::DW_UT_compile: - case llvm::dwarf::DW_UT_partial: -return G
[Lldb-commits] [lldb] [lldb] Fix AppleObjCDeclVendor for classes which have no methods (PR #145452)
https://github.com/bulbazord approved this pull request. https://github.com/llvm/llvm-project/pull/145452 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] Reland "[lldb][target] Add progress report for wait-attaching to proc… (PR #145111)
https://github.com/chelcassanova updated https://github.com/llvm/llvm-project/pull/145111 >From def09f294e36e2fe703d66eeae37253ac8fbb7b1 Mon Sep 17 00:00:00 2001 From: Chelsea Cassanova Date: Fri, 20 Jun 2025 13:47:32 -0700 Subject: [PATCH] Reland "[lldb][target] Add progress report for wait-attaching to process" (#144810) This relands commit e0933ab5ae4856c4aa188a5ea16716b3a8d0840b. The original commit was causing the test TestCreateAfterAttach.py to fail on ARM Ubuntu bots. It's possible that this could've been happening because the test for wait-attach progress reporting is waiting on a process named "a.out" which could be too generic as multiple other tests (when run in parallel on the bots) could also be using processes named "a.out". This commit changes the wait-attach progress report test to wait on a unique process name. Original PR description: This commit adds a progress report when wait-attaching to a process as well as a test for this. Original PR link: https://github.com/llvm/llvm-project/pull/144768 --- lldb/source/Target/Target.cpp | 1 + .../TestProgressReporting.py | 22 +++ 2 files changed, 23 insertions(+) diff --git a/lldb/source/Target/Target.cpp b/lldb/source/Target/Target.cpp index 45a9e1196a049..8f8d2ef21cc5f 100644 --- a/lldb/source/Target/Target.cpp +++ b/lldb/source/Target/Target.cpp @@ -3546,6 +3546,7 @@ llvm::Expected Target::GetTraceOrCreate() { } Status Target::Attach(ProcessAttachInfo &attach_info, Stream *stream) { + Progress attach_progress("Waiting to attach to process"); m_stats.SetLaunchOrAttachTime(); auto state = eStateInvalid; auto process_sp = GetProcessSP(); diff --git a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py index 9af53845ca1b7..a7f2e6b70dfc7 100644 --- a/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py +++ b/lldb/test/API/functionalities/progress_reporting/TestProgressReporting.py @@ -16,6 +16,28 @@ def setUp(self): self.broadcaster, lldb.SBDebugger.eBroadcastBitProgress ) +def test_wait_attach_progress_reporting(self): +"""Test that progress reports for wait attaching work as intended.""" +target = self.dbg.CreateTarget(None) + +# The waiting to attach progress message will get emitted upon +# trying to attach, but it's not going to be the event picked +# up by checking with fetch_next_event, so go through all emitted +# progres events and check that the waiting to attach one was emitted at all. +target.AttachToProcessWithName( +self.listener, +"a.out", +False, +lldb.SBError(), +) +event = lldb.SBEvent() +events = [] +while self.listener.GetNextEventForBroadcaster(self.broadcaster, event): +progress_data = lldb.SBDebugger.GetProgressDataFromEvent(event) +message = progress_data.GetValueForKey("message").GetStringValue(100) +events.append(message) +self.assertTrue("Waiting to attach to process" in events) + def test_dwarf_symbol_loading_progress_report(self): """Test that we are able to fetch dwarf symbol loading progress events""" self.build() ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DWARF64] Enable support for DWARF64 format handling (PR #145645)
HemangGadhavi wrote: @labath @DavidSpickett With this PR I have enable the support of `DWARF64` format, I made the use of the existing llvm framework to get the header size and also adjusting the form value according to the format (i.e. `DW_FORM_ref_addr` suppose to 4bytes for `DWARF32` and 8bytes for `DWARF64` as per the DWARF specification). With this PR at least we are able to do source level debugging with `DWARF64` format without any harm to `DWARF32` Please let me know your inputs here. https://github.com/llvm/llvm-project/pull/145645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DWARF64] Enable support for DWARF64 format handling (PR #145645)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h `` View the diff from clang-format here. ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index 1a712c3c7..d0cc5edc6 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -176,12 +176,12 @@ static FormSize g_form_sizes[] = { {0, 0}, // 0x0f DW_FORM_udata {0, 0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes // for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later -{1, 1}, // 0x11 DW_FORM_ref1 -{1, 2}, // 0x12 DW_FORM_ref2 -{1, 4}, // 0x13 DW_FORM_ref4 -{1, 8}, // 0x14 DW_FORM_ref8 -{0, 0}, // 0x15 DW_FORM_ref_udata -{0, 0}, // 0x16 DW_FORM_indirect +{1, 1}, // 0x11 DW_FORM_ref1 +{1, 2}, // 0x12 DW_FORM_ref2 +{1, 4}, // 0x13 DW_FORM_ref4 +{1, 8}, // 0x14 DW_FORM_ref8 +{0, 0}, // 0x15 DW_FORM_ref_udata +{0, 0}, // 0x16 DW_FORM_indirect {0, 0}, // 0x17 DW_FORM_sec_offset (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x18 DW_FORM_exprloc @@ -192,7 +192,7 @@ static FormSize g_form_sizes[] = { {0, 0}, // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64) {1, 16}, // 0x1e DW_FORM_data16 {0, 0}, // 0x1f DW_FORM_line_strp (4 bytes for DWARF32, 8 bytes for DWARF64) -{1, 8}, // 0x20 DW_FORM_ref_sig8 +{1, 8}, // 0x20 DW_FORM_ref_sig8 }; std::optional DWARFFormValue::GetFixedSize(dw_form_t form, `` https://github.com/llvm/llvm-project/pull/145645 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DWARF64] Enable support for DWARF64 format handling (PR #145645)
https://github.com/HemangGadhavi updated https://github.com/llvm/llvm-project/pull/145645 >From 547716f930b16cd66b5aa6ce3a59aaf6167ece01 Mon Sep 17 00:00:00 2001 From: HemangGadhavi Date: Wed, 25 Jun 2025 02:06:05 -0400 Subject: [PATCH] [lldb][DWARF64] Enable support for DWARF64 format handling --- .../SymbolFile/DWARF/DWARFFormValue.cpp | 59 --- .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 15 + .../Plugins/SymbolFile/DWARF/DWARFUnit.h | 1 + 3 files changed, 39 insertions(+), 36 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index fd3d45cef4c5e..693d3faf537d7 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -77,7 +77,10 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, case DW_FORM_strp: case DW_FORM_line_strp: case DW_FORM_sec_offset: - m_value.uval = data.GetMaxU64(offset_ptr, 4); + if (m_unit->GetFormat() == DwarfFormat::DWARF32) +m_value.uval = data.GetMaxU64(offset_ptr, 4); + else if (m_unit->GetFormat() == DwarfFormat::DWARF64) +m_value.uval = data.GetMaxU64(offset_ptr, 8); break; case DW_FORM_addrx1: case DW_FORM_strx1: @@ -121,8 +124,12 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, assert(m_unit); if (m_unit->GetVersion() <= 2) ref_addr_size = m_unit->GetAddressByteSize(); - else -ref_addr_size = 4; + else { +if (m_unit->GetFormat() == DwarfFormat::DWARF32) + ref_addr_size = 4; +else if (m_unit->GetFormat() == DwarfFormat::DWARF64) + ref_addr_size = 8; + } m_value.uval = data.GetMaxU64(offset_ptr, ref_addr_size); break; case DW_FORM_indirect: @@ -165,26 +172,27 @@ static FormSize g_form_sizes[] = { {1, 1}, // 0x0b DW_FORM_data1 {1, 1}, // 0x0c DW_FORM_flag {0, 0}, // 0x0d DW_FORM_sdata -{1, 4}, // 0x0e DW_FORM_strp +{0, 0}, // 0x0e DW_FORM_strp (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x0f DW_FORM_udata {0, 0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes // for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later -{1, 1}, // 0x11 DW_FORM_ref1 -{1, 2}, // 0x12 DW_FORM_ref2 -{1, 4}, // 0x13 DW_FORM_ref4 -{1, 8}, // 0x14 DW_FORM_ref8 -{0, 0}, // 0x15 DW_FORM_ref_udata -{0, 0}, // 0x16 DW_FORM_indirect -{1, 4}, // 0x17 DW_FORM_sec_offset -{0, 0}, // 0x18 DW_FORM_exprloc -{1, 0}, // 0x19 DW_FORM_flag_present -{0, 0}, // 0x1a DW_FORM_strx (ULEB128) -{0, 0}, // 0x1b DW_FORM_addrx (ULEB128) -{1, 4}, // 0x1c DW_FORM_ref_sup4 -{0, 0}, // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64) +{1, 1}, // 0x11 DW_FORM_ref1 +{1, 2}, // 0x12 DW_FORM_ref2 +{1, 4}, // 0x13 DW_FORM_ref4 +{1, 8}, // 0x14 DW_FORM_ref8 +{0, 0}, // 0x15 DW_FORM_ref_udata +{0, 0}, // 0x16 DW_FORM_indirect +{0, + 0}, // 0x17 DW_FORM_sec_offset (4 bytes for DWARF32, 8 bytes for DWARF64) +{0, 0}, // 0x18 DW_FORM_exprloc +{1, 0}, // 0x19 DW_FORM_flag_present +{0, 0}, // 0x1a DW_FORM_strx (ULEB128) +{0, 0}, // 0x1b DW_FORM_addrx (ULEB128) +{1, 4}, // 0x1c DW_FORM_ref_sup4 +{0, 0}, // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64) {1, 16}, // 0x1e DW_FORM_data16 -{1, 4}, // 0x1f DW_FORM_line_strp -{1, 8}, // 0x20 DW_FORM_ref_sig8 +{0, 0}, // 0x1f DW_FORM_line_strp (4 bytes for DWARF32, 8 bytes for DWARF64) +{1, 8}, // 0x20 DW_FORM_ref_sig8 }; std::optional DWARFFormValue::GetFixedSize(dw_form_t form, @@ -251,8 +259,12 @@ bool DWARFFormValue::SkipValue(dw_form_t form, // get this wrong if (unit->GetVersion() <= 2) ref_addr_size = unit->GetAddressByteSize(); -else - ref_addr_size = 4; +else { + if (unit->GetFormat() == DwarfFormat::DWARF32) +ref_addr_size = 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +ref_addr_size = 8; +} *offset_ptr += ref_addr_size; return true; @@ -288,7 +300,10 @@ bool DWARFFormValue::SkipValue(dw_form_t form, case DW_FORM_sec_offset: case DW_FORM_strp: case DW_FORM_line_strp: - *offset_ptr += 4; + if (unit->GetFormat() == DwarfFormat::DWARF32) +*offset_ptr += 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +*offset_ptr += 8; return true; // 4 byte values diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index ffd6f1dd52aff..f216ab13e8936 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -1073,20 +1073,7 @@ const lldb_private::DWARFDataExtracto
[Lldb-commits] [lldb] [lldb][RPC] Upstream lldb-rpc-gen tool (PR #138031)
@@ -0,0 +1,22 @@ +include(CheckCXXCompilerFlag) chelcassanova wrote: I'm actually not sure, though it seems to have originally been added to silence compiler warnings, so maybe this should be kept. https://github.com/llvm/llvm-project/pull/138031 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/144627 >From 92348b28fb02901e9437b92c1ddf8cfed31c Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 17 Jun 2025 18:57:11 -0700 Subject: [PATCH 1/4] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers The "process metadata" LC_NOTE allows for thread IDs to be specified in a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to allow for additional registers to be supplied on a per-thread basis. The registers included in a Mach-O corefile LC_THREAD load command can only be one of the register flavors that the kernel (xnu) defines in for arm64 -- the general purpose registers, floating point registers, exception registers. JTAG style corefile producers may have access to many additional registers beyond these that EL0 programs typically use, for instance TCR_EL1 on AArch64, and people developing low level code need access to these registers. This patch defines a format for including these registers for any thread. The JSON in "process metadata" is a dictionary that must have a `threads` key. The value is an array of entries, one per LC_THREAD in the Mach-O corefile. The number of entries must match the LC_THREADs so they can be correctly associated. Each thread's dictionary must have two keys, `sets`, and `registers`. `sets` is an array of register set names. If a register set name matches one from the LC_THREAD core registers, any registers that are defined will be added to that register set. e.g. metadata can add a register to the "General Purpose Registers" set that lldb shows users. `registers` is an array of dictionaries, one per register. Each register must have the keys `name`, `value`, `bitsize`, and `set`. It may provide additional keys like `alt-name`, that `DynamicRegisterInfo::SetRegisterInfo` recognizes. This `sets` + `registers` formatting is the same that is used by the `target.process.python-os-plugin-path` script interface uses, both are parsed by `DynamicRegisterInfo`. The one addition is that in this LC_NOTE metadata, each register must also have a `value` field, with the value provided in big-endian base 10, as usual with JSON. In RegisterContextUnifiedCore, I combine the register sets & registers from the LC_THREAD for a specific thread, and the metadata sets & registers for that thread from the LC_NOTE. Even if no LC_NOTE is present, this class ingests the LC_THREAD register contexts and reformats it to its internal stores before returning itself as the RegisterContex, instead of shortcutting and returning the core's native RegisterContext. I could have gone either way with that, but in the end I decided if the code is correct, we should live on it always. I added a test where we process save-core to create a userland corefile, then use a utility "add-lcnote" to strip the existing "process metadata" LC_NOTE that lldb put in it, and adds a new one from a JSON string. rdar://74358787 --- lldb/include/lldb/Symbol/ObjectFile.h | 17 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 61 ++- .../ObjectFile/Mach-O/ObjectFileMachO.h | 2 + .../Plugins/Process/mach-core/CMakeLists.txt | 1 + .../mach-core/RegisterContextUnifiedCore.cpp | 293 + .../mach-core/RegisterContextUnifiedCore.h| 57 +++ .../Process/mach-core/ThreadMachCore.cpp | 55 ++- .../lc-note/additional-registers/Makefile | 11 + .../TestMetadataRegisters.py | 100 + .../additional-registers/add-lcnote.cpp | 384 ++ .../lc-note/additional-registers/main.c | 11 + 11 files changed, 957 insertions(+), 35 deletions(-) create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.h create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/Makefile create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/TestMetadataRegisters.py create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/main.c diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 43567592dd447..1b9ae1fb31a69 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -18,6 +18,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" #include "llvm/Support/Threading.h" @@ -544,9 +545,9 @@ class ObjectFile : public std::enable_shared_from_this, return false; } - /// Get metadata about threads from the corefile. + /// Get metadata about thread ids from the corefile. /// - /// The corefile may have metadata (e.g. a Mach-O "thread extra
[Lldb-commits] [lldb] [lldb] Fix race condition in Process::WaitForProcessToStop() (PR #144919)
labath wrote: I think I understand most of what you're saying, and I think the proposed solution may solve the problem you have in mind -- but I don't think it can solve the problem *I* have in mind (and I'm not sure which of those is OP's problem :P). The race I *think* I see is in `Process::StopForDestroyOrDetach`. We first check the process state (both of them), and if it's running, we install the hijack listener (and wait on it). However if the stopped event is sent (enqueued to the primary listener) before the hijack listener is installed, the listener will never get anything. I don't see how fiddling with thread identities can help there. Even if it does, it will only help for one particular thread. OP is calling Kill from the event handling thread, but I don't think we require that. If Kill is called from some other thread, I think it could still run into the same bug (although the race window will most likely be smaller, since the event thread will be alive and pulling events from the queue). https://github.com/llvm/llvm-project/pull/144919 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda edited https://github.com/llvm/llvm-project/pull/144627 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
DavidSpickett wrote: This also times out on Windows on Arm - https://lab.llvm.org/buildbot/#/builders/141/builds/9615. First guess - it's waiting for DWO files to be loaded but we'll never use those on Windows? https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/144627 >From 92348b28fb02901e9437b92c1ddf8cfed31c Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 17 Jun 2025 18:57:11 -0700 Subject: [PATCH 1/5] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers The "process metadata" LC_NOTE allows for thread IDs to be specified in a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to allow for additional registers to be supplied on a per-thread basis. The registers included in a Mach-O corefile LC_THREAD load command can only be one of the register flavors that the kernel (xnu) defines in for arm64 -- the general purpose registers, floating point registers, exception registers. JTAG style corefile producers may have access to many additional registers beyond these that EL0 programs typically use, for instance TCR_EL1 on AArch64, and people developing low level code need access to these registers. This patch defines a format for including these registers for any thread. The JSON in "process metadata" is a dictionary that must have a `threads` key. The value is an array of entries, one per LC_THREAD in the Mach-O corefile. The number of entries must match the LC_THREADs so they can be correctly associated. Each thread's dictionary must have two keys, `sets`, and `registers`. `sets` is an array of register set names. If a register set name matches one from the LC_THREAD core registers, any registers that are defined will be added to that register set. e.g. metadata can add a register to the "General Purpose Registers" set that lldb shows users. `registers` is an array of dictionaries, one per register. Each register must have the keys `name`, `value`, `bitsize`, and `set`. It may provide additional keys like `alt-name`, that `DynamicRegisterInfo::SetRegisterInfo` recognizes. This `sets` + `registers` formatting is the same that is used by the `target.process.python-os-plugin-path` script interface uses, both are parsed by `DynamicRegisterInfo`. The one addition is that in this LC_NOTE metadata, each register must also have a `value` field, with the value provided in big-endian base 10, as usual with JSON. In RegisterContextUnifiedCore, I combine the register sets & registers from the LC_THREAD for a specific thread, and the metadata sets & registers for that thread from the LC_NOTE. Even if no LC_NOTE is present, this class ingests the LC_THREAD register contexts and reformats it to its internal stores before returning itself as the RegisterContex, instead of shortcutting and returning the core's native RegisterContext. I could have gone either way with that, but in the end I decided if the code is correct, we should live on it always. I added a test where we process save-core to create a userland corefile, then use a utility "add-lcnote" to strip the existing "process metadata" LC_NOTE that lldb put in it, and adds a new one from a JSON string. rdar://74358787 --- lldb/include/lldb/Symbol/ObjectFile.h | 17 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 61 ++- .../ObjectFile/Mach-O/ObjectFileMachO.h | 2 + .../Plugins/Process/mach-core/CMakeLists.txt | 1 + .../mach-core/RegisterContextUnifiedCore.cpp | 293 + .../mach-core/RegisterContextUnifiedCore.h| 57 +++ .../Process/mach-core/ThreadMachCore.cpp | 55 ++- .../lc-note/additional-registers/Makefile | 11 + .../TestMetadataRegisters.py | 100 + .../additional-registers/add-lcnote.cpp | 384 ++ .../lc-note/additional-registers/main.c | 11 + 11 files changed, 957 insertions(+), 35 deletions(-) create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.h create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/Makefile create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/TestMetadataRegisters.py create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/main.c diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 43567592dd447..1b9ae1fb31a69 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -18,6 +18,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" #include "llvm/Support/Threading.h" @@ -544,9 +545,9 @@ class ObjectFile : public std::enable_shared_from_this, return false; } - /// Get metadata about threads from the corefile. + /// Get metadata about thread ids from the corefile. /// - /// The corefile may have metadata (e.g. a Mach-O "thread extra
[Lldb-commits] [lldb] [lldb] include `LLVMTargetParser` in `LINK_COMPONENTS` (PR #145606)
https://github.com/JDevlieghere approved this pull request. https://github.com/llvm/llvm-project/pull/145606 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Migrating MainLoopWindows to files and sockets. (PR #145621)
https://github.com/ashgti created https://github.com/llvm/llvm-project/pull/145621 This updates MainLoopWindows to support events for reading from a file and a socket type. This unifies both handle types using `WaitForMultipleEvents` which can listen to both sockets and files for change events. This should allow us to unify how we handle watching files/pipes/sockets on Windows and Posix systems. >From 21652f8b18f122027bd62759a799faccbc8c21b8 Mon Sep 17 00:00:00 2001 From: John Harrison Date: Tue, 24 Jun 2025 17:48:54 -0700 Subject: [PATCH] [lldb] Migrating MainLoopWindows to files and sockets. This updates MainLoopWindows to support events for reading from a file and a socket type. This unifies both handle types using `WaitForMultipleEvents` which can listen to both sockets and files for change events. This should allow us to unify how we handle watching files/pipes/sockets on Windows and Posix systems. --- lldb/include/lldb/Host/JSONTransport.h| 13 +-- .../lldb/Host/windows/MainLoopWindows.h | 3 +- lldb/include/lldb/Utility/IOObject.h | 7 +- lldb/source/Host/common/File.cpp | 4 + lldb/source/Host/common/JSONTransport.cpp | 36 ++ lldb/source/Host/common/Socket.cpp| 13 ++- .../posix/ConnectionFileDescriptorPosix.cpp | 13 ++- lldb/source/Host/windows/MainLoopWindows.cpp | 108 ++ lldb/source/Utility/IOObject.cpp | 8 ++ lldb/tools/lldb-dap/DAP.cpp | 2 +- lldb/unittests/Host/FileTest.cpp | 2 +- 11 files changed, 112 insertions(+), 97 deletions(-) diff --git a/lldb/include/lldb/Host/JSONTransport.h b/lldb/include/lldb/Host/JSONTransport.h index 4087cdf2b42f7..348431ed662ed 100644 --- a/lldb/include/lldb/Host/JSONTransport.h +++ b/lldb/include/lldb/Host/JSONTransport.h @@ -85,8 +85,8 @@ class JSONTransport { /// Reads the next message from the input stream. template - llvm::Expected Read(const std::chrono::microseconds &timeout) { -llvm::Expected message = ReadImpl(timeout); + llvm::Expected Read() { +llvm::Expected message = ReadImpl(); if (!message) return message.takeError(); return llvm::json::parse(/*JSON=*/*message); @@ -96,8 +96,7 @@ class JSONTransport { virtual void Log(llvm::StringRef message); virtual llvm::Error WriteImpl(const std::string &message) = 0; - virtual llvm::Expected - ReadImpl(const std::chrono::microseconds &timeout) = 0; + virtual llvm::Expected ReadImpl() = 0; lldb::IOObjectSP m_input; lldb::IOObjectSP m_output; @@ -112,8 +111,7 @@ class HTTPDelimitedJSONTransport : public JSONTransport { protected: virtual llvm::Error WriteImpl(const std::string &message) override; - virtual llvm::Expected - ReadImpl(const std::chrono::microseconds &timeout) override; + virtual llvm::Expected ReadImpl() override; // FIXME: Support any header. static constexpr llvm::StringLiteral kHeaderContentLength = @@ -130,8 +128,7 @@ class JSONRPCTransport : public JSONTransport { protected: virtual llvm::Error WriteImpl(const std::string &message) override; - virtual llvm::Expected - ReadImpl(const std::chrono::microseconds &timeout) override; + virtual llvm::Expected ReadImpl() override; static constexpr llvm::StringLiteral kMessageSeparator = "\n"; }; diff --git a/lldb/include/lldb/Host/windows/MainLoopWindows.h b/lldb/include/lldb/Host/windows/MainLoopWindows.h index 3937a24645d95..d47bf7d5f50b7 100644 --- a/lldb/include/lldb/Host/windows/MainLoopWindows.h +++ b/lldb/include/lldb/Host/windows/MainLoopWindows.h @@ -37,11 +37,10 @@ class MainLoopWindows : public MainLoopBase { void Interrupt() override; private: - void ProcessReadObject(IOObject::WaitableHandle handle); llvm::Expected Poll(); struct FdInfo { -void *event; +const lldb::IOObjectSP &object_sp; Callback callback; }; llvm::DenseMap m_read_fds; diff --git a/lldb/include/lldb/Utility/IOObject.h b/lldb/include/lldb/Utility/IOObject.h index 8cf42992e7be5..de6532a637083 100644 --- a/lldb/include/lldb/Utility/IOObject.h +++ b/lldb/include/lldb/Utility/IOObject.h @@ -14,6 +14,7 @@ #include #include "lldb/lldb-private.h" +#include "lldb/lldb-types.h" namespace lldb_private { @@ -24,9 +25,9 @@ class IOObject { eFDTypeSocket, // Socket requiring send/recv }; - // TODO: On Windows this should be a HANDLE, and wait should use - // WaitForMultipleObjects - typedef int WaitableHandle; + // A handle for integrating with the host event loop model. + using WaitableHandle = lldb::file_t; + static const WaitableHandle kInvalidHandleValue; IOObject(FDType type) : m_fd_type(type) {} diff --git a/lldb/source/Host/common/File.cpp b/lldb/source/Host/common/File.cpp index 9aa95ffda44cb..23b6dc9fe850d 100644 --- a/lldb/source/Host/common/File.cpp +++ b/lldb/source/Host/common/File.cpp @@ -274,7 +274,11 @@ int NativeFile::GetDescriptor() const { } IOObject::
[Lldb-commits] [lldb] [lldb] Adding file and pipe support to lldb_private::MainLoopWindows. (PR #145621)
https://github.com/ashgti edited https://github.com/llvm/llvm-project/pull/145621 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Adding file and pipe support to lldb_private::MainLoopWindows. (PR #145621)
github-actions[bot] wrote: :warning: C/C++ code formatter, clang-format found issues in your code. :warning: You can test this locally with the following command: ``bash git-clang-format --diff HEAD~1 HEAD --extensions cpp,h -- lldb/include/lldb/Host/JSONTransport.h lldb/include/lldb/Host/windows/MainLoopWindows.h lldb/include/lldb/Utility/IOObject.h lldb/source/Host/common/File.cpp lldb/source/Host/common/JSONTransport.cpp lldb/source/Host/common/Socket.cpp lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/source/Host/windows/MainLoopWindows.cpp lldb/source/Utility/IOObject.cpp lldb/tools/lldb-dap/DAP.cpp lldb/unittests/Host/FileTest.cpp `` View the diff from clang-format here. ``diff diff --git a/lldb/include/lldb/Host/JSONTransport.h b/lldb/include/lldb/Host/JSONTransport.h index 348431ed6..172388421 100644 --- a/lldb/include/lldb/Host/JSONTransport.h +++ b/lldb/include/lldb/Host/JSONTransport.h @@ -84,8 +84,7 @@ public: } /// Reads the next message from the input stream. - template - llvm::Expected Read() { + template llvm::Expected Read() { llvm::Expected message = ReadImpl(); if (!message) return message.takeError(); diff --git a/lldb/source/Host/common/JSONTransport.cpp b/lldb/source/Host/common/JSONTransport.cpp index b5e271f61..f9bc01d92 100644 --- a/lldb/source/Host/common/JSONTransport.cpp +++ b/lldb/source/Host/common/JSONTransport.cpp @@ -27,8 +27,7 @@ using namespace lldb_private; /// ReadFull attempts to read the specified number of bytes. If EOF is /// encountered, an empty string is returned. -static Expected -ReadFull(IOObject &descriptor, size_t length) { +static Expected ReadFull(IOObject &descriptor, size_t length) { if (!descriptor.IsValid()) return llvm::make_error(); @@ -46,8 +45,8 @@ ReadFull(IOObject &descriptor, size_t length) { return data.substr(0, length); } -static Expected -ReadUntil(IOObject &descriptor, StringRef delimiter) { +static Expected ReadUntil(IOObject &descriptor, + StringRef delimiter) { std::string buffer; buffer.reserve(delimiter.size() + 1); while (!llvm::StringRef(buffer).ends_with(delimiter)) { @@ -67,8 +66,7 @@ void JSONTransport::Log(llvm::StringRef message) { LLDB_LOG(GetLog(LLDBLog::Host), "{0}", message); } -Expected -HTTPDelimitedJSONTransport::ReadImpl() { +Expected HTTPDelimitedJSONTransport::ReadImpl() { if (!m_input || !m_input->IsValid()) return llvm::make_error(); @@ -120,14 +118,12 @@ Error HTTPDelimitedJSONTransport::WriteImpl(const std::string &message) { return m_output->Write(Output.data(), num_bytes).takeError(); } -Expected -JSONRPCTransport::ReadImpl() { +Expected JSONRPCTransport::ReadImpl() { if (!m_input || !m_input->IsValid()) return make_error(); IOObject *input = m_input.get(); - Expected raw_json = - ReadUntil(*input, kMessageSeparator); + Expected raw_json = ReadUntil(*input, kMessageSeparator); if (!raw_json) return raw_json.takeError(); diff --git a/lldb/source/Host/common/Socket.cpp b/lldb/source/Host/common/Socket.cpp index 10c28a545..d6881f1b4 100644 --- a/lldb/source/Host/common/Socket.cpp +++ b/lldb/source/Host/common/Socket.cpp @@ -316,12 +316,12 @@ IOObject::WaitableHandle Socket::GetWaitableHandle() { #ifdef _WIN32 if (m_socket == INVALID_SOCKET) return IOObject::kInvalidHandleValue; - + WSAEVENT event = WSACreateEvent(); assert(event != WSA_INVALID_EVENT); if (WSAEventSelect(m_socket, event, FD_ACCEPT | FD_READ | FD_WRITE) != 0) return IOObject::kInvalidHandleValue; - + return event; #else return m_socket; diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index 86a23b4f6..2fcad7f19 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -453,7 +453,7 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout &timeout, // FIXME: Migrate to MainLoop. #if defined(_WIN32) -if (const auto *sock = static_cast(m_io_sp.get())) +if (const auto *sock = static_cast(m_io_sp.get())) select_helper.FDSetRead((socket_t)sock->GetNativeSocket()); // select() won't accept pipes on Windows. The entire Windows codepath // needs to be converted over to using WaitForMultipleObjects and event @@ -497,7 +497,8 @@ ConnectionFileDescriptor::BytesAvailable(const Timeout &timeout, } } else { #if defined(_WIN32) -if (const auto *sock = static_cast(m_io_sp.get()); select_helper.FDIsSetRead(sock->GetNativeSocket())) +if (const auto *sock = static_cast(m_io_sp.get()); +select_helper.FDIsSetRead(sock->GetNativeSocket())) #else if (select_helper.FDIsSetRead(handle)) #endif diff --git a/lldb/source/Host/windows/MainLoopWindows.cpp b/lldb/source/Host/windows/MainL
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/144627 >From 92348b28fb02901e9437b92c1ddf8cfed31c Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 17 Jun 2025 18:57:11 -0700 Subject: [PATCH 1/9] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers The "process metadata" LC_NOTE allows for thread IDs to be specified in a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to allow for additional registers to be supplied on a per-thread basis. The registers included in a Mach-O corefile LC_THREAD load command can only be one of the register flavors that the kernel (xnu) defines in for arm64 -- the general purpose registers, floating point registers, exception registers. JTAG style corefile producers may have access to many additional registers beyond these that EL0 programs typically use, for instance TCR_EL1 on AArch64, and people developing low level code need access to these registers. This patch defines a format for including these registers for any thread. The JSON in "process metadata" is a dictionary that must have a `threads` key. The value is an array of entries, one per LC_THREAD in the Mach-O corefile. The number of entries must match the LC_THREADs so they can be correctly associated. Each thread's dictionary must have two keys, `sets`, and `registers`. `sets` is an array of register set names. If a register set name matches one from the LC_THREAD core registers, any registers that are defined will be added to that register set. e.g. metadata can add a register to the "General Purpose Registers" set that lldb shows users. `registers` is an array of dictionaries, one per register. Each register must have the keys `name`, `value`, `bitsize`, and `set`. It may provide additional keys like `alt-name`, that `DynamicRegisterInfo::SetRegisterInfo` recognizes. This `sets` + `registers` formatting is the same that is used by the `target.process.python-os-plugin-path` script interface uses, both are parsed by `DynamicRegisterInfo`. The one addition is that in this LC_NOTE metadata, each register must also have a `value` field, with the value provided in big-endian base 10, as usual with JSON. In RegisterContextUnifiedCore, I combine the register sets & registers from the LC_THREAD for a specific thread, and the metadata sets & registers for that thread from the LC_NOTE. Even if no LC_NOTE is present, this class ingests the LC_THREAD register contexts and reformats it to its internal stores before returning itself as the RegisterContex, instead of shortcutting and returning the core's native RegisterContext. I could have gone either way with that, but in the end I decided if the code is correct, we should live on it always. I added a test where we process save-core to create a userland corefile, then use a utility "add-lcnote" to strip the existing "process metadata" LC_NOTE that lldb put in it, and adds a new one from a JSON string. rdar://74358787 --- lldb/include/lldb/Symbol/ObjectFile.h | 17 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 61 ++- .../ObjectFile/Mach-O/ObjectFileMachO.h | 2 + .../Plugins/Process/mach-core/CMakeLists.txt | 1 + .../mach-core/RegisterContextUnifiedCore.cpp | 293 + .../mach-core/RegisterContextUnifiedCore.h| 57 +++ .../Process/mach-core/ThreadMachCore.cpp | 55 ++- .../lc-note/additional-registers/Makefile | 11 + .../TestMetadataRegisters.py | 100 + .../additional-registers/add-lcnote.cpp | 384 ++ .../lc-note/additional-registers/main.c | 11 + 11 files changed, 957 insertions(+), 35 deletions(-) create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.h create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/Makefile create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/TestMetadataRegisters.py create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/main.c diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 43567592dd447..1b9ae1fb31a69 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -18,6 +18,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" #include "llvm/Support/Threading.h" @@ -544,9 +545,9 @@ class ObjectFile : public std::enable_shared_from_this, return false; } - /// Get metadata about threads from the corefile. + /// Get metadata about thread ids from the corefile. /// - /// The corefile may have metadata (e.g. a Mach-O "thread extra
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/144627 >From 92348b28fb02901e9437b92c1ddf8cfed31c Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 17 Jun 2025 18:57:11 -0700 Subject: [PATCH 1/8] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers The "process metadata" LC_NOTE allows for thread IDs to be specified in a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to allow for additional registers to be supplied on a per-thread basis. The registers included in a Mach-O corefile LC_THREAD load command can only be one of the register flavors that the kernel (xnu) defines in for arm64 -- the general purpose registers, floating point registers, exception registers. JTAG style corefile producers may have access to many additional registers beyond these that EL0 programs typically use, for instance TCR_EL1 on AArch64, and people developing low level code need access to these registers. This patch defines a format for including these registers for any thread. The JSON in "process metadata" is a dictionary that must have a `threads` key. The value is an array of entries, one per LC_THREAD in the Mach-O corefile. The number of entries must match the LC_THREADs so they can be correctly associated. Each thread's dictionary must have two keys, `sets`, and `registers`. `sets` is an array of register set names. If a register set name matches one from the LC_THREAD core registers, any registers that are defined will be added to that register set. e.g. metadata can add a register to the "General Purpose Registers" set that lldb shows users. `registers` is an array of dictionaries, one per register. Each register must have the keys `name`, `value`, `bitsize`, and `set`. It may provide additional keys like `alt-name`, that `DynamicRegisterInfo::SetRegisterInfo` recognizes. This `sets` + `registers` formatting is the same that is used by the `target.process.python-os-plugin-path` script interface uses, both are parsed by `DynamicRegisterInfo`. The one addition is that in this LC_NOTE metadata, each register must also have a `value` field, with the value provided in big-endian base 10, as usual with JSON. In RegisterContextUnifiedCore, I combine the register sets & registers from the LC_THREAD for a specific thread, and the metadata sets & registers for that thread from the LC_NOTE. Even if no LC_NOTE is present, this class ingests the LC_THREAD register contexts and reformats it to its internal stores before returning itself as the RegisterContex, instead of shortcutting and returning the core's native RegisterContext. I could have gone either way with that, but in the end I decided if the code is correct, we should live on it always. I added a test where we process save-core to create a userland corefile, then use a utility "add-lcnote" to strip the existing "process metadata" LC_NOTE that lldb put in it, and adds a new one from a JSON string. rdar://74358787 --- lldb/include/lldb/Symbol/ObjectFile.h | 17 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 61 ++- .../ObjectFile/Mach-O/ObjectFileMachO.h | 2 + .../Plugins/Process/mach-core/CMakeLists.txt | 1 + .../mach-core/RegisterContextUnifiedCore.cpp | 293 + .../mach-core/RegisterContextUnifiedCore.h| 57 +++ .../Process/mach-core/ThreadMachCore.cpp | 55 ++- .../lc-note/additional-registers/Makefile | 11 + .../TestMetadataRegisters.py | 100 + .../additional-registers/add-lcnote.cpp | 384 ++ .../lc-note/additional-registers/main.c | 11 + 11 files changed, 957 insertions(+), 35 deletions(-) create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.h create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/Makefile create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/TestMetadataRegisters.py create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/main.c diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 43567592dd447..1b9ae1fb31a69 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -18,6 +18,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" #include "llvm/Support/Threading.h" @@ -544,9 +545,9 @@ class ObjectFile : public std::enable_shared_from_this, return false; } - /// Get metadata about threads from the corefile. + /// Get metadata about thread ids from the corefile. /// - /// The corefile may have metadata (e.g. a Mach-O "thread extra
[Lldb-commits] [lldb] Reapply "[lldb/cmake] Plugin layering enforcement mechanism (#144543)" (PR #145305)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/145305 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 4d2b79b - [lldb] Fix build for #145017
Author: Pavel Labath Date: 2025-06-24T12:45:44+02:00 New Revision: 4d2b79b04a9ebd6c678c465c9a4b1f311ccfbfc2 URL: https://github.com/llvm/llvm-project/commit/4d2b79b04a9ebd6c678c465c9a4b1f311ccfbfc2 DIFF: https://github.com/llvm/llvm-project/commit/4d2b79b04a9ebd6c678c465c9a4b1f311ccfbfc2.diff LOG: [lldb] Fix build for #145017 Mid-flight collision with #145293. Added: Modified: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Removed: diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 4e3569a5e7987..4e70fe8ac1595 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -3512,7 +3512,7 @@ Status ProcessGDBRemote::LaunchAndConnectToDebugserver( // Our process spawned correctly, we can now set our connection to use // our end of the socket pair m_gdb_comm.SetConnection(std::make_unique( - socket_pair->second.release())); + std::move(socket_pair->second))); StartAsyncThread(); if (m_gdb_comm.IsConnected()) { ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
@@ -0,0 +1,293 @@ +//===-- RegisterContextUnifiedCore.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 "RegisterContextUnifiedCore.h" +#include "lldb/Target/DynamicRegisterInfo.h" +#include "lldb/Target/Process.h" +#include "lldb/Utility/DataExtractor.h" +#include "lldb/Utility/RegisterValue.h" +#include "lldb/Utility/StructuredData.h" + +using namespace lldb; +using namespace lldb_private; + +RegisterContextUnifiedCore::RegisterContextUnifiedCore( +Thread &thread, uint32_t concrete_frame_idx, +RegisterContextSP core_thread_regctx_sp, +StructuredData::ObjectSP metadata_thread_registers) +: RegisterContext(thread, concrete_frame_idx) { + + ProcessSP process_sp(thread.GetProcess()); + Target &target = process_sp->GetTarget(); + StructuredData::Dictionary *metadata_registers_dict = nullptr; + + // If we have thread metadata, check if the keys for register + // definitions are present; if not, clear the ObjectSP. + if (metadata_thread_registers && + metadata_thread_registers->GetAsDictionary()->HasKey("register_info")) { jasonmolenda wrote: Yeah I did that check up in `ThreadMachCore::CreateRegisterContextForFrame` but it makes more sense to locate that check here for clarity. (Originally most of this method was up in ThreadMachCore) https://github.com/llvm/llvm-project/pull/144627 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] fa5d7c9 - [lldb][lldb-dap] Fix runInTerminal test program on Windows
Author: David Spickett Date: 2025-06-24T11:07:45Z New Revision: fa5d7c926f5f571397eb1981649198136f1d6a92 URL: https://github.com/llvm/llvm-project/commit/fa5d7c926f5f571397eb1981649198136f1d6a92 DIFF: https://github.com/llvm/llvm-project/commit/fa5d7c926f5f571397eb1981649198136f1d6a92.diff LOG: [lldb][lldb-dap] Fix runInTerminal test program on Windows Added: Modified: lldb/test/API/tools/lldb-dap/runInTerminal/main.c Removed: diff --git a/lldb/test/API/tools/lldb-dap/runInTerminal/main.c b/lldb/test/API/tools/lldb-dap/runInTerminal/main.c index 0cc25d374d08a..40aa484b53810 100644 --- a/lldb/test/API/tools/lldb-dap/runInTerminal/main.c +++ b/lldb/test/API/tools/lldb-dap/runInTerminal/main.c @@ -1,6 +1,10 @@ #include #include +#ifdef _WIN32 +#include +#else #include +#endif int main(int argc, char *argv[]) { const char *foo = getenv("FOO"); ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
Michael137 wrote: Reverting for now to unblock macOS CI: ``` 10:20:36 FAIL: test_dwp_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the loaded dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 639, in test_dwp_dwo_file_count 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_no_debug_names_eager_loads_dwo_files (TestStats.TestCase) 10:20:36 Test the eager loading behavior of DWO files when debug_names is absent by 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 566, in test_no_debug_names_eager_loads_dwo_files 10:20:36 self.assertEqual(debug_stats["totalDwoFileCount"], 2) 10:20:36 AssertionError: 0 != 2 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang 10:20:36 == 10:20:36 FAIL: test_split_dwarf_dwo_file_count (TestStats.TestCase) 10:20:36 Test "statistics dump" and the dwo file count. 10:20:36 -- 10:20:36 Traceback (most recent call last): 10:20:36File "/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/llvm-project/lldb/test/API/commands/statistics/basic/TestStats.py", line 588, in test_split_dwarf_dwo_file_count 10:20:36 self.assertEqual(len(debug_stats["modules"]), 1) 10:20:36 AssertionError: 42 != 1 10:20:36 Config=arm64-/Users/ec2-user/jenkins/workspace/llvm.org/as-lldb-cmake/lldb-build/bin/clang ``` https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/144627 >From 92348b28fb02901e9437b92c1ddf8cfed31c Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 17 Jun 2025 18:57:11 -0700 Subject: [PATCH 1/6] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers The "process metadata" LC_NOTE allows for thread IDs to be specified in a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to allow for additional registers to be supplied on a per-thread basis. The registers included in a Mach-O corefile LC_THREAD load command can only be one of the register flavors that the kernel (xnu) defines in for arm64 -- the general purpose registers, floating point registers, exception registers. JTAG style corefile producers may have access to many additional registers beyond these that EL0 programs typically use, for instance TCR_EL1 on AArch64, and people developing low level code need access to these registers. This patch defines a format for including these registers for any thread. The JSON in "process metadata" is a dictionary that must have a `threads` key. The value is an array of entries, one per LC_THREAD in the Mach-O corefile. The number of entries must match the LC_THREADs so they can be correctly associated. Each thread's dictionary must have two keys, `sets`, and `registers`. `sets` is an array of register set names. If a register set name matches one from the LC_THREAD core registers, any registers that are defined will be added to that register set. e.g. metadata can add a register to the "General Purpose Registers" set that lldb shows users. `registers` is an array of dictionaries, one per register. Each register must have the keys `name`, `value`, `bitsize`, and `set`. It may provide additional keys like `alt-name`, that `DynamicRegisterInfo::SetRegisterInfo` recognizes. This `sets` + `registers` formatting is the same that is used by the `target.process.python-os-plugin-path` script interface uses, both are parsed by `DynamicRegisterInfo`. The one addition is that in this LC_NOTE metadata, each register must also have a `value` field, with the value provided in big-endian base 10, as usual with JSON. In RegisterContextUnifiedCore, I combine the register sets & registers from the LC_THREAD for a specific thread, and the metadata sets & registers for that thread from the LC_NOTE. Even if no LC_NOTE is present, this class ingests the LC_THREAD register contexts and reformats it to its internal stores before returning itself as the RegisterContex, instead of shortcutting and returning the core's native RegisterContext. I could have gone either way with that, but in the end I decided if the code is correct, we should live on it always. I added a test where we process save-core to create a userland corefile, then use a utility "add-lcnote" to strip the existing "process metadata" LC_NOTE that lldb put in it, and adds a new one from a JSON string. rdar://74358787 --- lldb/include/lldb/Symbol/ObjectFile.h | 17 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 61 ++- .../ObjectFile/Mach-O/ObjectFileMachO.h | 2 + .../Plugins/Process/mach-core/CMakeLists.txt | 1 + .../mach-core/RegisterContextUnifiedCore.cpp | 293 + .../mach-core/RegisterContextUnifiedCore.h| 57 +++ .../Process/mach-core/ThreadMachCore.cpp | 55 ++- .../lc-note/additional-registers/Makefile | 11 + .../TestMetadataRegisters.py | 100 + .../additional-registers/add-lcnote.cpp | 384 ++ .../lc-note/additional-registers/main.c | 11 + 11 files changed, 957 insertions(+), 35 deletions(-) create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.h create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/Makefile create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/TestMetadataRegisters.py create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/main.c diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 43567592dd447..1b9ae1fb31a69 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -18,6 +18,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" #include "llvm/Support/Threading.h" @@ -544,9 +545,9 @@ class ObjectFile : public std::enable_shared_from_this, return false; } - /// Get metadata about threads from the corefile. + /// Get metadata about thread ids from the corefile. /// - /// The corefile may have metadata (e.g. a Mach-O "thread extra
[Lldb-commits] [lldb] [lldb] Add count for number of DWO files loaded in statistics (PR #144424)
jeffreytan81 wrote: > @jeffreytan81 , > > > @vvereschaka, are you only seeing `TestStats.py` timeout on Windows or > > Linux as well? cc @qxy11 to follow-up. > > I seen it on Windows (non-cross) only. The linux builds get passed without > that problem. Thanks for checking. We did a relanding only enabling the test for dwo category, https://github.com/llvm/llvm-project/pull/145572. Let us know if there are still issues. https://github.com/llvm/llvm-project/pull/144424 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 0512d11 - [lldb] Clean up GDBRemoteCommunication::StartDebugserverProcess (#145021)
Author: Pavel Labath Date: 2025-06-25T08:09:36+02:00 New Revision: 0512d119fdf019b7c56e58f89b094ee5928b0a07 URL: https://github.com/llvm/llvm-project/commit/0512d119fdf019b7c56e58f89b094ee5928b0a07 DIFF: https://github.com/llvm/llvm-project/commit/0512d119fdf019b7c56e58f89b094ee5928b0a07.diff LOG: [lldb] Clean up GDBRemoteCommunication::StartDebugserverProcess (#145021) The function was extremely messy in that it, depending on the set of arguments, it could either modify the Connection object in `this` or not. It had a lot of arguments, with each call site passing a different combination of null values. This PR: - packs "url" and "comm_fd" arguments into a variant as they are mutually exclusive - removes the (surprising) "null url *and* null comm_fd" code path which is not used as of https://github.com/llvm/llvm-project/pull/145017 - marks the function as `static` to make it clear it (now) does not operate on the `this` object. Depends on #145017 Added: Modified: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp Removed: diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index 0d3ead840b080..bea2faff2330e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #if defined(__APPLE__) #define DEBUGSERVER_BASENAME "debugserver" @@ -894,11 +895,9 @@ FileSpec GDBRemoteCommunication::GetDebugserverPath(Platform *platform) { } Status GDBRemoteCommunication::StartDebugserverProcess( -const char *url, Platform *platform, ProcessLaunchInfo &launch_info, -uint16_t *port, const Args *inferior_args, shared_fd_t pass_comm_fd) { +std::variant comm, Platform *platform, +ProcessLaunchInfo &launch_info, const Args *inferior_args) { Log *log = GetLog(GDBRLog::Process); - LLDB_LOG(log, "Starting debug server: url={0}, port={1}", - url ? url : "", port ? *port : uint16_t(0)); FileSpec debugserver_file_spec = GetDebugserverPath(platform); if (!debugserver_file_spec) @@ -911,89 +910,58 @@ Status GDBRemoteCommunication::StartDebugserverProcess( #if !defined(__APPLE__) // First argument to lldb-server must be mode in which to run. - debugserver_args.AppendArgument(llvm::StringRef("gdbserver")); + debugserver_args.AppendArgument("gdbserver"); #endif - // If a url is supplied then use it - if (url && url[0]) -debugserver_args.AppendArgument(llvm::StringRef(url)); - - if (pass_comm_fd != SharedSocket::kInvalidFD) { -StreamString fd_arg; -fd_arg.Printf("--fd=%" PRIi64, (int64_t)pass_comm_fd); -debugserver_args.AppendArgument(fd_arg.GetString()); -// Send "pass_comm_fd" down to the inferior so it can use it to -// communicate back with this process. Ignored on Windows. -launch_info.AppendDuplicateFileAction((int64_t)pass_comm_fd, - (int64_t)pass_comm_fd); - } - // use native registers, not the GDB registers - debugserver_args.AppendArgument(llvm::StringRef("--native-regs")); + debugserver_args.AppendArgument("--native-regs"); if (launch_info.GetLaunchInSeparateProcessGroup()) -debugserver_args.AppendArgument(llvm::StringRef("--setsid")); +debugserver_args.AppendArgument("--setsid"); llvm::SmallString<128> named_pipe_path; // socket_pipe is used by debug server to communicate back either - // TCP port or domain socket name which it listens on. - // The second purpose of the pipe to serve as a synchronization point - + // TCP port or domain socket name which it listens on. However, we're not + // interested in the actualy value here. + // The only reason for using the pipe is to serve as a synchronization point - // once data is written to the pipe, debug server is up and running. Pipe socket_pipe; - std::unique_ptr sock_up; + // If a url is supplied then use it + if (shared_fd_t *comm_fd = std::get_if(&comm)) { +LLDB_LOG(log, "debugserver communicates over fd {0}", comm_fd); +assert(*comm_fd != SharedSocket::kInvalidFD); +debugserver_args.AppendArgument(llvm::formatv("--fd={0}", *comm_fd).str()); +// Send "comm_fd" down to the inferior so it can use it to communicate back +// with this process. +launch_info.AppendDuplicateFileAction((int64_t)*comm_fd, (int64_t)*comm_fd); + } else { +llvm::StringRef url = std::get(comm); +LLDB_LOG(log, "debugserver listens on: {0}", url); +debugserver_args.AppendArgument(url); - // port is null when deb
[Lldb-commits] [lldb] [lldb] Clean up GDBRemoteCommunication::StartDebugserverProcess (PR #145021)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/145021 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][DWARF64] Enable support for DWARF64 format handling (PR #145645)
https://github.com/HemangGadhavi created https://github.com/llvm/llvm-project/pull/145645 This PR introduces support for the DWARF64 format, enabling handling of 64-bit DWARF sections as defined by the DWARF specification. The update includes adjustments to header parsing and modification of form values to accommodate 64-bit offsets and values. >From e0ea9bbe177625e75c6bfb75585442ed473fb6ed Mon Sep 17 00:00:00 2001 From: HemangGadhavi Date: Wed, 25 Jun 2025 02:06:05 -0400 Subject: [PATCH] [lldb][DWARF64] Enable support for DWARF64 format handling --- .../SymbolFile/DWARF/DWARFFormValue.cpp | 33 ++- .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 15 + .../Plugins/SymbolFile/DWARF/DWARFUnit.h | 1 + 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index fd3d45cef4c5e..1a712c3c769af 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -77,7 +77,10 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, case DW_FORM_strp: case DW_FORM_line_strp: case DW_FORM_sec_offset: - m_value.uval = data.GetMaxU64(offset_ptr, 4); + if (m_unit->GetFormat() == DwarfFormat::DWARF32) +m_value.uval = data.GetMaxU64(offset_ptr, 4); + else if (m_unit->GetFormat() == DwarfFormat::DWARF64) +m_value.uval = data.GetMaxU64(offset_ptr, 8); break; case DW_FORM_addrx1: case DW_FORM_strx1: @@ -121,8 +124,12 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, assert(m_unit); if (m_unit->GetVersion() <= 2) ref_addr_size = m_unit->GetAddressByteSize(); - else -ref_addr_size = 4; + else { +if (m_unit->GetFormat() == DwarfFormat::DWARF32) + ref_addr_size = 4; +else if (m_unit->GetFormat() == DwarfFormat::DWARF64) + ref_addr_size = 8; + } m_value.uval = data.GetMaxU64(offset_ptr, ref_addr_size); break; case DW_FORM_indirect: @@ -165,7 +172,7 @@ static FormSize g_form_sizes[] = { {1, 1}, // 0x0b DW_FORM_data1 {1, 1}, // 0x0c DW_FORM_flag {0, 0}, // 0x0d DW_FORM_sdata -{1, 4}, // 0x0e DW_FORM_strp +{0, 0}, // 0x0e DW_FORM_strp (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x0f DW_FORM_udata {0, 0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes // for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later @@ -175,7 +182,8 @@ static FormSize g_form_sizes[] = { {1, 8}, // 0x14 DW_FORM_ref8 {0, 0}, // 0x15 DW_FORM_ref_udata {0, 0}, // 0x16 DW_FORM_indirect -{1, 4}, // 0x17 DW_FORM_sec_offset +{0, + 0}, // 0x17 DW_FORM_sec_offset (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x18 DW_FORM_exprloc {1, 0}, // 0x19 DW_FORM_flag_present {0, 0}, // 0x1a DW_FORM_strx (ULEB128) @@ -183,7 +191,7 @@ static FormSize g_form_sizes[] = { {1, 4}, // 0x1c DW_FORM_ref_sup4 {0, 0}, // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64) {1, 16}, // 0x1e DW_FORM_data16 -{1, 4}, // 0x1f DW_FORM_line_strp +{0, 0}, // 0x1f DW_FORM_line_strp (4 bytes for DWARF32, 8 bytes for DWARF64) {1, 8}, // 0x20 DW_FORM_ref_sig8 }; @@ -251,8 +259,12 @@ bool DWARFFormValue::SkipValue(dw_form_t form, // get this wrong if (unit->GetVersion() <= 2) ref_addr_size = unit->GetAddressByteSize(); -else - ref_addr_size = 4; +else { + if (unit->GetFormat() == DwarfFormat::DWARF32) +ref_addr_size = 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +ref_addr_size = 8; +} *offset_ptr += ref_addr_size; return true; @@ -288,7 +300,10 @@ bool DWARFFormValue::SkipValue(dw_form_t form, case DW_FORM_sec_offset: case DW_FORM_strp: case DW_FORM_line_strp: - *offset_ptr += 4; + if (unit->GetFormat() == DwarfFormat::DWARF32) +*offset_ptr += 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +*offset_ptr += 8; return true; // 4 byte values diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index ffd6f1dd52aff..f216ab13e8936 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -1073,20 +1073,7 @@ const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const { : m_dwarf.GetDWARFContext().getOrLoadDebugInfoData(); } -uint32_t DWARFUnit::GetHeaderByteSize() const { - switch (m_header.getUnitType()) { - case llvm::dwarf::DW_UT_compile: - case llvm::dwarf::DW_UT_partial: -return GetVersion() < 5 ? 11 : 12; - case llvm::dwarf::DW_UT_skeleton: - case llvm::dwarf::DW_UT_split_c
[Lldb-commits] [lldb] [lldb][DWARF64] Enable support for DWARF64 format handling (PR #145645)
llvmbot wrote: @llvm/pr-subscribers-lldb Author: Hemang Gadhavi (HemangGadhavi) Changes This PR introduces support for the DWARF64 format, enabling handling of 64-bit DWARF sections as defined by the DWARF specification. The update includes adjustments to header parsing and modification of form values to accommodate 64-bit offsets and values. --- Full diff: https://github.com/llvm/llvm-project/pull/145645.diff 3 Files Affected: - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp (+24-9) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp (+1-14) - (modified) lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h (+1) ``diff diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp index fd3d45cef4c5e..1a712c3c769af 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp @@ -77,7 +77,10 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, case DW_FORM_strp: case DW_FORM_line_strp: case DW_FORM_sec_offset: - m_value.uval = data.GetMaxU64(offset_ptr, 4); + if (m_unit->GetFormat() == DwarfFormat::DWARF32) +m_value.uval = data.GetMaxU64(offset_ptr, 4); + else if (m_unit->GetFormat() == DwarfFormat::DWARF64) +m_value.uval = data.GetMaxU64(offset_ptr, 8); break; case DW_FORM_addrx1: case DW_FORM_strx1: @@ -121,8 +124,12 @@ bool DWARFFormValue::ExtractValue(const DWARFDataExtractor &data, assert(m_unit); if (m_unit->GetVersion() <= 2) ref_addr_size = m_unit->GetAddressByteSize(); - else -ref_addr_size = 4; + else { +if (m_unit->GetFormat() == DwarfFormat::DWARF32) + ref_addr_size = 4; +else if (m_unit->GetFormat() == DwarfFormat::DWARF64) + ref_addr_size = 8; + } m_value.uval = data.GetMaxU64(offset_ptr, ref_addr_size); break; case DW_FORM_indirect: @@ -165,7 +172,7 @@ static FormSize g_form_sizes[] = { {1, 1}, // 0x0b DW_FORM_data1 {1, 1}, // 0x0c DW_FORM_flag {0, 0}, // 0x0d DW_FORM_sdata -{1, 4}, // 0x0e DW_FORM_strp +{0, 0}, // 0x0e DW_FORM_strp (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x0f DW_FORM_udata {0, 0}, // 0x10 DW_FORM_ref_addr (addr size for DWARF2 and earlier, 4 bytes // for DWARF32, 8 bytes for DWARF32 in DWARF 3 and later @@ -175,7 +182,8 @@ static FormSize g_form_sizes[] = { {1, 8}, // 0x14 DW_FORM_ref8 {0, 0}, // 0x15 DW_FORM_ref_udata {0, 0}, // 0x16 DW_FORM_indirect -{1, 4}, // 0x17 DW_FORM_sec_offset +{0, + 0}, // 0x17 DW_FORM_sec_offset (4 bytes for DWARF32, 8 bytes for DWARF64) {0, 0}, // 0x18 DW_FORM_exprloc {1, 0}, // 0x19 DW_FORM_flag_present {0, 0}, // 0x1a DW_FORM_strx (ULEB128) @@ -183,7 +191,7 @@ static FormSize g_form_sizes[] = { {1, 4}, // 0x1c DW_FORM_ref_sup4 {0, 0}, // 0x1d DW_FORM_strp_sup (4 bytes for DWARF32, 8 bytes for DWARF64) {1, 16}, // 0x1e DW_FORM_data16 -{1, 4}, // 0x1f DW_FORM_line_strp +{0, 0}, // 0x1f DW_FORM_line_strp (4 bytes for DWARF32, 8 bytes for DWARF64) {1, 8}, // 0x20 DW_FORM_ref_sig8 }; @@ -251,8 +259,12 @@ bool DWARFFormValue::SkipValue(dw_form_t form, // get this wrong if (unit->GetVersion() <= 2) ref_addr_size = unit->GetAddressByteSize(); -else - ref_addr_size = 4; +else { + if (unit->GetFormat() == DwarfFormat::DWARF32) +ref_addr_size = 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +ref_addr_size = 8; +} *offset_ptr += ref_addr_size; return true; @@ -288,7 +300,10 @@ bool DWARFFormValue::SkipValue(dw_form_t form, case DW_FORM_sec_offset: case DW_FORM_strp: case DW_FORM_line_strp: - *offset_ptr += 4; + if (unit->GetFormat() == DwarfFormat::DWARF32) +*offset_ptr += 4; + else if (unit->GetFormat() == DwarfFormat::DWARF64) +*offset_ptr += 8; return true; // 4 byte values diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp index ffd6f1dd52aff..f216ab13e8936 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp @@ -1073,20 +1073,7 @@ const lldb_private::DWARFDataExtractor &DWARFUnit::GetData() const { : m_dwarf.GetDWARFContext().getOrLoadDebugInfoData(); } -uint32_t DWARFUnit::GetHeaderByteSize() const { - switch (m_header.getUnitType()) { - case llvm::dwarf::DW_UT_compile: - case llvm::dwarf::DW_UT_partial: -return GetVersion() < 5 ? 11 : 12; - case llvm::dwarf::DW_UT_skeleton: - case llvm::dwarf::DW_UT_split_compile: -return 20; - case llvm::dwarf::DW_UT_type: - case llvm::dwarf::DW_UT_split_type: -return GetVersion() <
[Lldb-commits] [lldb] [lldb] make PlatformAndroid/AdbClient::GetSyncService threadsafe (PR #145382)
https://github.com/labath edited https://github.com/llvm/llvm-project/pull/145382 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)
dlav-sc wrote: > LGTM Thank you for the review! I'm going to land it by the end of the day. https://github.com/llvm/llvm-project/pull/127505 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers (PR #144627)
https://github.com/jasonmolenda updated https://github.com/llvm/llvm-project/pull/144627 >From 92348b28fb02901e9437b92c1ddf8cfed31c Mon Sep 17 00:00:00 2001 From: Jason Molenda Date: Tue, 17 Jun 2025 18:57:11 -0700 Subject: [PATCH 1/7] [lldb][Mach-O] Allow "process metadata" LC_NOTE to supply registers The "process metadata" LC_NOTE allows for thread IDs to be specified in a Mach-O corefile. This extends the JSON recognzied in that LC_NOTE to allow for additional registers to be supplied on a per-thread basis. The registers included in a Mach-O corefile LC_THREAD load command can only be one of the register flavors that the kernel (xnu) defines in for arm64 -- the general purpose registers, floating point registers, exception registers. JTAG style corefile producers may have access to many additional registers beyond these that EL0 programs typically use, for instance TCR_EL1 on AArch64, and people developing low level code need access to these registers. This patch defines a format for including these registers for any thread. The JSON in "process metadata" is a dictionary that must have a `threads` key. The value is an array of entries, one per LC_THREAD in the Mach-O corefile. The number of entries must match the LC_THREADs so they can be correctly associated. Each thread's dictionary must have two keys, `sets`, and `registers`. `sets` is an array of register set names. If a register set name matches one from the LC_THREAD core registers, any registers that are defined will be added to that register set. e.g. metadata can add a register to the "General Purpose Registers" set that lldb shows users. `registers` is an array of dictionaries, one per register. Each register must have the keys `name`, `value`, `bitsize`, and `set`. It may provide additional keys like `alt-name`, that `DynamicRegisterInfo::SetRegisterInfo` recognizes. This `sets` + `registers` formatting is the same that is used by the `target.process.python-os-plugin-path` script interface uses, both are parsed by `DynamicRegisterInfo`. The one addition is that in this LC_NOTE metadata, each register must also have a `value` field, with the value provided in big-endian base 10, as usual with JSON. In RegisterContextUnifiedCore, I combine the register sets & registers from the LC_THREAD for a specific thread, and the metadata sets & registers for that thread from the LC_NOTE. Even if no LC_NOTE is present, this class ingests the LC_THREAD register contexts and reformats it to its internal stores before returning itself as the RegisterContex, instead of shortcutting and returning the core's native RegisterContext. I could have gone either way with that, but in the end I decided if the code is correct, we should live on it always. I added a test where we process save-core to create a userland corefile, then use a utility "add-lcnote" to strip the existing "process metadata" LC_NOTE that lldb put in it, and adds a new one from a JSON string. rdar://74358787 --- lldb/include/lldb/Symbol/ObjectFile.h | 17 +- .../ObjectFile/Mach-O/ObjectFileMachO.cpp | 61 ++- .../ObjectFile/Mach-O/ObjectFileMachO.h | 2 + .../Plugins/Process/mach-core/CMakeLists.txt | 1 + .../mach-core/RegisterContextUnifiedCore.cpp | 293 + .../mach-core/RegisterContextUnifiedCore.h| 57 +++ .../Process/mach-core/ThreadMachCore.cpp | 55 ++- .../lc-note/additional-registers/Makefile | 11 + .../TestMetadataRegisters.py | 100 + .../additional-registers/add-lcnote.cpp | 384 ++ .../lc-note/additional-registers/main.c | 11 + 11 files changed, 957 insertions(+), 35 deletions(-) create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.cpp create mode 100644 lldb/source/Plugins/Process/mach-core/RegisterContextUnifiedCore.h create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/Makefile create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/TestMetadataRegisters.py create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/add-lcnote.cpp create mode 100644 lldb/test/API/macosx/lc-note/additional-registers/main.c diff --git a/lldb/include/lldb/Symbol/ObjectFile.h b/lldb/include/lldb/Symbol/ObjectFile.h index 43567592dd447..1b9ae1fb31a69 100644 --- a/lldb/include/lldb/Symbol/ObjectFile.h +++ b/lldb/include/lldb/Symbol/ObjectFile.h @@ -18,6 +18,7 @@ #include "lldb/Utility/Endian.h" #include "lldb/Utility/FileSpec.h" #include "lldb/Utility/FileSpecList.h" +#include "lldb/Utility/StructuredData.h" #include "lldb/Utility/UUID.h" #include "lldb/lldb-private.h" #include "llvm/Support/Threading.h" @@ -544,9 +545,9 @@ class ObjectFile : public std::enable_shared_from_this, return false; } - /// Get metadata about threads from the corefile. + /// Get metadata about thread ids from the corefile. /// - /// The corefile may have metadata (e.g. a Mach-O "thread extra
[Lldb-commits] [lldb] [LLDB] Update DIL to handle smart pointers; add more tests. (PR #143786)
https://github.com/cmtice updated https://github.com/llvm/llvm-project/pull/143786 >From 837e8dd36446104b207248c9dbf372a6da6ffbf1 Mon Sep 17 00:00:00 2001 From: Caroline Tice Date: Wed, 11 Jun 2025 14:24:17 -0700 Subject: [PATCH 1/7] [LLDB] Update DIL to handle smart pointers; add more tests. This updates the DIL implementation to handle smart pointers (accessing field members and dereferencing) in the same way the current 'frame variable' implementation does. It also adds tests for handling smart pointers, as well as some additional DIL tests. --- lldb/source/ValueObject/DILEval.cpp | 9 +++- .../frame/var-dil/basics/BitField/Makefile| 3 ++ .../BitField/TestFrameVarDILBitField.py | 38 .../frame/var-dil/basics/BitField/main.cpp| 44 +++ .../frame/var-dil/basics/Indirection/Makefile | 3 ++ .../Indirection/TestFrameVarDILIndirection.py | 36 +++ .../frame/var-dil/basics/Indirection/main.cpp | 14 ++ .../basics/PointerDereference/Makefile| 3 ++ .../TestFrameVarDILPointerDereference.py | 30 + .../basics/PointerDereference/main.cpp| 32 ++ .../frame/var-dil/basics/QualifiedId/Makefile | 3 ++ .../QualifiedId/TestFrameVarDILQualifiedId.py | 29 .../frame/var-dil/basics/QualifiedId/main.cpp | 18 .../frame/var-dil/basics/SharedPtr/Makefile | 6 +++ .../SharedPtr/TestFrameVarDILSharedPtr.py | 36 +++ .../TestFrameVarDILSharedPtrDeref.py | 29 .../frame/var-dil/basics/SharedPtr/main.cpp | 26 +++ .../frame/var-dil/basics/UniquePtr/Makefile | 6 +++ .../UniquePtr/TestFrameVarDILUniquePtr.py | 28 .../TestFrameVarDILUniquePtrDeref.py | 29 .../frame/var-dil/basics/UniquePtr/main.cpp | 25 +++ 21 files changed, 446 insertions(+), 1 deletion(-) create mode 100644 lldb/test/API/commands/frame/var-dil/basics/BitField/Makefile create mode 100644 lldb/test/API/commands/frame/var-dil/basics/BitField/TestFrameVarDILBitField.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/BitField/main.cpp create mode 100644 lldb/test/API/commands/frame/var-dil/basics/Indirection/Makefile create mode 100644 lldb/test/API/commands/frame/var-dil/basics/Indirection/TestFrameVarDILIndirection.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/Indirection/main.cpp create mode 100644 lldb/test/API/commands/frame/var-dil/basics/PointerDereference/Makefile create mode 100644 lldb/test/API/commands/frame/var-dil/basics/PointerDereference/TestFrameVarDILPointerDereference.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/PointerDereference/main.cpp create mode 100644 lldb/test/API/commands/frame/var-dil/basics/QualifiedId/Makefile create mode 100644 lldb/test/API/commands/frame/var-dil/basics/QualifiedId/TestFrameVarDILQualifiedId.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/QualifiedId/main.cpp create mode 100644 lldb/test/API/commands/frame/var-dil/basics/SharedPtr/Makefile create mode 100644 lldb/test/API/commands/frame/var-dil/basics/SharedPtr/TestFrameVarDILSharedPtr.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/SharedPtr/TestFrameVarDILSharedPtrDeref.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/SharedPtr/main.cpp create mode 100644 lldb/test/API/commands/frame/var-dil/basics/UniquePtr/Makefile create mode 100644 lldb/test/API/commands/frame/var-dil/basics/UniquePtr/TestFrameVarDILUniquePtr.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/UniquePtr/TestFrameVarDILUniquePtrDeref.py create mode 100644 lldb/test/API/commands/frame/var-dil/basics/UniquePtr/main.cpp diff --git a/lldb/source/ValueObject/DILEval.cpp b/lldb/source/ValueObject/DILEval.cpp index c8cb54aa18a93..adc34e25766b3 100644 --- a/lldb/source/ValueObject/DILEval.cpp +++ b/lldb/source/ValueObject/DILEval.cpp @@ -253,6 +253,12 @@ Interpreter::Visit(const UnaryOpNode *node) { rhs = dynamic_rhs; lldb::ValueObjectSP child_sp = rhs->Dereference(error); +if (!child_sp && m_use_synthetic) { + if (lldb::ValueObjectSP synth_obj_sp = rhs->GetSyntheticValue()) { +error.Clear(); +child_sp = synth_obj_sp->Dereference(error); + } +} if (error.Fail()) return llvm::make_error(m_expr, error.AsCString(), node->GetLocation()); @@ -280,6 +286,7 @@ Interpreter::Visit(const MemberOfNode *node) { auto base_or_err = Evaluate(node->GetBase()); if (!base_or_err) return base_or_err; + bool expr_is_ptr = node->GetIsArrow(); lldb::ValueObjectSP base = *base_or_err; // Perform some basic type & correctness checking. @@ -319,11 +326,11 @@ Interpreter::Visit(const MemberOfNode *node) { return llvm::make_error( m_expr, errMsg, node->GetLocation(
[Lldb-commits] [lldb] [lldb] Deploy Python DLL on Windows (PR #137467)
zmodem wrote: I don't know who maintains lldb on windows these days. I just package it. (Note that we don't even run the tests as part of release packaging. I've never been able to make them pass, but when I tried to remove lldb from the installer, people complained.) Also, are those python dlls distributable, or would there be licensing implications form including them in the installer? https://github.com/llvm/llvm-project/pull/137467 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [llvm] [LLDB] Warn about truncated DWARF section names on Windows (PR #145175)
@@ -1036,12 +1036,18 @@ void ObjectFilePECOFF::CreateSections(SectionList &unified_section_list) { m_sections_up->AddSection(header_sp); unified_section_list.AddSection(header_sp); +std::vector truncated_dwarf_sections; const uint32_t nsects = m_sect_headers.size(); for (uint32_t idx = 0; idx < nsects; ++idx) { llvm::StringRef sect_name = GetSectionName(m_sect_headers[idx]); ConstString const_sect_name(sect_name); SectionType section_type = GetSectionType(sect_name, m_sect_headers[idx]); + // Detect unknown sections matching ^\.debug_[a-z]$ + if (section_type == eSectionTypeOther && sect_name.size() == 8 && DavidSpickett wrote: I was thinking that lldb did not already have support for this format but it sounds like we already do. I know lld will write it out this way because I've seen that non-standard warning a few times before. https://github.com/llvm/llvm-project/pull/145175 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb][RISCV] fix LR/SC atomic sequence handling in lldb-server (PR #127505)
https://github.com/DavidSpickett approved this pull request. LGTM https://github.com/llvm/llvm-project/pull/127505 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] 46e1e9f - Reapply "[lldb/cmake] Plugin layering enforcement mechanism (#144543)" (#145305)
Author: Pavel Labath Date: 2025-06-24T11:10:35+02:00 New Revision: 46e1e9f104c853a49316b86ff0c6ca4380735a09 URL: https://github.com/llvm/llvm-project/commit/46e1e9f104c853a49316b86ff0c6ca4380735a09 DIFF: https://github.com/llvm/llvm-project/commit/46e1e9f104c853a49316b86ff0c6ca4380735a09.diff LOG: Reapply "[lldb/cmake] Plugin layering enforcement mechanism (#144543)" (#145305) The only difference from the original PR are the added BRIEF and FULL_DOCS arguments to define_property, which are required for cmake<3.23. Added: lldb/cmake/modules/LLDBLayeringCheck.cmake Modified: lldb/CMakeLists.txt lldb/docs/resources/contributing.rst lldb/source/Plugins/ABI/CMakeLists.txt lldb/source/Plugins/Architecture/CMakeLists.txt lldb/source/Plugins/Disassembler/CMakeLists.txt lldb/source/Plugins/DynamicLoader/CMakeLists.txt lldb/source/Plugins/ExpressionParser/CMakeLists.txt lldb/source/Plugins/Instruction/CMakeLists.txt lldb/source/Plugins/InstrumentationRuntime/CMakeLists.txt lldb/source/Plugins/JITLoader/CMakeLists.txt lldb/source/Plugins/Language/CMakeLists.txt lldb/source/Plugins/LanguageRuntime/CMakeLists.txt lldb/source/Plugins/MemoryHistory/CMakeLists.txt lldb/source/Plugins/ObjectContainer/CMakeLists.txt lldb/source/Plugins/ObjectFile/CMakeLists.txt lldb/source/Plugins/OperatingSystem/CMakeLists.txt lldb/source/Plugins/Platform/CMakeLists.txt lldb/source/Plugins/Process/CMakeLists.txt lldb/source/Plugins/Process/Utility/CMakeLists.txt lldb/source/Plugins/REPL/CMakeLists.txt lldb/source/Plugins/RegisterTypeBuilder/CMakeLists.txt lldb/source/Plugins/ScriptInterpreter/CMakeLists.txt lldb/source/Plugins/StructuredData/CMakeLists.txt lldb/source/Plugins/SymbolFile/CMakeLists.txt lldb/source/Plugins/SymbolLocator/CMakeLists.txt lldb/source/Plugins/SymbolVendor/CMakeLists.txt lldb/source/Plugins/SystemRuntime/CMakeLists.txt lldb/source/Plugins/Trace/CMakeLists.txt lldb/source/Plugins/TraceExporter/CMakeLists.txt lldb/source/Plugins/TypeSystem/CMakeLists.txt lldb/source/Plugins/UnwindAssembly/CMakeLists.txt Removed: diff --git a/lldb/CMakeLists.txt b/lldb/CMakeLists.txt index 2aaf75dd87bc3..e3b72e94d4beb 100644 --- a/lldb/CMakeLists.txt +++ b/lldb/CMakeLists.txt @@ -37,6 +37,7 @@ endif() include(LLDBConfig) include(AddLLDB) +include(LLDBLayeringCheck) set(LLDB_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include) @@ -127,6 +128,8 @@ add_subdirectory(source) add_subdirectory(tools) add_subdirectory(docs) +check_lldb_plugin_layering() + if (LLDB_ENABLE_PYTHON) if(LLDB_BUILD_FRAMEWORK) set(lldb_python_target_dir "${LLDB_FRAMEWORK_ABSOLUTE_BUILD_DIR}/LLDB.framework/Resources/Python/lldb") diff --git a/lldb/cmake/modules/LLDBLayeringCheck.cmake b/lldb/cmake/modules/LLDBLayeringCheck.cmake new file mode 100644 index 0..1116b28e89578 --- /dev/null +++ b/lldb/cmake/modules/LLDBLayeringCheck.cmake @@ -0,0 +1,76 @@ +foreach (scope DIRECTORY TARGET) + define_property(${scope} PROPERTY LLDB_PLUGIN_KIND INHERITED +BRIEF_DOCS "LLDB plugin kind (Process, SymbolFile, etc.)" +FULL_DOCS "See lldb/docs/resources/contributing.rst" + ) + + define_property(${scope} PROPERTY LLDB_ACCEPTABLE_PLUGIN_DEPENDENCIES INHERITED +BRIEF_DOCS "LLDB plugin kinds which the plugin can depend on" +FULL_DOCS "See lldb/docs/resources/contributing.rst" + ) + + define_property(${scope} PROPERTY LLDB_TOLERATED_PLUGIN_DEPENDENCIES INHERITED +BRIEF_DOCS "LLDB plugin kinds which are depended on for historic reasons." +FULL_DOCS "See lldb/docs/resources/contributing.rst" + ) +endforeach() + +option(LLDB_GENERATE_PLUGIN_DEP_GRAPH OFF) + +function(check_lldb_plugin_layering) + get_property(plugins GLOBAL PROPERTY LLDB_PLUGINS) + foreach (plugin ${plugins}) +get_property(plugin_kind TARGET ${plugin} PROPERTY LLDB_PLUGIN_KIND) +get_property(acceptable_deps TARGET ${plugin} + PROPERTY LLDB_ACCEPTABLE_PLUGIN_DEPENDENCIES) +get_property(tolerated_deps TARGET ${plugin} + PROPERTY LLDB_TOLERATED_PLUGIN_DEPENDENCIES) + +# A plugin is always permitted to depend on its own kind for the purposes +# subclassing. Ideally the intra-kind dependencies should not form a loop, +# but we're not checking that here. +list(APPEND acceptable_deps ${plugin_kind}) + +list(APPEND all_plugin_kinds ${plugin_kind}) + +get_property(link_libs TARGET ${plugin} PROPERTY LINK_LIBRARIES) +foreach (link_lib ${link_libs}) + if(link_lib IN_LIST plugins) +get_property(lib_kind TARGET ${link_lib} PROPERTY LLDB_PLUGIN_KIND) +if (lib_kind) + if (lib_kind IN_LIST acceptable_deps) +set(dep_kind green) + elseif (lib_kind IN_LIST tolerated_deps) +set(dep_kind yellow) + else() +set(dep_ki
[Lldb-commits] [lldb] cf9546b - [lldb] Remove GDBRemoteCommunication::ConnectLocally (#145293)
Author: Pavel Labath Date: 2025-06-24T11:11:35+02:00 New Revision: cf9546b826619890e965367a3e4d0da1991ba929 URL: https://github.com/llvm/llvm-project/commit/cf9546b826619890e965367a3e4d0da1991ba929 DIFF: https://github.com/llvm/llvm-project/commit/cf9546b826619890e965367a3e4d0da1991ba929.diff LOG: [lldb] Remove GDBRemoteCommunication::ConnectLocally (#145293) Originally added for reproducers, it is now only used for test code. While we could make it a test helper, I think that after #145015 it is simple enough to not be needed. Also squeeze in a change to make ConnectionFileDescriptor accept a unique_ptr. Added: Modified: lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.h lldb/tools/lldb-server/lldb-platform.cpp lldb/unittests/Core/CommunicationTest.cpp lldb/unittests/Host/ConnectionFileDescriptorTest.cpp lldb/unittests/Process/gdb-remote/GDBRemoteClientBaseTest.cpp lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationClientTest.cpp lldb/unittests/Process/gdb-remote/GDBRemoteCommunicationTest.cpp lldb/unittests/tools/lldb-server/tests/TestClient.cpp Removed: diff --git a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h index b771f9c3f45a2..df0e196fea688 100644 --- a/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h +++ b/lldb/include/lldb/Host/posix/ConnectionFileDescriptorPosix.h @@ -18,13 +18,10 @@ #include "lldb/Host/Pipe.h" #include "lldb/Host/Socket.h" #include "lldb/Utility/Connection.h" -#include "lldb/Utility/IOObject.h" namespace lldb_private { class Status; -class Socket; -class SocketAddress; class ConnectionFileDescriptor : public Connection { public: @@ -35,7 +32,7 @@ class ConnectionFileDescriptor : public Connection { ConnectionFileDescriptor(int fd, bool owns_fd); - ConnectionFileDescriptor(Socket *socket); + ConnectionFileDescriptor(std::unique_ptr socket_up); ~ConnectionFileDescriptor() override; @@ -136,8 +133,6 @@ class ConnectionFileDescriptor : public Connection { std::string m_uri; private: - void InitializeSocket(Socket *socket); - ConnectionFileDescriptor(const ConnectionFileDescriptor &) = delete; const ConnectionFileDescriptor & operator=(const ConnectionFileDescriptor &) = delete; diff --git a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp index ae935dda5af4e..57dce44812c89 100644 --- a/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp +++ b/lldb/source/Host/posix/ConnectionFileDescriptorPosix.cpp @@ -72,9 +72,11 @@ ConnectionFileDescriptor::ConnectionFileDescriptor(int fd, bool owns_fd) OpenCommandPipe(); } -ConnectionFileDescriptor::ConnectionFileDescriptor(Socket *socket) -: Connection(), m_pipe(), m_mutex(), m_shutting_down(false) { - InitializeSocket(socket); +ConnectionFileDescriptor::ConnectionFileDescriptor( +std::unique_ptr socket_up) +: m_shutting_down(false) { + m_uri = socket_up->GetRemoteConnectionURI(); + m_io_sp = std::move(socket_up); } ConnectionFileDescriptor::~ConnectionFileDescriptor() { @@ -796,8 +798,3 @@ ConnectionStatus ConnectionFileDescriptor::ConnectSerialPort( #endif // LLDB_ENABLE_POSIX llvm_unreachable("this function should be only called w/ LLDB_ENABLE_POSIX"); } - -void ConnectionFileDescriptor::InitializeSocket(Socket *socket) { - m_io_sp.reset(socket); - m_uri = socket->GetRemoteConnectionURI(); -} diff --git a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp index d1f57cc22d8bd..0d3ead840b080 100644 --- a/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp @@ -1128,8 +1128,8 @@ Status GDBRemoteCommunication::StartDebugserverProcess( Socket *accepted_socket = nullptr; error = sock_up->Accept(/*timeout=*/std::nullopt, accepted_socket); if (accepted_socket) { - SetConnection( - std::make_unique(accepted_socket)); + SetConnection(std::make_unique( + std::unique_ptr(accepted_socket))); } } @@ -1138,20 +1138,6 @@ Status GDBRemoteCommunication::StartDebugserverProcess( void GDBRemoteCommunication::DumpHistory(Stream &strm) { m_history.Dump(strm); } -llvm::Error -GDBRemoteCommunication::ConnectLocally(GDBRemoteCommunication &client, - GDBRemoteCommunication &server) { - llvm::Expected pair = Socket::CreatePair(); - if (!pair) -return pair.takeError(); - - client.SetConnection( - std::make_
[Lldb-commits] [lldb] [lldb] Remove GDBRemoteCommunication::ConnectLocally (PR #145293)
https://github.com/labath closed https://github.com/llvm/llvm-project/pull/145293 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] make PlatformAndroid/AdbClient::GetSyncService threadsafe (PR #145382)
@@ -417,13 +417,30 @@ Status AdbClient::ShellToFile(const char *command, milliseconds timeout, return Status(); } +// Returns a sync service for file operations. +// This operation is thread-safe - each call creates an isolated sync service +// with its own connection to avoid race conditions. std::unique_ptr AdbClient::GetSyncService(Status &error) { - std::unique_ptr sync_service; - error = StartSync(); - if (error.Success()) -sync_service.reset(new SyncService(std::move(m_conn))); + std::lock_guard lock(m_sync_mutex); labath wrote: What is this actually protecting? https://github.com/llvm/llvm-project/pull/145382 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] make PlatformAndroid/AdbClient::GetSyncService threadsafe (PR #145382)
@@ -417,13 +417,30 @@ Status AdbClient::ShellToFile(const char *command, milliseconds timeout, return Status(); } +// Returns a sync service for file operations. +// This operation is thread-safe - each call creates an isolated sync service +// with its own connection to avoid race conditions. std::unique_ptr AdbClient::GetSyncService(Status &error) { - std::unique_ptr sync_service; - error = StartSync(); - if (error.Success()) -sync_service.reset(new SyncService(std::move(m_conn))); + std::lock_guard lock(m_sync_mutex); + + // Create a temporary AdbClient with its own connection for this sync service + // This avoids the race condition of multiple threads accessing the same + // connection + AdbClient temp_client(m_device_id); + + // Connect and start sync on the temporary client + error = temp_client.Connect(); + if (error.Fail()) +return nullptr; + error = temp_client.StartSync(); + if (error.Fail()) +return nullptr; + + // Move the connection from the temporary client to the sync service + std::unique_ptr sync_service; + sync_service.reset(new SyncService(std::move(temp_client.m_conn))); return sync_service; labath wrote: ```suggestion return std::make_unique(std::move(temp_client.m_conn)); ``` https://github.com/llvm/llvm-project/pull/145382 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] make PlatformAndroid/AdbClient::GetSyncService threadsafe (PR #145382)
https://github.com/labath commented: That's one way to fix the problem. Another (maybe even more obvious) would be to use a single SyncService object but synchronize all access to it. I think your approach makes sense -- it unlocks more parallelism, though that parallelism may be a mirage if the device connection is going to be the bottleneck. And all the extra connections may add some overhead. Have you looked into how the two approaches compare? As for the patch itself, the code makes sense, but the result looks very path-dependent (meaning: you'd never write code like this -- creating a temporary AdbClient object -- if you were writing this from scratch). It's also not optimal, as you're creating a temporary AdbClient in PlatformAndroid::GetSyncService and then creating *another* temporary object inside AdbClient::GetSyncService. I think this would look better if PlatformAndroid::GetSyncService constructed a (new) SyncService directly. And the SyncService could create a temporary AdbClient object as an implementation detail (or not -- maybe it could handle all of the connection setup internally) https://github.com/llvm/llvm-project/pull/145382 ___ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
[Lldb-commits] [lldb] [lldb] Remove GDBRemoteCommunication::ConnectLocally (PR #145293)
llvm-ci wrote: LLVM Buildbot has detected a new failure on builder `fuchsia-x86_64-linux` running on `fuchsia-debian-64-us-central1-a-1` while building `lldb` at step 4 "annotate". Full details are available at: https://lab.llvm.org/buildbot/#/builders/11/builds/17943 Here is the relevant piece of the build log for the reference ``` Step 4 (annotate) failure: 'python ../llvm-zorg/zorg/buildbot/builders/annotated/fuchsia-linux.py ...' (failure) ... [227/2502] Copying CXX header __algorithm/partial_sort.h [228/2502] Generating header stdint.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/stdint.yaml [229/2502] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.llabs.dir/llabs.cpp.obj [230/2502] Building CXX object libc/src/string/CMakeFiles/libc.src.string.strspn.dir/strspn.cpp.obj [231/2502] Copying CXX header __algorithm/ranges_contains.h [232/2502] Copying CXX header __algorithm/out_value_result.h [233/2502] Copying CXX header __algorithm/nth_element.h [234/2502] Copying CXX header __algorithm/ranges_adjacent_find.h [235/2502] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.srand.dir/srand.cpp.obj [236/2502] Building CXX object libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj FAILED: libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-g77y29y1/./bin/clang++ --target=riscv32-unknown-elf -DLIBC_NAMESPACE=__llvm_libc_21_0_0_git -I/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc -isystem /var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-g77y29y1/include/riscv32-unknown-unknown-elf --target=riscv32-unknown-elf -march=rv32imafc -mabi=ilp32f -Wno-atomic-alignment "-Dvfprintf(stream, format, vlist)=vprintf(format, vlist)" "-Dfprintf(stream, format, ...)=printf(format)" -D_LIBCPP_PRINT=1 -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 -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -ffunction-sections -fdata-sections -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/build/llvm-build-g77y29y1/runtimes/runtimes-riscv32-unknown-elf-bins=../../../../llvm-project -ffile-prefix-map=/var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/= -no-canonical-prefixes -Os -DNDEBUG --target=riscv32-unknown-elf -DLIBC_QSORT_IMPL=LIBC_QSORT_HEAP_SORT -DLIBC_ADD_NULL_CHECKS "-DLIBC_MATH=(LIBC_MATH_SKIP_ACCURATE_PASS | LIBC_MATH_SMALL_TABLES)" -DLIBC_ERRNO_MODE=LIBC_ERRNO_MODE_EXTERNAL -fpie -ffreestanding -DLIBC_FULL_BUILD -nostdlibinc -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wdeprecated -Wno-c99-extensions -Wno-gnu-imaginary-constant -Wno-pedantic -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -DLIBC_COPT_PUBLIC_PACKAGING -MD -MT libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj -MF libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj.d -o libc/src/stdlib/CMakeFiles/libc.src.stdlib.memalignment.dir/memalignment.cpp.obj -c /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/stdlib/memalignment.cpp /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/stdlib/memalignment.cpp:20:3: error: unknown type name 'uintptr_t' 20 | uintptr_t addr = reinterpret_cast(p); | ^ /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/libc/src/stdlib/memalignment.cpp:20:37: error: unknown type name 'uintptr_t' 20 | uintptr_t addr = reinterpret_cast(p); | ^ 2 errors generated. [237/2502] Copying CXX header __atomic/is_always_lock_free.h [238/2502] Copying CXX header __algorithm/ranges_sort.h [239/2502] Copying CXX header __algorithm/transform.h [240/2502] Generating header uchar.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-project/runtimes/../libc/include/uchar.yaml [241/2502] Building CXX object libc/src/strings/CMakeFiles/libc.src.strings.strcasecmp.dir/strcasecmp.cpp.obj [242/2502] Copying CXX header __algorithm/partition.h [243/2502] Copying CXX header __algorithm/partial_sort_copy.h [244/2502] Copying CXX header __algorithm/ranges_swap_ranges.h [245/2502] Building CXX object libc/src/strings/CMakeFiles/libc.src.strings.strncasecmp.dir/strncasecmp.cpp.obj [246/2502] Generating header fenv.h from /var/lib/buildbot/fuchsia-x86_64-linux/llvm-projec