[Lldb-commits] [lldb] [lldb][NFC] Architecture plugins should report the vector element order (PR #157198)

2025-09-07 Thread Michael Buch via lldb-commits

https://github.com/Michael137 edited 
https://github.com/llvm/llvm-project/pull/157198
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Fix assertion when opcodes are exactly the length of the buffer (PR #157196)

2025-09-07 Thread Michael Buch via lldb-commits

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


https://github.com/llvm/llvm-project/pull/157196
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 371d1a8 - [lldb] Use weak pointers instead of shared pointers in DynamicLoader (#156446)

2025-09-07 Thread via lldb-commits

Author: Andrew Savonichev
Date: 2025-09-04T20:36:14+09:00
New Revision: 371d1a8e3e8513becf0e25ec6e6830d29221a902

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

LOG: [lldb] Use weak pointers instead of shared pointers in DynamicLoader 
(#156446)

DynamicLoaderWindowsDYLD uses pointers to Modules to maintain a map
from modules to their addresses, but it does not need to keep "strong"
references to them. Weak pointers should be enough, and would allow
modules to be released elsewhere.

Other DynamicLoader classes do not use shared pointers as well. For
example, DynamicLoaderPOSIXDYLD has a similar map with weak pointers.

Actually testing for modules being completely released can be tricky.
The test here is just to illustrate the case where shared pointers kept
modules in DynamicLoaderWindowsDYLD and prevented them from being
released. The test executes the following sequence:

  1. Create a target, load an executable and run it.

2. Remove one module from the target. The target should be the last
actual use of the module, but we have another reference to it in the
shared module cache.

3. Call MemoryPressureDetected to remove this last reference from the
cache.

  4. Replace the corresponding DLL file.

LLDB memory maps DLLs, and this makes files read-only on Windows. Unless
the modules are completely released (and therefore unmapped), (4) is
going to fail with "access denied".

However, the test does not trigger the bug completely - it passes with
and without the change.

Added: 
lldb/test/API/windows/launch/replace-dll/Makefile
lldb/test/API/windows/launch/replace-dll/TestReplaceDLL.py
lldb/test/API/windows/launch/replace-dll/bar.c
lldb/test/API/windows/launch/replace-dll/foo.c
lldb/test/API/windows/launch/replace-dll/test.c

Modified: 
lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h

Removed: 




diff  --git 
a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h 
b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h
index 42ea5aacecb40..8b1c3c3f467f4 100644
--- a/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h
+++ b/lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.h
@@ -45,7 +45,8 @@ class DynamicLoaderWindowsDYLD : public DynamicLoader {
   lldb::addr_t GetLoadAddress(lldb::ModuleSP executable);
 
 private:
-  std::map m_loaded_modules;
+  std::map>
+  m_loaded_modules;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/test/API/windows/launch/replace-dll/Makefile 
b/lldb/test/API/windows/launch/replace-dll/Makefile
new file mode 100644
index 0..22f1051530f87
--- /dev/null
+++ b/lldb/test/API/windows/launch/replace-dll/Makefile
@@ -0,0 +1 @@
+include Makefile.rules

diff  --git a/lldb/test/API/windows/launch/replace-dll/TestReplaceDLL.py 
b/lldb/test/API/windows/launch/replace-dll/TestReplaceDLL.py
new file mode 100644
index 0..afa97cf4afe50
--- /dev/null
+++ b/lldb/test/API/windows/launch/replace-dll/TestReplaceDLL.py
@@ -0,0 +1,62 @@
+import lldb
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+
+import gc
+import os
+
+
+class ReplaceDllTestCase(TestBase):
+@skipUnlessWindows
+def test(self):
+"""
+Test that LLDB unlocks module files once all references are released.
+"""
+
+exe = self.getBuildArtifact("a.out")
+foo = self.getBuildArtifact("foo.dll")
+bar = self.getBuildArtifact("bar.dll")
+
+self.build(
+dictionary={
+"DYLIB_NAME": "foo",
+"DYLIB_C_SOURCES": "foo.c",
+"C_SOURCES": "test.c",
+}
+)
+self.build(
+dictionary={
+"DYLIB_ONLY": "YES",
+"DYLIB_NAME": "bar",
+"DYLIB_C_SOURCES": "bar.c",
+}
+)
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, VALID_TARGET)
+
+shlib_names = ["foo"]
+environment = self.registerSharedLibrariesWithTarget(target, 
shlib_names)
+process = target.LaunchSimple(
+None, environment, self.get_process_working_directory()
+)
+self.assertEqual(process.GetExitStatus(), 42)
+
+module = next((m for m in target.modules if "foo" in m.file.basename), 
None)
+self.assertIsNotNone(module)
+self.assertEqual(module.file.fullpath, foo)
+
+target.RemoveModule(module)
+del module
+gc.collect()
+
+self.dbg.MemoryPressureDetected()
+
+os.remove(foo)
+os.rename(bar, foo)
+
+process = target.LaunchSimple(
+None, environment, sel

[Lldb-commits] [lldb] [lldb] Add some vector operations to the IRInterpreter (PR #155000)

2025-09-07 Thread Daniel Sanders via lldb-commits


@@ -30,9 +30,14 @@ class ArchitecturePPC64 : public Architecture {
   void AdjustBreakpointAddress(const Symbol &func,
Address &addr) const override;
 
+  lldb::ByteOrder GetVectorElementOrder() const override;
+
 private:
   static std::unique_ptr Create(const ArchSpec &arch);
-  ArchitecturePPC64() = default;
+  ArchitecturePPC64(lldb::ByteOrder vector_element_order)

dsandersllvm wrote:

It's not the only big-endian target but it is the only target I know of where 
the order of vector elements doesn't match LLVM-IR's order. MIPS  and ARM both 
have big-endian modes but vectors are 0-element first in both endians whereas 
big-endian PowerPC is highest-indexed element first. If I hadn't handled this 
then we'd read/write their vectors in reversed element order every time we 
tried to copy memory to/from an LLVM-IR value.

MIPS and ARM's vector layout has a different quirk on LLVM-IR/memory which is 
that bitcast isn't a no-op, it's a shuffle (which bytes swaps depends on the 
types involved). This is because it's defined as a store of the original type 
followed by a load of the new type. I haven't implemented this yet because I 
didn't need to support vector bitcast.

https://github.com/llvm/llvm-project/pull/155000
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [Clang][PowerPC] Add __dmr2048 type and DMF crypto builtins (PR #157152)

2025-09-07 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-backend-powerpc

@llvm/pr-subscribers-clang

Author: Maryam Moghadas (maryammo)


Changes



---

Patch is 22.86 KiB, truncated to 20.00 KiB below, full version: 
https://github.com/llvm/llvm-project/pull/157152.diff


11 Files Affected:

- (modified) clang/include/clang/Basic/BuiltinsPPC.def (+7) 
- (modified) clang/include/clang/Basic/PPCTypes.def (+1) 
- (modified) clang/lib/AST/ASTContext.cpp (+1) 
- (modified) clang/lib/CodeGen/TargetBuiltins/PPC.cpp (+2-1) 
- (modified) clang/test/AST/ast-dump-ppc-types.c (+2) 
- (modified) clang/test/CodeGen/PowerPC/builtins-ppc-dmf.c (+41) 
- (modified) clang/test/CodeGen/PowerPC/ppc-dmf-mma-builtin-err.c (+8-1) 
- (modified) clang/test/CodeGen/PowerPC/ppc-dmf-types.c (+156) 
- (modified) clang/test/CodeGenCXX/ppc-mangle-mma-types.cpp (+3) 
- (modified) clang/test/Sema/ppc-dmf-types.c (+100-14) 
- (modified) lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp (+1) 


``diff
diff --git a/clang/include/clang/Basic/BuiltinsPPC.def 
b/clang/include/clang/Basic/BuiltinsPPC.def
index 22926b6a7d095..017ae65bdafff 100644
--- a/clang/include/clang/Basic/BuiltinsPPC.def
+++ b/clang/include/clang/Basic/BuiltinsPPC.def
@@ -1123,6 +1123,13 @@ UNALIASED_CUSTOM_MMA_BUILTIN(mma_xvbf16ger2, "vW512*VV",
 UNALIASED_CUSTOM_MMA_BUILTIN(mma_pmxvbf16ger2, "vW512*VVi15i15i3",
  "mma,paired-vector-memops")
 
+UNALIASED_CUSTOM_BUILTIN(mma_dmsha2hash, "vW1024*W1024*Ii", true,
+ "mma,isa-future-instructions")
+UNALIASED_CUSTOM_BUILTIN(mma_dmsha3hash, "vW2048*Ii", true,
+ "mma,isa-future-instructions")
+UNALIASED_CUSTOM_BUILTIN(mma_dmxxshapad, "vW1024*VIiIiIi", true,
+ "mma,isa-future-instructions")
+
 // FIXME: Obviously incomplete.
 
 #undef BUILTIN
diff --git a/clang/include/clang/Basic/PPCTypes.def 
b/clang/include/clang/Basic/PPCTypes.def
index fc4155ca98b2d..9c0fa9198d5b1 100644
--- a/clang/include/clang/Basic/PPCTypes.def
+++ b/clang/include/clang/Basic/PPCTypes.def
@@ -30,6 +30,7 @@
 #endif
 
 
+PPC_VECTOR_MMA_TYPE(__dmr2048, DMR2048, 2048)
 PPC_VECTOR_MMA_TYPE(__dmr1024, DMR1024, 1024)
 PPC_VECTOR_MMA_TYPE(__vector_quad, VectorQuad, 512)
 PPC_VECTOR_VSX_TYPE(__vector_pair, VectorPair, 256)
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index dca05b41aee77..a5ead63f99680 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -3519,6 +3519,7 @@ static void encodeTypeForFunctionPointerAuth(const 
ASTContext &Ctx,
 case BuiltinType::VectorQuad:
 case BuiltinType::VectorPair:
 case BuiltinType::DMR1024:
+case BuiltinType::DMR2048:
   OS << "?";
   return;
 
diff --git a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp 
b/clang/lib/CodeGen/TargetBuiltins/PPC.cpp
index ba65cf1ce9b90..e71dc9ea523a2 100644
--- a/clang/lib/CodeGen/TargetBuiltins/PPC.cpp
+++ b/clang/lib/CodeGen/TargetBuiltins/PPC.cpp
@@ -1153,7 +1153,8 @@ Value *CodeGenFunction::EmitPPCBuiltinExpr(unsigned 
BuiltinID,
 }
 if (BuiltinID == PPC::BI__builtin_mma_dmmr ||
 BuiltinID == PPC::BI__builtin_mma_dmxor ||
-BuiltinID == PPC::BI__builtin_mma_disassemble_dmr) {
+BuiltinID == PPC::BI__builtin_mma_disassemble_dmr ||
+BuiltinID == PPC::BI__builtin_mma_dmsha2hash) {
   Address Addr = EmitPointerWithAlignment(E->getArg(1));
   Ops[1] = Builder.CreateLoad(Addr);
 }
diff --git a/clang/test/AST/ast-dump-ppc-types.c 
b/clang/test/AST/ast-dump-ppc-types.c
index 1c860c268e0ec..25f36f64dde79 100644
--- a/clang/test/AST/ast-dump-ppc-types.c
+++ b/clang/test/AST/ast-dump-ppc-types.c
@@ -17,6 +17,8 @@
 // are correctly defined. We also added checks on a couple of other targets to
 // ensure the types are target-dependent.
 
+// CHECK: TypedefDecl {{.*}} implicit __dmr2048 '__dmr2048'
+//  CHECK: `-BuiltinType {{.*}} '__dmr2048'
 // CHECK: TypedefDecl {{.*}} implicit __dmr1024 '__dmr1024'
 // CHECK: `-BuiltinType {{.*}} '__dmr1024'
 // CHECK: TypedefDecl {{.*}} implicit __vector_quad '__vector_quad'
diff --git a/clang/test/CodeGen/PowerPC/builtins-ppc-dmf.c 
b/clang/test/CodeGen/PowerPC/builtins-ppc-dmf.c
index c66f5e2a32919..e0d709802d876 100644
--- a/clang/test/CodeGen/PowerPC/builtins-ppc-dmf.c
+++ b/clang/test/CodeGen/PowerPC/builtins-ppc-dmf.c
@@ -126,3 +126,44 @@ void test_dmf_basic2(char *p1, char *res1, char *res2,
   __builtin_mma_build_dmr((__dmr1024*)res2, vv, vv, vv, vv, vv, vv, vv, vv);
   __builtin_mma_disassemble_dmr(res1, (__dmr1024*)p1);
 }
+
+// CHECK-LABEL: @test_dmsha2hash(
+// CHECK-NEXT:  entry:
+// CHECK-NEXT:[[TMP0:%.*]] = load <1024 x i1>, ptr [[VDMRP1:%.*]], align 
128, !tbaa [[TBAA6]]
+// CHECK-NEXT:[[TMP1:%.*]] = load <1024 x i1>, ptr [[VDMRP2:%.*]], align 
128, !tbaa [[TBAA6]]
+// CHECK-NEXT:[[TMP2:%.*]] = tail call <1024 x i1> 
@llvm.ppc.mma.dmsha2hash(<1024 x i1> [[TMP0]], <1024 x i1> [[TMP1]], i32 1)
+// CHECK-NEXT:store <1024 x

[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)

2025-09-07 Thread Michael Buch via lldb-commits

https://github.com/Michael137 milestoned 
https://github.com/llvm/llvm-project/pull/156050
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)

2025-09-07 Thread via lldb-commits


@@ -327,6 +366,11 @@ serveConnection(const Socket::SocketProtocol &protocol, 
const std::string &name,
   std::unique_lock lock(dap_sessions_mutex);
   dap_sessions.erase(&loop);
   std::notify_all_at_thread_exit(dap_sessions_condition, std::move(lock));
+
+  // Start the countdown to kill the server at the end of each connection.

jeffreytan81 wrote:

Why are we kill the server at the end of each connection? There can still be 
other alive connections. 
I do not think this is the behavior we wanted. You want to kill the server for 
the last connection. 

https://github.com/llvm/llvm-project/pull/156803
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Added a check for the specialization existence (PR #154123)

2025-09-07 Thread via lldb-commits

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 origin/main HEAD --extensions cpp -- 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp
``

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index 1b0a36c67..77f2e5f24 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1912,10 +1912,10 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   class_template_decl->AddSpecialization(class_specialization_decl,
  InsertPos);
 else {
-  module_sp->ReportError(
-  "SymbolFileDWARF({0:p}) - Specialization for "
-  "clang::ClassTemplateDecl({1:p}) already exists.",
-  static_cast(this), static_cast(class_template_decl));
+  module_sp->ReportError("SymbolFileDWARF({0:p}) - Specialization for "
+ "clang::ClassTemplateDecl({1:p}) already exists.",
+ static_cast(this),
+ static_cast(class_template_decl));
   return TypeSP();
 }
 

``




https://github.com/llvm/llvm-project/pull/154123
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][NFC] Architecture plugins should report the vector element order (PR #157198)

2025-09-07 Thread Michael Buch via lldb-commits

Michael137 wrote:

> Some targets like PowerPC store their

Is there some text missing here?

https://github.com/llvm/llvm-project/pull/157198
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Add utility to create Mach-O corefile from YAML desc (PR #153911)

2025-09-07 Thread Dmitry Vasilyev via lldb-commits

slydiman wrote:

lldb-remote-linux-win uses Windows host to build and run tests on AArch64 Linux.
Use @skipIf(hostoslist=["windows"]) instead of @skipIfWindows.

https://github.com/llvm/llvm-project/pull/153911
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Make internal shell the default for running LLDB lit tests. (PR #156729)

2025-09-07 Thread Aiden Grossman via lldb-commits

boomanaiden154 wrote:

> Ok, I will revert this and try to work out how to test/fix the issues on 
> windows (I wonder why it passed the windows CI premerge tests).

It might be picking up a different `sed` binary now rather than a reasonably 
consistent one used by bash.

> Maybe not? The failing test has already been updated and marked as 
> 'Unsupported' on windows?

Probably still good to fix the TODO there if possible.

https://github.com/llvm/llvm-project/pull/156729
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] Default-initialize all fields of lldb_dap::protocol::Symbol. (PR #157150)

2025-09-07 Thread Jonas Devlieghere via lldb-commits


@@ -50,29 +50,29 @@ llvm::json::Value toJSON(const SourceLLDBData &);
 
 struct Symbol {
   /// The symbol id, usually the original symbol table index.
-  uint32_t id;
+  uint32_t id = 0;
 
   /// True if this symbol is debug information in a symbol.
-  bool isDebug;
+  bool isDebug = false;
 
   /// True if this symbol is not actually in the symbol table, but synthesized
   /// from other info in the object file.
-  bool isSynthetic;
+  bool isSynthetic = false;
 
   /// True if this symbol is globally visible.
-  bool isExternal;
+  bool isExternal = false;
 
   /// The symbol type.
-  lldb::SymbolType type;
+  lldb::SymbolType type = lldb::eSymbolTypeInvalid;
 
   /// The symbol file address.
-  lldb::addr_t fileAddress;
+  lldb::addr_t fileAddress = 0;

JDevlieghere wrote:

```suggestion
  lldb::addr_t fileAddress = LLDB_INVALID_ADDRESS;
```

https://github.com/llvm/llvm-project/pull/157150
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)

2025-09-07 Thread Roy Shi via lldb-commits

https://github.com/royitaqi edited 
https://github.com/llvm/llvm-project/pull/156803
___
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] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)

2025-09-07 Thread Rick van Voorden via lldb-commits

https://github.com/vanvoorden edited 
https://github.com/llvm/llvm-project/pull/156995
___
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] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)

2025-09-07 Thread Rick van Voorden via lldb-commits

https://github.com/vanvoorden edited 
https://github.com/llvm/llvm-project/pull/156995
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Introduce ScriptedFrame affordance (PR #149622)

2025-09-07 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben closed 
https://github.com/llvm/llvm-project/pull/149622
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb] Introduce ScriptedFrame affordance (PR #149622)

2025-09-07 Thread Med Ismail Bennani via lldb-commits

https://github.com/medismailben updated 
https://github.com/llvm/llvm-project/pull/149622

>From d5d9e01134e0cf78974cd5f50f028bd71756c24f Mon Sep 17 00:00:00 2001
From: Med Ismail Bennani 
Date: Thu, 4 Sep 2025 14:59:44 -0700
Subject: [PATCH] [lldb] Introduce ScriptedFrame affordance

This patch introduces a new scripting affordance in lldb:  `ScriptedFrame`.

This allows user to produce mock stackframes in scripted threads and
scripted processes from a python script.

With this change, StackFrame can be synthetized from different sources:
- Either from a dictionary containing a load address, and a frame index,
  which is the legacy way.
- Or by creating a ScriptedFrame python object.

One particularity of synthezising stackframes from the ScriptedFrame
python object, is that these frame have an optional PC, meaning that
they don't have a report a valid PC and they can act as shells that just
contain static information, like the frame function name, the list of
variables or registers, etc. It can also provide a symbol context.

rdar://157260006

Signed-off-by: Med Ismail Bennani 
---
 .../python/templates/scripted_process.py  | 136 +
 lldb/include/lldb/API/SBSymbolContext.h   |   1 +
 .../Interfaces/ScriptedFrameInterface.h   |  55 +
 .../Interfaces/ScriptedThreadInterface.h  |  10 +
 .../lldb/Interpreter/ScriptInterpreter.h  |   5 +
 lldb/include/lldb/Target/StackFrame.h |  34 ++--
 lldb/include/lldb/lldb-forward.h  |   3 +
 lldb/source/Core/FormatEntity.cpp |   2 +-
 .../Plugins/Process/scripted/CMakeLists.txt   |   1 +
 .../Process/scripted/ScriptedFrame.cpp| 191 ++
 .../Plugins/Process/scripted/ScriptedFrame.h  |  63 ++
 .../Process/scripted/ScriptedThread.cpp   |  82 +++-
 .../Plugins/Process/scripted/ScriptedThread.h |   5 +-
 .../Python/Interfaces/CMakeLists.txt  |   1 +
 .../ScriptInterpreterPythonInterfaces.h   |   1 +
 .../ScriptedFramePythonInterface.cpp  | 157 ++
 .../Interfaces/ScriptedFramePythonInterface.h |  59 ++
 .../Interfaces/ScriptedPythonInterface.cpp|   3 +-
 .../ScriptedThreadPythonInterface.cpp |  17 ++
 .../ScriptedThreadPythonInterface.h   |   5 +
 .../Python/ScriptInterpreterPython.cpp|   5 +
 .../Python/ScriptInterpreterPythonImpl.h  |   2 +
 .../dummy_scripted_process.py |  65 +-
 23 files changed, 871 insertions(+), 32 deletions(-)
 create mode 100644 
lldb/include/lldb/Interpreter/Interfaces/ScriptedFrameInterface.h
 create mode 100644 lldb/source/Plugins/Process/scripted/ScriptedFrame.cpp
 create mode 100644 lldb/source/Plugins/Process/scripted/ScriptedFrame.h
 create mode 100644 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.cpp
 create mode 100644 
lldb/source/Plugins/ScriptInterpreter/Python/Interfaces/ScriptedFramePythonInterface.h

diff --git a/lldb/examples/python/templates/scripted_process.py 
b/lldb/examples/python/templates/scripted_process.py
index b6360b8519077..49059d533f38a 100644
--- a/lldb/examples/python/templates/scripted_process.py
+++ b/lldb/examples/python/templates/scripted_process.py
@@ -383,6 +383,142 @@ def get_extended_info(self):
 """
 return self.extended_info
 
+def get_scripted_frame_plugin(self):
+"""Get scripted frame plugin name.
+
+Returns:
+str: Name of the scripted frame plugin.
+"""
+return None
+
+
+class ScriptedFrame(metaclass=ABCMeta):
+"""
+The base class for a scripted frame.
+
+Most of the base class methods are `@abstractmethod` that need to be
+overwritten by the inheriting class.
+"""
+
+@abstractmethod
+def __init__(self, thread, args):
+"""Construct a scripted frame.
+
+Args:
+thread (ScriptedThread): The thread owning this frame.
+args (lldb.SBStructuredData): A Dictionary holding arbitrary
+key/value pairs used by the scripted frame.
+"""
+self.target = None
+self.originating_thread = None
+self.thread = None
+self.args = None
+self.id = None
+self.name = None
+self.register_info = None
+self.register_ctx = {}
+self.variables = []
+
+if (
+isinstance(thread, ScriptedThread)
+or isinstance(thread, lldb.SBThread)
+and thread.IsValid()
+):
+self.target = thread.target
+self.process = thread.process
+self.originating_thread = thread
+self.thread = self.process.GetThreadByIndexID(thread.tid)
+self.get_register_info()
+
+@abstractmethod
+def get_id(self):
+"""Get the scripted frame identifier.
+
+Returns:
+int: The identifier of the scripted frame in the scripted thread.
+"""
+pass
+
+def get_pc(self):
+"""

[Lldb-commits] [lldb] [lldb][ElfCore] Improve main executable detection in core files (PR #157170)

2025-09-07 Thread via lldb-commits

https://github.com/GeorgeHuyubo created 
https://github.com/llvm/llvm-project/pull/157170

This change improves how LLDB's ProcessElfCore plugin identifies the main 
executable when loading ELF core files. Previously, the code would simply use 
the first entry in the NT_FILE section, which is not guaranteed to be the main 
executable, also the first entry might not have a valid UUID.

1. **Storing executable name**: Extract the executable name from the ELF 
NT_PRPSINFO note and store it in `m_executable_name`

2. **Preferential matching**: When selecting the main executable from NT_FILE 
entries, prefer entries whose path ends with the stored executable name

3. **UUID-based lookup**: Call `FindModuleUUID()` helper function to properly 
match modules by path and retrieve a valid UUID



>From 28869cdcde362c654b518fac7d9945d1d1ee823f Mon Sep 17 00:00:00 2001
From: George Hu 
Date: Fri, 5 Sep 2025 13:23:48 -0700
Subject: [PATCH] [lldb][ElfCore] Improve main executable detection in core
 files

---
 .../Plugins/Process/elf-core/ProcessElfCore.cpp  | 16 +---
 .../Plugins/Process/elf-core/ProcessElfCore.h|  3 +++
 2 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp 
b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
index 88eeddf178788..e88daebebfa7e 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.cpp
@@ -257,12 +257,21 @@ Status ProcessElfCore::DoLoadCore() {
   // the main executable using data we found in the core file notes.
   lldb::ModuleSP exe_module_sp = GetTarget().GetExecutableModule();
   if (!exe_module_sp) {
-// The first entry in the NT_FILE might be our executable
 if (!m_nt_file_entries.empty()) {
+  // The first entry in the NT_FILE might be our executable
+  llvm::StringRef executable_path = m_nt_file_entries[0].path;
+  // Prefer the NT_FILE entry matching m_executable_name as main 
executable.
+  for (const NT_FILE_Entry &file_entry : m_nt_file_entries)
+if (llvm::StringRef(file_entry.path)
+.ends_with("/" + m_executable_name)) {
+  executable_path = file_entry.path;
+  break;
+}
+
   ModuleSpec exe_module_spec;
   exe_module_spec.GetArchitecture() = arch;
-  exe_module_spec.GetUUID() = m_nt_file_entries[0].uuid;
-  exe_module_spec.GetFileSpec().SetFile(m_nt_file_entries[0].path,
+  exe_module_spec.GetUUID() = FindModuleUUID(executable_path);
+  exe_module_spec.GetFileSpec().SetFile(executable_path,
 FileSpec::Style::native);
   if (exe_module_spec.GetFileSpec()) {
 exe_module_sp =
@@ -935,6 +944,7 @@ llvm::Error 
ProcessElfCore::parseLinuxNotes(llvm::ArrayRef notes) {
 return status.ToError();
   thread_data.name.assign (prpsinfo.pr_fname, strnlen (prpsinfo.pr_fname, 
sizeof (prpsinfo.pr_fname)));
   SetID(prpsinfo.pr_pid);
+  m_executable_name = prpsinfo.pr_fname;
   break;
 }
 case ELF::NT_SIGINFO: {
diff --git a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h 
b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
index a91c04a277f60..601c8c4ed1b92 100644
--- a/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
+++ b/lldb/source/Plugins/Process/elf-core/ProcessElfCore.h
@@ -152,6 +152,9 @@ class ProcessElfCore : public 
lldb_private::PostMortemProcess {
   // NT_FILE entries found from the NOTE segment
   std::vector m_nt_file_entries;
 
+  // Executable name found from the ELF PRPSINFO
+  std::string m_executable_name;
+
   // Parse thread(s) data structures(prstatus, prpsinfo) from given NOTE 
segment
   llvm::Error ParseThreadContextsFromNoteSegment(
   const elf::ELFProgramHeader &segment_header,

___
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] [compiler-rt] [flang] [libcxx] [libcxxabi] [lld] [lldb] [llvm] [Inclusive Language] migrate "sanity" checks to "soundness" checks (PR #156995)

2025-09-07 Thread Rick van Voorden via lldb-commits

vanvoorden wrote:

> I'd like to see this massive change to be backed by an RFC on Discourse.

@Endilll Fair enough… I opened an RFC pitch thread on the forums. Thanks!

https://github.com/llvm/llvm-project/pull/156995
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [LLDB] Make internal shell the default for running LLDB lit tests. (PR #156729)

2025-09-07 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Same on Windows on Arm: 
https://lab.llvm.org/buildbot/#/builders/141/builds/11277

```
 TEST 'lldb-shell :: Process/UnsupportedLanguage.test' 
FAILED 
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 3
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe 
--target=specify-a-target-or-use-a-_host-substitution 
--target=aarch64-pc-windows-msvc 
-fmodules-cache-path=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-shell
 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Process/Inputs/true.c
 -std=c99 -g -c -S -emit-llvm -o -| sed -e 
's/DW_LANG_C99/DW_LANG_Mips_Assembler/g' 
>C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.ll
# executed command: 
'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe' 
--target=specify-a-target-or-use-a-_host-substitution 
--target=aarch64-pc-windows-msvc 
'-fmodules-cache-path=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-shell'
 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Process/Inputs/true.c'
 -std=c99 -g -c -S -emit-llvm -o -
# .---command stderr
# | clang: warning: argument unused during compilation: 
'-fmodules-cache-path=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-shell'
 [-Wunused-command-line-argument]
# | clang: warning: argument unused during compilation: '-c' 
[-Wunused-command-line-argument]
# `-
# executed command: sed -e s/DW_LANG_C99/DW_LANG_Mips_Assembler/g
# note: command had no output on stdout or stderr
# RUN: at line 5
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe 
--target=specify-a-target-or-use-a-_host-substitution 
--target=aarch64-pc-windows-msvc 
-fmodules-cache-path=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-shell
 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.ll
 -g -o 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe
# executed command: 
'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe' 
--target=specify-a-target-or-use-a-_host-substitution 
--target=aarch64-pc-windows-msvc 
'-fmodules-cache-path=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-shell'
 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.ll'
 -g -o 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe'
# .---command stderr
# | clang: warning: argument unused during compilation: 
'-fmodules-cache-path=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-shell'
 [-Wunused-command-line-argument]
# `-
# RUN: at line 6
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lldb.exe --no-lldbinit 
-S 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb\test\Shell\lit-lldb-init-quiet
 -o "b main" -o r -o q -b 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe
 2>&1 | c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\filecheck.exe 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Process\UnsupportedLanguage.test
 --check-prefix ASM
# executed command: 
'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\lldb.exe' 
--no-lldbinit -S 
'C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb\test\Shell\lit-lldb-init-quiet'
 -o 'b main' -o r -o q -b 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\tools\lldb\test\Shell\Process\Output\UnsupportedLanguage.test.tmp.exe'
# note: command had no output on stdout or stderr
# executed command: 
'c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\filecheck.exe' 
'C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Process\UnsupportedLanguage.test'
 --check-prefix ASM
# note: command had no output on stdout or stderr
# RUN: at line 10
c:\users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe 
--target=specify-a-target-or-use-a-_host-substitution 
--target=aarch64-pc-windows-msvc 
-fmodules-cache-path=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-shell
 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\Shell\Process/Inputs/true.c
 -std=c99 -g -c -S -emit-llvm -o -| sed -e 
's/DW_LANG_C99/DW_LANG_Cobol74/g' 
>C:\Users\tcwg\llvm-worker\lldb-aarch64-wind

[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)

2025-09-07 Thread Igor Kudrin via lldb-commits


@@ -152,6 +152,11 @@ constexpr RegsetDesc AARCH64_GCS_Desc[] = {
 {llvm::Triple::Linux, llvm::Triple::aarch64, llvm::ELF::NT_ARM_GCS},
 };
 
+constexpr RegsetDesc ARM_VFP_Desc[] = {
+{llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, llvm::ELF::NT_ARM_VFP},
+{llvm::Triple::Linux, llvm::Triple::UnknownArch, llvm::ELF::NT_ARM_VFP},

igorkudrin wrote:

Done

https://github.com/llvm/llvm-project/pull/155956
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][Instrumentation] Set selected frame to outside sanitizer libraries (PR #133079)

2025-09-07 Thread Michael Buch via lldb-commits

https://github.com/Michael137 updated 
https://github.com/llvm/llvm-project/pull/133079

>From 2314f9e584d736ce2093cc196c7c57c2087cde42 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Wed, 26 Mar 2025 12:54:36 +
Subject: [PATCH 1/3] [lldb][Instrumentation] Set selected frame to outside
 sanitizer libraries

---
 .../Target/InstrumentationRuntimeStopInfo.h   |  3 ++
 lldb/include/lldb/Target/StackFrameList.h |  2 +
 lldb/include/lldb/Target/Thread.h |  4 ++
 .../Target/InstrumentationRuntimeStopInfo.cpp | 42 +++
 lldb/source/Target/Process.cpp|  2 +
 5 files changed, 53 insertions(+)

diff --git a/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h 
b/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h
index 5345160850914..dafa41c11327a 100644
--- a/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h
+++ b/lldb/include/lldb/Target/InstrumentationRuntimeStopInfo.h
@@ -24,6 +24,9 @@ class InstrumentationRuntimeStopInfo : public StopInfo {
 return lldb::eStopReasonInstrumentation;
   }
 
+  std::optional
+  GetSuggestedStackFrameIndex(bool inlined_stack) override;
+
   const char *GetDescription() override;
 
   bool DoShouldNotify(Event *event_ptr) override { return true; }
diff --git a/lldb/include/lldb/Target/StackFrameList.h 
b/lldb/include/lldb/Target/StackFrameList.h
index 8a66296346f2d..be6ec3b09d8aa 100644
--- a/lldb/include/lldb/Target/StackFrameList.h
+++ b/lldb/include/lldb/Target/StackFrameList.h
@@ -36,6 +36,8 @@ class StackFrameList {
   /// Get the frame at index \p idx. Invisible frames cannot be indexed.
   lldb::StackFrameSP GetFrameAtIndex(uint32_t idx);
 
+  void ResetSuggestedStackFrameIndex() { m_selected_frame_idx.reset(); }
+
   /// Get the first concrete frame with index greater than or equal to \p idx.
   /// Unlike \ref GetFrameAtIndex, this cannot return a synthetic frame.
   lldb::StackFrameSP GetFrameWithConcreteFrameIndex(uint32_t unwind_idx);
diff --git a/lldb/include/lldb/Target/Thread.h 
b/lldb/include/lldb/Target/Thread.h
index 1d1e3dcfc1dc6..747d7299025f8 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -433,6 +433,10 @@ class Thread : public std::enable_shared_from_this,
 return GetStackFrameList()->GetFrameAtIndex(idx);
   }
 
+  virtual void ResetSuggestedStackFrameIndex() {
+return GetStackFrameList()->ResetSuggestedStackFrameIndex();
+  }
+
   virtual lldb::StackFrameSP
   GetFrameWithConcreteFrameIndex(uint32_t unwind_idx);
 
diff --git a/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp 
b/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp
index 7f82581cc601e..1daeebdbaf9c7 100644
--- a/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp
+++ b/lldb/source/Target/InstrumentationRuntimeStopInfo.cpp
@@ -8,13 +8,20 @@
 
 #include "lldb/Target/InstrumentationRuntimeStopInfo.h"
 
+#include "lldb/Core/Module.h"
 #include "lldb/Target/InstrumentationRuntime.h"
 #include "lldb/Target/Process.h"
+#include "lldb/lldb-enumerations.h"
 #include "lldb/lldb-private.h"
 
 using namespace lldb;
 using namespace lldb_private;
 
+static bool IsStoppedInDarwinSanitizer(Thread &thread, Module &module) {
+  return module.GetFileSpec().GetFilename().GetStringRef().starts_with(
+  "libclang_rt.");
+}
+
 InstrumentationRuntimeStopInfo::InstrumentationRuntimeStopInfo(
 Thread &thread, std::string description,
 StructuredData::ObjectSP additional_data)
@@ -34,3 +41,38 @@ 
InstrumentationRuntimeStopInfo::CreateStopReasonWithInstrumentationData(
   return StopInfoSP(
   new InstrumentationRuntimeStopInfo(thread, description, additionalData));
 }
+
+std::optional
+InstrumentationRuntimeStopInfo::GetSuggestedStackFrameIndex(
+bool inlined_stack) {
+  auto thread_sp = GetThread();
+  if (!thread_sp)
+return std::nullopt;
+
+  // Defensive upper-bound of when we stop walking up the frames in
+  // case we somehow ended up looking at an infinite recursion.
+  const size_t max_stack_depth = 128;
+
+  // Start at parent frame.
+  size_t stack_idx = 1;
+  StackFrameSP most_relevant_frame_sp =
+  thread_sp->GetStackFrameAtIndex(stack_idx);
+
+  while (most_relevant_frame_sp && stack_idx <= max_stack_depth) {
+auto const &sc =
+most_relevant_frame_sp->GetSymbolContext(lldb::eSymbolContextModule);
+
+if (!sc.module_sp)
+  return std::nullopt;
+
+// Found a frame outside of the sanitizer runtime libraries.
+// That's the one we want to display.
+if (!IsStoppedInDarwinSanitizer(*thread_sp, *sc.module_sp))
+  return stack_idx;
+
+++stack_idx;
+most_relevant_frame_sp = thread_sp->GetStackFrameAtIndex(stack_idx);
+  }
+
+  return stack_idx;
+}
diff --git a/lldb/source/Target/Process.cpp b/lldb/source/Target/Process.cpp
index f2f5598f0ab53..f82cea2d668ed 100644
--- a/lldb/source/Target/Process.cpp
+++ b/lldb/source/Target/Process.cpp
@@ -4257,6 +4257,8 @@ bool Process::ProcessEventData::ShouldStop(Event 
*eve

[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Added a check for the specialization existence (PR #154123)

2025-09-07 Thread via lldb-commits

tgs-sc wrote:

@Michael137, can you please take a look as a week has passed? I added unittest 
and updated godbolt reproduction.

https://github.com/llvm/llvm-project/pull/154123
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (PR #156050)

2025-09-07 Thread Michael Buch via lldb-commits

https://github.com/Michael137 closed 
https://github.com/llvm/llvm-project/pull/156050
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [llvm] Remove filegroup rules for .pyi files removed in 22c2e15408553b2c172d407a8ee417adc2a93757 (PR #157178)

2025-09-07 Thread via lldb-commits

https://github.com/lexi-nadia closed 
https://github.com/llvm/llvm-project/pull/157178
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)

2025-09-07 Thread Igor Kudrin via lldb-commits

https://github.com/igorkudrin updated 
https://github.com/llvm/llvm-project/pull/155956

>From b1348c5099d6071b08872b0bba67b8468c86c6fe Mon Sep 17 00:00:00 2001
From: Igor Kudrin 
Date: Thu, 28 Aug 2025 14:39:37 -0700
Subject: [PATCH 1/5] [lldb][elf-core][ARM] Add support for VFP registers

This patch loads values of the VFP registers from the NT_ARM_VFP note.
Note that a CORE/NT_FPREGSET note is typically present in core dump
files and used to store the FPA registers. The FPA unit is rare and
obsolete; however, at least Linux and FreeBSD create the note even if
the unit is absent.
---
 .../elf-core/RegisterContextPOSIXCore_arm.cpp |  21 ++
 .../elf-core/RegisterContextPOSIXCore_arm.h   |   1 +
 .../Process/elf-core/RegisterUtilities.cpp|   2 +-
 .../Process/elf-core/RegisterUtilities.h  |   4 
 .../postmortem/elf-core/TestLinuxCore.py  |  21 ++
 .../postmortem/elf-core/linux-arm.core| Bin 252 -> 532 bytes
 6 files changed, 48 insertions(+), 1 deletion(-)

diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
index 3a62081827c6a..acfa1103d62f0 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
@@ -23,6 +23,10 @@ RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(
   gpregset.GetByteSize());
   m_gpr.SetData(m_gpr_buffer);
   m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+  const llvm::Triple &target_triple =
+  m_register_info_up->GetTargetArchitecture().GetTriple();
+  m_fpr = getRegset(notes, target_triple, ARM_VFP_Desc);
 }
 
 RegisterContextCorePOSIX_arm::~RegisterContextCorePOSIX_arm() = default;
@@ -51,6 +55,23 @@ bool RegisterContextCorePOSIX_arm::ReadRegister(const 
RegisterInfo *reg_info,
   return true;
 }
   }
+
+  const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
+  if (reg == LLDB_INVALID_REGNUM)
+return false;
+
+  if (IsFPR(reg)) {
+assert(offset >= GetGPRSize());
+offset -= GetGPRSize();
+if (m_fpr.ValidOffsetForDataOfSize(offset, reg_info->byte_size)) {
+  Status error;
+  value.SetFromMemoryData(*reg_info, m_fpr.GetDataStart() + offset,
+  reg_info->byte_size, lldb::eByteOrderLittle,
+  error);
+  return error.Success();
+}
+  }
+
   return false;
 }
 
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
index 8d773a046bcac..e466ee242181b 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
@@ -48,6 +48,7 @@ class RegisterContextCorePOSIX_arm : public 
RegisterContextPOSIX_arm {
 private:
   lldb::DataBufferSP m_gpr_buffer;
   lldb_private::DataExtractor m_gpr;
+  lldb_private::DataExtractor m_fpr;
 };
 
 #endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM_H
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
index 7455d78774ee6..0100c2fdbd34b 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
@@ -16,7 +16,7 @@ static std::optional
 getNoteType(const llvm::Triple &Triple,
 llvm::ArrayRef RegsetDescs) {
   for (const auto &Entry : RegsetDescs) {
-if (Entry.OS != Triple.getOS())
+if (Entry.OS != llvm::Triple::UnknownOS && Entry.OS != Triple.getOS())
   continue;
 if (Entry.Arch != llvm::Triple::UnknownArch &&
 Entry.Arch != Triple.getArch())
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h 
b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
index 59382a12cde0a..645ec363768e9 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
@@ -152,6 +152,10 @@ constexpr RegsetDesc AARCH64_GCS_Desc[] = {
 {llvm::Triple::Linux, llvm::Triple::aarch64, llvm::ELF::NT_ARM_GCS},
 };
 
+constexpr RegsetDesc ARM_VFP_Desc[] = {
+{llvm::Triple::UnknownOS, llvm::Triple::arm, llvm::ELF::NT_ARM_VFP},
+};
+
 constexpr RegsetDesc PPC_VMX_Desc[] = {
 {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, llvm::ELF::NT_PPC_VMX},
 {llvm::Triple::Linux, llvm::Triple::UnknownArch, llvm::ELF::NT_PPC_VMX},
diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py 
b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
index a68175dc4e4d7..d8b389fab0170 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -688,6 +688,27 

[Lldb-commits] [lldb] a862225 - [lldb][DWARFASTParserClang] Don't complete conflicting Objective-C++ types (#156681)

2025-09-07 Thread via lldb-commits

Author: Michael Buch
Date: 2025-09-03T20:04:53+01:00
New Revision: a862225813c251c28b085603b7d32d4b111dbc57

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

LOG: [lldb][DWARFASTParserClang] Don't complete conflicting Objective-C++ types 
(#156681)

This upstreams https://github.com/swiftlang/llvm-project/pull/10313.

If we detect a situation where a forward declaration is C++ and the
definition DIE is Objective-C, then just don't try to complete the type
(it would crash otherwise). In the long term we might want to add
support for completing such types.

We've seen real world crashes when debugging WebKit and wxWidgets
because of this. Both projects forward declare ObjC++ decls in the way
shown in the test.

rdar://145959981

Added: 
lldb/test/Shell/SymbolFile/DWARF/objcxx-forward-decls.test

Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index a429ea848b7f7..0f1f41baced86 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -2230,6 +2230,18 @@ bool DWARFASTParserClang::CompleteRecordType(const 
DWARFDIE &die,
   for (DelayedAddObjCClassProperty &property : delayed_properties)
 property.Finalize();
 }
+  } else if (Language::LanguageIsObjC(
+ static_cast(die.GetAttributeValueAsUnsigned(
+ DW_AT_APPLE_runtime_class, eLanguageTypeUnknown {
+/// The forward declaration was C++ but the definition is Objective-C.
+/// We currently don't handle such situations. In such cases, keep the
+/// forward declaration without a definition to avoid violating Clang AST
+/// invariants.
+LLDB_LOG(GetLog(LLDBLog::Expressions),
+ "WARNING: Type completion aborted because forward declaration for 
"
+ "'{0}' is C++ while definition is Objective-C.",
+ llvm::StringRef(die.GetName()));
+return {};
   }
 
   if (!bases.empty()) {

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/objcxx-forward-decls.test 
b/lldb/test/Shell/SymbolFile/DWARF/objcxx-forward-decls.test
new file mode 100644
index 0..30109c2943c9b
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/objcxx-forward-decls.test
@@ -0,0 +1,70 @@
+# REQUIRES: system-darwin
+
+# In this test we have two CUs with conflicting forward declaration
+# depending on the CU language (one is C++ and the other is Objective-C++).
+# We are then stopped in the C++ CU and try to print the type, at which
+# point LLDB will try to make it into an Clang AST node. If LLDB were to
+# interpret the type as C++ instead of Objective-C, we'd violate Clang
+# invariants and crash.
+#
+# RUN: split-file %s %t
+# RUN: %clangxx_host -c -g -x objective-c++ %t/request.m -o %t/request_objc.o
+# RUN: %clangxx_host -c -g %t/main.cpp -o %t/main.o
+# RUN: %clangxx_host %t/main.o %t/request_objc.o -framework Foundation -o 
%t/a.out
+#
+# RUN: %lldb %t/a.out \
+# RUN:-o "breakpoint set -p return -X main" \
+# RUN:-o run \
+# RUN:-o "frame variable r" \
+# RUN:-o exit | FileCheck %s
+#
+# RUN: dsymutil %t/a.out
+#
+# RUN: %lldb %t/a.out \
+# RUN:-o "breakpoint set -p return -X main" \
+# RUN:-o run \
+# RUN:-o "frame variable r" \
+# RUN:-o exit | FileCheck %s --check-prefix=CHECK-DSYM
+
+# CHECK:  (lldb) frame variable r
+# CHECK-NEXT: (Request) ::r = (m_request = "Hello, World!")
+
+# CHECK-DSYM:  (lldb) frame variable r
+# CHECK-DSYM-NEXT: (Request) ::r = (m_request = "Hello, World!")
+
+#--- lib.h
+#ifndef LIB_H_IN
+#define LIB_H_IN
+
+#ifdef __OBJC__
+@class NSString;   
+#else
+class NSString;
+#endif
+
+struct Request {
+  NSString * m_request = nullptr;
+};
+
+#endif // _H_IN
+
+#--- main.cpp
+#include "lib.h"
+
+void process(Request *);
+
+Request r;
+
+int main() {
+process(&r);
+return 0;
+}
+
+#--- request.m
+#import 
+
+#include "lib.h"
+
+void process(Request * r) {
+  r->m_request = @"Hello, World!";
+}



___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb-dap] Add new optional argument `time-to-live` when using `--connection` (PR #156803)

2025-09-07 Thread Roy Shi via lldb-commits


@@ -327,6 +366,11 @@ serveConnection(const Socket::SocketProtocol &protocol, 
const std::string &name,
   std::unique_lock lock(dap_sessions_mutex);
   dap_sessions.erase(&loop);
   std::notify_all_at_thread_exit(dap_sessions_condition, std::move(lock));
+
+  // Start the countdown to kill the server at the end of each connection.

royitaqi wrote:

@jeffreytan81:  Thanks for the suggestions / good points.

> I would suggest only schedule callback for the last connections alive

Got it. I think the optimization makes sense (as you said, the existing logic 
is still needed). I will try to use `dap_sessions` to detect "I was the last 
connection alive".

--

> there seems to be a race condition here
I can be wrong (new to `MainLoopBase` and `MainLoopPosix`).

**TL;DR**: IIUC, there is no such race condition. This is guaranteed by 
`MainLoopPosix`, because:
- It handles all callbacks and read objects in sequence (see 
`MainLoopPosix::Run()`).
- It checks `m_terminate_request` before processing each read object (see 
`MainLoopPosix::RunImpl::ProcessReadEvents()`).

**Details**:
So, either of the following will happen:

**Case 1: Last connection times out first**: In this case, the timeout callback 
invokes `loop.RequestTermination()` and sets `m_terminate_request`. Then, the 
socket detects a new connection, but the callback given to `Accept()` is never 
invoked, because `m_terminate_request` is already set and the object read from 
the socket is discarded.

**Case 2: New client connects first**: In this case, the callback given to 
`Accept()` is invoked. It will reset the global variable before spinning the 
rest of the initiation into a separate thread. Then, the "last" connection's 
timeout callback is invoked. It will see that the global variable has been 
reset, so it won't request termination.

Kindly LMK if I missed anything.

With that said, I will move the `loop.RequestTermination()` call into the 
scoped lock, because it's a cheap operation anyways.

https://github.com/llvm/llvm-project/pull/156803
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)

2025-09-07 Thread Igor Kudrin via lldb-commits

https://github.com/igorkudrin updated 
https://github.com/llvm/llvm-project/pull/155956

>From b1348c5099d6071b08872b0bba67b8468c86c6fe Mon Sep 17 00:00:00 2001
From: Igor Kudrin 
Date: Thu, 28 Aug 2025 14:39:37 -0700
Subject: [PATCH 1/4] [lldb][elf-core][ARM] Add support for VFP registers

This patch loads values of the VFP registers from the NT_ARM_VFP note.
Note that a CORE/NT_FPREGSET note is typically present in core dump
files and used to store the FPA registers. The FPA unit is rare and
obsolete; however, at least Linux and FreeBSD create the note even if
the unit is absent.
---
 .../elf-core/RegisterContextPOSIXCore_arm.cpp |  21 ++
 .../elf-core/RegisterContextPOSIXCore_arm.h   |   1 +
 .../Process/elf-core/RegisterUtilities.cpp|   2 +-
 .../Process/elf-core/RegisterUtilities.h  |   4 
 .../postmortem/elf-core/TestLinuxCore.py  |  21 ++
 .../postmortem/elf-core/linux-arm.core| Bin 252 -> 532 bytes
 6 files changed, 48 insertions(+), 1 deletion(-)

diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
index 3a62081827c6a..acfa1103d62f0 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp
@@ -23,6 +23,10 @@ RegisterContextCorePOSIX_arm::RegisterContextCorePOSIX_arm(
   gpregset.GetByteSize());
   m_gpr.SetData(m_gpr_buffer);
   m_gpr.SetByteOrder(gpregset.GetByteOrder());
+
+  const llvm::Triple &target_triple =
+  m_register_info_up->GetTargetArchitecture().GetTriple();
+  m_fpr = getRegset(notes, target_triple, ARM_VFP_Desc);
 }
 
 RegisterContextCorePOSIX_arm::~RegisterContextCorePOSIX_arm() = default;
@@ -51,6 +55,23 @@ bool RegisterContextCorePOSIX_arm::ReadRegister(const 
RegisterInfo *reg_info,
   return true;
 }
   }
+
+  const uint32_t reg = reg_info->kinds[lldb::eRegisterKindLLDB];
+  if (reg == LLDB_INVALID_REGNUM)
+return false;
+
+  if (IsFPR(reg)) {
+assert(offset >= GetGPRSize());
+offset -= GetGPRSize();
+if (m_fpr.ValidOffsetForDataOfSize(offset, reg_info->byte_size)) {
+  Status error;
+  value.SetFromMemoryData(*reg_info, m_fpr.GetDataStart() + offset,
+  reg_info->byte_size, lldb::eByteOrderLittle,
+  error);
+  return error.Success();
+}
+  }
+
   return false;
 }
 
diff --git 
a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h 
b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
index 8d773a046bcac..e466ee242181b 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h
@@ -48,6 +48,7 @@ class RegisterContextCorePOSIX_arm : public 
RegisterContextPOSIX_arm {
 private:
   lldb::DataBufferSP m_gpr_buffer;
   lldb_private::DataExtractor m_gpr;
+  lldb_private::DataExtractor m_fpr;
 };
 
 #endif // LLDB_SOURCE_PLUGINS_PROCESS_ELF_CORE_REGISTERCONTEXTPOSIXCORE_ARM_H
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp 
b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
index 7455d78774ee6..0100c2fdbd34b 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.cpp
@@ -16,7 +16,7 @@ static std::optional
 getNoteType(const llvm::Triple &Triple,
 llvm::ArrayRef RegsetDescs) {
   for (const auto &Entry : RegsetDescs) {
-if (Entry.OS != Triple.getOS())
+if (Entry.OS != llvm::Triple::UnknownOS && Entry.OS != Triple.getOS())
   continue;
 if (Entry.Arch != llvm::Triple::UnknownArch &&
 Entry.Arch != Triple.getArch())
diff --git a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h 
b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
index 59382a12cde0a..645ec363768e9 100644
--- a/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
+++ b/lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
@@ -152,6 +152,10 @@ constexpr RegsetDesc AARCH64_GCS_Desc[] = {
 {llvm::Triple::Linux, llvm::Triple::aarch64, llvm::ELF::NT_ARM_GCS},
 };
 
+constexpr RegsetDesc ARM_VFP_Desc[] = {
+{llvm::Triple::UnknownOS, llvm::Triple::arm, llvm::ELF::NT_ARM_VFP},
+};
+
 constexpr RegsetDesc PPC_VMX_Desc[] = {
 {llvm::Triple::FreeBSD, llvm::Triple::UnknownArch, llvm::ELF::NT_PPC_VMX},
 {llvm::Triple::Linux, llvm::Triple::UnknownArch, llvm::ELF::NT_PPC_VMX},
diff --git a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py 
b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
index a68175dc4e4d7..d8b389fab0170 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -688,6 +688,27 

[Lldb-commits] [lldb] Default-initialize all fields of lldb_dap::protocol::Symbol. (PR #157150)

2025-09-07 Thread via lldb-commits

https://github.com/lexi-nadia created 
https://github.com/llvm/llvm-project/pull/157150

None

>From 088a1dd896e7bbb27e4be3a59fd241928e0fccfd Mon Sep 17 00:00:00 2001
From: lexinadia 
Date: Fri, 5 Sep 2025 17:40:29 +
Subject: [PATCH] Default-initialize all fields of lldb_dap::protocol::Symbol.

---
 .../Handler/ModuleSymbolsRequestHandler.cpp  |  2 +-
 lldb/tools/lldb-dap/Protocol/DAPTypes.h  | 16 
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/lldb/tools/lldb-dap/Handler/ModuleSymbolsRequestHandler.cpp 
b/lldb/tools/lldb-dap/Handler/ModuleSymbolsRequestHandler.cpp
index 4c61138e5007e..4a9d256cfa975 100644
--- a/lldb/tools/lldb-dap/Handler/ModuleSymbolsRequestHandler.cpp
+++ b/lldb/tools/lldb-dap/Handler/ModuleSymbolsRequestHandler.cpp
@@ -60,7 +60,7 @@ ModuleSymbolsRequestHandler::Run(const ModuleSymbolsArguments 
&args) const {
 if (!symbol.IsValid())
   continue;
 
-Symbol dap_symbol = {};
+Symbol dap_symbol;
 dap_symbol.id = symbol.GetID();
 dap_symbol.type = symbol.GetType();
 dap_symbol.isDebug = symbol.IsDebug();
diff --git a/lldb/tools/lldb-dap/Protocol/DAPTypes.h 
b/lldb/tools/lldb-dap/Protocol/DAPTypes.h
index 7fccf1359a737..17a25c092b8dd 100644
--- a/lldb/tools/lldb-dap/Protocol/DAPTypes.h
+++ b/lldb/tools/lldb-dap/Protocol/DAPTypes.h
@@ -50,29 +50,29 @@ llvm::json::Value toJSON(const SourceLLDBData &);
 
 struct Symbol {
   /// The symbol id, usually the original symbol table index.
-  uint32_t id;
+  uint32_t id = 0;
 
   /// True if this symbol is debug information in a symbol.
-  bool isDebug;
+  bool isDebug = false;
 
   /// True if this symbol is not actually in the symbol table, but synthesized
   /// from other info in the object file.
-  bool isSynthetic;
+  bool isSynthetic = false;
 
   /// True if this symbol is globally visible.
-  bool isExternal;
+  bool isExternal = false;
 
   /// The symbol type.
-  lldb::SymbolType type;
+  lldb::SymbolType type = lldb::eSymbolTypeInvalid;
 
   /// The symbol file address.
-  lldb::addr_t fileAddress;
+  lldb::addr_t fileAddress = 0;
 
   /// The symbol load address.
-  std::optional loadAddress;
+  std::optional loadAddress = std::nullopt;
 
   /// The symbol size.
-  lldb::addr_t size;
+  lldb::addr_t size = 0;
 
   /// The symbol name.
   std::string name;

___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][elf-core][ARM] Add support for VFP registers (PR #155956)

2025-09-07 Thread via lldb-commits

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 origin/main HEAD --extensions cpp,c,h -- 
lldb/test/API/functionalities/postmortem/elf-core/linux-arm-vfp.c 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.cpp 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm.h 
lldb/source/Plugins/Process/elf-core/RegisterUtilities.h
``

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:





View the diff from clang-format here.


``diff
diff --git a/lldb/test/API/functionalities/postmortem/elf-core/linux-arm-vfp.c 
b/lldb/test/API/functionalities/postmortem/elf-core/linux-arm-vfp.c
index 9cba59efa..90a728d83 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/linux-arm-vfp.c
+++ b/lldb/test/API/functionalities/postmortem/elf-core/linux-arm-vfp.c
@@ -1,4 +1,5 @@
-// commandline: -march=armv7+fp -nostdlib -static -Wl,--build-id=none 
linux-arm-vfp.c
+// commandline: -march=armv7+fp -nostdlib -static -Wl,--build-id=none
+// linux-arm-vfp.c
 
 static void foo(char *boom) {
   asm volatile(R"(
@@ -16,6 +17,4 @@ static void foo(char *boom) {
   *boom = 47;
 }
 
-void _start(void) {
-  foo(0);
-}
+void _start(void) { foo(0); }

``




https://github.com/llvm/llvm-project/pull/155956
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 4b362f1 - [lldb][DataFormatter] Allow std::string formatters to match against custom allocators (#156050)

2025-09-07 Thread via lldb-commits

Author: Michael Buch
Date: 2025-09-05T09:24:50+01:00
New Revision: 4b362f152e58abd6aeed5d603a6dfc10115ed1ab

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

LOG: [lldb][DataFormatter] Allow std::string formatters to match against custom 
allocators (#156050)

This came up in https://github.com/llvm/llvm-project/issues/155691.

For `std::basic_string` our formatter matching logic required the
allocator template parameter to be a `std::allocator`. There is no
compelling reason (that I know of) why this would be required for us to
apply the existing formatter to the string. We don't check the
`allocator` parameter for other STL containers either. This meant that
`std::string` that used custom allocators wouldn't be formatted. This
patch relaxes the regex for `basic_string`.

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/TestDataFormatterStdString.py

lldb/test/API/functionalities/data-formatter/data-formatter-stl/generic/string/main.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
index c39b529f7305a..277de8f444828 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp
@@ -749,31 +749,27 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
 lldb_private::formatters::LibcxxStringSummaryProviderASCII,
 "std::string summary provider",
 "^std::__[[:alnum:]]+::basic_string, "
-"std::__[[:alnum:]]+::allocator >$",
+"std::__[[:alnum:]]+::char_traits,.*>$",
 stl_summary_flags, true);
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxStringSummaryProviderASCII,
 "std::string summary provider",
 "^std::__[[:alnum:]]+::basic_string, "
-"std::__[[:alnum:]]+::allocator >$",
+"std::__[[:alnum:]]+::char_traits,.*>$",
 stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxStringSummaryProviderUTF16,
 "std::u16string summary provider",
 "^std::__[[:alnum:]]+::basic_string, "
-"std::__[[:alnum:]]+::allocator >$",
+"std::__[[:alnum:]]+::char_traits,.*>$",
 stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp,
 lldb_private::formatters::LibcxxStringSummaryProviderUTF32,
 "std::u32string summary provider",
 "^std::__[[:alnum:]]+::basic_string, "
-"std::__[[:alnum:]]+::allocator >$",
+"std::__[[:alnum:]]+::char_traits,.*>$",
 stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp,
@@ -784,8 +780,7 @@ static void LoadLibCxxFormatters(lldb::TypeCategoryImplSP 
cpp_category_sp) {
 lldb_private::formatters::LibcxxWStringSummaryProvider,
 "std::wstring summary provider",
 "^std::__[[:alnum:]]+::basic_string, "
-"std::__[[:alnum:]]+::allocator >$",
+"std::__[[:alnum:]]+::char_traits,.*>$",
 stl_summary_flags, true);
 
   AddCXXSummary(cpp_category_sp,
@@ -1301,24 +1296,16 @@ static void RegisterStdStringSummaryProvider(
 
   category_sp->AddTypeSummary(makeSpecifier(string_ty), summary_sp);
 
-  // std::basic_string
   category_sp->AddTypeSummary(
   makeSpecifier(llvm::formatv("std::basic_string<{}>", char_ty).str()),
   summary_sp);
-  // std::basic_string,std::allocator >
-  category_sp->AddTypeSummary(
-  
makeSpecifier(llvm::formatv("std::basic_string<{0},std::char_traits<{0}>,"
-  "std::allocator<{0}> >",
-  char_ty)
-.str()),
-  summary_sp);
-  // std::basic_string, std::allocator >
+
   category_sp->AddTypeSummary(
-  makeSpecifier(
-  llvm::formatv("std::basic_string<{0}, std::char_traits<{0}>, "
-"std::allocator<{0}> >",
+  std::make_shared(
+  llvm::formatv("^std::basic_string<{0}, ?std::char_traits<{0}>,.*>$",
 char_ty)
-  .str()),
+  .str(),
+  eFormatterMatchRegex),
   summary_sp);
 }
 
@@ -1363,20 +1350,17 @@ static void 
LoadLibStdcppFormatters(lldb::TypeCategoryImplSP cpp_category_sp) {
   cpp_category_sp->AddTypeSummary("std::__cxx11::string", eFormatterMatchExact,
   

[Lldb-commits] [clang] [lldb] [llvm] [mlir] MC: Add Triple overloads for more MC constructors (PR #157321)

2025-09-07 Thread Matt Arsenault via lldb-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/157321

>From 5f2205d454e38e63ab6d9ed2a41ff8d8b674ec6b Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Sun, 7 Sep 2025 09:03:22 +0900
Subject: [PATCH] MC: Add Triple overloads for more MC constructors

Avoids more Triple->string->Triple round trip. This
is a continuation of f137c3d592e96330e450a8fd63ef7e8877fc1908
---
 bolt/lib/Core/BinaryContext.cpp   |  6 +-
 clang/lib/Parse/ParseStmtAsm.cpp  |  9 +--
 clang/tools/driver/cc1as_main.cpp | 17 +++---
 .../Disassembler/LLVMC/DisassemblerLLVMC.cpp  |  5 +-
 .../MIPS/EmulateInstructionMIPS.cpp   | 17 +++---
 .../MIPS64/EmulateInstructionMIPS64.cpp   |  8 +--
 llvm/include/llvm/MC/TargetRegistry.h | 61 +++
 llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp | 10 +--
 .../lib/DWARFLinker/Classic/DWARFStreamer.cpp |  6 +-
 .../DWARFLinker/Parallel/DWARFEmitterImpl.cpp |  6 +-
 .../Parallel/DebugLineSectionEmitter.h|  6 +-
 .../LogicalView/Readers/LVBinaryReader.cpp| 15 ++---
 .../RuntimeDyld/RuntimeDyldChecker.cpp|  6 +-
 llvm/lib/MC/MCDisassembler/Disassembler.cpp   | 17 +++---
 llvm/lib/Object/ModuleSymbolTable.cpp |  7 +--
 llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp |  2 +-
 llvm/lib/Target/Mips/MipsAsmPrinter.cpp   |  3 +-
 .../llvm-cfi-verify/lib/FileAnalysis.cpp  |  8 ++-
 llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp  |  2 +-
 llvm/tools/llvm-dwp/llvm-dwp.cpp  |  7 ++-
 .../llvm-exegesis/lib/DisassemblerHelper.cpp  |  4 +-
 llvm/tools/llvm-exegesis/lib/LlvmState.cpp|  2 +-
 llvm/tools/llvm-jitlink/llvm-jitlink.cpp  |  6 +-
 llvm/tools/llvm-mc/Disassembler.cpp   | 21 ---
 llvm/tools/llvm-mc/Disassembler.h |  6 +-
 llvm/tools/llvm-mc/llvm-mc.cpp| 11 ++--
 llvm/tools/llvm-mca/llvm-mca.cpp  |  6 +-
 llvm/tools/llvm-ml/Disassembler.cpp   |  5 +-
 llvm/tools/llvm-ml/llvm-ml.cpp| 10 ++-
 llvm/tools/llvm-objdump/MachODump.cpp | 46 +++---
 llvm/tools/llvm-objdump/llvm-objdump.cpp  | 39 ++--
 llvm/tools/llvm-profgen/ProfiledBinary.cpp| 24 
 llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp| 10 +--
 llvm/tools/sancov/sancov.cpp  |  6 +-
 .../DWARFExpressionCompactPrinterTest.cpp |  2 +-
 .../DWARF/DWARFExpressionCopyBytesTest.cpp| 12 ++--
 .../DebugInfo/DWARF/DwarfGenerator.cpp|  6 +-
 llvm/unittests/MC/AMDGPU/Disassembler.cpp | 34 ++-
 llvm/unittests/MC/DwarfLineTableHeaders.cpp   | 20 +++---
 llvm/unittests/MC/DwarfLineTables.cpp | 13 ++--
 llvm/unittests/MC/MCInstPrinter.cpp   | 11 ++--
 .../MC/SystemZ/SystemZAsmLexerTest.cpp| 15 +++--
 .../MC/SystemZ/SystemZMCDisassemblerTest.cpp  | 14 ++---
 .../MC/X86/X86MCDisassemblerTest.cpp  | 15 ++---
 .../llvm-exegesis/AArch64/TargetTest.cpp  |  6 +-
 .../llvm-exegesis/PowerPC/AnalysisTest.cpp|  6 +-
 .../llvm-exegesis/PowerPC/TargetTest.cpp  |  6 +-
 llvm/unittests/tools/llvm-mca/MCATestBase.cpp |  8 +--
 mlir/lib/Target/LLVM/ROCDL/Target.cpp |  7 +--
 49 files changed, 323 insertions(+), 266 deletions(-)

diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index dd0d041692484..23a5a65c2c5f0 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -207,7 +207,7 @@ Expected> 
BinaryContext::createBinaryContext(
  Twine("BOLT-ERROR: ", Error));
 
   std::unique_ptr MRI(
-  TheTarget->createMCRegInfo(TripleName));
+  TheTarget->createMCRegInfo(TheTriple));
   if (!MRI)
 return createStringError(
 make_error_code(std::errc::not_supported),
@@ -215,7 +215,7 @@ Expected> 
BinaryContext::createBinaryContext(
 
   // Set up disassembler.
   std::unique_ptr AsmInfo(
-  TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions()));
+  TheTarget->createMCAsmInfo(*MRI, TheTriple, MCTargetOptions()));
   if (!AsmInfo)
 return createStringError(
 make_error_code(std::errc::not_supported),
@@ -227,7 +227,7 @@ Expected> 
BinaryContext::createBinaryContext(
   AsmInfo->setAllowAtInName(true);
 
   std::unique_ptr STI(
-  TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
+  TheTarget->createMCSubtargetInfo(TheTriple, "", FeaturesStr));
   if (!STI)
 return createStringError(
 make_error_code(std::errc::not_supported),
diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp
index c679aa6fe7b27..48338566e789d 100644
--- a/clang/lib/Parse/ParseStmtAsm.cpp
+++ b/clang/lib/Parse/ParseStmtAsm.cpp
@@ -543,7 +543,8 @@ StmtResult 
Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
   std::string FeaturesStr =
   llvm::join(TO.Features.begin(), TO.Features.end(), ",");
 
-  std::unique_ptr MRI(TheTarget->createMCRegInfo(TT));
+  std::unique_ptr 

[Lldb-commits] [clang] [lldb] [llvm] [mlir] MC: Add Triple overloads for more MC constructors (PR #157321)

2025-09-07 Thread Matt Arsenault via lldb-commits

https://github.com/arsenm auto_merge_enabled 
https://github.com/llvm/llvm-project/pull/157321
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Added a check for the specialization existence (PR #154123)

2025-09-07 Thread via lldb-commits

https://github.com/tgs-sc updated 
https://github.com/llvm/llvm-project/pull/154123

>From 5a639e67cbffecaba1728ad77cb531f1f40764dc Mon Sep 17 00:00:00 2001
From: Timur Golubovich 
Date: Mon, 18 Aug 2025 17:29:01 +0300
Subject: [PATCH] [lldb][DWARFASTParserClang] Added a check for the
 specialization existence

While debugging an application with incorrect dwarf information, where
DW_TAG_template_value_parameter was lost, I found that lldb does not
check that the corresponding specialization exists. As a result, at the
stage when ASTImporter works, the type is completed in such a way that
it inherits from itself. And during the calculation of layout, an
infinite recursion occurs. To catch this error, I added a corresponding check
at the stage of restoring the type from dwarf information.
---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  |  23 +-
 .../unittests/SymbolFile/DWARF/CMakeLists.txt |   3 +-
 .../DWARF/DWARFASTParserClangTests.cpp|  33 +
 .../Inputs/DW_AT_spec_decl_exists-test.yaml   | 675 ++
 4 files changed, 730 insertions(+), 4 deletions(-)
 create mode 100644 
lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_spec_decl_exists-test.yaml

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index c76d67b47b336..943a010d7704f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1725,6 +1725,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   const dw_tag_t tag = die.Tag();
   SymbolFileDWARF *dwarf = die.GetDWARF();
   LanguageType cu_language = SymbolFileDWARF::GetLanguage(*die.GetCU());
+  ModuleSP module_sp = dwarf->GetObjectFile()->GetModule();
   Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
 
   ConstString unique_typename(attrs.name);
@@ -1735,7 +1736,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 GetUniqueTypeNameAndDeclaration(die, cu_language, unique_typename,
 unique_decl);
 if (log) {
-  dwarf->GetObjectFile()->GetModule()->LogMessage(
+  module_sp->LogMessage(
   log, "SymbolFileDWARF({0:p}) - {1:x16}: {2} has unique name: {3} ",
   static_cast(this), die.GetID(), DW_TAG_value_to_name(tag),
   unique_typename.AsCString());
@@ -1806,7 +1807,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 
 if (type_sp) {
   if (log) {
-dwarf->GetObjectFile()->GetModule()->LogMessage(
+module_sp->LogMessage(
 log,
 "SymbolFileDWARF({0:p}) - {1:x16}: {2} ({3}) type \"{4}\" is an "
 "incomplete objc type, complete type is {5:x8}",
@@ -1856,7 +1857,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 attrs.name.GetCString(), tag_decl_kind, template_param_infos);
 if (!class_template_decl) {
   if (log) {
-dwarf->GetObjectFile()->GetModule()->LogMessage(
+module_sp->LogMessage(
 log,
 "SymbolFileDWARF({0:p}) - {1:x16}: {2} ({3}) type \"{4}\" "
 "clang::ClassTemplateDecl failed to return a decl.",
@@ -1873,6 +1874,22 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 clang_type =
 m_ast.CreateClassTemplateSpecializationType(class_specialization_decl);
 
+// Try to find an existing specialization with these template arguments and
+// template parameter list.
+void *InsertPos = nullptr;
+if 
(!class_template_decl->findSpecialization(template_param_infos.GetArgs(),
+ InsertPos))
+  // Add this specialization to the class template.
+  class_template_decl->AddSpecialization(class_specialization_decl,
+ InsertPos);
+else {
+  module_sp->ReportError("SymbolFileDWARF({0:p}) - Specialization for "
+ "clang::ClassTemplateDecl({1:p}) already exists.",
+ static_cast(this),
+ static_cast(class_template_decl));
+  return TypeSP();
+}
+
 m_ast.SetMetadata(class_template_decl, metadata);
 m_ast.SetMetadata(class_specialization_decl, metadata);
   }
diff --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index eb2e00adba64b..88492188e794b 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -27,6 +27,7 @@ add_lldb_unittest(SymbolFileDWARFTests
 
 set(test_inputs
test-dwarf.exe
-   DW_AT_default_value-test.yaml)
+   DW_AT_default_value-test.yaml
+   DW_AT_spec_decl_exists-test.yaml)
 
 add_unittest_inputs(SymbolFileDWARFTests "${test_inputs}")
diff --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
b/lldb/unittests/Sy

[Lldb-commits] [lldb] [lldb][DWARFASTParserClang] Added a check for the specialization existence (PR #154123)

2025-09-07 Thread via lldb-commits

https://github.com/tgs-sc updated 
https://github.com/llvm/llvm-project/pull/154123

>From f86f3acf76227f618c36147c260ae5fb72fc9e80 Mon Sep 17 00:00:00 2001
From: Timur Golubovich 
Date: Mon, 18 Aug 2025 17:29:01 +0300
Subject: [PATCH] [lldb][DWARFASTParserClang] Added a check for the
 specialization existence

While debugging an application with incorrect dwarf information, where
DW_TAG_template_value_parameter was lost, I found that lldb does not
check that the corresponding specialization exists. As a result, at the
stage when ASTImporter works, the type is completed in such a way that
it inherits from itself. And during the calculation of layout, an
infinite recursion occurs. To catch this error, I added a corresponding check
at the stage of restoring the type from dwarf information.
---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  |  25 +-
 .../unittests/SymbolFile/DWARF/CMakeLists.txt |   3 +-
 .../DWARF/DWARFASTParserClangTests.cpp|  33 +
 .../Inputs/DW_AT_spec_decl_exists-test.yaml   | 675 ++
 4 files changed, 732 insertions(+), 4 deletions(-)
 create mode 100644 
lldb/unittests/SymbolFile/DWARF/Inputs/DW_AT_spec_decl_exists-test.yaml

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index c76d67b47b336..c3937929ff1f0 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -1725,6 +1725,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   const dw_tag_t tag = die.Tag();
   SymbolFileDWARF *dwarf = die.GetDWARF();
   LanguageType cu_language = SymbolFileDWARF::GetLanguage(*die.GetCU());
+  ModuleSP module_sp = dwarf->GetObjectFile()->GetModule();
   Log *log = GetLog(DWARFLog::TypeCompletion | DWARFLog::Lookups);
 
   ConstString unique_typename(attrs.name);
@@ -1735,7 +1736,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 GetUniqueTypeNameAndDeclaration(die, cu_language, unique_typename,
 unique_decl);
 if (log) {
-  dwarf->GetObjectFile()->GetModule()->LogMessage(
+  module_sp->LogMessage(
   log, "SymbolFileDWARF({0:p}) - {1:x16}: {2} has unique name: {3} ",
   static_cast(this), die.GetID(), DW_TAG_value_to_name(tag),
   unique_typename.AsCString());
@@ -1806,7 +1807,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 
 if (type_sp) {
   if (log) {
-dwarf->GetObjectFile()->GetModule()->LogMessage(
+module_sp->LogMessage(
 log,
 "SymbolFileDWARF({0:p}) - {1:x16}: {2} ({3}) type \"{4}\" is an "
 "incomplete objc type, complete type is {5:x8}",
@@ -1856,7 +1857,7 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 attrs.name.GetCString(), tag_decl_kind, template_param_infos);
 if (!class_template_decl) {
   if (log) {
-dwarf->GetObjectFile()->GetModule()->LogMessage(
+module_sp->LogMessage(
 log,
 "SymbolFileDWARF({0:p}) - {1:x16}: {2} ({3}) type \"{4}\" "
 "clang::ClassTemplateDecl failed to return a decl.",
@@ -1873,6 +1874,24 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
 clang_type =
 m_ast.CreateClassTemplateSpecializationType(class_specialization_decl);
 
+// Try to find an existing specialization with these template arguments and
+// template parameter list.
+void *InsertPos = nullptr;
+llvm::ArrayRef args =
+template_param_infos.GetArgs();
+if (!args.empty() &&
+!class_template_decl->findSpecialization(args, InsertPos))
+  // Add this specialization to the class template.
+  class_template_decl->AddSpecialization(class_specialization_decl,
+ InsertPos);
+else {
+  module_sp->ReportError("SymbolFileDWARF({0:p}) - Specialization for "
+ "clang::ClassTemplateDecl({1:p}) already exists.",
+ static_cast(this),
+ static_cast(class_template_decl));
+  return TypeSP();
+}
+
 m_ast.SetMetadata(class_template_decl, metadata);
 m_ast.SetMetadata(class_specialization_decl, metadata);
   }
diff --git a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt 
b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
index eb2e00adba64b..88492188e794b 100644
--- a/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
+++ b/lldb/unittests/SymbolFile/DWARF/CMakeLists.txt
@@ -27,6 +27,7 @@ add_lldb_unittest(SymbolFileDWARFTests
 
 set(test_inputs
test-dwarf.exe
-   DW_AT_default_value-test.yaml)
+   DW_AT_default_value-test.yaml
+   DW_AT_spec_decl_exists-test.yaml)
 
 add_unittest_inputs(SymbolFileDWARFTests "${test_inputs}")
diff --git a/lldb/unittests/SymbolFile/DWARF/DWARFASTParserClangTests.cpp 
b/

[Lldb-commits] [clang] [lldb] [llvm] [mlir] MC: Add Triple overloads for more MC constructors (PR #157321)

2025-09-07 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-aarch64-windows` 
running on `linaro-armv8-windows-msvc-05` while building 
`bolt,clang,lldb,llvm,mlir` at step 6 "test".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/141/builds/11367


Here is the relevant piece of the build log for the reference

```
Step 6 (test) failure: build (failure)
...
PASS: lldb-api :: tools/lldb-dap/step/TestDAP_step.py (1240 of 2301)
PASS: lldb-api :: tools/lldb-dap/stop-hooks/TestDAP_stop_hooks.py (1241 of 2301)
UNSUPPORTED: lldb-api :: 
tools/lldb-dap/terminated-event/TestDAP_terminatedEvent.py (1242 of 2301)
PASS: lldb-api :: tools/lldb-dap/threads/TestDAP_threads.py (1243 of 2301)
UNSUPPORTED: lldb-api :: tools/lldb-dap/variables/TestDAP_variables.py (1244 of 
2301)
PASS: lldb-api :: 
tools/lldb-dap/variables/children/TestDAP_variables_children.py (1245 of 2301)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestAppleSimulatorOSType.py (1246 of 
2301)
PASS: lldb-api :: tools/lldb-server/TestGdbRemoteAttach.py (1247 of 2301)
UNSUPPORTED: lldb-api :: tools/lldb-server/TestGdbRemoteAuxvSupport.py (1248 of 
2301)
UNRESOLVED: lldb-api :: tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py 
(1249 of 2301)
 TEST 'lldb-api :: 
tools/lldb-dap/stepInTargets/TestDAP_stepInTargets.py' FAILED 

Script:
--
C:/Users/tcwg/scoop/apps/python/current/python.exe 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/llvm-project/lldb\test\API\dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --env 
LLVM_INCLUDE_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/include 
--env LLVM_TOOLS_DIR=C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin 
--arch aarch64 --build-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex 
--lldb-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-lldb\lldb-api
 --clang-module-cache-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/lldb-test-build.noindex/module-cache-clang\lldb-api
 --executable 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/lldb.exe --compiler 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/clang.exe --dsymutil 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin/dsymutil.exe --make 
C:/Users/tcwg/scoop/shims/make.exe --llvm-tools-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./bin --lldb-obj-root 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/tools/lldb --lldb-libs-dir 
C:/Users/tcwg/llvm-worker/lldb-aarch64-windows/build/./lib --cmake-build-type 
Release --skip-category=watchpoint 
C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\llvm-project\lldb\test\API\tools\lldb-dap\stepInTargets
 -p TestDAP_stepInTargets.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 
67823469bd1c5f5416c4b009a895dcaffa971b69)
  clang revision 67823469bd1c5f5416c4b009a895dcaffa971b69
  llvm revision 67823469bd1c5f5416c4b009a895dcaffa971b69
Skipping the following test categories: ['watchpoint', 'libc++', 'libstdcxx', 
'dwo', 'dsym', 'gmodules', 'debugserver', 'objc', 'fork', 'pexpect']


--
Command Output (stderr):
--
UNSUPPORTED: LLDB 
(C:\Users\tcwg\llvm-worker\lldb-aarch64-windows\build\bin\clang.exe-aarch64) :: 
test_basic (TestDAP_stepInTargets.TestDAP_stepInTargets.test_basic) (skipping 
due to the following parameter(s): architecture) 

= DEBUG ADAPTER PROTOCOL LOGS =

1757307552.565528870 (stdio) --> 
{"command":"initialize","type":"request","arguments":{"adapterID":"lldb-native","clientID":"vscode","columnsStartAt1":true,"linesStartAt1":true,"locale":"en-us","pathFormat":"path","supportsRunInTerminalRequest":true,"supportsVariablePaging":true,"supportsVariableType":true,"supportsStartDebuggingRequest":true,"supportsProgressReporting":true,"$__lldb_sourceInitFile":false},"seq":1}

1757307552.565704107 (stdio) queued (command=initialize seq=1)

1757307552.575782061 (stdio) <-- {"body":{"$__lldb_version":"lldb version 
22.0.0git (https://github.com/llvm/llvm-project.git revision 
67823469bd1c5f5416c4b009a895dcaffa971b69)\n  clang revision 
67823469bd1c5f5416c4b009a895dcaffa971b69\n  llvm revision 
67823469bd1c5f5416c4b009a895dcaffa971b69","completionTriggerCharacters":["."," 
","\t"],"exceptionBreakpointFilters":[{"description":"C++ 
Catch","filter":"cpp_catch","label":"C++ 
Catch","supportsCondition":true},{"description":"C++ 
Throw","filter":"cpp_throw","label":"C++ 
Throw","supportsCondition":true},{"description":"Objective-C 
Catch","filter":"objc_catch","label":"Objective-C 
Catch","supportsCondition":true},{"description":"Objective-C 
Throw","filter":"objc_throw","label":"Objective-C 
Throw","supportsCondition":true}],"supportTerminateDebuggee":true,"supportsBreakpointLocationsRequest":true,"supportsCancelRequest":true,"suppor

[Lldb-commits] [clang] [lldb] [llvm] [mlir] MC: Add Triple overloads for more MC constructors (PR #157321)

2025-09-07 Thread Matt Arsenault via lldb-commits

https://github.com/arsenm closed 
https://github.com/llvm/llvm-project/pull/157321
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [clang] [lldb] [llvm] [mlir] MC: Add Triple overloads for more MC constructors (PR #157321)

2025-09-07 Thread LLVM Continuous Integration via lldb-commits

llvm-ci wrote:

LLVM Buildbot has detected a new failure on builder `lldb-remote-linux-ubuntu` 
running on `as-builder-9` while building `bolt,clang,lldb,llvm,mlir` at step 16 
"test-check-lldb-api".

Full details are available at: 
https://lab.llvm.org/buildbot/#/builders/195/builds/14270


Here is the relevant piece of the build log for the reference

```
Step 16 (test-check-lldb-api) failure: Test just built components: 
check-lldb-api completed (failure)
 TEST 'lldb-api :: 
functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py'
 FAILED 
Script:
--
/usr/bin/python3.12 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/dotest.py
 -u CXXFLAGS -u CFLAGS --env 
LLVM_LIBS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib
 --env 
LLVM_INCLUDE_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include
 --env 
LLVM_TOOLS_DIR=/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin
 --libcxx-include-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/c++/v1
 --libcxx-include-target-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/include/aarch64-unknown-linux-gnu/c++/v1
 --libcxx-library-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib/aarch64-unknown-linux-gnu
 --arch aarch64 --build-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex
 --lldb-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-lldb/lldb-api
 --clang-module-cache-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/lldb-test-build.noindex/module-cache-clang/lldb-api
 --executable 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/lldb 
--compiler 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang 
--dsymutil 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin/dsymutil
 --make /usr/bin/gmake --llvm-tools-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./bin 
--lldb-obj-root 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/tools/lldb 
--lldb-libs-dir 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/./lib 
--cmake-build-type Release --platform-url 
connect://jetson-agx-2198.lab.llvm.org:1234 --platform-working-dir 
/home/ubuntu/lldb-tests --sysroot /mnt/fs/jetson-agx-ubuntu --env 
ARCH_CFLAGS=-mcpu=cortex-a78 --platform-name remote-linux 
--skip-category=lldb-server 
/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/thread/concurrent_events
 -p TestConcurrentCrashWithWatchpointBreakpointSignal.py
--
Exit Code: 1

Command Output (stdout):
--
lldb version 22.0.0git (https://github.com/llvm/llvm-project.git revision 
67823469bd1c5f5416c4b009a895dcaffa971b69)
  clang revision 67823469bd1c5f5416c4b009a895dcaffa971b69
  llvm revision 67823469bd1c5f5416c4b009a895dcaffa971b69
Setting up remote platform 'remote-linux'
Connecting to remote platform 'remote-linux' at 
'connect://jetson-agx-2198.lab.llvm.org:1234'...
Connected.
Setting remote platform working directory to '/home/ubuntu/lldb-tests'...
Skipping the following test categories: ['lldb-server', 'msvcstl', 'dsym', 
'gmodules', 'debugserver', 'objc', 'lldb-dap']

--
Command Output (stderr):
--
WARNING:root:Custom libc++ is not supported for remote runs: ignoring --libcxx 
arguments
FAIL: LLDB 
(/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/build/bin/clang-aarch64)
 :: test 
(TestConcurrentCrashWithWatchpointBreakpointSignal.ConcurrentCrashWithWatchpointBreakpointSignal.test)
==
FAIL: test 
(TestConcurrentCrashWithWatchpointBreakpointSignal.ConcurrentCrashWithWatchpointBreakpointSignal.test)
   Test a thread that crashes while other threads generate a signal and hit a 
watchpoint and breakpoint.
--
Traceback (most recent call last):
  File 
"/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py",
 line 155, in wrapper
return func(*args, **kwargs)
   ^
  File 
"/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/test/API/functionalities/thread/concurrent_events/TestConcurrentCrashWithWatchpointBreakpointSignal.py",
 line 14, in test
self.do_thread_actions(
  File 
"/home/buildbot/worker/as-builder-9/lldb-remote-linux-ubuntu/llvm-project/lldb/packages/Python/lldbsuite/test/concurrent_base.py",
 line 225, in do_thread_actions
self.assertEqual(
AssertionError: 1 != 5 : Expected to see 5 threads, but seeing 1. Details:
thread 1 running due to none at

Config=aarch6

[Lldb-commits] [clang] [lldb] [llvm] [mlir] MC: Add Triple overloads for more MC constructors (PR #157321)

2025-09-07 Thread Matt Arsenault via lldb-commits

https://github.com/arsenm updated 
https://github.com/llvm/llvm-project/pull/157321

>From 5f2205d454e38e63ab6d9ed2a41ff8d8b674ec6b Mon Sep 17 00:00:00 2001
From: Matt Arsenault 
Date: Sun, 7 Sep 2025 09:03:22 +0900
Subject: [PATCH 1/2] MC: Add Triple overloads for more MC constructors

Avoids more Triple->string->Triple round trip. This
is a continuation of f137c3d592e96330e450a8fd63ef7e8877fc1908
---
 bolt/lib/Core/BinaryContext.cpp   |  6 +-
 clang/lib/Parse/ParseStmtAsm.cpp  |  9 +--
 clang/tools/driver/cc1as_main.cpp | 17 +++---
 .../Disassembler/LLVMC/DisassemblerLLVMC.cpp  |  5 +-
 .../MIPS/EmulateInstructionMIPS.cpp   | 17 +++---
 .../MIPS64/EmulateInstructionMIPS64.cpp   |  8 +--
 llvm/include/llvm/MC/TargetRegistry.h | 61 +++
 llvm/lib/CodeGen/CodeGenTargetMachineImpl.cpp | 10 +--
 .../lib/DWARFLinker/Classic/DWARFStreamer.cpp |  6 +-
 .../DWARFLinker/Parallel/DWARFEmitterImpl.cpp |  6 +-
 .../Parallel/DebugLineSectionEmitter.h|  6 +-
 .../LogicalView/Readers/LVBinaryReader.cpp| 15 ++---
 .../RuntimeDyld/RuntimeDyldChecker.cpp|  6 +-
 llvm/lib/MC/MCDisassembler/Disassembler.cpp   | 17 +++---
 llvm/lib/Object/ModuleSymbolTable.cpp |  7 +--
 llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp |  2 +-
 llvm/lib/Target/Mips/MipsAsmPrinter.cpp   |  3 +-
 .../llvm-cfi-verify/lib/FileAnalysis.cpp  |  8 ++-
 llvm/tools/llvm-dwarfdump/llvm-dwarfdump.cpp  |  2 +-
 llvm/tools/llvm-dwp/llvm-dwp.cpp  |  7 ++-
 .../llvm-exegesis/lib/DisassemblerHelper.cpp  |  4 +-
 llvm/tools/llvm-exegesis/lib/LlvmState.cpp|  2 +-
 llvm/tools/llvm-jitlink/llvm-jitlink.cpp  |  6 +-
 llvm/tools/llvm-mc/Disassembler.cpp   | 21 ---
 llvm/tools/llvm-mc/Disassembler.h |  6 +-
 llvm/tools/llvm-mc/llvm-mc.cpp| 11 ++--
 llvm/tools/llvm-mca/llvm-mca.cpp  |  6 +-
 llvm/tools/llvm-ml/Disassembler.cpp   |  5 +-
 llvm/tools/llvm-ml/llvm-ml.cpp| 10 ++-
 llvm/tools/llvm-objdump/MachODump.cpp | 46 +++---
 llvm/tools/llvm-objdump/llvm-objdump.cpp  | 39 ++--
 llvm/tools/llvm-profgen/ProfiledBinary.cpp| 24 
 llvm/tools/llvm-rtdyld/llvm-rtdyld.cpp| 10 +--
 llvm/tools/sancov/sancov.cpp  |  6 +-
 .../DWARFExpressionCompactPrinterTest.cpp |  2 +-
 .../DWARF/DWARFExpressionCopyBytesTest.cpp| 12 ++--
 .../DebugInfo/DWARF/DwarfGenerator.cpp|  6 +-
 llvm/unittests/MC/AMDGPU/Disassembler.cpp | 34 ++-
 llvm/unittests/MC/DwarfLineTableHeaders.cpp   | 20 +++---
 llvm/unittests/MC/DwarfLineTables.cpp | 13 ++--
 llvm/unittests/MC/MCInstPrinter.cpp   | 11 ++--
 .../MC/SystemZ/SystemZAsmLexerTest.cpp| 15 +++--
 .../MC/SystemZ/SystemZMCDisassemblerTest.cpp  | 14 ++---
 .../MC/X86/X86MCDisassemblerTest.cpp  | 15 ++---
 .../llvm-exegesis/AArch64/TargetTest.cpp  |  6 +-
 .../llvm-exegesis/PowerPC/AnalysisTest.cpp|  6 +-
 .../llvm-exegesis/PowerPC/TargetTest.cpp  |  6 +-
 llvm/unittests/tools/llvm-mca/MCATestBase.cpp |  8 +--
 mlir/lib/Target/LLVM/ROCDL/Target.cpp |  7 +--
 49 files changed, 323 insertions(+), 266 deletions(-)

diff --git a/bolt/lib/Core/BinaryContext.cpp b/bolt/lib/Core/BinaryContext.cpp
index dd0d041692484..23a5a65c2c5f0 100644
--- a/bolt/lib/Core/BinaryContext.cpp
+++ b/bolt/lib/Core/BinaryContext.cpp
@@ -207,7 +207,7 @@ Expected> 
BinaryContext::createBinaryContext(
  Twine("BOLT-ERROR: ", Error));
 
   std::unique_ptr MRI(
-  TheTarget->createMCRegInfo(TripleName));
+  TheTarget->createMCRegInfo(TheTriple));
   if (!MRI)
 return createStringError(
 make_error_code(std::errc::not_supported),
@@ -215,7 +215,7 @@ Expected> 
BinaryContext::createBinaryContext(
 
   // Set up disassembler.
   std::unique_ptr AsmInfo(
-  TheTarget->createMCAsmInfo(*MRI, TripleName, MCTargetOptions()));
+  TheTarget->createMCAsmInfo(*MRI, TheTriple, MCTargetOptions()));
   if (!AsmInfo)
 return createStringError(
 make_error_code(std::errc::not_supported),
@@ -227,7 +227,7 @@ Expected> 
BinaryContext::createBinaryContext(
   AsmInfo->setAllowAtInName(true);
 
   std::unique_ptr STI(
-  TheTarget->createMCSubtargetInfo(TripleName, "", FeaturesStr));
+  TheTarget->createMCSubtargetInfo(TheTriple, "", FeaturesStr));
   if (!STI)
 return createStringError(
 make_error_code(std::errc::not_supported),
diff --git a/clang/lib/Parse/ParseStmtAsm.cpp b/clang/lib/Parse/ParseStmtAsm.cpp
index c679aa6fe7b27..48338566e789d 100644
--- a/clang/lib/Parse/ParseStmtAsm.cpp
+++ b/clang/lib/Parse/ParseStmtAsm.cpp
@@ -543,7 +543,8 @@ StmtResult 
Parser::ParseMicrosoftAsmStatement(SourceLocation AsmLoc) {
   std::string FeaturesStr =
   llvm::join(TO.Features.begin(), TO.Features.end(), ",");
 
-  std::unique_ptr MRI(TheTarget->createMCRegInfo(TT));
+  std::unique_