[Lldb-commits] [lldb] [lldb] Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host (PR #115337)

2024-11-07 Thread Dmitry Vasilyev via lldb-commits

https://github.com/slydiman created 
https://github.com/llvm/llvm-project/pull/115337

Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host.

>From d9f799f02fb47804d4e35c5fd73433280b650257 Mon Sep 17 00:00:00 2001
From: Dmitry Vasilyev 
Date: Thu, 7 Nov 2024 20:22:57 +0400
Subject: [PATCH] [lldb] Fixed the @skipUnlessAArch64MTELinuxCompiler decorator
 in case of Windows host

Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host.
---
 .../Python/lldbsuite/test/decorators.py   | 39 +++
 1 file changed, 31 insertions(+), 8 deletions(-)

diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 34319e203a3177..d4c5e61a8fd95a 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -989,13 +989,27 @@ def skipUnlessAArch64MTELinuxCompiler(func):
 
 def is_toolchain_with_mte():
 compiler_path = lldbplatformutil.getCompiler()
-compiler = os.path.basename(compiler_path)
-f = tempfile.NamedTemporaryFile()
+f_src = tempfile.NamedTemporaryFile(delete=False)
+f_out = tempfile.NamedTemporaryFile(delete=False)
 if lldbplatformutil.getPlatform() == "windows":
 return "MTE tests are not compatible with 'windows'"
 
-cmd = "echo 'int main() {}' | %s -x c -o %s -" % (compiler_path, 
f.name)
+# Note hostos may be Windows.
+f_src.close()
+f_out.close()
+
+with open(f_src.name, "w") as f:
+f.write("int main() {}")
+cmd = f"{compiler_path} -x c -o {f_out.name} {f_src.name}"
 if os.popen(cmd).close() is not None:
+try:
+os.remove(f_src.name)
+except OSError:
+pass
+try:
+os.remove(f_out.name)
+except OSError:
+pass
 # Cannot compile at all, don't skip the test
 # so that we report the broken compiler normally.
 return None
@@ -1010,12 +1024,21 @@ def is_toolchain_with_mte():
 int main() {
 void* ptr = __arm_mte_create_random_tag((void*)(0), 0);
 }"""
-cmd = "echo '%s' | %s -march=armv8.5-a+memtag -x c -o %s -" % (
-test_src,
-compiler_path,
-f.name,
+with open(f_src.name, "w") as f:
+f.write(test_src)
+cmd = (
+f"{compiler_path} -march=armv8.5-a+memtag -x c -o {f_out.name} 
{f_src.name}"
 )
-if os.popen(cmd).close() is not None:
+res = os.popen(cmd).close()
+try:
+os.remove(f_src.name)
+except OSError:
+pass
+try:
+os.remove(f_out.name)
+except OSError:
+pass
+if res is not None:
 return "Toolchain does not support MTE"
 return None
 

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


[Lldb-commits] [clang] [compiler-rt] [lldb] [llvm] [mlir] [SPIRV] Add reads from image buffer for shaders. (PR #115178)

2024-11-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 21835ee28d47037137ea5a73ba466211b3e1a2d1 
f227cd7076f27917da400f307635ee2376267b95 --extensions h,c,cpp -- 
clang/test/C/C2y/n3344.c clang/lib/Headers/avxintrin.h 
clang/lib/Sema/SemaDecl.cpp clang/test/CodeGen/X86/avx-builtins.c 
compiler-rt/lib/builtins/cpu_model/riscv.c 
llvm/include/llvm/LineEditor/LineEditor.h 
llvm/include/llvm/Target/TargetMachine.h llvm/lib/Analysis/ValueTracking.cpp 
llvm/lib/ExecutionEngine/Orc/TargetProcess/JITLoaderGDB.cpp 
llvm/lib/LineEditor/LineEditor.cpp 
llvm/lib/Target/AArch64/AArch64TargetMachine.cpp 
llvm/lib/Target/AArch64/AArch64TargetMachine.h 
llvm/lib/Target/ARM/ARMTargetMachine.cpp llvm/lib/Target/ARM/ARMTargetMachine.h 
llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp 
llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.h 
llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp 
llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp 
llvm/lib/Target/X86/X86TargetMachine.cpp llvm/lib/Target/X86/X86TargetMachine.h 
llvm/tools/lli/lli.cpp 
llvm/tools/llvm-jitlink/llvm-jitlink-executor/llvm-jitlink-executor.cpp 
llvm/tools/llvm-objdump/XCOFFDump.cpp 
mlir/lib/Dialect/Linalg/IR/LinalgInterfaces.cpp 
mlir/lib/Dialect/Linalg/IR/LinalgOps.cpp 
mlir/lib/Dialect/Linalg/Transforms/TransposeMatmul.cpp 
mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp 
mlir/lib/Dialect/NVGPU/TransformOps/NVGPUTransformOps.cpp 
mlir/tools/mlir-linalg-ods-gen/mlir-linalg-ods-yaml-gen.cpp
``





View the diff from clang-format here.


``diff
diff --git a/clang/lib/Headers/avxintrin.h b/clang/lib/Headers/avxintrin.h
index 8e497a9823..fa5ff9f97b 100644
--- a/clang/lib/Headers/avxintrin.h
+++ b/clang/lib/Headers/avxintrin.h
@@ -3706,9 +3706,10 @@ _mm256_undefined_si256(void)
 ///A double-precision floating-point value used to initialize bits [63:0]
 ///of the result.
 /// \returns An initialized 256-bit floating-point vector of [4 x double].
-static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
-_mm256_set_pd(double __a, double __b, double __c, double __d)
-{
+static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set_pd(double __a,
+   double __b,
+   double __c,
+   double __d) 
{
   return __extension__ (__m256d){ __d, __c, __b, __a };
 }
 
@@ -3746,9 +3747,8 @@ _mm256_set_pd(double __a, double __b, double __c, double 
__d)
 ///of the result.
 /// \returns An initialized 256-bit floating-point vector of [8 x float].
 static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
-_mm256_set_ps(float __a, float __b, float __c, float __d,
-  float __e, float __f, float __g, float __h)
-{
+_mm256_set_ps(float __a, float __b, float __c, float __d, float __e, float __f,
+  float __g, float __h) {
   return __extension__ (__m256){ __h, __g, __f, __e, __d, __c, __b, __a };
 }
 
@@ -3973,8 +3973,7 @@ _mm256_set_epi64x(long long __a, long long __b, long long 
__c, long long __d)
 ///of the result.
 /// \returns An initialized 256-bit floating-point vector of [4 x double].
 static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
-_mm256_setr_pd(double __a, double __b, double __c, double __d)
-{
+_mm256_setr_pd(double __a, double __b, double __c, double __d) {
   return _mm256_set_pd(__d, __c, __b, __a);
 }
 
@@ -4013,9 +4012,8 @@ _mm256_setr_pd(double __a, double __b, double __c, double 
__d)
 ///of the result.
 /// \returns An initialized 256-bit floating-point vector of [8 x float].
 static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
-_mm256_setr_ps(float __a, float __b, float __c, float __d,
-   float __e, float __f, float __g, float __h)
-{
+_mm256_setr_ps(float __a, float __b, float __c, float __d, float __e, float 
__f,
+   float __g, float __h) {
   return _mm256_set_ps(__h, __g, __f, __e, __d, __c, __b, __a);
 }
 
@@ -4230,8 +4228,7 @@ _mm256_setr_epi64x(long long __a, long long __b, long 
long __c, long long __d)
 ///element of the result.
 /// \returns An initialized 256-bit floating-point vector of [4 x double].
 static __inline __m256d __DEFAULT_FN_ATTRS_CONSTEXPR
-_mm256_set1_pd(double __w)
-{
+_mm256_set1_pd(double __w) {
   return _mm256_set_pd(__w, __w, __w, __w);
 }
 
@@ -4248,9 +4245,7 @@ _mm256_set1_pd(double __w)
 ///A single-precision floating-point value used to initialize each vector
 ///element of the result.
 /// \returns An initialized 256-bit floating-point vector of [8 x float].
-static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR
-_mm256_set1_ps(float __w)
-{
+static __inline __m256 __DEFAULT_FN_ATTRS_CONSTEXPR _mm256_set1_ps(float __w) {
   return _mm256_set_ps(__w, __w, __w, __w, __w, __w, __w, __w);
 }
 

``

[Lldb-commits] [lldb] [lldb] Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host (PR #115337)

2024-11-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Dmitry Vasilyev (slydiman)


Changes

Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of 
Windows host.

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


1 Files Affected:

- (modified) lldb/packages/Python/lldbsuite/test/decorators.py (+31-8) 


``diff
diff --git a/lldb/packages/Python/lldbsuite/test/decorators.py 
b/lldb/packages/Python/lldbsuite/test/decorators.py
index 34319e203a3177..d4c5e61a8fd95a 100644
--- a/lldb/packages/Python/lldbsuite/test/decorators.py
+++ b/lldb/packages/Python/lldbsuite/test/decorators.py
@@ -989,13 +989,27 @@ def skipUnlessAArch64MTELinuxCompiler(func):
 
 def is_toolchain_with_mte():
 compiler_path = lldbplatformutil.getCompiler()
-compiler = os.path.basename(compiler_path)
-f = tempfile.NamedTemporaryFile()
+f_src = tempfile.NamedTemporaryFile(delete=False)
+f_out = tempfile.NamedTemporaryFile(delete=False)
 if lldbplatformutil.getPlatform() == "windows":
 return "MTE tests are not compatible with 'windows'"
 
-cmd = "echo 'int main() {}' | %s -x c -o %s -" % (compiler_path, 
f.name)
+# Note hostos may be Windows.
+f_src.close()
+f_out.close()
+
+with open(f_src.name, "w") as f:
+f.write("int main() {}")
+cmd = f"{compiler_path} -x c -o {f_out.name} {f_src.name}"
 if os.popen(cmd).close() is not None:
+try:
+os.remove(f_src.name)
+except OSError:
+pass
+try:
+os.remove(f_out.name)
+except OSError:
+pass
 # Cannot compile at all, don't skip the test
 # so that we report the broken compiler normally.
 return None
@@ -1010,12 +1024,21 @@ def is_toolchain_with_mte():
 int main() {
 void* ptr = __arm_mte_create_random_tag((void*)(0), 0);
 }"""
-cmd = "echo '%s' | %s -march=armv8.5-a+memtag -x c -o %s -" % (
-test_src,
-compiler_path,
-f.name,
+with open(f_src.name, "w") as f:
+f.write(test_src)
+cmd = (
+f"{compiler_path} -march=armv8.5-a+memtag -x c -o {f_out.name} 
{f_src.name}"
 )
-if os.popen(cmd).close() is not None:
+res = os.popen(cmd).close()
+try:
+os.remove(f_src.name)
+except OSError:
+pass
+try:
+os.remove(f_out.name)
+except OSError:
+pass
+if res is not None:
 return "Toolchain does not support MTE"
 return None
 

``




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


[Lldb-commits] [lldb] [llvm] [DebugInfo] Add explicit visibility macros to CodeView template functions (PR #113102)

2024-11-07 Thread David Blaikie via lldb-commits

dwblaikie wrote:

@zmodem perhaps you know someone who might be able to look at a CodeView change?

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread John Harrison via lldb-commits


@@ -11,23 +11,28 @@
 #define LLDB_TOOLS_LLDB_DAP_INSTRUCTIONBREAKPOINT_H
 
 #include "Breakpoint.h"
+#include "DAPForward.h"
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include 
 
 namespace lldb_dap {
 
 // Instruction Breakpoint
 struct InstructionBreakpoint : public Breakpoint {
 
   lldb::addr_t instructionAddressReference;
-  int32_t id;
   int32_t offset;
 
-  InstructionBreakpoint()
-  : Breakpoint(), instructionAddressReference(LLDB_INVALID_ADDRESS), id(0),
+  InstructionBreakpoint(DAP &d)

ashgti wrote:

I added `explicit` to the `BreakpointBase::BreakpointBase(DAP &)` constructor 
and removed all the other unnecessary constructors.

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


[Lldb-commits] [lldb] [lldb] Relax check for breakpoint site in Unwind/windows-unaligned-x86_64.test (PR #115318)

2024-11-07 Thread Stefan Gränitz via lldb-commits

https://github.com/weliveindetail created 
https://github.com/llvm/llvm-project/pull/115318

This test checks the thread backtrace for entries of intermediate frames that 
aren't aligned to 16 bytes. In order to do that, it sets a single breakpoint 
and makes sure we stop there. It seems sufficient, however, to check that we 
hit the breakpoint itself and not which particular site.

From 9a7b266b9ca22584abc4614637128189b3ce8f4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Stefan=20Gr=C3=A4nitz?= 
Date: Thu, 7 Nov 2024 14:26:44 +0100
Subject: [PATCH] [lldb] Relax check for breakpoint site in
 Unwind/windows-unaligned-x86_64.test

---
 lldb/test/Shell/Unwind/windows-unaligned-x86_64.test | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/test/Shell/Unwind/windows-unaligned-x86_64.test 
b/lldb/test/Shell/Unwind/windows-unaligned-x86_64.test
index 94f1c011ebd2a6..0356960424328b 100644
--- a/lldb/test/Shell/Unwind/windows-unaligned-x86_64.test
+++ b/lldb/test/Shell/Unwind/windows-unaligned-x86_64.test
@@ -17,7 +17,7 @@ breakpoint set -n func
 # CHECK: Breakpoint 1: where = {{.*}}`{{(::)?}}func
 
 process launch
-# CHECK: stop reason = breakpoint 1.1
+# CHECK: stop reason = breakpoint 1
 
 thread backtrace
 # CHECK: frame #0: {{.*}}`{{(::)?}}func

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread John Harrison via lldb-commits

https://github.com/ashgti updated 
https://github.com/llvm/llvm-project/pull/115208

>From 125c8976906ff25da6e212dff21d1b129575bd28 Mon Sep 17 00:00:00 2001
From: John Harrison 
Date: Wed, 6 Nov 2024 09:36:48 -0800
Subject: [PATCH 1/4] [lldb-dap] Refactoring breakpoints to not use the `g_dap`
 reference.

Instead, when a breakpoint is constructed it will be passed a DAP reference 
that it should use for its lifetime.

This is part of a larger refactor to remove the global `g_dap` variable in 
favor of managing instances.
---
 lldb/tools/lldb-dap/Breakpoint.cpp|   8 +-
 lldb/tools/lldb-dap/Breakpoint.h  |   9 +-
 lldb/tools/lldb-dap/BreakpointBase.cpp|   4 +-
 lldb/tools/lldb-dap/BreakpointBase.h  |  12 +-
 lldb/tools/lldb-dap/DAP.cpp   |  22 +-
 lldb/tools/lldb-dap/DAPForward.h  |   1 +
 lldb/tools/lldb-dap/ExceptionBreakpoint.cpp   |   6 +-
 lldb/tools/lldb-dap/ExceptionBreakpoint.h |  12 +-
 lldb/tools/lldb-dap/FunctionBreakpoint.cpp|   7 +-
 lldb/tools/lldb-dap/FunctionBreakpoint.h  |   4 +-
 lldb/tools/lldb-dap/InstructionBreakpoint.cpp |  13 +-
 lldb/tools/lldb-dap/InstructionBreakpoint.h   |  14 +-
 lldb/tools/lldb-dap/JSONUtils.cpp |  64 ---
 lldb/tools/lldb-dap/JSONUtils.h   |  11 -
 lldb/tools/lldb-dap/SourceBreakpoint.cpp  |  17 +-
 lldb/tools/lldb-dap/SourceBreakpoint.h|   3 +-
 lldb/tools/lldb-dap/Watchpoint.cpp|   9 +-
 lldb/tools/lldb-dap/Watchpoint.h  |   8 +-
 lldb/tools/lldb-dap/lldb-dap.cpp  | 495 --
 19 files changed, 318 insertions(+), 401 deletions(-)

diff --git a/lldb/tools/lldb-dap/Breakpoint.cpp 
b/lldb/tools/lldb-dap/Breakpoint.cpp
index 9ea7a42ca85a1e..aee2f87e2cc23e 100644
--- a/lldb/tools/lldb-dap/Breakpoint.cpp
+++ b/lldb/tools/lldb-dap/Breakpoint.cpp
@@ -7,11 +7,13 @@
 
//===--===//
 
 #include "Breakpoint.h"
-#include "DAP.h"
-#include "JSONUtils.h"
+
 #include "lldb/API/SBBreakpointLocation.h"
 #include "llvm/ADT/StringExtras.h"
 
+#include "DAP.h"
+#include "JSONUtils.h"
+
 using namespace lldb_dap;
 
 void Breakpoint::SetCondition() { bp.SetCondition(condition.c_str()); }
@@ -51,7 +53,7 @@ void Breakpoint::CreateJsonObject(llvm::json::Object &object) 
{
 
   if (bp_addr.IsValid()) {
 std::string formatted_addr =
-"0x" + llvm::utohexstr(bp_addr.GetLoadAddress(g_dap.target));
+"0x" + llvm::utohexstr(bp_addr.GetLoadAddress(bp.GetTarget()));
 object.try_emplace("instructionReference", formatted_addr);
 auto line_entry = bp_addr.GetLineEntry();
 const auto line = line_entry.GetLine();
diff --git a/lldb/tools/lldb-dap/Breakpoint.h b/lldb/tools/lldb-dap/Breakpoint.h
index ee9d3736d6190f..cffeb2fab1f0ef 100644
--- a/lldb/tools/lldb-dap/Breakpoint.h
+++ b/lldb/tools/lldb-dap/Breakpoint.h
@@ -9,18 +9,19 @@
 #ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINT_H
 #define LLDB_TOOLS_LLDB_DAP_BREAKPOINT_H
 
-#include "BreakpointBase.h"
 #include "lldb/API/SBBreakpoint.h"
 
+#include "BreakpointBase.h"
+
 namespace lldb_dap {
 
 struct Breakpoint : public BreakpointBase {
   // The LLDB breakpoint associated wit this source breakpoint
   lldb::SBBreakpoint bp;
 
-  Breakpoint() = default;
-  Breakpoint(const llvm::json::Object &obj) : BreakpointBase(obj){};
-  Breakpoint(lldb::SBBreakpoint bp) : bp(bp) {}
+  Breakpoint(DAP &d) : BreakpointBase(d) {}
+  Breakpoint(DAP &d, const llvm::json::Object &obj) : BreakpointBase(d, obj) {}
+  Breakpoint(DAP &d, lldb::SBBreakpoint bp) : BreakpointBase(d), bp(bp) {}
 
   void SetCondition() override;
   void SetHitCondition() override;
diff --git a/lldb/tools/lldb-dap/BreakpointBase.cpp 
b/lldb/tools/lldb-dap/BreakpointBase.cpp
index f3cb06a3562d48..c5d7a9778df018 100644
--- a/lldb/tools/lldb-dap/BreakpointBase.cpp
+++ b/lldb/tools/lldb-dap/BreakpointBase.cpp
@@ -11,8 +11,8 @@
 
 using namespace lldb_dap;
 
-BreakpointBase::BreakpointBase(const llvm::json::Object &obj)
-: condition(std::string(GetString(obj, "condition"))),
+BreakpointBase::BreakpointBase(DAP &d, const llvm::json::Object &obj)
+: dap(d), condition(std::string(GetString(obj, "condition"))),
   hitCondition(std::string(GetString(obj, "hitCondition"))) {}
 
 void BreakpointBase::UpdateBreakpoint(const BreakpointBase &request_bp) {
diff --git a/lldb/tools/lldb-dap/BreakpointBase.h 
b/lldb/tools/lldb-dap/BreakpointBase.h
index 79301480e0e588..bb660ddc451bd5 100644
--- a/lldb/tools/lldb-dap/BreakpointBase.h
+++ b/lldb/tools/lldb-dap/BreakpointBase.h
@@ -9,12 +9,17 @@
 #ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
 #define LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
 
-#include "llvm/Support/JSON.h"
 #include 
 
+#include "llvm/Support/JSON.h"
+
+#include "DAPForward.h"
+
 namespace lldb_dap {
 
 struct BreakpointBase {
+  // Associated DAP session.
+  DAP &dap;
 
   // An optional expression for conditional breakpoints.
   std::strin

[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -11,23 +11,28 @@
 #define LLDB_TOOLS_LLDB_DAP_INSTRUCTIONBREAKPOINT_H
 
 #include "Breakpoint.h"
+#include "DAPForward.h"
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include 
 
 namespace lldb_dap {
 
 // Instruction Breakpoint
 struct InstructionBreakpoint : public Breakpoint {
 
   lldb::addr_t instructionAddressReference;
-  int32_t id;
   int32_t offset;
 
-  InstructionBreakpoint()
-  : Breakpoint(), instructionAddressReference(LLDB_INVALID_ADDRESS), id(0),
+  InstructionBreakpoint(DAP &d)

labath wrote:

Thanks :D

There's no llvm policy on that, but I'd recommend using `explicit` everywhere 
where the two objects aren't different representations of the same "value". 
There's a lot of room for interpretation there, but that's definitely not the 
case for these class.

Another way to look at it is: would you be surprised if you passed an object of 
one type (`DAP`, here) to a function taking the other type 
(`InstructionBreakpoint`) and the call ended up creating a temporary object of 
the other type?

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


[Lldb-commits] [lldb] [lldb] Add builtin e alias for expression (PR #115359)

2024-11-07 Thread via lldb-commits

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

`expr` is much more common than `exit` or `env` so this seems like a fine idea.

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


[Lldb-commits] [lldb] [lldb] Add builtin e alias for expression (PR #115359)

2024-11-07 Thread Dave Lee via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Zequan Wu via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Support overriding the disassembly CPU & features (PR #115382)

2024-11-07 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/115382

Add the ability to override the disassembly CPU and CPU features through a 
target setting (`target.disassembly-cpu` and
`target.disassembly-features`) and a `disassemble` command option (`--cpu` and 
`--features`).

This is especially relevant for architectures like RISC-V which relies heavily 
on CPU extensions.

The majority of this patch is plumbing the options through. I recommend looking 
at DisassemblerLLVMC and the test for the observable change in behavior.

>From b5947cfe8fd7702f801c91f48ca050a5c839a707 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 7 Nov 2024 14:08:50 -0800
Subject: [PATCH] [lldb] Support overriding the disassembly CPU & features

Add the ability to override the disassembly CPU and CPU features through
a target setting (`target.disassembly-cpu` and
`target.disassembly-features`) and a `disassemble` command option
(`--cpu` and `--features`).

This is especially relevant for architectures like RISC-V which relies
heavily on CPU extensions.

The majority of this patch is plumbing the options through. I recommend
looking at DisassemblerLLVMC and the test for the observable change in
behavior.
---
 lldb/include/lldb/Core/Disassembler.h |  32 +--
 .../Interpreter/CommandOptionArgumentTable.h  |   2 +
 lldb/include/lldb/Target/Target.h |   4 +
 lldb/include/lldb/lldb-enumerations.h |   2 +
 lldb/include/lldb/lldb-private-interfaces.h   |   5 +-
 lldb/source/API/SBFunction.cpp|   4 +-
 lldb/source/API/SBSymbol.cpp  |   4 +-
 lldb/source/API/SBTarget.cpp  |  13 +-
 .../Commands/CommandObjectDisassemble.cpp |  38 ++-
 .../Commands/CommandObjectDisassemble.h   |  14 ++
 lldb/source/Commands/Options.td   |   4 +
 lldb/source/Core/Disassembler.cpp |  42 ++--
 lldb/source/Core/DumpDataExtractor.cpp|   7 +-
 lldb/source/Expression/IRExecutionUnit.cpp|   6 +-
 .../Architecture/Mips/ArchitectureMips.cpp|   2 +-
 .../Disassembler/LLVMC/DisassemblerLLVMC.cpp  | 120 -
 .../Disassembler/LLVMC/DisassemblerLLVMC.h|   8 +-
 .../Windows-DYLD/DynamicLoaderWindowsDYLD.cpp |   2 +-
 .../Process/Utility/StopInfoMachException.cpp |   7 +-
 .../UnwindAssemblyInstEmulation.cpp   |   4 +-
 lldb/source/Symbol/Function.cpp   |   6 +-
 lldb/source/Symbol/Symbol.cpp |   6 +-
 lldb/source/Target/Process.cpp|   5 +-
 lldb/source/Target/StackFrame.cpp |  17 +-
 lldb/source/Target/Target.cpp |  14 ++
 lldb/source/Target/TargetProperties.td|   6 +
 lldb/source/Target/ThreadPlanStepRange.cpp|   6 +-
 lldb/source/Target/ThreadPlanTracer.cpp   |   5 +-
 lldb/source/Target/TraceDumper.cpp|   6 +-
 .../command-disassemble-cpu-features.yaml | 230 ++
 30 files changed, 478 insertions(+), 143 deletions(-)
 create mode 100644 
lldb/test/Shell/Commands/command-disassemble-cpu-features.yaml

diff --git a/lldb/include/lldb/Core/Disassembler.h 
b/lldb/include/lldb/Core/Disassembler.h
index 21969aed03c209..e0ad4316e02497 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -409,35 +409,37 @@ class Disassembler : public 
std::enable_shared_from_this,
   // flavor string gets set wrong. Instead, if you get a flavor string you
   // don't understand, use the default.  Folks who care to check can use the
   // FlavorValidForArchSpec method on the disassembler they got back.
-  static lldb::DisassemblerSP
-  FindPlugin(const ArchSpec &arch, const char *flavor, const char 
*plugin_name);
+  static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch,
+ const char *flavor, const char *cpu,
+ const char *features,
+ const char *plugin_name);
 
   // This version will use the value in the Target settings if flavor is NULL;
-  static lldb::DisassemblerSP FindPluginForTarget(const Target &target,
-  const ArchSpec &arch,
-  const char *flavor,
-  const char *plugin_name);
+  static lldb::DisassemblerSP
+  FindPluginForTarget(const Target &target, const ArchSpec &arch,
+  const char *flavor, const char *cpu, const char 
*features,
+  const char *plugin_name);
 
   struct Limit {
 enum { Bytes, Instructions } kind;
 lldb::addr_t value;
   };
 
-  static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch,
-   const char *plugin_name,
-   const char *flavor,
-   Target &target,
-   

[Lldb-commits] [lldb] 60e3a81 - [lldb] Add builtin e alias for expression (#115359)

2024-11-07 Thread via lldb-commits

Author: Dave Lee
Date: 2024-11-07T11:24:00-08:00
New Revision: 60e3a81c4299baf80e7b80db9cb8368223ee9546

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

LOG: [lldb] Add builtin e alias for expression (#115359)

The changes in 461f859a72 (llvm/llvm-project#65974) resulted in a change
in behavior not just for completion, but also for selection of inexect
commands.

Since many use `e` to mean `expression`, this change adds an alias for
`e`. Note that the referenced change similarly aliases `h` to `help`.

Added: 


Modified: 
lldb/source/Interpreter/CommandInterpreter.cpp
lldb/test/API/functionalities/abbreviation/TestAbbreviations.py

Removed: 




diff  --git a/lldb/source/Interpreter/CommandInterpreter.cpp 
b/lldb/source/Interpreter/CommandInterpreter.cpp
index c990972ca64bcf..227ed802aa933c 100644
--- a/lldb/source/Interpreter/CommandInterpreter.cpp
+++ b/lldb/source/Interpreter/CommandInterpreter.cpp
@@ -441,6 +441,8 @@ void CommandInterpreter::Initialize() {
 
   cmd_obj_sp = GetCommandSPExact("expression");
   if (cmd_obj_sp) {
+// Ensure `e` runs `expression`.
+AddAlias("e", cmd_obj_sp);
 AddAlias("call", cmd_obj_sp, "--")->SetHelpLong("");
 CommandAlias *parray_alias =
 AddAlias("parray", cmd_obj_sp, "--element-count %1 --");

diff  --git a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py 
b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
index 02ee581da516d4..a8cbffbb7ba4a5 100644
--- a/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
+++ b/lldb/test/API/functionalities/abbreviation/TestAbbreviations.py
@@ -20,6 +20,10 @@ def test_command_abbreviations_and_aliases(self):
 self.assertTrue(result.Succeeded())
 self.assertEqual("apropos script", result.GetOutput())
 
+command_interpreter.ResolveCommand("e", result)
+self.assertTrue(result.Succeeded())
+self.assertEqual("expression", result.GetOutput())
+
 command_interpreter.ResolveCommand("h", result)
 self.assertTrue(result.Succeeded())
 self.assertEqual("help", result.GetOutput())



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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Zequan Wu via lldb-commits


@@ -0,0 +1,31 @@
+// Test lldb is able to compute the fully qualified names on templates with
+// -gsimple-template-names and -fdebug-types-section.
+
+// REQUIRES: lld
+
+// Test against logging to see if we print the fully qualified names correctly.
+// RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names %s -o %t
+// RUN: %lldb %t -o "log enable dwarf comp" -o "target variable v1 v2" -o exit 
| FileCheck %s --check-prefix=LOG
+
+// Test that we following DW_AT_signature correctly. If not, lldb might 
confuse the types of v1 and v2.
+// RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names 
-fdebug-types-section %s -o %t
+// RUN: %lldb %t -o "target variable v1 v2" -o exit | FileCheck %s 
--check-prefix=TYPE
+
+// LOG: unique name: ::t2 >
+// LOG: unique name: ::t2 >

ZequanWu wrote:

I recalled why I added this extra logging. It's to test this 
[change](https://github.com/llvm/llvm-project/pull/112811/files#diff-5dd6736e4d6c38623630df16c4494c1a8b099716ee0f05c9af54b4bafb1d864eR1619-R1625)
 in `DWARFASTParserClang::GetUniqueTypeNameAndDeclaration`, which is outside 
the `DWARFTypePrinter`. Though the change shouldn't change the lldb's behaviour 
at all (as long as the names generated by this function is consistent and 
unambiguous, the unique dwarf ast type map will work properly), it will be good 
the internally used names are correctly generated. 

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Zequan Wu via lldb-commits

https://github.com/ZequanWu updated 
https://github.com/llvm/llvm-project/pull/112811

>From 3fc0675398547617731d0501e3d4b98e2ffc480e Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Wed, 9 Oct 2024 22:35:46 -0700
Subject: [PATCH 1/3] [lldb][dwarf] Compute fully qualified names on simplified
 template names with DWARFTypePrinter

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 21 +++
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.h   |  7 
 .../Plugins/SymbolFile/DWARF/DWARFDIE.cpp | 35 ++
 .../Plugins/SymbolFile/DWARF/DWARFDIE.h   | 15 
 .../SymbolFile/DWARF/DWARFFormValue.cpp   | 25 +
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.h |  3 ++
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 36 +--
 .../TypeSystem/Clang/TypeSystemClang.cpp  | 20 ---
 .../TypeSystem/Clang/TypeSystemClang.h|  4 ---
 .../DWARF/x86/simplified-template-names.cpp   | 31 
 llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h  |  2 ++
 .../llvm/DebugInfo/DWARF/DWARFTypePrinter.h   | 31 ++--
 llvm/lib/DebugInfo/DWARF/DWARFDie.cpp |  9 +
 13 files changed, 170 insertions(+), 69 deletions(-)
 create mode 100644 
lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index a30d898a93cc4d..41cb11f94a45e8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -44,6 +44,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Type.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/DebugInfo/DWARF/DWARFTypePrinter.h"
 #include "llvm/Demangle/Demangle.h"
 
 #include 
@@ -825,11 +826,11 @@ std::string 
DWARFASTParserClang::GetDIEClassTemplateParams(DWARFDIE die) {
   if (llvm::StringRef(die.GetName()).contains("<"))
 return {};
 
-  TypeSystemClang::TemplateParameterInfos template_param_infos;
-  if (ParseTemplateParameterInfos(die, template_param_infos))
-return m_ast.PrintTemplateParams(template_param_infos);
-
-  return {};
+  std::string name;
+  llvm::raw_string_ostream os(name);
+  llvm::DWARFTypePrinter type_printer(os);
+  type_printer.appendAndTerminateTemplateParameters(die);
+  return name;
 }
 
 void DWARFASTParserClang::MapDeclDIEToDefDIE(
@@ -1617,9 +1618,9 @@ void DWARFASTParserClang::GetUniqueTypeNameAndDeclaration(
 case DW_TAG_structure_type:
 case DW_TAG_union_type: {
   if (const char *class_union_struct_name = parent_decl_ctx_die.GetName()) 
{
-qualified_name.insert(
-0, GetDIEClassTemplateParams(parent_decl_ctx_die));
 qualified_name.insert(0, "::");
+qualified_name.insert(0,
+  GetDIEClassTemplateParams(parent_decl_ctx_die));
 qualified_name.insert(0, class_union_struct_name);
   }
   parent_decl_ctx_die = parent_decl_ctx_die.GetParentDeclContextDIE();
@@ -1672,6 +1673,12 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   if (attrs.name) {
 GetUniqueTypeNameAndDeclaration(die, cu_language, unique_typename,
 unique_decl);
+if (log) {
+  dwarf->GetObjectFile()->GetModule()->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());
+}
 if (UniqueDWARFASTType *unique_ast_entry_type =
 dwarf->GetUniqueDWARFASTTypeMap().Find(
 unique_typename, die, unique_decl, byte_size,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
index 235343d2271223..ca25801137be38 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
@@ -24,9 +24,11 @@ class DWARFUnit;
 class DWARFDebugInfoEntry;
 class DWARFDeclContext;
 class SymbolFileDWARF;
+class DWARFFormValue;
 
 class DWARFBaseDIE {
 public:
+  using DWARFFormValue = dwarf::DWARFFormValue;
   DWARFBaseDIE() = default;
 
   DWARFBaseDIE(DWARFUnit *cu, DWARFDebugInfoEntry *die)
@@ -46,6 +48,7 @@ class DWARFBaseDIE {
   explicit operator bool() const { return IsValid(); }
 
   bool IsValid() const { return m_cu && m_die; }
+  bool isValid() const { return IsValid(); }
 
   bool HasChildren() const;
 
@@ -85,6 +88,8 @@ class DWARFBaseDIE {
   // Accessing information about a DIE
   dw_tag_t Tag() const;
 
+  dw_tag_t getTag() const { return Tag(); }
+
   dw_offset_t GetOffset() const;
 
   // Get the LLDB user ID for this DIE. This is often just the DIE offset,
@@ -95,6 +100,8 @@ class DWARFBaseDIE {
 
   const char *GetName() const;
 
+  const char *getShortName() const { return GetName(); }
+
   lldb::ModuleSP GetModule() const;
 
   // Gett

[Lldb-commits] [lldb] [lldb][docs] Document Lua 5.3 as the only supported version (PR #115288)

2024-11-07 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] [lldb][docs] Document Lua 5.3 as the only supported version (PR #115288)

2024-11-07 Thread Jonas Devlieghere via lldb-commits

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

LGTM. Lua doesn't guarantee compatibility between minor versions to Lua 5.3 and 
5.4 are more like Python 2 and Python 3 rather than Python 3.9 and 3.11 for 
example. I might try to get it working with both at some point (mostly because 
Homebrew install 5.4 by default and I have to do extra work to get `lua@5.3`). 
Until then this matches the state of things. 

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Zequan Wu via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Zequan Wu via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Zequan Wu via lldb-commits

https://github.com/ZequanWu updated 
https://github.com/llvm/llvm-project/pull/112811

>From 3fc0675398547617731d0501e3d4b98e2ffc480e Mon Sep 17 00:00:00 2001
From: Zequan Wu 
Date: Wed, 9 Oct 2024 22:35:46 -0700
Subject: [PATCH 1/4] [lldb][dwarf] Compute fully qualified names on simplified
 template names with DWARFTypePrinter

---
 .../SymbolFile/DWARF/DWARFASTParserClang.cpp  | 21 +++
 .../Plugins/SymbolFile/DWARF/DWARFBaseDIE.h   |  7 
 .../Plugins/SymbolFile/DWARF/DWARFDIE.cpp | 35 ++
 .../Plugins/SymbolFile/DWARF/DWARFDIE.h   | 15 
 .../SymbolFile/DWARF/DWARFFormValue.cpp   | 25 +
 .../Plugins/SymbolFile/DWARF/DWARFFormValue.h |  3 ++
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 36 +--
 .../TypeSystem/Clang/TypeSystemClang.cpp  | 20 ---
 .../TypeSystem/Clang/TypeSystemClang.h|  4 ---
 .../DWARF/x86/simplified-template-names.cpp   | 31 
 llvm/include/llvm/DebugInfo/DWARF/DWARFDie.h  |  2 ++
 .../llvm/DebugInfo/DWARF/DWARFTypePrinter.h   | 31 ++--
 llvm/lib/DebugInfo/DWARF/DWARFDie.cpp |  9 +
 13 files changed, 170 insertions(+), 69 deletions(-)
 create mode 100644 
lldb/test/Shell/SymbolFile/DWARF/x86/simplified-template-names.cpp

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
index a30d898a93cc4d..41cb11f94a45e8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp
@@ -44,6 +44,7 @@
 #include "clang/AST/DeclTemplate.h"
 #include "clang/AST/Type.h"
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/DebugInfo/DWARF/DWARFTypePrinter.h"
 #include "llvm/Demangle/Demangle.h"
 
 #include 
@@ -825,11 +826,11 @@ std::string 
DWARFASTParserClang::GetDIEClassTemplateParams(DWARFDIE die) {
   if (llvm::StringRef(die.GetName()).contains("<"))
 return {};
 
-  TypeSystemClang::TemplateParameterInfos template_param_infos;
-  if (ParseTemplateParameterInfos(die, template_param_infos))
-return m_ast.PrintTemplateParams(template_param_infos);
-
-  return {};
+  std::string name;
+  llvm::raw_string_ostream os(name);
+  llvm::DWARFTypePrinter type_printer(os);
+  type_printer.appendAndTerminateTemplateParameters(die);
+  return name;
 }
 
 void DWARFASTParserClang::MapDeclDIEToDefDIE(
@@ -1617,9 +1618,9 @@ void DWARFASTParserClang::GetUniqueTypeNameAndDeclaration(
 case DW_TAG_structure_type:
 case DW_TAG_union_type: {
   if (const char *class_union_struct_name = parent_decl_ctx_die.GetName()) 
{
-qualified_name.insert(
-0, GetDIEClassTemplateParams(parent_decl_ctx_die));
 qualified_name.insert(0, "::");
+qualified_name.insert(0,
+  GetDIEClassTemplateParams(parent_decl_ctx_die));
 qualified_name.insert(0, class_union_struct_name);
   }
   parent_decl_ctx_die = parent_decl_ctx_die.GetParentDeclContextDIE();
@@ -1672,6 +1673,12 @@ DWARFASTParserClang::ParseStructureLikeDIE(const 
SymbolContext &sc,
   if (attrs.name) {
 GetUniqueTypeNameAndDeclaration(die, cu_language, unique_typename,
 unique_decl);
+if (log) {
+  dwarf->GetObjectFile()->GetModule()->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());
+}
 if (UniqueDWARFASTType *unique_ast_entry_type =
 dwarf->GetUniqueDWARFASTTypeMap().Find(
 unique_typename, die, unique_decl, byte_size,
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
index 235343d2271223..ca25801137be38 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h
@@ -24,9 +24,11 @@ class DWARFUnit;
 class DWARFDebugInfoEntry;
 class DWARFDeclContext;
 class SymbolFileDWARF;
+class DWARFFormValue;
 
 class DWARFBaseDIE {
 public:
+  using DWARFFormValue = dwarf::DWARFFormValue;
   DWARFBaseDIE() = default;
 
   DWARFBaseDIE(DWARFUnit *cu, DWARFDebugInfoEntry *die)
@@ -46,6 +48,7 @@ class DWARFBaseDIE {
   explicit operator bool() const { return IsValid(); }
 
   bool IsValid() const { return m_cu && m_die; }
+  bool isValid() const { return IsValid(); }
 
   bool HasChildren() const;
 
@@ -85,6 +88,8 @@ class DWARFBaseDIE {
   // Accessing information about a DIE
   dw_tag_t Tag() const;
 
+  dw_tag_t getTag() const { return Tag(); }
+
   dw_offset_t GetOffset() const;
 
   // Get the LLDB user ID for this DIE. This is often just the DIE offset,
@@ -95,6 +100,8 @@ class DWARFBaseDIE {
 
   const char *GetName() const;
 
+  const char *getShortName() const { return GetName(); }
+
   lldb::ModuleSP GetModule() const;
 
   // Gett

[Lldb-commits] [lldb] [lldb] Support overriding the disassembly CPU & features (PR #115382)

2024-11-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

Add the ability to override the disassembly CPU and CPU features through a 
target setting (`target.disassembly-cpu` and
`target.disassembly-features`) and a `disassemble` command option (`--cpu` and 
`--features`).

This is especially relevant for architectures like RISC-V which relies heavily 
on CPU extensions.

The majority of this patch is plumbing the options through. I recommend looking 
at DisassemblerLLVMC and the test for the observable change in behavior.

---

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


30 Files Affected:

- (modified) lldb/include/lldb/Core/Disassembler.h (+17-15) 
- (modified) lldb/include/lldb/Interpreter/CommandOptionArgumentTable.h (+2) 
- (modified) lldb/include/lldb/Target/Target.h (+4) 
- (modified) lldb/include/lldb/lldb-enumerations.h (+2) 
- (modified) lldb/include/lldb/lldb-private-interfaces.h (+3-2) 
- (modified) lldb/source/API/SBFunction.cpp (+2-2) 
- (modified) lldb/source/API/SBSymbol.cpp (+2-2) 
- (modified) lldb/source/API/SBTarget.cpp (+7-6) 
- (modified) lldb/source/Commands/CommandObjectDisassemble.cpp (+28-10) 
- (modified) lldb/source/Commands/CommandObjectDisassemble.h (+14) 
- (modified) lldb/source/Commands/Options.td (+4) 
- (modified) lldb/source/Core/Disassembler.cpp (+25-17) 
- (modified) lldb/source/Core/DumpDataExtractor.cpp (+4-3) 
- (modified) lldb/source/Expression/IRExecutionUnit.cpp (+4-2) 
- (modified) lldb/source/Plugins/Architecture/Mips/ArchitectureMips.cpp (+1-1) 
- (modified) lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp 
(+65-55) 
- (modified) lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.h (+5-3) 
- (modified) 
lldb/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp 
(+1-1) 
- (modified) lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp 
(+5-2) 
- (modified) 
lldb/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
 (+2-2) 
- (modified) lldb/source/Symbol/Function.cpp (+3-3) 
- (modified) lldb/source/Symbol/Symbol.cpp (+3-3) 
- (modified) lldb/source/Target/Process.cpp (+4-1) 
- (modified) lldb/source/Target/StackFrame.cpp (+11-6) 
- (modified) lldb/source/Target/Target.cpp (+14) 
- (modified) lldb/source/Target/TargetProperties.td (+6) 
- (modified) lldb/source/Target/ThreadPlanStepRange.cpp (+4-2) 
- (modified) lldb/source/Target/ThreadPlanTracer.cpp (+3-2) 
- (modified) lldb/source/Target/TraceDumper.cpp (+3-3) 
- (added) lldb/test/Shell/Commands/command-disassemble-cpu-features.yaml (+230) 


``diff
diff --git a/lldb/include/lldb/Core/Disassembler.h 
b/lldb/include/lldb/Core/Disassembler.h
index 21969aed03c209..e0ad4316e02497 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -409,35 +409,37 @@ class Disassembler : public 
std::enable_shared_from_this,
   // flavor string gets set wrong. Instead, if you get a flavor string you
   // don't understand, use the default.  Folks who care to check can use the
   // FlavorValidForArchSpec method on the disassembler they got back.
-  static lldb::DisassemblerSP
-  FindPlugin(const ArchSpec &arch, const char *flavor, const char 
*plugin_name);
+  static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch,
+ const char *flavor, const char *cpu,
+ const char *features,
+ const char *plugin_name);
 
   // This version will use the value in the Target settings if flavor is NULL;
-  static lldb::DisassemblerSP FindPluginForTarget(const Target &target,
-  const ArchSpec &arch,
-  const char *flavor,
-  const char *plugin_name);
+  static lldb::DisassemblerSP
+  FindPluginForTarget(const Target &target, const ArchSpec &arch,
+  const char *flavor, const char *cpu, const char 
*features,
+  const char *plugin_name);
 
   struct Limit {
 enum { Bytes, Instructions } kind;
 lldb::addr_t value;
   };
 
-  static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch,
-   const char *plugin_name,
-   const char *flavor,
-   Target &target,
-   const AddressRange 
&disasm_range,
-   bool force_live_memory = false);
+  static lldb::DisassemblerSP
+  DisassembleRange(const ArchSpec &arch, const char *plugin_name,
+   const char *flavor, const char *cpu, const char *features,
+   Target &target, const AddressRange &disasm_range,
+   

[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4 variant on Darwin (PR #115401)

2024-11-07 Thread Michael Buch via lldb-commits

https://github.com/Michael137 created 
https://github.com/llvm/llvm-project/pull/115401

https://github.com/llvm/llvm-project/pull/111859 fixed these tests for DWARFv4 
on Linux by adjusting the manual index. As part of the change we unXFAILed 
these tests for DWARFv4 on all platforms. However, the manual index isn't used 
on macOS so they're still broken. This patch reverts the XFAIL on Darwin for 
DWARFv4.

Example CI failure:
```
FAIL: test_inline_static_members_dwarf4_dsym 
(TestConstStaticIntegralMember.TestCase)
--
Traceback (most recent call last):
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 1769, in test_method
return attrvalue(self)
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 153, in test_inline_static_members_dwarf4
self.check_inline_static_members("-gdwarf-4")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 129, in check_inline_static_members
self.check_global_var("A::int_val", "const int", "1")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 118, in check_global_var
self.assertGreaterEqual(len(var_list), 1)
AssertionError: 0 not greater than or equal to 1
```

>From 0b81874674b52c3252c71f9e0713abe37bb55373 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Fri, 8 Nov 2024 00:18:03 +
Subject: [PATCH] [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4
 variant on Darwin

https://github.com/llvm/llvm-project/pull/111859 fixed these
tests for DWARFv4 on Linux by adjusting the manual index.
As part of the change we unXFAILed these tests for DWARFv4
on all platforms. However, the manual index isn't used on macOS
so they're still broken. This patch reverts the XFAIL on Darwin
for DWARFv4.

Example CI failure:
```
FAIL: test_inline_static_members_dwarf4_dsym 
(TestConstStaticIntegralMember.TestCase)
--
Traceback (most recent call last):
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 1769, in test_method
return attrvalue(self)
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 153, in test_inline_static_members_dwarf4
self.check_inline_static_members("-gdwarf-4")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 129, in check_inline_static_members
self.check_global_var("A::int_val", "const int", "1")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 118, in check_global_var
self.assertGreaterEqual(len(var_list), 1)
AssertionError: 0 not greater than or equal to 1
```
---
 .../TestConstStaticIntegralMember.py  | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 23349f7e89acae..cb01c7fc3612ce 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -150,7 +150,7 @@ def test_inline_static_members_dwarf5(self):
 self.check_inline_static_members("-gdwarf-5")
 
 # On linux this passes due to the manual index
-@expectedFailureDarwin(debug_info=no_match(["dsym"]))
+@expectedFailureDarwin
 def test_inline_static_members_dwarf4(self):
 self.check_inline_static_members("-gdwarf-4")
 
@@ -203,7 +203,7 @@ def test_shadowed_static_inline_members_dwarf5(self):
 self.check_shadowed_static_inline_members("-gdwarf-5")
 
 # On linux this passes due to the manual index
-@expectedFailureDarwin(debug_info=no_match(["dsym"]))
+@expectedFailureDarwin
 def test_shadowed_static_inline_members_dwarf4(self):
 self.check_shadowed_static_inline_members("-gdwarf-4")
 

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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4 variant on Darwin (PR #115401)

2024-11-07 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4 variant on Darwin (PR #115401)

2024-11-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

https://github.com/llvm/llvm-project/pull/111859 fixed these tests for DWARFv4 
on Linux by adjusting the manual index. As part of the change we unXFAILed 
these tests for DWARFv4 on all platforms. However, the manual index isn't used 
on macOS so they're still broken. This patch reverts the XFAIL on Darwin for 
DWARFv4.

Example CI failure:
```
FAIL: test_inline_static_members_dwarf4_dsym 
(TestConstStaticIntegralMember.TestCase)
--
Traceback (most recent call last):
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 1769, in test_method
return attrvalue(self)
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 153, in test_inline_static_members_dwarf4
self.check_inline_static_members("-gdwarf-4")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 129, in check_inline_static_members
self.check_global_var("A::int_val", "const int", "1")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 118, in check_global_var
self.assertGreaterEqual(len(var_list), 1)
AssertionError: 0 not greater than or equal to 1
```

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


1 Files Affected:

- (modified) 
lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 (+2-2) 


``diff
diff --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 23349f7e89acae..cb01c7fc3612ce 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -150,7 +150,7 @@ def test_inline_static_members_dwarf5(self):
 self.check_inline_static_members("-gdwarf-5")
 
 # On linux this passes due to the manual index
-@expectedFailureDarwin(debug_info=no_match(["dsym"]))
+@expectedFailureDarwin
 def test_inline_static_members_dwarf4(self):
 self.check_inline_static_members("-gdwarf-4")
 
@@ -203,7 +203,7 @@ def test_shadowed_static_inline_members_dwarf5(self):
 self.check_shadowed_static_inline_members("-gdwarf-5")
 
 # On linux this passes due to the manual index
-@expectedFailureDarwin(debug_info=no_match(["dsym"]))
+@expectedFailureDarwin
 def test_shadowed_static_inline_members_dwarf4(self):
 self.check_shadowed_static_inline_members("-gdwarf-4")
 

``




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


[Lldb-commits] [lldb] [lldb] Index static const members of classes, structs and unions as global variables in DWARF 4 and earlier (PR #111859)

2024-11-07 Thread Michael Buch via lldb-commits

Michael137 wrote:

https://github.com/llvm/llvm-project/pull/115401

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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4 variant on Darwin (PR #115401)

2024-11-07 Thread Adrian Prantl via lldb-commits

https://github.com/adrian-prantl approved this pull request.


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


[Lldb-commits] [lldb] [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4 variant on Darwin (PR #115401)

2024-11-07 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Support overriding the disassembly CPU & features (PR #115382)

2024-11-07 Thread Jonas Devlieghere via lldb-commits

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

>From b5947cfe8fd7702f801c91f48ca050a5c839a707 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 7 Nov 2024 14:08:50 -0800
Subject: [PATCH 1/3] [lldb] Support overriding the disassembly CPU & features

Add the ability to override the disassembly CPU and CPU features through
a target setting (`target.disassembly-cpu` and
`target.disassembly-features`) and a `disassemble` command option
(`--cpu` and `--features`).

This is especially relevant for architectures like RISC-V which relies
heavily on CPU extensions.

The majority of this patch is plumbing the options through. I recommend
looking at DisassemblerLLVMC and the test for the observable change in
behavior.
---
 lldb/include/lldb/Core/Disassembler.h |  32 +--
 .../Interpreter/CommandOptionArgumentTable.h  |   2 +
 lldb/include/lldb/Target/Target.h |   4 +
 lldb/include/lldb/lldb-enumerations.h |   2 +
 lldb/include/lldb/lldb-private-interfaces.h   |   5 +-
 lldb/source/API/SBFunction.cpp|   4 +-
 lldb/source/API/SBSymbol.cpp  |   4 +-
 lldb/source/API/SBTarget.cpp  |  13 +-
 .../Commands/CommandObjectDisassemble.cpp |  38 ++-
 .../Commands/CommandObjectDisassemble.h   |  14 ++
 lldb/source/Commands/Options.td   |   4 +
 lldb/source/Core/Disassembler.cpp |  42 ++--
 lldb/source/Core/DumpDataExtractor.cpp|   7 +-
 lldb/source/Expression/IRExecutionUnit.cpp|   6 +-
 .../Architecture/Mips/ArchitectureMips.cpp|   2 +-
 .../Disassembler/LLVMC/DisassemblerLLVMC.cpp  | 120 -
 .../Disassembler/LLVMC/DisassemblerLLVMC.h|   8 +-
 .../Windows-DYLD/DynamicLoaderWindowsDYLD.cpp |   2 +-
 .../Process/Utility/StopInfoMachException.cpp |   7 +-
 .../UnwindAssemblyInstEmulation.cpp   |   4 +-
 lldb/source/Symbol/Function.cpp   |   6 +-
 lldb/source/Symbol/Symbol.cpp |   6 +-
 lldb/source/Target/Process.cpp|   5 +-
 lldb/source/Target/StackFrame.cpp |  17 +-
 lldb/source/Target/Target.cpp |  14 ++
 lldb/source/Target/TargetProperties.td|   6 +
 lldb/source/Target/ThreadPlanStepRange.cpp|   6 +-
 lldb/source/Target/ThreadPlanTracer.cpp   |   5 +-
 lldb/source/Target/TraceDumper.cpp|   6 +-
 .../command-disassemble-cpu-features.yaml | 230 ++
 30 files changed, 478 insertions(+), 143 deletions(-)
 create mode 100644 
lldb/test/Shell/Commands/command-disassemble-cpu-features.yaml

diff --git a/lldb/include/lldb/Core/Disassembler.h 
b/lldb/include/lldb/Core/Disassembler.h
index 21969aed03c209..e0ad4316e02497 100644
--- a/lldb/include/lldb/Core/Disassembler.h
+++ b/lldb/include/lldb/Core/Disassembler.h
@@ -409,35 +409,37 @@ class Disassembler : public 
std::enable_shared_from_this,
   // flavor string gets set wrong. Instead, if you get a flavor string you
   // don't understand, use the default.  Folks who care to check can use the
   // FlavorValidForArchSpec method on the disassembler they got back.
-  static lldb::DisassemblerSP
-  FindPlugin(const ArchSpec &arch, const char *flavor, const char 
*plugin_name);
+  static lldb::DisassemblerSP FindPlugin(const ArchSpec &arch,
+ const char *flavor, const char *cpu,
+ const char *features,
+ const char *plugin_name);
 
   // This version will use the value in the Target settings if flavor is NULL;
-  static lldb::DisassemblerSP FindPluginForTarget(const Target &target,
-  const ArchSpec &arch,
-  const char *flavor,
-  const char *plugin_name);
+  static lldb::DisassemblerSP
+  FindPluginForTarget(const Target &target, const ArchSpec &arch,
+  const char *flavor, const char *cpu, const char 
*features,
+  const char *plugin_name);
 
   struct Limit {
 enum { Bytes, Instructions } kind;
 lldb::addr_t value;
   };
 
-  static lldb::DisassemblerSP DisassembleRange(const ArchSpec &arch,
-   const char *plugin_name,
-   const char *flavor,
-   Target &target,
-   const AddressRange 
&disasm_range,
-   bool force_live_memory = false);
+  static lldb::DisassemblerSP
+  DisassembleRange(const ArchSpec &arch, const char *plugin_name,
+   const char *flavor, const char *cpu, const char *features,
+   Target &target, const AddressRange &disasm_range,
+   bool force_live_memory = false);
 
   static lldb::Disass

[Lldb-commits] [lldb] 1ced07e - [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4 variant on Darwin (#115401)

2024-11-07 Thread via lldb-commits

Author: Michael Buch
Date: 2024-11-08T00:23:38Z
New Revision: 1ced07e06e23659a96dbf6d53cd68d3bbbe3d792

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

LOG: [lldb][test] TestConstStaticIntegralMember.py: XFAIL DWARFv4 variant on 
Darwin (#115401)

https://github.com/llvm/llvm-project/pull/111859 fixed these tests for
DWARFv4 on Linux by adjusting the manual index. As part of the change we
unXFAILed these tests for DWARFv4 on all platforms. However, the manual
index isn't used on macOS so they're still broken. This patch reverts
the XFAIL on Darwin for DWARFv4.

Example CI failure:
```
FAIL: test_inline_static_members_dwarf4_dsym 
(TestConstStaticIntegralMember.TestCase)
--
Traceback (most recent call last):
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 1769, in test_method
return attrvalue(self)
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 153, in test_inline_static_members_dwarf4
self.check_inline_static_members("-gdwarf-4")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 129, in check_inline_static_members
self.check_global_var("A::int_val", "const int", "1")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 118, in check_global_var
self.assertGreaterEqual(len(var_list), 1)
AssertionError: 0 not greater than or equal to 1
```

Added: 


Modified: 

lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index 23349f7e89acae..cb01c7fc3612ce 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -150,7 +150,7 @@ def test_inline_static_members_dwarf5(self):
 self.check_inline_static_members("-gdwarf-5")
 
 # On linux this passes due to the manual index
-@expectedFailureDarwin(debug_info=no_match(["dsym"]))
+@expectedFailureDarwin
 def test_inline_static_members_dwarf4(self):
 self.check_inline_static_members("-gdwarf-4")
 
@@ -203,7 +203,7 @@ def test_shadowed_static_inline_members_dwarf5(self):
 self.check_shadowed_static_inline_members("-gdwarf-5")
 
 # On linux this passes due to the manual index
-@expectedFailureDarwin(debug_info=no_match(["dsym"]))
+@expectedFailureDarwin
 def test_shadowed_static_inline_members_dwarf4(self):
 self.check_shadowed_static_inline_members("-gdwarf-4")
 



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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -11,23 +11,28 @@
 #define LLDB_TOOLS_LLDB_DAP_INSTRUCTIONBREAKPOINT_H
 
 #include "Breakpoint.h"
+#include "DAPForward.h"
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include 
 
 namespace lldb_dap {
 
 // Instruction Breakpoint
 struct InstructionBreakpoint : public Breakpoint {
 
   lldb::addr_t instructionAddressReference;
-  int32_t id;
   int32_t offset;
 
-  InstructionBreakpoint()
-  : Breakpoint(), instructionAddressReference(LLDB_INVALID_ADDRESS), id(0),
+  InstructionBreakpoint(DAP &d)

labath wrote:

```suggestion
  explicit InstructionBreakpoint(DAP &d)
```

And maybe in some other cases as well.

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -2701,28 +2702,21 @@ void request_setBreakpoints(const llvm::json::Object 
&request) {
   // to an empty array.
   if (breakpoints) {
 for (const auto &bp : *breakpoints) {
-  auto bp_obj = bp.getAsObject();
+  const auto *bp_obj = bp.getAsObject();
   if (bp_obj) {
-SourceBreakpoint src_bp(*bp_obj);
-request_bps[src_bp.line] = src_bp;
-
+SourceBreakpoint src_bp(g_dap, *bp_obj);
+request_bps.try_emplace(src_bp.line, src_bp);
+const auto [kv, inserted] =
+g_dap.source_breakpoints[path].try_emplace(src_bp.line, src_bp);
 // We check if this breakpoint already exists to update it
-auto existing_source_bps = g_dap.source_breakpoints.find(path);
-if (existing_source_bps != g_dap.source_breakpoints.end()) {
-  const auto &existing_bp =
-  existing_source_bps->second.find(src_bp.line);
-  if (existing_bp != existing_source_bps->second.end()) {
-existing_bp->second.UpdateBreakpoint(src_bp);
-AppendBreakpoint(&existing_bp->second, response_breakpoints, path,
- src_bp.line);
-continue;
-  }
+if (inserted) {
+  kv->getSecond().SetBreakpoint(path.data());
+} else {
+  kv->getSecond().UpdateBreakpoint(src_bp);
 }

labath wrote:

```suggestion
if (inserted)
  kv->getSecond().SetBreakpoint(path.data());
else
  kv->getSecond().UpdateBreakpoint(src_bp);
```

We don't use braces on statements that fit on a single line. 
https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements

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


[Lldb-commits] [lldb] [lldb][docs] Document Lua 5.3 as the only supported version (PR #115288)

2024-11-07 Thread David Spickett via lldb-commits

https://github.com/DavidSpickett created 
https://github.com/llvm/llvm-project/pull/115288

Technically you can manually set `LUA_LIBRARIES` and others to use a different 
version, and I don't see any version checks in the C++ code. However, I'm not 
sure that is intentional, it looks more like a side effect of how the CMake was 
written.

>From 99e8ea45dd2f8f56a5dbf590b02452d697168a07 Mon Sep 17 00:00:00 2001
From: David Spickett 
Date: Thu, 7 Nov 2024 09:45:57 +
Subject: [PATCH] [lldb][docs] Document Lua 5.3 as the only supported version

Technically you can manually set `LUA_LIBRARIES` and others
to use a different version, and I don't see any version checks
in the C++ code.

However, I'm not sure that is intentional, it looks more like a
side effect of how the CMake was written.
---
 lldb/docs/resources/build.rst | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index 33b6a6f79def4b..e64f71d0325382 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -64,7 +64,7 @@ CMake configuration error.
 
+---+--+--+
 | Python| Python scripting | 
``LLDB_ENABLE_PYTHON``   |
 
+---+--+--+
-| Lua   | Lua scripting| 
``LLDB_ENABLE_LUA``  |
+| Lua   | Lua scripting. Only version 5.3 is supported.| 
``LLDB_ENABLE_LUA``  |
 
+---+--+--+
 
 Depending on your platform and package manager, one might run any of the

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


[Lldb-commits] [lldb] [lldb][docs] Document Lua 5.3 as the only supported version (PR #115288)

2024-11-07 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: David Spickett (DavidSpickett)


Changes

Technically you can manually set `LUA_LIBRARIES` and others to use a different 
version, and I don't see any version checks in the C++ code. However, I'm not 
sure that is intentional, it looks more like a side effect of how the CMake was 
written.

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


1 Files Affected:

- (modified) lldb/docs/resources/build.rst (+1-1) 


``diff
diff --git a/lldb/docs/resources/build.rst b/lldb/docs/resources/build.rst
index 33b6a6f79def4b..e64f71d0325382 100644
--- a/lldb/docs/resources/build.rst
+++ b/lldb/docs/resources/build.rst
@@ -64,7 +64,7 @@ CMake configuration error.
 
+---+--+--+
 | Python| Python scripting | 
``LLDB_ENABLE_PYTHON``   |
 
+---+--+--+
-| Lua   | Lua scripting| 
``LLDB_ENABLE_LUA``  |
+| Lua   | Lua scripting. Only version 5.3 is supported.| 
``LLDB_ENABLE_LUA``  |
 
+---+--+--+
 
 Depending on your platform and package manager, one might run any of the

``




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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo commented:

Besides everything mentioned by Pavel, this looks pretty good.


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


[Lldb-commits] [lldb] [lldb] Index static const members of classes, structs and unions as global variables in DWARF 4 and earlier (PR #111859)

2024-11-07 Thread Michael Buch via lldb-commits

Michael137 wrote:

This also fails on the macOS buildbots:
```
FAIL: test_inline_static_members_dwarf4_dsym 
(TestConstStaticIntegralMember.TestCase)
--
Traceback (most recent call last):
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py",
 line 1769, in test_method
return attrvalue(self)
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 153, in test_inline_static_members_dwarf4
self.check_inline_static_members("-gdwarf-4")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 129, in check_inline_static_members
self.check_global_var("A::int_val", "const int", "1")
  File 
"/Users/ec2-user/jenkins/workspace/llvm.org/lldb-cmake/llvm-project/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py",
 line 118, in check_global_var
self.assertGreaterEqual(len(var_list), 1)
AssertionError: 0 not greater than or equal to 1
```
Could you take a look? Not sure why the XFAIL isn't catching this.

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


[Lldb-commits] [lldb] 85eec89 - [lldb][test] Disable new dwarf5 integral member tests on Windows

2024-11-07 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2024-11-07T15:27:12Z
New Revision: 85eec89600085a054650585d3a3287a6e0a93a50

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

LOG: [lldb][test] Disable new dwarf5 integral member tests on Windows

Added by https://github.com/llvm/llvm-project/pull/111859

Due to:
https://lab.llvm.org/buildbot/#/builders/141/builds/3691

This is not uncommon with DWARF testing on Windows. We may be
discarding the required information during linking.

I will look into it next week.

Added: 


Modified: 

lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py

Removed: 




diff  --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index e3d004b38a1571..23349f7e89acae 100644
--- 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
+++ 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
@@ -142,6 +142,8 @@ def check_inline_static_members(self, flags):
 "ClassWithConstexprs::scoped_enum_val", "ScopedEnum", 
"scoped_enum_case2"
 )
 
+# Fails on Windows for unknown reasons.
+@skipIfWindows
 # On linux this passes due to the manual index
 @expectedFailureDarwin(debug_info=no_match(["dsym"]))
 def test_inline_static_members_dwarf5(self):
@@ -193,6 +195,8 @@ def check_shadowed_static_inline_members(self, flags):
 self.expect_expr("ns::Foo::mem", result_value="10")
 self.expect_expr("::Foo::mem", result_value="-29")
 
+# Fails on Windows for unknown reasons.
+@skipIfWindows
 # On linux this passes due to the manual index
 @expectedFailureDarwin(debug_info=no_match(["dsym"]))
 def test_shadowed_static_inline_members_dwarf5(self):



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


[Lldb-commits] [lldb] [lldb] Index static const members of classes, structs and unions as global variables in DWARF 4 and earlier (PR #111859)

2024-11-07 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I've disabled the new tests on Windows but can't look into the reason for the 
failures until next week.

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


[Lldb-commits] [lldb] 1361c19 - [lldb] Index static const members of classes, structs and unions as global variables in DWARF 4 and earlier (#111859)

2024-11-07 Thread via lldb-commits

Author: Ilia Kuklin
Date: 2024-11-07T16:06:03+05:00
New Revision: 1361c19c04d0b3d9156fe0c5393d158cf69c14e7

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

LOG: [lldb] Index static const members of classes, structs and unions as global 
variables in DWARF 4 and earlier (#111859)

In DWARF 4 and earlier `static const` members of structs, classes and
unions have an entry tag `DW_TAG_member`, and are also tagged as
`DW_AT_declaration`, but otherwise follow the same rules as
`DW_TAG_variable`.

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp

lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
lldb/test/API/lang/cpp/const_static_integral_member/main.cpp

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
index 66d0bc4b90cb52..c0a2066f8239e5 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
@@ -614,7 +614,7 @@ DWARFDebugInfoEntry::GetAbbreviationDeclarationPtr(const 
DWARFUnit *cu) const {
 }
 
 bool DWARFDebugInfoEntry::IsGlobalOrStaticScopeVariable() const {
-  if (Tag() != DW_TAG_variable)
+  if (Tag() != DW_TAG_variable && Tag() != DW_TAG_member)
 return false;
   const DWARFDebugInfoEntry *parent_die = GetParent();
   while (parent_die != nullptr) {

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
index 887983de2e8516..1220e6115a2a95 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/ManualDWARFIndex.cpp
@@ -222,6 +222,13 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
 case DW_TAG_variable:
   break;
 
+case DW_TAG_member:
+  // Only in DWARF 4 and earlier `static const` members of a struct, a 
class
+  // or a union have an entry tag `DW_TAG_member`
+  if (unit.GetVersion() >= 5)
+continue;
+  break;
+
 default:
   continue;
 }
@@ -362,6 +369,18 @@ void ManualDWARFIndex::IndexUnitImpl(DWARFUnit &unit,
 set.namespaces.Insert(ConstString(name), ref);
   break;
 
+case DW_TAG_member: {
+  // In DWARF 4 and earlier `static const` members of a struct, a class or 
a
+  // union have an entry tag `DW_TAG_member`, and are also tagged as
+  // `DW_AT_declaration`, but otherwise follow the same rules as
+  // `DW_TAG_variable`.
+  bool parent_is_class_type = false;
+  if (auto parent = die.GetParent())
+parent_is_class_type = DWARFDIE(&unit, parent).IsStructUnionOrClass();
+  if (!parent_is_class_type || !is_declaration)
+break;
+  [[fallthrough]];
+}
 case DW_TAG_variable:
   if (name && has_location_or_const_value && is_global_or_static_variable) 
{
 set.globals.Insert(ConstString(name), ref);

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index f39189b6cead42..e19c490bf44d3f 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2403,7 +2403,7 @@ void SymbolFileDWARF::FindGlobalVariables(
   sc.module_sp = m_objfile_sp->GetModule();
 assert(sc.module_sp);
 
-if (die.Tag() != DW_TAG_variable)
+if (die.Tag() != DW_TAG_variable && die.Tag() != DW_TAG_member)
   return true;
 
 auto *dwarf_cu = llvm::dyn_cast(die.GetCU());
@@ -3505,7 +3505,7 @@ VariableSP SymbolFileDWARF::ParseVariableDIE(const 
SymbolContext &sc,
   ModuleSP module = GetObjectFile()->GetModule();
 
   if (tag != DW_TAG_variable && tag != DW_TAG_constant &&
-  (tag != DW_TAG_formal_parameter || !sc.function))
+  tag != DW_TAG_member && (tag != DW_TAG_formal_parameter || !sc.function))
 return nullptr;
 
   DWARFAttributes attributes = die.GetAttributes();
@@ -3811,7 +3811,7 @@ void SymbolFileDWARF::ParseAndAppendGlobalVariable(
 return;
 
   dw_tag_t tag = die.Tag();
-  if (tag != DW_TAG_variable && tag != DW_TAG_constant)
+  if (tag != DW_TAG_variable && tag != DW_TAG_constant && tag != DW_TAG_member)
 return;
 
   // Check to see if we have already parsed this variable or constant?

diff  --git 
a/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
 
b/lldb/test/API/lang/cpp/const_static_integral_member/TestConstStaticIntegralMember.py
index cdade2d335df0b..e3d004b38a1571 100644
--- 
a/lldb/test/API/lang/cp

[Lldb-commits] [lldb] [lldb] Index static const members of classes, structs and unions as global variables in DWARF 4 and earlier (PR #111859)

2024-11-07 Thread Ilia Kuklin via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -4572,235 +4554,219 @@ void request__testGetTargetBreakpoints(const 
llvm::json::Object &request) {
 //   "(with reason `instruction breakpoint`) is generated.\nClients "
 //   "should only call this request if the corresponding capability "
 //   "`supportsInstructionBreakpoints` is true.",
-//   "properties" : {
-// "command" : {"type" : "string", "enum" :
-// ["setInstructionBreakpoints"]}, "arguments" :
-// {"$ref" : "#/definitions/SetInstructionBreakpointsArguments"}
+//   "properties": {
+// "command": { "type": "string", "enum": ["setInstructionBreakpoints"]
+// }, "arguments": {"$ref":
+// "#/definitions/SetInstructionBreakpointsArguments"}
 //   },
-//   "required" : [ "command", "arguments" ]
+//   "required": [ "command", "arguments" ]
 // }
 //   ]
 // },
-//  "SetInstructionBreakpointsArguments"
-// : {
-//   "type" : "object",
-//   "description" : "Arguments for `setInstructionBreakpoints` request",
-//   "properties" : {
-// "breakpoints" : {
-//   "type" : "array",
-//   "items" : {"$ref" : "#/definitions/InstructionBreakpoint"},
-//   "description" : "The instruction references of the breakpoints"
-// }
-//   },
-//   "required" : ["breakpoints"]
-// },
-//   "SetInstructionBreakpointsResponse"
-// : {
-//   "allOf" : [
-// {"$ref" : "#/definitions/Response"}, {
-//   "type" : "object",
-//   "description" : "Response to `setInstructionBreakpoints` request",
-//   "properties" : {
-// "body" : {
-//   "type" : "object",
-//   "properties" : {
-// "breakpoints" : {
-//   "type" : "array",
-//   "items" : {"$ref" : "#/definitions/Breakpoint"},
-//   "description" :
-//   "Information about the breakpoints. The array elements
-//   " "correspond to the elements of the `breakpoints`
-//   array."
-// }
-//   },
-//   "required" : ["breakpoints"]
+// "SetInstructionBreakpointsArguments": {
+//   "type": "object",
+//   "description": "Arguments for `setInstructionBreakpoints` request",
+//   "properties": {
+// "breakpoints": {
+//   "type": "array",
+//   "items": {"$ref": "#/definitions/InstructionBreakpoint"},
+//   "description": "The instruction references of the breakpoints"
+// }
+//   },
+//   "required": ["breakpoints"]
+// },
+// "SetInstructionBreakpointsResponse": {
+//   "allOf": [
+// {"$ref": "#/definitions/Response"},
+// {
+//   "type": "object",
+//   "description": "Response to `setInstructionBreakpoints` request",
+//   "properties": {
+// "body": {
+//   "type": "object",
+//   "properties": {
+// "breakpoints": {
+//   "type": "array",
+//   "items": {"$ref": "#/definitions/Breakpoint"},
+//   "description":
+//   "Information about the breakpoints. The array elements
+//   " "correspond to the elements of the `breakpoints`
+//   array."
 // }
 //   },
-//   "required" : ["body"]
+//   "required": ["breakpoints"]
 // }
-//   ]
-// },
-// "InstructionBreakpoint" : {
-//   "type" : "object",
-//   "description" : "Properties of a breakpoint passed to the "
+//   },
+//   "required": ["body"]
+// }
+//   ]
+// },
+// "InstructionBreakpoint": {
+//   "type": "object",
+//   "description": "Properties of a breakpoint passed to the "
 //   "`setInstructionBreakpoints` request",
-//   "properties" : {
-// "instructionReference" : {
-//   "type" : "string",
+//   "properties": {
+// "instructionReference": {
+//   "type": "string",
 //   "description" :
 //   "The instruction reference of the breakpoint.\nThis should be a "
 //   "memory or instruction pointer reference from an
 //   `EvaluateResponse`, "
 //   "`Variable`, `StackFrame`, `GotoTarget`, or `Breakpoint`."
 // },
-// "offset" : {
-//   "type" : "integer",
-//   "description" : "The offset from the instruction reference in "
+// "offset": {
+//   "type": "integer",
+//   "description": "The offset from the instruction reference in "
 //   "bytes.\nThis can be negative."
 // },
-// "condition" : {
-//   "type" : "string",
-//   "description" : "An expression for conditional breakpoints.\nIt is 
only
+// "condition": {
+//   "type": "string",
+//   "description": "An expression for conditional breakpoints.\nIt is only
 //   "
 //   "honored by a debug adapter if the correspon

[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -7,12 +7,15 @@
 
//===--===//
 
 #include "BreakpointBase.h"
+
 #include "JSONUtils.h"
 
+#include "llvm/ADT/StringRef.h"

labath wrote:

```suggestion
#include "BreakpointBase.h"
#include "JSONUtils.h"
#include "llvm/ADT/StringRef.h"
```

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -10,6 +10,8 @@
 #define LLDB_TOOLS_LLDB_DAP_BREAKPOINT_H
 
 #include "BreakpointBase.h"
+#include "DAPForward.h"
+
 #include "lldb/API/SBBreakpoint.h"

labath wrote:

```suggestion
#include "DAPForward.h"
#include "lldb/API/SBBreakpoint.h"
```

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -7,10 +7,19 @@
 
//===--===//
 
 #include "Breakpoint.h"
-#include "DAP.h"
+
 #include "JSONUtils.h"
+
+#include "lldb/API/SBAddress.h"
 #include "lldb/API/SBBreakpointLocation.h"
+#include "lldb/API/SBLineEntry.h"
+
 #include "llvm/ADT/StringExtras.h"
+#include "llvm/Support/JSON.h"
+
+#include 
+#include 
+#include 

labath wrote:

```suggestion
#include "JSONUtils.h"
#include "lldb/API/SBAddress.h"
#include "lldb/API/SBBreakpointLocation.h"
#include "lldb/API/SBLineEntry.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Support/JSON.h"
#include 
#include 
#include 
```

(I've replaced the c headers with c++ equivalents. I've also put the includes 
back into a separate group, which is the LLVM style and ensures clang-format 
will group them into the [preferred 
order](https://llvm.org/docs/CodingStandards.html#include-style). LLDB does not 
stick to that much, but I don't see a reason to regress that here)

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits

https://github.com/labath commented:

This PR is much easier to review. I mainly focused on the stylistic parts. I'll 
leave it to the lldb-dap maintainers to review the functionality.

Copying polymorphic objects around is asking for trouble, and I don't think we 
should be doing that. You didn't come up with that, and it's unrelated to what 
you're trying to do, so I'm not asking you to change that. I'm just mentioning 
this in case you feel the urge to do something about.

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -9,21 +9,27 @@
 #ifndef LLDB_TOOLS_LLDB_DAP_EXCEPTIONBREAKPOINT_H
 #define LLDB_TOOLS_LLDB_DAP_EXCEPTIONBREAKPOINT_H
 
-#include 
+#include "DAPForward.h"
 
 #include "lldb/API/SBBreakpoint.h"
+#include "lldb/lldb-enumerations.h"
+
+#include 
+#include 

labath wrote:

```suggestion
#include "DAPForward.h"
#include "lldb/API/SBBreakpoint.h"
#include "lldb/lldb-enumerations.h"
#include 
#include 
```

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -3202,8 +3184,7 @@ void request_setDataBreakpoints(const llvm::json::Object 
&request) {
 for (const auto &bp : *breakpoints) {
   const auto *bp_obj = bp.getAsObject();
   if (bp_obj) {

labath wrote:

here too

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -11,23 +11,28 @@
 #define LLDB_TOOLS_LLDB_DAP_INSTRUCTIONBREAKPOINT_H
 
 #include "Breakpoint.h"
+#include "DAPForward.h"
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include 

labath wrote:

```suggestion
#include "Breakpoint.h"
#include "DAPForward.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-types.h"
#include 
```

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -9,21 +9,25 @@
 #ifndef LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
 #define LLDB_TOOLS_LLDB_DAP_BREAKPOINTBASE_H
 
-#include "llvm/Support/JSON.h"
+#include "DAPForward.h"
+
 #include 

labath wrote:

```suggestion
#include "DAPForward.h"
#include 
```

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -7,18 +7,19 @@
 
//===--===//
 
 #include "FunctionBreakpoint.h"
+
 #include "DAP.h"

labath wrote:

```suggestion
#include "FunctionBreakpoint.h"
#include "DAP.h"
```

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -6,27 +6,55 @@
 //
 
//===--===//
 
-#include 
-#include 
-#include 
-#include 
+#include "JSONUtils.h"
 
-#include "llvm/ADT/StringRef.h"
-#include "llvm/Support/FormatVariadic.h"
-#include "llvm/Support/Path.h"
-#include "llvm/Support/ScopedPrinter.h"
+#include "BreakpointBase.h"
+#include "DAP.h"
+#include "ExceptionBreakpoint.h"
+#include "LLDBUtils.h"
 

labath wrote:

Here too (github won't let me make a suggestion)

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -8,22 +8,30 @@
 
//===--===//
 
 #include "InstructionBreakpoint.h"
+
 #include "DAP.h"
 #include "JSONUtils.h"
 
+#include "lldb/API/SBBreakpoint.h"
+#include "lldb/API/SBTarget.h"
+
+#include "llvm/ADT/StringRef.h"

labath wrote:

```suggestion
#include "InstructionBreakpoint.h"
#include "DAP.h"
#include "JSONUtils.h"
#include "lldb/API/SBBreakpoint.h"
#include "lldb/API/SBTarget.h"
#include "llvm/ADT/StringRef.h"
```

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -95,6 +100,8 @@ class DWARFBaseDIE {
 
   const char *GetName() const;
 
+  const char *getShortName() const { return GetName(); }

labath wrote:

(I was considering the same thing, but I don't particularly care either way)

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -46,6 +48,7 @@ class DWARFBaseDIE {
   explicit operator bool() const { return IsValid(); }
 
   bool IsValid() const { return m_cu && m_die; }
+  bool isValid() const { return IsValid(); }

labath wrote:

I'm sorry, I guess I wasn't clear about this. What I was suggesting is to just 
revert the addition `isValid` -- as there already exists a comon API. I didn't 
want to remove things that are already there. (I mean, I'd be fine with that 
doing that under the flag of moving the LLDB API closer to LLVM, but I don't 
think we ought to do that as a part of this PR)

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Walter Erquinigo via lldb-commits


@@ -11,23 +11,28 @@
 #define LLDB_TOOLS_LLDB_DAP_INSTRUCTIONBREAKPOINT_H
 
 #include "Breakpoint.h"
+#include "DAPForward.h"
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include 
 
 namespace lldb_dap {
 
 // Instruction Breakpoint
 struct InstructionBreakpoint : public Breakpoint {
 
   lldb::addr_t instructionAddressReference;
-  int32_t id;
   int32_t offset;
 
-  InstructionBreakpoint()
-  : Breakpoint(), instructionAddressReference(LLDB_INVALID_ADDRESS), id(0),
+  InstructionBreakpoint(DAP &d)

walter-erquinigo wrote:

@labath , you are becoming my reference for high quality code in LLVM.
In general, do you recommend marking most one-argument constructors as explicit 
in the codebase?

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


[Lldb-commits] [lldb] [llvm] Modify the localCache API to require an explicit commit on CachedFile… (PR #115331)

2024-11-07 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-debuginfo

@llvm/pr-subscribers-lldb

Author: None (anjenner)


Changes

…Stream.

CachedFileStream has previously performed the commit step in its destructor, 
but this means its only recourse for error handling is report_fatal_error. 
Modify this to add an explicit commit() method, and call this in the 
appropriate places with appropriate error handling for the location.

Currently the destructor of CacheStream gives an assert failure in Debug builds 
if commit() was not called. This will help track down any remaining uses of the 
API that assume the old destructior behaviour. In Release builds we fall back 
to the previous behaviour and call report_fatal_error if the commit fails.

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


7 Files Affected:

- (modified) lldb/source/Core/DataFileCache.cpp (+5) 
- (modified) llvm/include/llvm/Support/Caching.h (+1) 
- (modified) llvm/lib/Debuginfod/Debuginfod.cpp (+9) 
- (modified) llvm/lib/LTO/LTOBackend.cpp (+3) 
- (modified) llvm/lib/Support/Caching.cpp (+29-11) 
- (modified) llvm/tools/gold/gold-plugin.cpp (+3-1) 
- (modified) llvm/tools/llvm-lto2/llvm-lto2.cpp (+3-1) 


``diff
diff --git a/lldb/source/Core/DataFileCache.cpp 
b/lldb/source/Core/DataFileCache.cpp
index ef0e07a8b03420d..910926971123174 100644
--- a/lldb/source/Core/DataFileCache.cpp
+++ b/lldb/source/Core/DataFileCache.cpp
@@ -132,6 +132,11 @@ bool DataFileCache::SetCachedData(llvm::StringRef key,
   if (file_or_err) {
 llvm::CachedFileStream *cfs = file_or_err->get();
 cfs->OS->write((const char *)data.data(), data.size());
+if (llvm::Error err = cfs->commit()) {
+  Log *log = GetLog(LLDBLog::Modules);
+  LLDB_LOG_ERROR(log, std::move(err),
+ "failed to commit to the cache for key: {0}");
+}
 return true;
   } else {
 Log *log = GetLog(LLDBLog::Modules);
diff --git a/llvm/include/llvm/Support/Caching.h 
b/llvm/include/llvm/Support/Caching.h
index cf45145619d95b8..120bcd9da02edea 100644
--- a/llvm/include/llvm/Support/Caching.h
+++ b/llvm/include/llvm/Support/Caching.h
@@ -30,6 +30,7 @@ class CachedFileStream {
   CachedFileStream(std::unique_ptr OS,
std::string OSPath = "")
   : OS(std::move(OS)), ObjectPathName(OSPath) {}
+  virtual Error commit() { return Error::success(); }
   std::unique_ptr OS;
   std::string ObjectPathName;
   virtual ~CachedFileStream() = default;
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp 
b/llvm/lib/Debuginfod/Debuginfod.cpp
index 4c785117ae8ef77..6ff889d3a8cad2b 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -188,6 +188,7 @@ class StreamedHTTPResponseHandler : public 
HTTPResponseHandler {
 public:
   StreamedHTTPResponseHandler(CreateStreamFn CreateStream, HTTPClient &Client)
   : CreateStream(CreateStream), Client(Client) {}
+  Error commit();
   virtual ~StreamedHTTPResponseHandler() = default;
 
   Error handleBodyChunk(StringRef BodyChunk) override;
@@ -210,6 +211,12 @@ Error 
StreamedHTTPResponseHandler::handleBodyChunk(StringRef BodyChunk) {
   return Error::success();
 }
 
+Error StreamedHTTPResponseHandler::commit() {
+  if (FileStream)
+return FileStream->commit();
+  return Error::success();
+}
+
 // An over-accepting simplification of the HTTP RFC 7230 spec.
 static bool isHeader(StringRef S) {
   StringRef Name;
@@ -298,6 +305,8 @@ Expected getCachedOrDownloadArtifact(
   Error Err = Client.perform(Request, Handler);
   if (Err)
 return std::move(Err);
+  if (Err = Handler.commit())
+return std::move(Err);
 
   unsigned Code = Client.responseCode();
   if (Code && Code != 200)
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index ad332d25d9c0824..862a6820569f7ad 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -432,6 +432,9 @@ static void codegen(const Config &Conf, TargetMachine *TM,
 
   if (DwoOut)
 DwoOut->keep();
+
+  if (Error Err = Stream->commit())
+report_fatal_error(std::move(Err));
 }
 
 static void splitCodeGen(const Config &C, TargetMachine *TM,
diff --git a/llvm/lib/Support/Caching.cpp b/llvm/lib/Support/Caching.cpp
index 66e540efaca972d..2ecdf53701030d1 100644
--- a/llvm/lib/Support/Caching.cpp
+++ b/llvm/lib/Support/Caching.cpp
@@ -80,6 +80,7 @@ Expected llvm::localCache(const Twine 
&CacheNameRef,
   sys::fs::TempFile TempFile;
   std::string ModuleName;
   unsigned Task;
+  bool Committed = false;
 
   CacheStream(std::unique_ptr OS, AddBufferFn AddBuffer,
   sys::fs::TempFile TempFile, std::string EntryPath,
@@ -88,9 +89,10 @@ Expected llvm::localCache(const Twine 
&CacheNameRef,
 AddBuffer(std::move(AddBuffer)), TempFile(std::move(TempFile)),
 ModuleName(ModuleName), Task(Task) {}
 
-  ~CacheStream() {
-// TODO: Manually commit

[Lldb-commits] [lldb] [llvm] Modify the localCache API to require an explicit commit on CachedFile… (PR #115331)

2024-11-07 Thread via lldb-commits

https://github.com/anjenner created 
https://github.com/llvm/llvm-project/pull/115331

…Stream.

CachedFileStream has previously performed the commit step in its destructor, 
but this means its only recourse for error handling is report_fatal_error. 
Modify this to add an explicit commit() method, and call this in the 
appropriate places with appropriate error handling for the location.

Currently the destructor of CacheStream gives an assert failure in Debug builds 
if commit() was not called. This will help track down any remaining uses of the 
API that assume the old destructior behaviour. In Release builds we fall back 
to the previous behaviour and call report_fatal_error if the commit fails.

>From 67167aac43137d5a2e0737713a100af7ed12b2c6 Mon Sep 17 00:00:00 2001
From: Andrew Jenner 
Date: Thu, 7 Nov 2024 10:47:42 -0500
Subject: [PATCH] Modify the localCache API to require an explicit commit on
 CachedFileStream.

CachedFileStream has previously performed the commit step in its destructor,
but this means its only recourse for error handling is report_fatal_error.
Modify this to add an explicit commit() method, and call this in the
appropriate places with appropriate error handling for the location.

Currently the destructor of CacheStream gives an assert failure in Debug builds
if commit() was not called. This will help track down any remaining uses of the
API that assume the old destructior behaviour. In Release builds we fall back
to the previous behaviour and call report_fatal_error if the commit fails.
---
 lldb/source/Core/DataFileCache.cpp  |  5 
 llvm/include/llvm/Support/Caching.h |  1 +
 llvm/lib/Debuginfod/Debuginfod.cpp  |  9 +++
 llvm/lib/LTO/LTOBackend.cpp |  3 +++
 llvm/lib/Support/Caching.cpp| 40 +
 llvm/tools/gold/gold-plugin.cpp |  4 ++-
 llvm/tools/llvm-lto2/llvm-lto2.cpp  |  4 ++-
 7 files changed, 53 insertions(+), 13 deletions(-)

diff --git a/lldb/source/Core/DataFileCache.cpp 
b/lldb/source/Core/DataFileCache.cpp
index ef0e07a8b03420d..910926971123174 100644
--- a/lldb/source/Core/DataFileCache.cpp
+++ b/lldb/source/Core/DataFileCache.cpp
@@ -132,6 +132,11 @@ bool DataFileCache::SetCachedData(llvm::StringRef key,
   if (file_or_err) {
 llvm::CachedFileStream *cfs = file_or_err->get();
 cfs->OS->write((const char *)data.data(), data.size());
+if (llvm::Error err = cfs->commit()) {
+  Log *log = GetLog(LLDBLog::Modules);
+  LLDB_LOG_ERROR(log, std::move(err),
+ "failed to commit to the cache for key: {0}");
+}
 return true;
   } else {
 Log *log = GetLog(LLDBLog::Modules);
diff --git a/llvm/include/llvm/Support/Caching.h 
b/llvm/include/llvm/Support/Caching.h
index cf45145619d95b8..120bcd9da02edea 100644
--- a/llvm/include/llvm/Support/Caching.h
+++ b/llvm/include/llvm/Support/Caching.h
@@ -30,6 +30,7 @@ class CachedFileStream {
   CachedFileStream(std::unique_ptr OS,
std::string OSPath = "")
   : OS(std::move(OS)), ObjectPathName(OSPath) {}
+  virtual Error commit() { return Error::success(); }
   std::unique_ptr OS;
   std::string ObjectPathName;
   virtual ~CachedFileStream() = default;
diff --git a/llvm/lib/Debuginfod/Debuginfod.cpp 
b/llvm/lib/Debuginfod/Debuginfod.cpp
index 4c785117ae8ef77..6ff889d3a8cad2b 100644
--- a/llvm/lib/Debuginfod/Debuginfod.cpp
+++ b/llvm/lib/Debuginfod/Debuginfod.cpp
@@ -188,6 +188,7 @@ class StreamedHTTPResponseHandler : public 
HTTPResponseHandler {
 public:
   StreamedHTTPResponseHandler(CreateStreamFn CreateStream, HTTPClient &Client)
   : CreateStream(CreateStream), Client(Client) {}
+  Error commit();
   virtual ~StreamedHTTPResponseHandler() = default;
 
   Error handleBodyChunk(StringRef BodyChunk) override;
@@ -210,6 +211,12 @@ Error 
StreamedHTTPResponseHandler::handleBodyChunk(StringRef BodyChunk) {
   return Error::success();
 }
 
+Error StreamedHTTPResponseHandler::commit() {
+  if (FileStream)
+return FileStream->commit();
+  return Error::success();
+}
+
 // An over-accepting simplification of the HTTP RFC 7230 spec.
 static bool isHeader(StringRef S) {
   StringRef Name;
@@ -298,6 +305,8 @@ Expected getCachedOrDownloadArtifact(
   Error Err = Client.perform(Request, Handler);
   if (Err)
 return std::move(Err);
+  if (Err = Handler.commit())
+return std::move(Err);
 
   unsigned Code = Client.responseCode();
   if (Code && Code != 200)
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index ad332d25d9c0824..862a6820569f7ad 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -432,6 +432,9 @@ static void codegen(const Config &Conf, TargetMachine *TM,
 
   if (DwoOut)
 DwoOut->keep();
+
+  if (Error Err = Stream->commit())
+report_fatal_error(std::move(Err));
 }
 
 static void splitCodeGen(const Config &C, TargetMachine *TM,
diff --git a/llvm/lib/Support/Caching.c

[Lldb-commits] [lldb] [lldb][test] Skip one inline stepping test for arm-ubuntu. (PR #114295)

2024-11-07 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Test was fixed by https://github.com/llvm/llvm-project/pull/114628.

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -0,0 +1,31 @@
+// Test lldb is able to compute the fully qualified names on templates with
+// -gsimple-template-names and -fdebug-types-section.
+
+// REQUIRES: lld
+
+// Test against logging to see if we print the fully qualified names correctly.
+// RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names %s -o %t
+// RUN: %lldb %t -o "log enable dwarf comp" -o "target variable v1 v2" -o exit 
| FileCheck %s --check-prefix=LOG
+
+// Test that we following DW_AT_signature correctly. If not, lldb might 
confuse the types of v1 and v2.
+// RUN: %clangxx --target=x86_64-pc-linux -g -gsimple-template-names 
-fdebug-types-section %s -o %t
+// RUN: %lldb %t -o "target variable v1 v2" -o exit | FileCheck %s 
--check-prefix=TYPE
+
+// LOG: unique name: ::t2 >
+// LOG: unique name: ::t2 >

labath wrote:

I'm not exactly thrilled by the idea of using logs for testing, and even less 
about adding log statements with the sole purpose of testing a piece of code.

A unit test for the DWARFTypePrinter would definitely be better, and I think it 
should be possible to reuse what we have in 
unittests/SymbolFile/DWARF/DWARFDIETest.cpp. For testing its integration into 
the rest of lldb, an end-to-end might be better (maybe the existing ones are 
fine, but we can definitely add new ones if you think something is missing).

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


[Lldb-commits] [lldb] [lldb] Relax check for breakpoint site in Unwind/windows-unaligned-x86_64.test (PR #115318)

2024-11-07 Thread Stefan Gränitz via lldb-commits

weliveindetail wrote:

We see a few tests failing for this reason downstream in swift-lldb: 
https://github.com/swiftlang/swift/pull/76894#issuecomment-2441139173 I filed a 
ticket to investigate the actual issue 
https://github.com/swiftlang/llvm-project/issues/9540

It would be great to unblock this particular test, because we expect the 
functionality under test to be fixed with 
https://github.com/llvm/llvm-project/issues/101710

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

> With these changes, and the fact that BreakpointBase has a DAP& member, the 
> breakpoints cannot be copied. 

I don't see that as a problem, but if at some point we need some more 
flexibility, we should be able to use std::reference_wrapper to store the ref 
and then allow for copies of objects when it makes sense.

> I do wonder if we should further refactor the types in lldb-dap to be a 
> little more like clangd where we have a more distinct protocol representation 
> with toJSON/fromJSON JSON serialization support (e.g. 
> https://github.com/llvm/llvm-project/blob/main/clang-tools-extra/clangd/Protocol.h).

100%! 

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


[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Walter Erquinigo via lldb-commits

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

accepting because it seems you addressed all of Pavel's issues

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


[Lldb-commits] [lldb] [lldb] Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host (PR #115337)

2024-11-07 Thread Pavel Labath via lldb-commits


@@ -1010,12 +1024,21 @@ def is_toolchain_with_mte():
 int main() {
 void* ptr = __arm_mte_create_random_tag((void*)(0), 0);
 }"""
-cmd = "echo '%s' | %s -march=armv8.5-a+memtag -x c -o %s -" % (
-test_src,
-compiler_path,
-f.name,
+with open(f_src.name, "w") as f:
+f.write(test_src)

labath wrote:

Considered using the `subprocess` module and passing the contents through the 
`input` argument?

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


[Lldb-commits] [lldb] [lldb] Fixed the @skipUnlessAArch64MTELinuxCompiler decorator in case of Windows host (PR #115337)

2024-11-07 Thread Pavel Labath via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Support riscv32 corefiles (PR #115408)

2024-11-07 Thread Jonas Devlieghere via lldb-commits

https://github.com/JDevlieghere created 
https://github.com/llvm/llvm-project/pull/115408

None

>From db9978e0bf8ce26a71eb73393c4951d14cdbd510 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Thu, 7 Nov 2024 17:18:50 -0800
Subject: [PATCH] [lldb] Support riscv32 corefiles

---
 .../Plugins/Process/Utility/CMakeLists.txt|   2 +
 .../Utility/RegisterContextPOSIX_riscv32.cpp  |  81 
 .../Utility/RegisterContextPOSIX_riscv32.h|  63 ++
 .../Utility/RegisterInfoPOSIX_riscv32.cpp | 142 ++
 .../Utility/RegisterInfoPOSIX_riscv32.h   |  76 +++
 .../Utility/RegisterInfoPOSIX_riscv64.cpp |   9 +-
 .../Process/Utility/RegisterInfos_riscv32.h   | 185 ++
 .../Plugins/Process/elf-core/CMakeLists.txt   |   1 +
 .../RegisterContextPOSIXCore_riscv32.cpp  |  81 
 .../RegisterContextPOSIXCore_riscv32.h|  56 ++
 10 files changed, 691 insertions(+), 5 deletions(-)
 create mode 100644 
lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp
 create mode 100644 
lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.h
 create mode 100644 
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv32.cpp
 create mode 100644 
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_riscv32.h
 create mode 100644 lldb/source/Plugins/Process/Utility/RegisterInfos_riscv32.h
 create mode 100644 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.cpp
 create mode 100644 
lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_riscv32.h

diff --git a/lldb/source/Plugins/Process/Utility/CMakeLists.txt 
b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
index 308ea29e31ad77..5ffd2d7114cc98 100644
--- a/lldb/source/Plugins/Process/Utility/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/Utility/CMakeLists.txt
@@ -39,6 +39,7 @@ add_lldb_library(lldbPluginProcessUtility
   RegisterContextPOSIX_arm64.cpp
   RegisterContextPOSIX_loongarch64.cpp
   RegisterContextPOSIX_mips64.cpp
+  RegisterContextPOSIX_riscv32.cpp
   RegisterContextPOSIX_powerpc.cpp
   RegisterContextPOSIX_ppc64le.cpp
   RegisterContextPOSIX_riscv64.cpp
@@ -53,6 +54,7 @@ add_lldb_library(lldbPluginProcessUtility
   RegisterInfoPOSIX_arm64.cpp
   RegisterInfoPOSIX_loongarch64.cpp
   RegisterInfoPOSIX_ppc64le.cpp
+  RegisterInfoPOSIX_riscv32.cpp
   RegisterInfoPOSIX_riscv64.cpp
   StopInfoMachException.cpp
   ThreadMemory.cpp
diff --git 
a/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp 
b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp
new file mode 100644
index 00..64064f86cea046
--- /dev/null
+++ b/lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_riscv32.cpp
@@ -0,0 +1,81 @@
+//===-- RegisterContextPOSIX_riscv32.cpp *- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "RegisterContextPOSIX_riscv32.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Target/Target.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/DataBufferHeap.h"
+#include "lldb/Utility/DataExtractor.h"
+#include "lldb/Utility/Endian.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/Utility/Scalar.h"
+#include "llvm/Support/Compiler.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+RegisterContextPOSIX_riscv32::RegisterContextPOSIX_riscv32(
+lldb_private::Thread &thread,
+std::unique_ptr register_info)
+: lldb_private::RegisterContext(thread, 0),
+  m_register_info_up(std::move(register_info)) {}
+
+RegisterContextPOSIX_riscv32::~RegisterContextPOSIX_riscv32() = default;
+
+void RegisterContextPOSIX_riscv32::invalidate() {}
+
+void RegisterContextPOSIX_riscv32::InvalidateAllRegisters() {}
+
+size_t RegisterContextPOSIX_riscv32::GetRegisterCount() {
+  return m_register_info_up->GetRegisterCount();
+}
+
+size_t RegisterContextPOSIX_riscv32::GetGPRSize() {
+  return m_register_info_up->GetGPRSize();
+}
+
+unsigned RegisterContextPOSIX_riscv32::GetRegisterSize(unsigned int reg) {
+  return m_register_info_up->GetRegisterInfo()[reg].byte_size;
+}
+
+unsigned RegisterContextPOSIX_riscv32::GetRegisterOffset(unsigned int reg) {
+  return m_register_info_up->GetRegisterInfo()[reg].byte_offset;
+}
+
+const lldb_private::RegisterInfo *
+RegisterContextPOSIX_riscv32::GetRegisterInfoAtIndex(size_t reg) {
+  if (reg < GetRegisterCount())
+return &GetRegisterInfo()[reg];
+
+  return nullptr;
+}
+
+size_t RegisterContextPOSIX_riscv32::GetRegisterSetCount() {
+  return m_register_info_up->GetRegisterCount();
+}
+
+const lldb_private::RegisterSet *
+RegisterContextPOSIX_riscv32::GetRegisterSet(size_t set) {
+  return m_register_info_up->GetRegisterSet(set);
+}
+
+const lldb_private::Reg

[Lldb-commits] [lldb] [lldb-dap] Refactoring breakpoints to not use the `g_dap` reference. (PR #115208)

2024-11-07 Thread Walter Erquinigo via lldb-commits


@@ -11,23 +11,28 @@
 #define LLDB_TOOLS_LLDB_DAP_INSTRUCTIONBREAKPOINT_H
 
 #include "Breakpoint.h"
+#include "DAPForward.h"
+
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-types.h"
+
+#include 
 
 namespace lldb_dap {
 
 // Instruction Breakpoint
 struct InstructionBreakpoint : public Breakpoint {
 
   lldb::addr_t instructionAddressReference;
-  int32_t id;
   int32_t offset;
 
-  InstructionBreakpoint()
-  : Breakpoint(), instructionAddressReference(LLDB_INVALID_ADDRESS), id(0),
+  InstructionBreakpoint(DAP &d)

walter-erquinigo wrote:

Thanks for your thoughts!

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


[Lldb-commits] [lldb] [lldb][docs] Document Lua 5.3 as the only supported version (PR #115288)

2024-11-07 Thread Jonas Devlieghere via lldb-commits

JDevlieghere wrote:

Although Lua doesn't use semver, the difference between 5.3 and 5.4 isn't as 
stark as I thought. LLDB builds fine against Lua 5.4 and I was able to make the 
test pass. I just need to make a change so we don't hardcode `5.3` in the path. 

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


[Lldb-commits] [lldb] 1c8fca8 - [lldb][LoongArch] Function calls support in lldb expressions

2024-11-07 Thread via lldb-commits

Author: wanglei
Date: 2024-11-08T10:43:57+08:00
New Revision: 1c8fca82a0f4ac6df5db539e96adcad143f5ebe7

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

LOG: [lldb][LoongArch] Function calls support in lldb expressions

This patch adds desired feature flags in JIT compiler to enable
hard-float instructions if target supports them and allows to use floats
and doubles in lldb expressions.

Fited tests:
lldb-shell :: Expr/TestAnonNamespaceParamFunc.cpp
lldb-shell :: Expr/TestIRMemoryMap.test
lldb-shell :: Expr/TestStringLiteralExpr.test
lldb-shell :: SymbolFile/DWARF/debug-types-expressions.test

Similar as #99336
Depens on: https://github.com/llvm/llvm-project/pull/114741

Reviewed By: SixWeining

Pull Request: https://github.com/llvm/llvm-project/pull/114742

Added: 
lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.h
lldb/source/Plugins/ABI/LoongArch/CMakeLists.txt

Modified: 
lldb/include/lldb/Utility/ArchSpec.h
lldb/source/Plugins/ABI/CMakeLists.txt
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp
lldb/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index 5990f984b09e2d..2a74058673bae5 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -107,6 +107,15 @@ class ArchSpec {
 eRISCVSubType_riscv64,
   };
 
+  enum LoongArcheflags {
+eLoongArch_abi_soft_float = 0x, /// soft float
+eLoongArch_abi_single_float =
+0x0001, /// single precision floating point, +f
+eLoongArch_abi_double_float =
+0x0002, /// double precision floating point, +d
+eLoongArch_abi_mask = 0x0003,
+  };
+
   enum LoongArchSubType {
 eLoongArchSubType_unknown,
 eLoongArchSubType_loongarch32,

diff  --git a/lldb/source/Plugins/ABI/CMakeLists.txt 
b/lldb/source/Plugins/ABI/CMakeLists.txt
index 9241a2487d522f..e33ac87354860e 100644
--- a/lldb/source/Plugins/ABI/CMakeLists.txt
+++ b/lldb/source/Plugins/ABI/CMakeLists.txt
@@ -1,4 +1,4 @@
-foreach(target AArch64 ARM ARC Hexagon Mips MSP430 PowerPC RISCV SystemZ X86)
+foreach(target AArch64 ARM ARC Hexagon LoongArch Mips MSP430 PowerPC RISCV 
SystemZ X86)
   if (${target} IN_LIST LLVM_TARGETS_TO_BUILD)
 add_subdirectory(${target})
   endif()

diff  --git a/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp 
b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
new file mode 100644
index 00..dc7e9bba000676
--- /dev/null
+++ b/lldb/source/Plugins/ABI/LoongArch/ABISysV_loongarch.cpp
@@ -0,0 +1,677 @@
+//===-- 
ABISysV_loongarch.cpp--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "ABISysV_loongarch.h"
+
+#include 
+#include 
+#include 
+
+#include "llvm/IR/DerivedTypes.h"
+#include "llvm/Support/MathExtras.h"
+
+#include "Utility/LoongArch_DWARF_Registers.h"
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/Value.h"
+#include "lldb/Target/RegisterContext.h"
+#include "lldb/Target/StackFrame.h"
+#include "lldb/Target/Thread.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/RegisterValue.h"
+#include "lldb/ValueObject/ValueObjectConstResult.h"
+
+#define DEFINE_REG_NAME(reg_num) ConstString(#reg_num).GetCString()
+#define DEFINE_REG_NAME_STR(reg_name) ConstString(reg_name).GetCString()
+
+// The ABI is not a source of such information as size, offset, encoding, etc.
+// of a register. Just provides correct dwarf and eh_frame numbers.
+
+#define DEFINE_GENERIC_REGISTER_STUB(dwarf_num, generic_num)   
\
+  {
\
+  DEFINE_REG_NAME(dwarf_num),  
\
+  DEFINE_REG_NAME_STR(nullptr),
\
+  0,   
\
+  0,   
\
+  eEncodingInvalid,
\
+  eFormatDefault,  
\
+  {dwarf_num, dwarf_num, generic_num, LLDB_INVALID_REGNUM, dwarf_num}, 
\
+  nullptr, 
\
+  nullptr,

[Lldb-commits] [lldb] [llvm] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-07 Thread via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb][LoongArch] Function calls support in lldb expressions (PR #114742)

2024-11-07 Thread via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [lldb][dwarf] Compute fully qualified names on simplified template names with DWARFTypePrinter (PR #112811)

2024-11-07 Thread Pavel Labath via lldb-commits

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


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