[Lldb-commits] [clang] [lldb] [llvm] [ADT] Mark StringSwitch Cases with 6+ arguments as deprecated. NFC. (PR #163405)

2025-10-14 Thread Nikita Popov via lldb-commits


@@ -110,31 +111,41 @@ class StringSwitch {
 return CasesImpl(Value, {S0, S1, S2, S3, S4});
   }
 
+  LLVM_DEPRECATED("Pass cases in std::initializer_list instead",
+  "Cases({S0, S1, ...}, Value)")

nikic wrote:

The second argument to LLVM_DEPRECATED is a fix-it replacement. Use 
`[[deprecated]]` instead of LLVM_DEPRECATED if you cannot provide a valid 
fix-it. We should really rename this macro.

https://github.com/llvm/llvm-project/pull/163405
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Parse qSupported MultiMemRead tag in GDB Remote Client (PR #163249)

2025-10-14 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan edited 
https://github.com/llvm/llvm-project/pull/163249
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Remove timings from TestDAP_attach (PR #163452)

2025-10-14 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere updated 
https://github.com/llvm/llvm-project/pull/163452

>From ee6524a76ba47f97ebea6d7b4620a2cea94997d5 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Tue, 14 Oct 2025 13:56:05 -0700
Subject: [PATCH 1/2] [lldb-dap] Remove timings from TestDAP_attach

This PR split TestDAP_attach into two tests and removes any reliance on
timing from the simple attach tests. Instead, it uses stdin and stdout
to synchronize between the test and the inferior, and to check that
we're attached to the correct inferior.

Fixes #163295
---
 .../tools/lldb-dap/attach-commands/Makefile   |   3 +
 .../attach-commands/TestDAP_attachCommands.py | 146 +
 .../API/tools/lldb-dap/attach-commands/main.c |  30 +++
 .../tools/lldb-dap/attach/TestDAP_attach.py   | 202 +++---
 lldb/test/API/tools/lldb-dap/attach/main.c|  11 +-
 5 files changed, 211 insertions(+), 181 deletions(-)
 create mode 100644 lldb/test/API/tools/lldb-dap/attach-commands/Makefile
 create mode 100644 
lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py
 create mode 100644 lldb/test/API/tools/lldb-dap/attach-commands/main.c

diff --git a/lldb/test/API/tools/lldb-dap/attach-commands/Makefile 
b/lldb/test/API/tools/lldb-dap/attach-commands/Makefile
new file mode 100644
index 0..10495940055b6
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/attach-commands/Makefile
@@ -0,0 +1,3 @@
+C_SOURCES := main.c
+
+include Makefile.rules
diff --git 
a/lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py 
b/lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py
new file mode 100644
index 0..09f22ca5eff30
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/attach-commands/TestDAP_attachCommands.py
@@ -0,0 +1,146 @@
+"""
+Test lldb-dap attach commands
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+import lldbdap_testcase
+import time
+
+class TestDAP_attach(lldbdap_testcase.DAPTestCaseBase):
+@skipIfNetBSD  # Hangs on NetBSD as well
+def test_commands(self):
+"""
+Tests the "initCommands", "preRunCommands", "stopCommands",
+"exitCommands", "terminateCommands" and "attachCommands"
+that can be passed during attach.
+
+"initCommands" are a list of LLDB commands that get executed
+before the target is created.
+"preRunCommands" are a list of LLDB commands that get executed
+after the target has been created and before the launch.
+"stopCommands" are a list of LLDB commands that get executed each
+time the program stops.
+"exitCommands" are a list of LLDB commands that get executed when
+the process exits
+"attachCommands" are a list of LLDB commands that get executed and
+must have a valid process in the selected target in LLDB after
+they are done executing. This allows custom commands to create any
+kind of debug session.
+"terminateCommands" are a list of LLDB commands that get executed when
+the debugger session terminates.
+"""
+program = self.build_and_create_debug_adapter_for_attach()
+
+# Here we just create a target and launch the process as a way to test
+# if we are able to use attach commands to create any kind of a target
+# and use it for debugging
+attachCommands = [
+'target create -d "%s"' % (program),
+"process launch --stop-at-entry",
+]
+initCommands = ["target list", "platform list"]
+preRunCommands = ["image list a.out", "image dump sections a.out"]
+postRunCommands = ["help trace", "help process trace"]
+stopCommands = ["frame variable", "thread backtrace"]
+exitCommands = ["expr 2+3", "expr 3+4"]
+terminateCommands = ["expr 4+2"]
+self.attach(
+program=program,
+attachCommands=attachCommands,
+initCommands=initCommands,
+preRunCommands=preRunCommands,
+stopCommands=stopCommands,
+exitCommands=exitCommands,
+terminateCommands=terminateCommands,
+postRunCommands=postRunCommands,
+)
+# Get output from the console. This should contain both the
+# "initCommands" and the "preRunCommands".
+output = self.get_console()
+# Verify all "initCommands" were found in console output
+self.verify_commands("initCommands", output, initCommands)
+# Verify all "preRunCommands" were found in console output
+self.verify_commands("preRunCommands", output, preRunCommands)
+# Verify all "postRunCommands" were found in console output
+self.verify_commands("postRunCommands", output, postRunCommands)
+
+functions = ["main"]
+breakpoint_ids = self.set_function_breakpoints(functions)
+self.assertEqual

[Lldb-commits] [lldb] bed17c0 - [lldb][NFCI] Refactor AppleObjCClassDescriptorV2 method_t parsing functions (#163291)

2025-10-14 Thread via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2025-10-14T14:02:46-07:00
New Revision: bed17c03fee09eabbd35eca3a8829f913a374424

URL: 
https://github.com/llvm/llvm-project/commit/bed17c03fee09eabbd35eca3a8829f913a374424
DIFF: 
https://github.com/llvm/llvm-project/commit/bed17c03fee09eabbd35eca3a8829f913a374424.diff

LOG: [lldb][NFCI] Refactor AppleObjCClassDescriptorV2 method_t parsing 
functions (#163291)

This rewrites ClassDescriptorV2::method_t::Read (and the loop calling
that function) in an NFCI way to perform a couple of things:

1. Cleanup code with indirect style. For example, the old loop would
have default-constructor a `unique_ptr`, which was *reused* on
every iteration of the loop. It called `method_t::Read` on each
iteration, and never checked the return value prior to invoking the
callback. In other words, if `Read` failed, the callback was called on
random values.

2. Exposed memory reads that could benefit from the MultiMemoryRead
packet proposed in [1].

[1]:
https://discourse.llvm.org/t/rfc-a-new-vectorized-memory-read-packet/88441

Added: 


Modified: 

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp

lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h

Removed: 




diff  --git 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
index cc0c9e728964e..6d8f41aef1ffc 100644
--- 
a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
+++ 
b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.cpp
@@ -14,6 +14,7 @@
 #include "lldb/Utility/LLDBLog.h"
 #include "lldb/Utility/Log.h"
 #include "lldb/lldb-enumerations.h"
+#include "llvm/ADT/Sequence.h"
 
 using namespace lldb;
 using namespace lldb_private;
@@ -266,22 +267,47 @@ bool ClassDescriptorV2::method_list_t::Read(Process 
*process,
   return true;
 }
 
-bool ClassDescriptorV2::method_t::Read(Process *process, lldb::addr_t addr,
-   lldb::addr_t 
relative_selector_base_addr,
-   bool is_small, bool has_direct_sel) {
-  size_t ptr_size = process->GetAddressByteSize();
-  size_t size = GetSize(process, is_small);
+llvm::SmallVector
+ClassDescriptorV2::ReadMethods(llvm::ArrayRef addresses,
+   lldb::addr_t relative_selector_base_addr,
+   bool is_small, bool has_direct_sel) const {
+  lldb_private::Process *process = m_runtime.GetProcess();
+  if (!process)
+return {};
 
-  DataBufferHeap buffer(size, '\0');
-  Status error;
+  const size_t size = method_t::GetSize(process, is_small);
+  const size_t num_methods = addresses.size();
 
-  process->ReadMemory(addr, buffer.GetBytes(), size, error);
-  if (error.Fail()) {
-return false;
+  llvm::SmallVector buffer(num_methods * size, 0);
+  llvm::DenseSet failed_indices;
+
+  for (auto [idx, addr] : llvm::enumerate(addresses)) {
+Status error;
+process->ReadMemory(addr, buffer.data() + idx * size, size, error);
+if (error.Fail())
+  failed_indices.insert(idx);
   }
 
-  DataExtractor extractor(buffer.GetBytes(), size, process->GetByteOrder(),
-  ptr_size);
+  llvm::SmallVector methods;
+  methods.reserve(num_methods);
+  for (auto [idx, addr] : llvm::enumerate(addresses)) {
+if (failed_indices.contains(idx))
+  continue;
+DataExtractor extractor(buffer.data() + idx * size, size,
+process->GetByteOrder(),
+process->GetAddressByteSize());
+methods.push_back(method_t());
+methods.back().Read(extractor, process, addr, relative_selector_base_addr,
+is_small, has_direct_sel);
+  }
+
+  return methods;
+}
+
+bool ClassDescriptorV2::method_t::Read(DataExtractor &extractor,
+   Process *process, lldb::addr_t addr,
+   lldb::addr_t 
relative_selector_base_addr,
+   bool is_small, bool has_direct_sel) {
   lldb::offset_t cursor = 0;
 
   if (is_small) {
@@ -291,11 +317,11 @@ bool ClassDescriptorV2::method_t::Read(Process *process, 
lldb::addr_t addr,
 
 m_name_ptr = addr + nameref_offset;
 
+Status error;
 if (!has_direct_sel) {
   // The SEL offset points to a SELRef. We need to dereference twice.
-  m_name_ptr = process->ReadUnsignedIntegerFromMemory(m_name_ptr, ptr_size,
-  0, error);
-  if (!error.Success())
+  m_name_ptr = process->ReadPointerFromMemory(m_name_ptr, error);
+  if (error.Fail())
 return false;
 } else if (relative_selector_base_addr != LLDB_INVALID_ADD

[Lldb-commits] [lldb] [lldb] Correct BridgeOS spelling and ignore case when parsing the SDK (PR #163479)

2025-10-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Ignore case when parsing the Xcode SDK. The BridgeOS SDK is capitalized, but 
previously failed to parse because we were looking for bridgeOS. This PR 
updates the enum value and the canonical spelling, and also relaxes the parsing 
to be case insensitive.

rdar://162641896

---
Full diff: https://github.com/llvm/llvm-project/pull/163479.diff


4 Files Affected:

- (modified) lldb/include/lldb/Utility/XcodeSDK.h (+1-1) 
- (modified) lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (+1-1) 
- (modified) lldb/source/Utility/XcodeSDK.cpp (+17-16) 
- (modified) lldb/unittests/Utility/XcodeSDKTest.cpp (+2) 


``diff
diff --git a/lldb/include/lldb/Utility/XcodeSDK.h 
b/lldb/include/lldb/Utility/XcodeSDK.h
index 5b345a4965cf9..5f89019537689 100644
--- a/lldb/include/lldb/Utility/XcodeSDK.h
+++ b/lldb/include/lldb/Utility/XcodeSDK.h
@@ -38,7 +38,7 @@ class XcodeSDK {
 watchOS,
 XRSimulator,
 XROS,
-bridgeOS,
+BridgeOS,
 Linux,
 unknown = -1
   };
diff --git a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp 
b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
index cd72454fe0287..5aad4470091bc 100644
--- a/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
+++ b/lldb/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
@@ -1150,7 +1150,7 @@ void 
PlatformDarwin::AddClangModuleCompilationOptionsForSDKType(
 case XcodeSDK::Type::XRSimulator:
 case XcodeSDK::Type::XROS:
   // FIXME: Pass the right argument once it exists.
-case XcodeSDK::Type::bridgeOS:
+case XcodeSDK::Type::BridgeOS:
 case XcodeSDK::Type::Linux:
 case XcodeSDK::Type::unknown:
   if (Log *log = GetLog(LLDBLog::Host)) {
diff --git a/lldb/source/Utility/XcodeSDK.cpp b/lldb/source/Utility/XcodeSDK.cpp
index 2040791882fd0..d20d485e64328 100644
--- a/lldb/source/Utility/XcodeSDK.cpp
+++ b/lldb/source/Utility/XcodeSDK.cpp
@@ -38,8 +38,8 @@ static llvm::StringRef GetName(XcodeSDK::Type type) {
 return "XRSimulator";
   case XcodeSDK::XROS:
 return "XROS";
-  case XcodeSDK::bridgeOS:
-return "bridgeOS";
+  case XcodeSDK::BridgeOS:
+return "BridgeOS";
   case XcodeSDK::Linux:
 return "Linux";
   case XcodeSDK::unknown:
@@ -65,27 +65,27 @@ bool XcodeSDK::operator==(const XcodeSDK &other) const {
 }
 
 static XcodeSDK::Type ParseSDKName(llvm::StringRef &name) {
-  if (name.consume_front("MacOSX"))
+  if (name.consume_front_insensitive("MacOSX"))
 return XcodeSDK::MacOSX;
-  if (name.consume_front("iPhoneSimulator"))
+  if (name.consume_front_insensitive("iPhoneSimulator"))
 return XcodeSDK::iPhoneSimulator;
-  if (name.consume_front("iPhoneOS"))
+  if (name.consume_front_insensitive("iPhoneOS"))
 return XcodeSDK::iPhoneOS;
-  if (name.consume_front("AppleTVSimulator"))
+  if (name.consume_front_insensitive("AppleTVSimulator"))
 return XcodeSDK::AppleTVSimulator;
-  if (name.consume_front("AppleTVOS"))
+  if (name.consume_front_insensitive("AppleTVOS"))
 return XcodeSDK::AppleTVOS;
-  if (name.consume_front("WatchSimulator"))
+  if (name.consume_front_insensitive("WatchSimulator"))
 return XcodeSDK::WatchSimulator;
-  if (name.consume_front("WatchOS"))
+  if (name.consume_front_insensitive("WatchOS"))
 return XcodeSDK::watchOS;
-  if (name.consume_front("XRSimulator"))
+  if (name.consume_front_insensitive("XRSimulator"))
 return XcodeSDK::XRSimulator;
-  if (name.consume_front("XROS"))
+  if (name.consume_front_insensitive("XROS"))
 return XcodeSDK::XROS;
-  if (name.consume_front("bridgeOS"))
-return XcodeSDK::bridgeOS;
-  if (name.consume_front("Linux"))
+  if (name.consume_front_insensitive("BridgeOS"))
+return XcodeSDK::BridgeOS;
+  if (name.consume_front_insensitive("Linux"))
 return XcodeSDK::Linux;
   static_assert(XcodeSDK::Linux == XcodeSDK::numSDKTypes - 1,
 "New SDK type was added, update this list!");
@@ -110,7 +110,8 @@ static llvm::VersionTuple ParseSDKVersion(llvm::StringRef 
&name) {
 }
 
 static bool ParseAppleInternalSDK(llvm::StringRef &name) {
-  return name.consume_front("Internal.") || name.consume_front(".Internal.");
+  return name.consume_front_insensitive("Internal.") ||
+ name.consume_front_insensitive(".Internal.");
 }
 
 XcodeSDK::Info XcodeSDK::Parse() const {
@@ -204,7 +205,7 @@ std::string XcodeSDK::GetCanonicalName(XcodeSDK::Info info) 
{
   case XROS:
 name = "xros";
 break;
-  case bridgeOS:
+  case BridgeOS:
 name = "bridgeos";
 break;
   case Linux:
diff --git a/lldb/unittests/Utility/XcodeSDKTest.cpp 
b/lldb/unittests/Utility/XcodeSDKTest.cpp
index de9f91a04d53e..f3964f25c821b 100644
--- a/lldb/unittests/Utility/XcodeSDKTest.cpp
+++ b/lldb/unittests/Utility/XcodeSDKTest.cpp
@@ -27,6 +27,8 @@ TEST(XcodeSDKTest, ParseTest) {
   EXPECT_EQ(XcodeSDK("AppleTVOS.sdk").GetType(), XcodeSDK::AppleTVOS);
   EXPECT_EQ(XcodeSDK("WatchSimulator.sdk").

[Lldb-commits] [lldb] [lldb] Parse qSupported MultiMemRead tag in GDB Remote Client (PR #163249)

2025-10-14 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda approved this pull request.

Looks good to me.

https://github.com/llvm/llvm-project/pull/163249
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [llvm] [ADT] Mark StringSwitch Cases with 6+ arguments as deprecated. NFC. (PR #163405)

2025-10-14 Thread Jakub Kuderski via lldb-commits

https://github.com/kuhar updated 
https://github.com/llvm/llvm-project/pull/163405

>From 6d0d2d7171b2ebe6670c3b0b4966b4b1b42147d7 Mon Sep 17 00:00:00 2001
From: Jakub Kuderski 
Date: Tue, 14 Oct 2025 10:23:32 -0400
Subject: [PATCH 1/6] [ADT] Mark StringSwitch Cases 6+ arguments as deprecated.
 NFC.

Switch to the `.Cases({S0, S1, ...}, Value)` overload instead.
---
 .../Core/PathSensitive/AnalysisManager.h  |   4 +-
 clang/lib/Basic/Targets/AVR.cpp   |  30 ++--
 clang/lib/Driver/Job.cpp  |  31 ++--
 clang/lib/Frontend/FrontendOptions.cpp|  17 +-
 clang/lib/InstallAPI/HeaderFile.cpp   |   2 +-
 clang/lib/Lex/PPDirectives.cpp| 105 ++-
 clang/lib/Sema/CheckExprLifetime.cpp  |  16 +-
 .../Checkers/CheckSecuritySyntaxOnly.cpp  |  22 +--
 .../ABI/LoongArch/ABISysV_loongarch.cpp   |  13 +-
 .../Plugins/ABI/RISCV/ABISysV_riscv.cpp   |  19 +-
 .../source/Plugins/ABI/X86/ABISysV_x86_64.cpp |   4 +-
 .../Plugins/ABI/X86/ABIWindows_x86_64.cpp |   9 +-
 llvm/include/llvm/ADT/StringSwitch.h  |  13 +-
 llvm/lib/BinaryFormat/XCOFF.cpp   |  30 ++--
 .../Target/RISCV/AsmParser/RISCVAsmParser.cpp |   6 +-
 .../Target/RISCV/MCA/RISCVCustomBehaviour.cpp |   2 +-
 .../WebAssemblyMCTypeUtilities.cpp|   2 +-
 .../lib/Target/X86/AsmParser/X86AsmParser.cpp |  11 +-
 .../TargetParser/ARMTargetParserCommon.cpp|  10 +-
 llvm/lib/TargetParser/Triple.cpp  | 167 +-
 llvm/utils/TableGen/FastISelEmitter.cpp   |   2 +-
 21 files changed, 276 insertions(+), 239 deletions(-)

diff --git 
a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h 
b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
index e3cf1bac83ad0..1e87b479d1cf8 100644
--- a/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
+++ b/clang/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h
@@ -140,8 +140,8 @@ class AnalysisManager : public BugReporterData {
   // It might be great to reuse FrontendOptions::getInputKindForExtension()
   // but for now it doesn't discriminate between code and header files.
   return llvm::StringSwitch(SM.getFilename(SL).rsplit('.').second)
-  .Cases("c", "m", "mm", "C", "cc", "cp", true)
-  .Cases("cpp", "CPP", "c++", "cxx", "cppm", true)
+  .Cases({"c", "m", "mm", "C", "cc", "cp"}, true)
+  .Cases({"cpp", "CPP", "c++", "cxx", "cppm"}, true)
   .Default(false);
 }
 
diff --git a/clang/lib/Basic/Targets/AVR.cpp b/clang/lib/Basic/Targets/AVR.cpp
index bbe7b01ca036d..2673669bc9035 100644
--- a/clang/lib/Basic/Targets/AVR.cpp
+++ b/clang/lib/Basic/Targets/AVR.cpp
@@ -420,23 +420,23 @@ static MCUInfo AVRMcus[] = {
 
 static bool ArchHasELPM(StringRef Arch) {
   return llvm::StringSwitch(Arch)
-.Cases("31", "51", "6", true)
-.Cases("102", "104", "105", "106", "107", true)
-.Default(false);
+  .Cases({"31", "51", "6"}, true)
+  .Cases({"102", "104", "105", "106", "107"}, true)
+  .Default(false);
 }
 
 static bool ArchHasELPMX(StringRef Arch) {
   return llvm::StringSwitch(Arch)
-.Cases("51", "6", true)
-.Cases("102", "104", "105", "106", "107", true)
-.Default(false);
+  .Cases({"51", "6"}, true)
+  .Cases({"102", "104", "105", "106", "107"}, true)
+  .Default(false);
 }
 
 static bool ArchHasMOVW(StringRef Arch) {
   return llvm::StringSwitch(Arch)
-.Cases("25", "35", "4", "5", "51", "6", true)
-.Cases("102", "103", "104", "105", "106", "107", true)
-.Default(false);
+  .Cases({"25", "35", "4", "5", "51", "6"}, true)
+  .Cases({"102", "103", "104", "105", "106", "107"}, true)
+  .Default(false);
 }
 
 static bool ArchHasLPMX(StringRef Arch) {
@@ -445,16 +445,16 @@ static bool ArchHasLPMX(StringRef Arch) {
 
 static bool ArchHasMUL(StringRef Arch) {
   return llvm::StringSwitch(Arch)
-.Cases("4", "5", "51", "6", true)
-.Cases("102", "103", "104", "105", "106", "107", true)
-.Default(false);
+  .Cases({"4", "5", "51", "6"}, true)
+  .Cases({"102", "103", "104", "105", "106", "107"}, true)
+  .Default(false);
 }
 
 static bool ArchHasJMPCALL(StringRef Arch) {
   return llvm::StringSwitch(Arch)
-.Cases("3", "31", "35", "5", "51", "6", true)
-.Cases("102", "103", "104", "105", "106", "107", true)
-.Default(false);
+  .Cases({"3", "31", "35", "5", "51", "6"}, true)
+  .Cases({"102", "103", "104", "105", "106", "107"}, true)
+  .Default(false);
 }
 
 static bool ArchHas3BytePC(StringRef Arch) {
diff --git a/clang/lib/Driver/Job.cpp b/clang/lib/Driver/Job.cpp
index 880e9e396c41e..715429bcd2096 100644
--- a/clang/lib/Driver/Job.cpp
+++ b/clang/lib/Driver/Job.cpp
@@ -57,24 +57,25 @@ static bool skipArgs(const char *Flag, bool HaveCrashVFS, 
int &SkipNum,
   SkipNum = 2;
   // These flags are all of the form -Flag  and are treated as two
   // argum

[Lldb-commits] [lldb] [lldb][NFC] Remove unused find_program logic (PR #163446)

2025-10-14 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere approved this pull request.


https://github.com/llvm/llvm-project/pull/163446
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Enable locate module callback for main executable (PR #160199)

2025-10-14 Thread via lldb-commits

https://github.com/GeorgeHuyubo updated 
https://github.com/llvm/llvm-project/pull/160199

>From c6534a14078ee8644c2403d51e9df613cddce22b Mon Sep 17 00:00:00 2001
From: George Hu 
Date: Mon, 22 Sep 2025 13:42:31 -0700
Subject: [PATCH 1/6] Call locate module callback for main executable

---
 lldb/source/Target/Platform.cpp | 50 +++--
 1 file changed, 41 insertions(+), 9 deletions(-)

diff --git a/lldb/source/Target/Platform.cpp b/lldb/source/Target/Platform.cpp
index 8681adaf5ea76..bbbe066cdea9e 100644
--- a/lldb/source/Target/Platform.cpp
+++ b/lldb/source/Target/Platform.cpp
@@ -750,12 +750,30 @@ Platform::ResolveExecutable(const ModuleSpec &module_spec,
 
   if (resolved_module_spec.GetArchitecture().IsValid() ||
   resolved_module_spec.GetUUID().IsValid()) {
-Status error =
-ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
-module_search_paths_ptr, nullptr, nullptr);
+// Call locate module callback first to give it a chance to find/register
+// symbol file specs for the main executable, similar to how shared
+// libraries are handled in Platform::GetRemoteSharedModule()
+FileSpec symbol_file_spec;
+CallLocateModuleCallbackIfSet(resolved_module_spec, exe_module_sp,
+  symbol_file_spec, nullptr);
 
-if (exe_module_sp && exe_module_sp->GetObjectFile())
-  return error;
+Status error;
+if (!exe_module_sp) {
+  // If locate module callback didn't provide a module, fallback to 
standard
+  // path
+  error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
+  module_search_paths_ptr, nullptr,
+  nullptr);
+}
+
+if (exe_module_sp && exe_module_sp->GetObjectFile()) {
+  // Set the symbol file if locate module callback returned one
+  if (symbol_file_spec) {
+exe_module_sp->SetSymbolFileFileSpec(symbol_file_spec);
+  }
+  return error; // Return the actual status from GetSharedModule (or 
success
+// from callback)
+}
 exe_module_sp.reset();
   }
   // No valid architecture was specified or the exact arch wasn't found.
@@ -767,12 +785,26 @@ Platform::ResolveExecutable(const ModuleSpec &module_spec,
   Status error;
   for (const ArchSpec &arch : GetSupportedArchitectures(process_host_arch)) {
 resolved_module_spec.GetArchitecture() = arch;
-error =
-ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
-module_search_paths_ptr, nullptr, nullptr);
+
+// Call locate module callback first, then fallback to standard path
+FileSpec symbol_file_spec;
+CallLocateModuleCallbackIfSet(resolved_module_spec, exe_module_sp,
+  symbol_file_spec, nullptr);
+
+if (!exe_module_sp) {
+  error = ModuleList::GetSharedModule(resolved_module_spec, exe_module_sp,
+  module_search_paths_ptr, nullptr,
+  nullptr);
+}
+
 if (error.Success()) {
-  if (exe_module_sp && exe_module_sp->GetObjectFile())
+  if (exe_module_sp && exe_module_sp->GetObjectFile()) {
+// Set the symbol file if locate module callback returned one
+if (symbol_file_spec) {
+  exe_module_sp->SetSymbolFileFileSpec(symbol_file_spec);
+}
 break;
+  }
   error = Status::FromErrorString("no exe object file");
 }
 

>From 2dc6595e89a26ff3d9774dc3d82daac0f0576aca Mon Sep 17 00:00:00 2001
From: George Hu 
Date: Fri, 26 Sep 2025 16:45:58 -0700
Subject: [PATCH 2/6] [lldb] Refactor add target into ModuleSpec

---
 lldb/include/lldb/Core/ModuleList.h   |  1 -
 lldb/include/lldb/Core/ModuleSpec.h   |  9 
 lldb/include/lldb/Target/Platform.h   | 16 +++---
 .../include/lldb/Target/RemoteAwarePlatform.h |  6 +--
 lldb/source/API/SBModule.cpp  |  4 +-
 lldb/source/Core/DynamicLoader.cpp|  5 +-
 lldb/source/Core/ModuleList.cpp   | 12 -
 .../DynamicLoaderDarwinKernel.cpp |  6 +--
 .../POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp |  5 +-
 .../MacOSX/PlatformAppleSimulator.cpp |  8 +--
 .../Platform/MacOSX/PlatformAppleSimulator.h  |  1 -
 .../Platform/MacOSX/PlatformDarwin.cpp| 39 +-
 .../Plugins/Platform/MacOSX/PlatformDarwin.h  |  3 +-
 .../Platform/MacOSX/PlatformDarwinDevice.cpp  | 10 ++--
 .../Platform/MacOSX/PlatformDarwinDevice.h|  1 -
 .../Platform/MacOSX/PlatformDarwinKernel.cpp  | 22 +++-
 .../Platform/MacOSX/PlatformDarwinKernel.h| 11 ++--
 .../Platform/MacOSX/PlatformMacOSX.cpp|  9 ++--
 .../Plugins/Platform/MacOSX/PlatformMacOSX.h  |  1 -
 .../MacOSX/PlatformRemoteDarwinDevice.cpp | 18 +++
 .../MacOSX/PlatformRemoteDarwinDevice.h   |  1 -
 .../Process/e

[Lldb-commits] [lldb] [lldb-dap][test] create temp source file in test directory. (PR #163383)

2025-10-14 Thread Jonas Devlieghere via lldb-commits


@@ -29,7 +29,7 @@ def build_and_run_until_breakpoint(self):
 """
 Build the program and run until the breakpoint is hit, and return the 
stack frames.
 """
-other_source_file = "other.c"
+other_source_file = os.path.join(self.getBuildDir(), "other.c")

JDevlieghere wrote:

Can we use `getBuildArtifact` here?
```suggestion
other_source_file = self.getBuildArtifact("other.c")
```

https://github.com/llvm/llvm-project/pull/163383
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-10-14 Thread Kees Cook via lldb-commits

kees wrote:

@JustinStitt were looking over things, and I stumbled over something here...

> Thanks. So IIUC, the rule is:
> 
> 1. If the type of either operand of an arithmetic operator is `__ob_trap`,  
> the operator traps on overflow, and the result type is `__ob_trap`.

This is correct and what I was expecting.

> 2. If either the operand type or the destination type of an integer 
> conversion is `__ob_trap`, the conversion traps on overflow.

This one, however, I think it not what we want, but I may be missing something.

```
int __ob_trap src = bigger_than_255;
...
char dest = src;
```

I don't think we want a trap on the `dest` assignment, since it isn't 
`__ob_trap`. It doesn't care about the truncation. This is a "sided" operation, 
unlike the arithmetic.


https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Darwin] Add `process launch --memory-tagging` option (PR #162944)

2025-10-14 Thread Julian Lettner via lldb-commits


@@ -1210,6 +1210,39 @@ static Status LaunchProcessPosixSpawn(const char 
*exe_path,
 }
   }
 
+  if (launch_info.GetFlags().Test(eLaunchFlagMemoryTagging)) {
+// The following function configures the spawn attributes to launch the
+// process with memory tagging explicitly enabled.  We look it up
+// dynamically since it is only available on newer OS.  Does nothing on
+// hardware which does not support MTE.
+//
+//   int posix_spawnattr_set_use_sec_transition_shims_np(
+//   posix_spawnattr_t *attr, uint32_t flags);
+//

yln wrote:

The call of this API (through the function pointer) is the line that does the 
work.
```
posix_spawnattr_set_use_sec_transition_shims_np_fn(&attr, 0)
```
It means "launch with memory tagging enabled".

* The naming of this function is unfortunate
* We call through function pointer that is looked up via `dlsym()` because the 
function is not available on older OS
* The `flags=0` value allows for future, more specific semantics.
* Everything else is just error handling

https://github.com/llvm/llvm-project/pull/162944
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [Clang] Introduce OverflowBehaviorType for fine-grained overflow control (PR #148914)

2025-10-14 Thread Justin Stitt via lldb-commits

JustinStitt wrote:

@kees

> If we don't follow what I'm describing, this becomes meaningless:
> 
> ```
> int __ob_trap big = runtime_1024;
> ...
> char __ob_wrap byte = big; // is this supposed to wrap or trap? I say wrap -- 
> we're describing how "byte" behaves
> ```
> 
> How can we perform an assignment where we _want_ a wrapping behavior if 
> suddenly `ob_trap` dominates even from the RHS?

FWIW, this doesn't compile


```c
$ cat test.c
void foo(int some) {
  int __ob_trap big = some;
  char __ob_wrap byte = big; // is this supposed to wrap or trap? I say wrap -- 
we're describing how "byte" behaves
}

$ clang test.c -foverflow-behavior-types -fsyntax-only

test.c:3:18: error: cannot assign between incompatible overflow behavior types 
('__ob_wrap' and '__ob_trap')
3 |   char __ob_wrap byte = big; // is this supposed to wrap or trap? I say 
wrap -- we're describing how "byte" behaves
  |  ^
1 error generated.
```

https://github.com/llvm/llvm-project/pull/148914
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFCI] Refactor AppleObjCClassDescriptorV2 method_t parsing functions (PR #163291)

2025-10-14 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan edited 
https://github.com/llvm/llvm-project/pull/163291
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [llvm] [ADT] Mark StringSwitch Cases with 6+ arguments as deprecated. NFC. (PR #163405)

2025-10-14 Thread Sam Elliott via lldb-commits

https://github.com/lenary approved this pull request.

LGTM

https://github.com/llvm/llvm-project/pull/163405
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [gdbremote] Document MultiMemRead packet in protocol extensions (PR #162675)

2025-10-14 Thread Jason Molenda via lldb-commits

https://github.com/jasonmolenda approved this pull request.

Looks good to me with the edits, but David's feedback was more critical, I'd 
like to get his sign-off.

https://github.com/llvm/llvm-project/pull/162675
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [llvm] [ADT] Mark StringSwitch Cases with 6+ arguments as deprecated. NFC. (PR #163405)

2025-10-14 Thread Sam Elliott via lldb-commits

lenary wrote:

Can I ask why? And why 6+?

Have particular issues been seen with these?

https://github.com/llvm/llvm-project/pull/163405
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap][test] create temp source file in test directory. (PR #163383)

2025-10-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo approved this pull request.


https://github.com/llvm/llvm-project/pull/163383
___
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits