[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-14 Thread David Spickett via lldb-commits


@@ -0,0 +1,169 @@
+"""
+Test the use of the global module cache in lldb
+"""
+
+import lldb
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+import os
+import shutil
+from pathlib import Path
+import time
+
+class GlobalModuleCacheTestCase(TestBase):
+# NO_DEBUG_INFO_TESTCASE = True
+
+def check_counter_var(self, thread, value):
+frame = thread.frames[0]
+var = frame.FindVariable("counter")
+self.assertTrue(var.GetError().Success(), "Got counter variable")
+self.assertEqual(var.GetValueAsUnsigned(), value, "This was one-print")
+
+def copy_to_main(self, src, dst):
+# We are relying on the source file being newer than the .o file from
+# a previous build, so sleep a bit here to ensure that the touch is 
later.
+time.sleep(2)
+try:
+shutil.copy(src, dst)
+except:
+self.fail(f"Could not copy {src} to {dst}")
+Path(dst).touch()
+
+# The rerun tests indicate rerunning on Windows doesn't really work, so
+# this one won't either.
+@skipIfWindows
+def test_OneTargetOneDebugger(self):
+self.do_test(True, True)
+
+# This behaves as implemented but that behavior is not desirable.
+# This test tests for the desired behavior as an expected fail.
+@skipIfWindows
+@expectedFailureAll
+def test_TwoTargetsOneDebugger(self):
+self.do_test(False, True)
+
+@skipIfWindows
+@expectedFailureAll
+def test_OneTargetTwoDebuggers(self):
+self.do_test(True, False)
+
+def do_test(self, one_target, one_debugger):
+# Make sure that if we have one target, and we run, then
+# change the binary and rerun, the binary (and any .o files
+# if using dwarf in .o file debugging) get removed from the
+# shared module cache.  They are no longer reachable.
+debug_style = self.getDebugInfo()
+
+# Before we do anything, clear the global module cache so we don't
+# see objects from other runs:
+lldb.SBDebugger.MemoryPressureDetected()
+
+# Set up the paths for our two versions of main.c:
+main_c_path = os.path.join(self.getBuildDir(), "main.c")
+one_print_path = os.path.join(self.getSourceDir(), "one-print.c")
+two_print_path = os.path.join(self.getSourceDir(), "two-print.c")
+main_filespec = lldb.SBFileSpec(main_c_path)
+
+# First copy the one-print.c to main.c in the build folder and
+# build our a.out from there:
+self.copy_to_main(one_print_path, main_c_path)
+self.build(dictionary={"C_SOURCES": main_c_path, "EXE": "a.out"})
+
+(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
+self, "return counter;", main_filespec
+)
+
+# Make sure we ran the version we intended here:
+self.check_counter_var(thread, 1)
+process.Kill()
+
+# Now copy two-print.c over main.c, rebuild, and rerun:
+# os.unlink(target.GetExecutable().fullpath)

DavidSpickett wrote:

Also commented out code here.

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


[Lldb-commits] [lldb] d0f5039 - Reland "Add a test for evicting unreachable modules from the global module cache (#74894)"

2023-12-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-14T10:54:03Z
New Revision: d0f5039e5db5c2b9222f78e7242401061ab259dc

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

LOG: Reland "Add a test for evicting unreachable modules from the global module 
cache (#74894)"

This reverts commit 35dacf2f51af251a74ac98ed29e7c454a619fcf1.

And relands the original change with two additions so I can debug the failure 
on Arm/AArch64:
* Enable lldb step logging in the tests.
* Assert that the current plan is not the base plan at the spot I believe is 
calling PopPlan.

These will be removed and replaced with a proper fix once I see some failures 
on the bots,
I couldn't reproduce it locally.

(also, no sign of it on the x86_64 bot)

Added: 
lldb/test/API/python_api/global_module_cache/Makefile
lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
lldb/test/API/python_api/global_module_cache/one-print.c
lldb/test/API/python_api/global_module_cache/two-print.c

Modified: 
lldb/source/Target/Thread.cpp

Removed: 




diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 865cee97e6d878..6d634f25edf8a4 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -831,6 +831,7 @@ bool Thread::ShouldStop(Event *event_ptr) {
 do {
   if (should_stop)
 current_plan->WillStop();
+  assert(!current_plan->IsBasePlan() && "Cannot pop base plan!");
   PopPlan();
 } while ((current_plan = GetCurrentPlan()) != prev_plan_ptr);
 // Now, if the responsible plan was not "Okay to discard" then

diff  --git a/lldb/test/API/python_api/global_module_cache/Makefile 
b/lldb/test/API/python_api/global_module_cache/Makefile
new file mode 100644
index 00..22f1051530f871
--- /dev/null
+++ b/lldb/test/API/python_api/global_module_cache/Makefile
@@ -0,0 +1 @@
+include Makefile.rules

diff  --git 
a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py 
b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
new file mode 100644
index 00..b8675532e6394f
--- /dev/null
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -0,0 +1,174 @@
+"""
+Test the use of the global module cache in lldb
+"""
+
+import lldb
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+from lldbsuite.test import lldbutil
+import os
+import shutil
+from pathlib import Path
+import time
+
+class GlobalModuleCacheTestCase(TestBase):
+# NO_DEBUG_INFO_TESTCASE = True
+
+def check_counter_var(self, thread, value):
+frame = thread.frames[0]
+var = frame.FindVariable("counter")
+self.assertTrue(var.GetError().Success(), "Got counter variable")
+self.assertEqual(var.GetValueAsUnsigned(), value, "This was one-print")
+
+def copy_to_main(self, src, dst):
+# We are relying on the source file being newer than the .o file from
+# a previous build, so sleep a bit here to ensure that the touch is 
later.
+time.sleep(2)
+try:
+shutil.copy(src, dst)
+except:
+self.fail(f"Could not copy {src} to {dst}")
+Path(dst).touch()
+
+# The rerun tests indicate rerunning on Windows doesn't really work, so
+# this one won't either.
+@skipIfWindows
+def test_OneTargetOneDebugger(self):
+self.do_test(True, True)
+
+# This behaves as implemented but that behavior is not desirable.
+# This test tests for the desired behavior as an expected fail.
+@skipIfWindows
+@expectedFailureAll
+def test_TwoTargetsOneDebugger(self):
+self.do_test(False, True)
+
+@skipIfWindows
+@expectedFailureAll
+def test_OneTargetTwoDebuggers(self):
+self.do_test(True, False)
+
+def do_test(self, one_target, one_debugger):
+# Here to debug flakiness on Arm, remove later!
+log_cmd_result = lldb.SBCommandReturnObject()
+interp = self.dbg.GetCommandInterpreter()
+interp.HandleCommand("log enable lldb step", log_cmd_result)
+
+# Make sure that if we have one target, and we run, then
+# change the binary and rerun, the binary (and any .o files
+# if using dwarf in .o file debugging) get removed from the
+# shared module cache.  They are no longer reachable.
+debug_style = self.getDebugInfo()
+
+# Before we do anything, clear the global module cache so we don't
+# see objects from other runs:
+lldb.SBDebugger.MemoryPressureDetected()
+
+# Set up the paths for our two versions of main.c:
+main_c_path = os.path.join(self.getBuildDir(), "main.c")
+one_prin

[Lldb-commits] [clang-tools-extra] [lldb] [mlir] [libc] [lld] [clang] [libcxx] [compiler-rt] [llvm] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

https://github.com/muneebkhan85 updated 
https://github.com/llvm/llvm-project/pull/71555

>From 7bb2f9793b2a2cccbaa401f6e2ac850b587f2b59 Mon Sep 17 00:00:00 2001
From: Muneeb Khan 
Date: Tue, 7 Nov 2023 23:52:17 +0800
Subject: [PATCH 1/9] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF

This patch adds continuous loop peeling to scf loop transforms
in the MLIR backend. This transforms the target loop into a
chain of loops, with step sizes that are powers of two and
decrease exponetially across subsequent loops. Originally
authored by Litu Zhou litu.z...@huawei.com.
---
 .../SCF/TransformOps/SCFTransformOps.td   |  36 +
 .../SCF/TransformOps/SCFTransformOps.cpp  | 147 ++
 .../Dialect/SCF/loop-continuous-peel.mlir |  98 
 3 files changed, 281 insertions(+)
 create mode 100644 mlir/test/Dialect/SCF/loop-continuous-peel.mlir

diff --git a/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td 
b/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
index 14df7e23a430fb..e3d79a7f0ae40f 100644
--- a/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
+++ b/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
@@ -147,6 +147,42 @@ def LoopPeelOp : Op {
+  let description = [{
+Transforms the loop into a chain of loops, with step sizes that are
+powers of two and decrease exponetially across subsequent loops.
+The transform is similar to loop.peel in the effect that it creates a loop
+with a step (that is power of 2) to divide the range evenly, with the
+difference that the remaining iterations are spread across similar loops
+with exponentially decreasing step sizes, with the last loop with step size
+of 2^0 = 1.
+
+ Return modes
+
+This operation consumes the `target` handles and produces the
+continuously-peeled loop.
+  }];
+
+  let arguments =
+  (ins TransformHandleTypeInterface:$target,
+   DefaultValuedAttr:$single_iter_opt);
+  // TODO: Return both the peeled loop and the remainder loop.
+  let results = (outs TransformHandleTypeInterface:$transformed);
+
+  let assemblyFormat =
+"$target attr-dict `:` functional-type(operands, results)";
+
+  let extraClassDeclaration = [{
+::mlir::DiagnosedSilenceableFailure applyToOne(
+::mlir::transform::TransformRewriter &rewriter,
+::mlir::Operation *target,
+::mlir::transform::ApplyToEachResultList &results,
+::mlir::transform::TransformState &state);
+  }];
+}
+
 def LoopPipelineOp : Op {
diff --git a/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp 
b/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
index 62370604142cd5..dcba6a8b406b21 100644
--- a/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
+++ b/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
@@ -206,6 +206,153 @@ 
transform::LoopPeelOp::applyToOne(transform::TransformRewriter &rewriter,
   return DiagnosedSilenceableFailure::success();
 }
 
+//===-===//
+// LoopContinuousPeelOp
+//===-===//
+
+static LogicalResult splitLoopHelper(RewriterBase &b, scf::ForOp &forOp,
+ scf::ForOp &partialIteration,
+ Value &splitBound) {
+  RewriterBase::InsertionGuard guard(b);
+  auto lbInt = getConstantIntValue(forOp.getLowerBound());
+  auto ubInt = getConstantIntValue(forOp.getUpperBound());
+  auto stepInt = getConstantIntValue(forOp.getStep());
+
+  // No specialization necessary if step already divides upper bound evenly.
+  if (lbInt && ubInt && stepInt && (*ubInt - *lbInt) % *stepInt == 0)
+return failure();
+  // No specialization necessary if step size is 1.
+  if (stepInt == static_cast(1))
+return failure();
+
+  // Create ForOp for partial iteration.
+  b.setInsertionPointAfter(forOp);
+  partialIteration = cast(b.clone(*forOp.getOperation()));
+  partialIteration.getLowerBoundMutable().assign(splitBound);
+  forOp.replaceAllUsesWith(partialIteration->getResults());
+  partialIteration.getInitArgsMutable().assign(forOp->getResults());
+
+  // Set new upper loop bound.
+  b.updateRootInPlace(
+  forOp, [&]() { forOp.getUpperBoundMutable().assign(splitBound); });
+
+  return success();
+}
+
+static scf::IfOp convertSingleIterFor(RewriterBase &b, scf::ForOp &forOp) {
+  Location loc = forOp->getLoc();
+  IRMapping mapping;
+  mapping.map(forOp.getInductionVar(), forOp.getLowerBound());
+  for (auto [arg, operand] :
+   llvm::zip(forOp.getRegionIterArgs(), forOp.getInitsMutable())) {
+mapping.map(arg, operand.get());
+  }
+  b.setInsertionPoint(forOp);
+  auto cond =
+  b.create(loc, arith::CmpIPredicate::slt,
+  forOp.getLowerBound(), forOp.getUpperBound());
+  auto ifOp = b.create(loc, forOp->getResultTypes(), cond, true);
+  // then branch
+  b.setInsert

[Lldb-commits] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [mlir] [libc] [clang] [lldb] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

https://github.com/muneebkhan85 updated 
https://github.com/llvm/llvm-project/pull/71555

>From 7bb2f9793b2a2cccbaa401f6e2ac850b587f2b59 Mon Sep 17 00:00:00 2001
From: Muneeb Khan 
Date: Tue, 7 Nov 2023 23:52:17 +0800
Subject: [PATCH 1/9] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF

This patch adds continuous loop peeling to scf loop transforms
in the MLIR backend. This transforms the target loop into a
chain of loops, with step sizes that are powers of two and
decrease exponetially across subsequent loops. Originally
authored by Litu Zhou litu.z...@huawei.com.
---
 .../SCF/TransformOps/SCFTransformOps.td   |  36 +
 .../SCF/TransformOps/SCFTransformOps.cpp  | 147 ++
 .../Dialect/SCF/loop-continuous-peel.mlir |  98 
 3 files changed, 281 insertions(+)
 create mode 100644 mlir/test/Dialect/SCF/loop-continuous-peel.mlir

diff --git a/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td 
b/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
index 14df7e23a430fb..e3d79a7f0ae40f 100644
--- a/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
+++ b/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
@@ -147,6 +147,42 @@ def LoopPeelOp : Op {
+  let description = [{
+Transforms the loop into a chain of loops, with step sizes that are
+powers of two and decrease exponetially across subsequent loops.
+The transform is similar to loop.peel in the effect that it creates a loop
+with a step (that is power of 2) to divide the range evenly, with the
+difference that the remaining iterations are spread across similar loops
+with exponentially decreasing step sizes, with the last loop with step size
+of 2^0 = 1.
+
+ Return modes
+
+This operation consumes the `target` handles and produces the
+continuously-peeled loop.
+  }];
+
+  let arguments =
+  (ins TransformHandleTypeInterface:$target,
+   DefaultValuedAttr:$single_iter_opt);
+  // TODO: Return both the peeled loop and the remainder loop.
+  let results = (outs TransformHandleTypeInterface:$transformed);
+
+  let assemblyFormat =
+"$target attr-dict `:` functional-type(operands, results)";
+
+  let extraClassDeclaration = [{
+::mlir::DiagnosedSilenceableFailure applyToOne(
+::mlir::transform::TransformRewriter &rewriter,
+::mlir::Operation *target,
+::mlir::transform::ApplyToEachResultList &results,
+::mlir::transform::TransformState &state);
+  }];
+}
+
 def LoopPipelineOp : Op {
diff --git a/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp 
b/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
index 62370604142cd5..dcba6a8b406b21 100644
--- a/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
+++ b/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
@@ -206,6 +206,153 @@ 
transform::LoopPeelOp::applyToOne(transform::TransformRewriter &rewriter,
   return DiagnosedSilenceableFailure::success();
 }
 
+//===-===//
+// LoopContinuousPeelOp
+//===-===//
+
+static LogicalResult splitLoopHelper(RewriterBase &b, scf::ForOp &forOp,
+ scf::ForOp &partialIteration,
+ Value &splitBound) {
+  RewriterBase::InsertionGuard guard(b);
+  auto lbInt = getConstantIntValue(forOp.getLowerBound());
+  auto ubInt = getConstantIntValue(forOp.getUpperBound());
+  auto stepInt = getConstantIntValue(forOp.getStep());
+
+  // No specialization necessary if step already divides upper bound evenly.
+  if (lbInt && ubInt && stepInt && (*ubInt - *lbInt) % *stepInt == 0)
+return failure();
+  // No specialization necessary if step size is 1.
+  if (stepInt == static_cast(1))
+return failure();
+
+  // Create ForOp for partial iteration.
+  b.setInsertionPointAfter(forOp);
+  partialIteration = cast(b.clone(*forOp.getOperation()));
+  partialIteration.getLowerBoundMutable().assign(splitBound);
+  forOp.replaceAllUsesWith(partialIteration->getResults());
+  partialIteration.getInitArgsMutable().assign(forOp->getResults());
+
+  // Set new upper loop bound.
+  b.updateRootInPlace(
+  forOp, [&]() { forOp.getUpperBoundMutable().assign(splitBound); });
+
+  return success();
+}
+
+static scf::IfOp convertSingleIterFor(RewriterBase &b, scf::ForOp &forOp) {
+  Location loc = forOp->getLoc();
+  IRMapping mapping;
+  mapping.map(forOp.getInductionVar(), forOp.getLowerBound());
+  for (auto [arg, operand] :
+   llvm::zip(forOp.getRegionIterArgs(), forOp.getInitsMutable())) {
+mapping.map(arg, operand.get());
+  }
+  b.setInsertionPoint(forOp);
+  auto cond =
+  b.create(loc, arith::CmpIPredicate::slt,
+  forOp.getLowerBound(), forOp.getUpperBound());
+  auto ifOp = b.create(loc, forOp->getResultTypes(), cond, true);
+  // then branch
+  b.setInsert

[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

Failures didn't reproduce locally, so this is back in with an extra assert and 
logging enabled so I can catch it if it happens again.

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


[Lldb-commits] [lldb] Make only one function that needs to be implemented when searching for types (PR #74786)

2023-12-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

> If we need to expected fail the python test on window until we can look into 
> it, I would vote to do this.

As it happens, I'm using the buildbot machine to reproduce this. So it's not 
doing any more builds for now. I'll put in workarounds if I don't find the 
issue by Friday.

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


[Lldb-commits] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [mlir] [libc] [clang] [lldb] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

https://github.com/muneebkhan85 updated 
https://github.com/llvm/llvm-project/pull/71555

>From 7bb2f9793b2a2cccbaa401f6e2ac850b587f2b59 Mon Sep 17 00:00:00 2001
From: Muneeb Khan 
Date: Tue, 7 Nov 2023 23:52:17 +0800
Subject: [PATCH 01/10] [MLIR][LLVM] Add Continuous Loop Peeling transform to
 SCF

This patch adds continuous loop peeling to scf loop transforms
in the MLIR backend. This transforms the target loop into a
chain of loops, with step sizes that are powers of two and
decrease exponetially across subsequent loops. Originally
authored by Litu Zhou litu.z...@huawei.com.
---
 .../SCF/TransformOps/SCFTransformOps.td   |  36 +
 .../SCF/TransformOps/SCFTransformOps.cpp  | 147 ++
 .../Dialect/SCF/loop-continuous-peel.mlir |  98 
 3 files changed, 281 insertions(+)
 create mode 100644 mlir/test/Dialect/SCF/loop-continuous-peel.mlir

diff --git a/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td 
b/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
index 14df7e23a430fb..e3d79a7f0ae40f 100644
--- a/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
+++ b/mlir/include/mlir/Dialect/SCF/TransformOps/SCFTransformOps.td
@@ -147,6 +147,42 @@ def LoopPeelOp : Op {
+  let description = [{
+Transforms the loop into a chain of loops, with step sizes that are
+powers of two and decrease exponetially across subsequent loops.
+The transform is similar to loop.peel in the effect that it creates a loop
+with a step (that is power of 2) to divide the range evenly, with the
+difference that the remaining iterations are spread across similar loops
+with exponentially decreasing step sizes, with the last loop with step size
+of 2^0 = 1.
+
+ Return modes
+
+This operation consumes the `target` handles and produces the
+continuously-peeled loop.
+  }];
+
+  let arguments =
+  (ins TransformHandleTypeInterface:$target,
+   DefaultValuedAttr:$single_iter_opt);
+  // TODO: Return both the peeled loop and the remainder loop.
+  let results = (outs TransformHandleTypeInterface:$transformed);
+
+  let assemblyFormat =
+"$target attr-dict `:` functional-type(operands, results)";
+
+  let extraClassDeclaration = [{
+::mlir::DiagnosedSilenceableFailure applyToOne(
+::mlir::transform::TransformRewriter &rewriter,
+::mlir::Operation *target,
+::mlir::transform::ApplyToEachResultList &results,
+::mlir::transform::TransformState &state);
+  }];
+}
+
 def LoopPipelineOp : Op {
diff --git a/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp 
b/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
index 62370604142cd5..dcba6a8b406b21 100644
--- a/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
+++ b/mlir/lib/Dialect/SCF/TransformOps/SCFTransformOps.cpp
@@ -206,6 +206,153 @@ 
transform::LoopPeelOp::applyToOne(transform::TransformRewriter &rewriter,
   return DiagnosedSilenceableFailure::success();
 }
 
+//===-===//
+// LoopContinuousPeelOp
+//===-===//
+
+static LogicalResult splitLoopHelper(RewriterBase &b, scf::ForOp &forOp,
+ scf::ForOp &partialIteration,
+ Value &splitBound) {
+  RewriterBase::InsertionGuard guard(b);
+  auto lbInt = getConstantIntValue(forOp.getLowerBound());
+  auto ubInt = getConstantIntValue(forOp.getUpperBound());
+  auto stepInt = getConstantIntValue(forOp.getStep());
+
+  // No specialization necessary if step already divides upper bound evenly.
+  if (lbInt && ubInt && stepInt && (*ubInt - *lbInt) % *stepInt == 0)
+return failure();
+  // No specialization necessary if step size is 1.
+  if (stepInt == static_cast(1))
+return failure();
+
+  // Create ForOp for partial iteration.
+  b.setInsertionPointAfter(forOp);
+  partialIteration = cast(b.clone(*forOp.getOperation()));
+  partialIteration.getLowerBoundMutable().assign(splitBound);
+  forOp.replaceAllUsesWith(partialIteration->getResults());
+  partialIteration.getInitArgsMutable().assign(forOp->getResults());
+
+  // Set new upper loop bound.
+  b.updateRootInPlace(
+  forOp, [&]() { forOp.getUpperBoundMutable().assign(splitBound); });
+
+  return success();
+}
+
+static scf::IfOp convertSingleIterFor(RewriterBase &b, scf::ForOp &forOp) {
+  Location loc = forOp->getLoc();
+  IRMapping mapping;
+  mapping.map(forOp.getInductionVar(), forOp.getLowerBound());
+  for (auto [arg, operand] :
+   llvm::zip(forOp.getRegionIterArgs(), forOp.getInitsMutable())) {
+mapping.map(arg, operand.get());
+  }
+  b.setInsertionPoint(forOp);
+  auto cond =
+  b.create(loc, arith::CmpIPredicate::slt,
+  forOp.getLowerBound(), forOp.getUpperBound());
+  auto ifOp = b.create(loc, forOp->getResultTypes(), cond, true);
+  // then branch
+  b.setIns

[Lldb-commits] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [mlir] [libc] [clang] [lldb] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [mlir] [libc] [clang] [lldb] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [mlir] [libc] [clang] [lldb] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [libc] [clang] [lld] [mlir] [libcxx] [lldb] [compiler-rt] [clang-tools-extra] [llvm] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [libc] [clang] [lld] [mlir] [libcxx] [lldb] [compiler-rt] [clang-tools-extra] [llvm] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits


@@ -105,6 +106,168 @@ static void specializeForLoopForUnrolling(ForOp op) {
   op.erase();
 }
 
+static LogicalResult splitLoopHelper(RewriterBase &b, scf::ForOp &forOp,
+ scf::ForOp &partialIteration,
+ Value &splitBound) {
+  RewriterBase::InsertionGuard guard(b);
+  auto lbInt = getConstantIntValue(forOp.getLowerBound());
+  auto ubInt = getConstantIntValue(forOp.getUpperBound());
+  auto stepInt = getConstantIntValue(forOp.getStep());
+
+  // No specialization necessary if step already divides upper bound evenly.
+  if (lbInt && ubInt && stepInt && (*ubInt - *lbInt) % *stepInt == 0)
+return failure();
+  // No specialization necessary if step size is 1.
+  if (stepInt == static_cast(1))
+return failure();
+
+  // Create ForOp for partial iteration.
+  b.setInsertionPointAfter(forOp);
+  partialIteration = cast(b.clone(*forOp.getOperation()));
+  partialIteration.getLowerBoundMutable().assign(splitBound);
+  forOp.replaceAllUsesWith(partialIteration->getResults());
+  partialIteration.getInitArgsMutable().assign(forOp->getResults());
+
+  // Set new upper loop bound.
+  b.updateRootInPlace(
+  forOp, [&]() { forOp.getUpperBoundMutable().assign(splitBound); });
+
+  return success();
+}
+
+static scf::IfOp convertSingleIterFor(RewriterBase &b, scf::ForOp &forOp) {
+  Location loc = forOp->getLoc();
+  IRMapping mapping;
+  mapping.map(forOp.getInductionVar(), forOp.getLowerBound());
+  for (auto [arg, operand] :
+   llvm::zip(forOp.getRegionIterArgs(), forOp.getInitsMutable())) {
+mapping.map(arg, operand.get());
+  }
+  b.setInsertionPoint(forOp);
+  auto cond =
+  b.create(loc, arith::CmpIPredicate::slt,
+  forOp.getLowerBound(), forOp.getUpperBound());
+  auto ifOp = b.create(loc, forOp->getResultTypes(), cond, true);
+  // then branch
+  b.setInsertionPointToStart(ifOp.thenBlock());
+  for (Operation &op : forOp.getBody()->getOperations()) {
+b.clone(op, mapping);

muneebkhan85 wrote:

Done. 

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


[Lldb-commits] [libc] [clang] [lld] [mlir] [libcxx] [lldb] [compiler-rt] [clang-tools-extra] [llvm] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [libc] [clang] [lld] [mlir] [libcxx] [lldb] [compiler-rt] [clang-tools-extra] [llvm] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

muneebkhan85 wrote:

ping @matthias-springer 

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


[Lldb-commits] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [mlir] [libc] [clang] [lldb] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [lld] [clang-tools-extra] [llvm] [libcxx] [compiler-rt] [mlir] [libc] [clang] [lldb] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)

2023-12-14 Thread via lldb-commits

https://github.com/cmtice updated 
https://github.com/llvm/llvm-project/pull/73472

>From a063ebd8ee8bbd491fff3449bc20d663d2e501ea Mon Sep 17 00:00:00 2001
From: Caroline Tice 
Date: Sun, 26 Nov 2023 17:24:39 -0800
Subject: [PATCH 1/6] [LLDB] Add more helper functions to CompilerType class
 (second try).

This adds 23 new helper functions to LLDB's CompilerType class, things
like IsSmartPtrType, IsPromotableIntegerType,
GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a
few).

It also has run clang-format on the files CompilerType.{h,cpp}.

These helper functions are needed as part of the implementation for
the Data Inspection Language, (see
https://discourse.llvm.org/t/rfc-data-inspection-language/69893).
---
 lldb/include/lldb/Symbol/CompilerType.h |  56 -
 lldb/source/Symbol/CompilerType.cpp | 285 ++--
 2 files changed, 320 insertions(+), 21 deletions(-)

diff --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index 0a9533a1ac0efc..a3331ad3269c01 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -112,9 +112,7 @@ class CompilerType {
 
   /// Tests.
   /// \{
-  explicit operator bool() const {
-return m_type_system.lock() && m_type;
-  }
+  explicit operator bool() const { return m_type_system.lock() && m_type; }
 
   bool IsValid() const { return (bool)*this; }
 
@@ -194,6 +192,54 @@ class CompilerType {
   bool IsTypedefType() const;
 
   bool IsVoidType() const;
+
+  bool IsSmartPtrType() const;
+
+  bool IsInteger() const;
+
+  bool IsFloat() const;
+
+  bool IsEnumerationType() const;
+
+  bool IsUnscopedEnumerationType() const;
+
+  bool IsIntegerOrUnscopedEnumerationType() const;
+
+  bool IsSigned() const;
+
+  bool IsNullPtrType() const;
+
+  bool IsBoolean() const;
+
+  bool IsEnumerationIntegerTypeSigned() const;
+
+  bool IsScalarOrUnscopedEnumerationType() const;
+
+  bool IsPromotableIntegerType() const;
+
+  bool IsPointerToVoid() const;
+
+  bool IsRecordType() const;
+
+  bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base,
+ bool carry_virtual = false) const;
+
+  bool IsContextuallyConvertibleToBool() const;
+
+  bool IsBasicType() const;
+
+  std::string TypeDescription();
+
+  bool CompareTypes(CompilerType rhs) const;
+
+  const char *GetTypeTag();
+
+  uint32_t GetNumberOfNonEmptyBaseClasses();
+
+  CompilerType GetTemplateArgumentType(uint32_t idx);
+
+  CompilerType GetSmartPtrPointeeType();
+
   /// \}
 
   /// Type Completion.
@@ -436,8 +482,8 @@ class CompilerType {
  ExecutionContextScope *exe_scope);
 
   /// Dump to stdout.
-  void DumpTypeDescription(lldb::DescriptionLevel level =
-   lldb::eDescriptionLevelFull) const;
+  void DumpTypeDescription(
+  lldb::DescriptionLevel level = lldb::eDescriptionLevelFull) const;
 
   /// Print a description of the type to a stream. The exact implementation
   /// varies, but the expectation is that eDescriptionLevelFull returns a
diff --git a/lldb/source/Symbol/CompilerType.cpp 
b/lldb/source/Symbol/CompilerType.cpp
index 78cc8dad94a9c5..854d6cab01b508 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -54,7 +54,7 @@ bool CompilerType::IsArrayType(CompilerType 
*element_type_ptr, uint64_t *size,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsArrayType(m_type, element_type_ptr, size,
-  is_incomplete);
+ is_incomplete);
 
   if (element_type_ptr)
 element_type_ptr->Clear();
@@ -157,7 +157,8 @@ bool CompilerType::IsBlockPointerType(
 CompilerType *function_pointer_type_ptr) const {
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
-  return type_system_sp->IsBlockPointerType(m_type, 
function_pointer_type_ptr);
+  return type_system_sp->IsBlockPointerType(m_type,
+function_pointer_type_ptr);
   return false;
 }
 
@@ -249,7 +250,7 @@ bool CompilerType::IsPossibleDynamicType(CompilerType 
*dynamic_pointee_type,
   if (IsValid())
 if (auto type_system_sp = GetTypeSystem())
   return type_system_sp->IsPossibleDynamicType(m_type, 
dynamic_pointee_type,
-check_cplusplus, check_objc);
+   check_cplusplus, 
check_objc);
   return false;
 }
 
@@ -302,6 +303,256 @@ bool CompilerType::IsBeingDefined() const {
   return false;
 }
 
+bool CompilerType::IsSmartPtrType() const {
+  // These regular expressions cover shared, unique and weak pointers both from
+  // stdlibc++ and libc+++.
+
+  static llvm::Regex k_libcxx_std_unique_ptr_regex(
+  "^std::__[[:alnum:]]+::unique_ptr<.+>(( )?&)?$");
+  static llvm::Regex k_libcxx_std_shared_ptr_regex(
+  "^std::__[[:alnum:]

[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)

2023-12-14 Thread via lldb-commits


@@ -302,6 +302,195 @@ bool CompilerType::IsBeingDefined() const {
   return false;
 }
 
+bool CompilerType::IsInteger() const {
+  bool is_signed = false; // May be reset by the call below.
+  return IsIntegerType(is_signed);
+}
+
+bool CompilerType::IsFloat() const {
+  uint32_t count = 0;
+  bool is_complex = false;
+  return IsFloatingPointType(count, is_complex);
+}
+
+bool CompilerType::IsEnumerationType() const {
+  bool is_signed = false; // May be reset by the call below.
+  return IsEnumerationType(is_signed);
+}
+
+bool CompilerType::IsUnscopedEnumerationType() const {
+  return IsEnumerationType() && !IsScopedEnumerationType();
+}
+
+bool CompilerType::IsIntegerOrUnscopedEnumerationType() const {
+  return IsInteger() || IsUnscopedEnumerationType();
+}
+
+bool CompilerType::IsSigned() const {
+  if (IsEnumerationType())
+return IsEnumerationIntegerTypeSigned();
+
+  return GetTypeInfo() & lldb::eTypeIsSigned;

cmtice wrote:

@adrian-prantl Actually I think it already works properly without 
special-casing enums (I went back and looked and could not figure out why I had 
done this). I've cleaned it up now and removed the special casing.  Are you OK 
with me committing this now?

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


[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/74808

>From 4e6bfb5f26f7744db1cb4a37d0e342195ae0ff8a Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 8 Dec 2023 00:11:19 -0500
Subject: [PATCH] [lldb-dap] Implement quiet commands

This adds support for optionally prefixing any command with `?`, which 
effectively prevents the output of these commands to be printed to the console 
unless they fail. This comes handy when programmaticaly running commands on 
behalf of the user without wanting them to know unless they fail.

In a later PR I plan to implement the `!` prefix for commands that abort 
lldb-dap upon errors.
---
 .../test/tools/lldb-dap/lldbdap_testcase.py   |  7 ++
 .../test/API/tools/lldb-dap/commands/Makefile |  3 +
 .../lldb-dap/commands/TestDAP_commands.py | 80 +++
 .../test/API/tools/lldb-dap/commands/main.cpp |  1 +
 lldb/tools/lldb-dap/DAP.cpp   | 50 ++--
 lldb/tools/lldb-dap/DAP.h | 17 ++--
 lldb/tools/lldb-dap/LLDBUtils.cpp | 77 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 37 -
 lldb/tools/lldb-dap/lldb-dap.cpp  | 51 +---
 lldb/tools/lldb-dap/package.json  | 24 +++---
 10 files changed, 287 insertions(+), 60 deletions(-)
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/Makefile
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/main.cpp

diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 4ccd6014e54be..7436b9900e98b 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -291,6 +291,7 @@ def attach(
 postRunCommands=None,
 sourceMap=None,
 sourceInitFile=False,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and attach to the process.
@@ -322,6 +323,8 @@ def cleanup():
 postRunCommands=postRunCommands,
 sourceMap=sourceMap,
 )
+if expectFailure:
+return response
 if not (response and response["success"]):
 self.assertTrue(
 response["success"], "attach failed (%s)" % 
(response["message"])
@@ -437,6 +440,8 @@ def build_and_launch(
 commandEscapePrefix=None,
 customFrameFormat=None,
 customThreadFormat=None,
+launchCommands=None,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and launch the process.
@@ -470,4 +475,6 @@ def build_and_launch(
 commandEscapePrefix=commandEscapePrefix,
 customFrameFormat=customFrameFormat,
 customThreadFormat=customThreadFormat,
+launchCommands=launchCommands,
+expectFailure=expectFailure,
 )
diff --git a/lldb/test/API/tools/lldb-dap/commands/Makefile 
b/lldb/test/API/tools/lldb-dap/commands/Makefile
new file mode 100644
index 0..8b20bcb05
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py 
b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
new file mode 100644
index 0..226b9385fe719
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
@@ -0,0 +1,80 @@
+import os
+
+import dap_server
+import lldbdap_testcase
+from lldbsuite.test import lldbtest, lldbutil
+from lldbsuite.test.decorators import *
+
+
+class TestDAP_commands(lldbdap_testcase.DAPTestCaseBase):
+def test_command_directive_quiet_on_success(self):
+program = self.getBuildArtifact("a.out")
+command_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
false"
+)
+command_not_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
true"
+)
+self.build_and_launch(
+program,
+initCommands=["?" + command_quiet, command_not_quiet],
+terminateCommands=["?" + command_quiet, command_not_quiet],
+stopCommands=["?" + command_quiet, command_not_quiet],
+exitCommands=["?" + command_quiet, command_not_quiet],
+)
+full_output = self.collect_console(duration=1.0)
+self.assertNotIn(command_quiet, full_output)
+self.assertIn(command_not_quiet, full_output)
+
+def do_test_abort_on_error(
+self,
+use_init_commands=False,
+use_launch_commands=False,
+use_pre_run_commands=False,
+use_post_run_commands=Fal

[Lldb-commits] [lld] [compiler-rt] [libc] [clang] [libcxx] [lldb] [flang] [mlir] [llvm] [clang-tools-extra] [AMDGPU] GFX12: Add Split Workgroup Barrier (PR #74836)

2023-12-14 Thread Jay Foad via lldb-commits


@@ -684,6 +684,51 @@ s_rndne_f16 s5, 0xfe0b
 s_rndne_f16 s5, 0x3456
 // GFX12: encoding: [0xff,0x6e,0x85,0xbe,0x56,0x34,0x00,0x00]
 
+s_barrier_signal -2

jayfoad wrote:

Missing `s_get_barrier_state` tests in this file?

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


[Lldb-commits] [llvm] [lldb] DEBUGINFOD based DWP acquisition for LLDB (PR #70996)

2023-12-14 Thread Michał Górny via lldb-commits

mgorny wrote:

I'm afraid that log's non-verbose (i.e. missing `-v`), so it doesn't tell me 
which libraries are being linked. Also, I don't think I'll be able to tell much 
without logs for all of cmake, build and install of both LLVM and LLDB.

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


[Lldb-commits] [llvm] [libcxx] [clang] [clang-tools-extra] [lldb] [libc] [flang] [mlir] [compiler-rt] [lld] [AMDGPU] GFX12: Add Split Workgroup Barrier (PR #74836)

2023-12-14 Thread Mariusz Sikora via lldb-commits


@@ -684,6 +684,51 @@ s_rndne_f16 s5, 0xfe0b
 s_rndne_f16 s5, 0x3456
 // GFX12: encoding: [0xff,0x6e,0x85,0xbe,0x56,0x34,0x00,0x00]
 
+s_barrier_signal -2

mariusz-sikora-at-amd wrote:

Thanks !

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


[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

2023-12-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/75244

>From d8397cb98d219f8d368937efb5c7ba940f420fe3 Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 8 Dec 2023 12:58:30 -0500
Subject: [PATCH] [lldb-dap] Emit more structured info along with variables

In order to allow smarter vscode extensions, it's useful to send additional 
structured information of SBValues to the client. Specifically, I'm now sending 
error, summary, autoSummary and inMemoryValue in addition to the existing 
properties being sent. This is cheap because these properties have to be 
calculated anyway to generate the display value of the variable, but they are 
now available for extensions to better analyze variables. For example, if the 
error field is not present, the extension might be able to provide cool 
features, and the current way to do that is to look for the " 
TryCreateAutoSummary(lldb::SBValue value) {
   return TryCreateAutoSummaryForContainer(value);
 }
 
-std::string ValueToString(lldb::SBValue v) {
-  std::string result;
-  llvm::raw_string_ostream strm(result);
-
-  lldb::SBError error = v.GetError();
-  if (!error.Success()) {
-strm << "";
-  } else {
-llvm::StringRef value = v.GetValue();
-llvm::StringRef nonAutoSummary = v.GetSummary();
-std::optional summary = !nonAutoSummary.empty()
- ? nonAutoSummary.str()
- : TryCreateAutoSummary(v);
-if (!value.empty()) {
-  strm << value;
-  if (summary)
-strm << ' ' << *summary;
-} else if (summary) {
-  strm << *summary;
-
-  // As last resort, we print its type and address if available.
-} else {
-  if (llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
-  !type_name.empty()) {
-strm << type_name;
-lldb::addr_t address = v.GetLoadAddress();
-if (address != LLDB_INVALID_ADDRESS)
-  strm << " @ " << llvm::format_hex(address, 0);
-  }
-}
-  }
-  return result;
-}
-
-void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
-llvm::StringRef key) {
-  std::string result = ValueToString(v);
-  EmplaceSafeString(object, key, result);
-}
-
 void FillResponse(const llvm::json::Object &request,
   llvm::json::Object &response) {
   // Fill in all of the needed response fields to a "request" and set "success"
@@ -1044,6 +1004,59 @@ std::string 
CreateUniqueVariableNameForDisplay(lldb::SBValue v,
   return name_builder.GetData();
 }
 
+VariableDescription::VariableDescription(
+lldb::SBValue v, bool format_hex, bool is_name_duplicated,
+std::optional custom_name) {
+  name = custom_name
+ ? *custom_name
+ : CreateUniqueVariableNameForDisplay(v, is_name_duplicated);
+
+  type_obj = v.GetType();
+  std::string raw_display_type_name =
+  llvm::StringRef(type_obj.GetDisplayTypeName()).str();
+  display_type_name =
+  !raw_display_type_name.empty() ? raw_display_type_name : NO_TYPENAME;
+
+  if (format_hex)
+v.SetFormat(lldb::eFormatHex);
+
+  llvm::raw_string_ostream os_display_value(display_value);
+
+  if (lldb::SBError sb_error = v.GetError(); sb_error.Fail()) {
+error = sb_error.GetCString();
+os_display_value << "";
+  } else {
+lldb_value = llvm::StringRef(v.GetValue()).str();
+summary = llvm::StringRef(v.GetSummary()).str();
+if (summary.empty())
+  auto_summary = TryCreateAutoSummary(v);
+
+std::optional effective_summary =
+!summary.empty() ? summary : auto_summary;
+
+if (!lldb_value.empty()) {
+  os_display_value << lldb_value;
+  if (effective_summary)
+os_display_value << " " << *effective_summary;
+} else if (effective_summary) {
+  os_display_value << *effective_summary;
+
+  // As last resort, we print its type and address if available.
+} else {
+  if (!raw_display_type_name.empty()) {
+os_display_value << raw_display_type_name;
+lldb::addr_t address = v.GetLoadAddress();
+if (address != LLDB_INVALID_ADDRESS)
+  os_display_value << " @ " << llvm::format_hex(address, 0);
+  }
+}
+  }
+
+  lldb::SBStream evaluateStream;
+  v.GetExpressionPath(evaluateStream);
+  evaluate_name = llvm::StringRef(evaluateStream.GetData()).str();
+}
+
 // "Variable": {
 //   "type": "object",
 //   "description": "A Variable is a name/value pair. Optionally a variable
@@ -1103,27 +1116,56 @@ std::string 
CreateUniqueVariableNameForDisplay(lldb::SBValue v,
 //   can use this optional information to present the
 //   children in a paged UI and fetch them in chunks."
 // }
-// "declaration": {
-//   "type": "object | undefined",
-//   "description": "Extension to the protocol that indicates the source
-//   location where the variable was declared. This value
-//

[Lldb-commits] [libc] [clang] [mlir] [lldb] [lld] [compiler-rt] [libcxx] [llvm] [clang-tools-extra] [MLIR][LLVM] Add Continuous Loop Peeling transform to SCF (PR #71555)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] 481bb62 - [lldb] Assert immediately prior to calling PopPlan

2023-12-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-14T16:51:12Z
New Revision: 481bb62e50317cf20df9493aad842790162ac3e7

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

LOG: [lldb] Assert immediately prior to calling PopPlan

This is part of ongoing attempts to catch the test from
2684281d208612a746b05c891f346bd7b95318d5 failing on Arm and AArch64.

I did get logs for the failure but only on Arm, where the backtrace is
truncated. So, let's do the assert that PopPlan was going to do,
before we call it.

Then I should know exactly which PopPlan is asserting.

Technically I should take a mutex here, but technically I shouldn't
be debugging via buildbot, so I'm going to take the risk temporarily.

Added: 


Modified: 
lldb/source/Target/Thread.cpp

Removed: 




diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 6d634f25edf8a4..11aff37ac8c636 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -717,6 +717,16 @@ void Thread::DidResume() {
 
 void Thread::DidStop() { SetState(eStateStopped); }
 
+#define CHECK_BEFORE_POP_PLAN  
\
+  {
\
+uint32_t i = 0;
\
+ThreadPlanSP p;
\
+while ((p = GetPlans().GetPlanByIndex(i, false)))  
\
+  i++; 
\
+(void)i;
+assert(i != 1 && "Cannot pop plan when there is only one plan (the base 
plan)");
+}
+
 bool Thread::ShouldStop(Event *event_ptr) {
   ThreadPlan *current_plan = GetCurrentPlan();
 
@@ -831,7 +841,7 @@ bool Thread::ShouldStop(Event *event_ptr) {
 do {
   if (should_stop)
 current_plan->WillStop();
-  assert(!current_plan->IsBasePlan() && "Cannot pop base plan!");
+  CHECK_BEFORE_POP_PLAN;
   PopPlan();
 } while ((current_plan = GetCurrentPlan()) != prev_plan_ptr);
 // Now, if the responsible plan was not "Okay to discard" then
@@ -884,6 +894,7 @@ bool Thread::ShouldStop(Event *event_ptr) {
   // If a Controlling Plan wants to stop, we let it. Otherwise, see if
   // the plan's parent wants to stop.
 
+  CHECK_BEFORE_POP_PLAN;
   PopPlan();
   if (should_stop && current_plan->IsControllingPlan() &&
   !current_plan->OkayToDiscard()) {
@@ -932,6 +943,7 @@ bool Thread::ShouldStop(Event *event_ptr) {
   // plan is complete but does not explain the stop (example: step to a
   // line with breakpoint), let us move the plan to
   // completed_plan_stack anyway
+  CHECK_BEFORE_POP_PLAN;
   PopPlan();
 } else
   DiscardPlan();



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


[Lldb-commits] [lldb] 71b4d74 - [lldb] Fixup PopPlan assert

2023-12-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-14T16:55:07Z
New Revision: 71b4d7498ffecca5957fa0a63b1abf141d7b8441

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

LOG: [lldb] Fixup PopPlan assert

Fixes 481bb62e50317cf20df9493aad842790162ac3e7.

Added: 


Modified: 
lldb/source/Target/Thread.cpp

Removed: 




diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 11aff37ac8c63..4801e3e58d9ef 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -723,9 +723,10 @@ void Thread::DidStop() { SetState(eStateStopped); }
 ThreadPlanSP p;
\
 while ((p = GetPlans().GetPlanByIndex(i, false)))  
\
   i++; 
\
-(void)i;
-assert(i != 1 && "Cannot pop plan when there is only one plan (the base 
plan)");
-}
+(void)i;   
\
+assert(i != 1 &&   
\
+   "Cannot pop plan when there is only one plan (the base plan)"); 
\
+  }
 
 bool Thread::ShouldStop(Event *event_ptr) {
   ThreadPlan *current_plan = GetCurrentPlan();



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


[Lldb-commits] [llvm] [flang] [compiler-rt] [lld] [libcxx] [clang] [libcxxabi] [clang-tools-extra] [lldb] [AMDGPU] GFX12: select @llvm.prefetch intrinsic (PR #74576)

2023-12-14 Thread Jay Foad via lldb-commits


@@ -3164,6 +3164,18 @@ def : GCNPat <
 (as_i1timm $bound_ctrl))
 >;
 
+class SMPrefetchGetPcPat : GCNPat <

jayfoad wrote:

This pattern also interprets the "address" argument as being an offset from PC, 
so it should also be removed from this version of the patch.

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


[Lldb-commits] [lldb] [lldb][NFCI] Remove unused parameter from BreakpointResolver*::CreateFromStructuredData (PR #75374)

2023-12-14 Thread via lldb-commits

jimingham wrote:

You don't need the breakpoint to create the resolver.  It's been a while, but I 
imagine I was passing in the breakpoint here so that if there were errors with 
deserializing the resolver from the structured data we could mention the 
breakpoint number.  But that's not really necessary, you can add the breakpoint 
number to the error reporting after you get the error back from 
CreateFromStructuredData.  So this looks fine to me.

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


[Lldb-commits] [lldb] 5bc1adf - Revert "lldb: Cache string hash during ConstString pool queries/insertions"

2023-12-14 Thread David Blaikie via lldb-commits

Author: David Blaikie
Date: 2023-12-14T17:44:18Z
New Revision: 5bc1adff69315dcef670e9fcbe04067b5d5963fb

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

LOG: Revert "lldb: Cache string hash during ConstString pool queries/insertions"

Underlying StringMap API for providing a hash has caused some problems
(observed a crash in lld) - so reverting this until I can figure out/fix
what's going on there.

This reverts commit 52ba075571958e2fec8d871ddfa1ef56486b86d3.
This reverts commit 2e197602305be18b963928e6ae024a004a95af6d.

Added: 


Modified: 
lldb/source/Utility/ConstString.cpp
llvm/lib/Support/StringMap.cpp

Removed: 




diff  --git a/lldb/source/Utility/ConstString.cpp 
b/lldb/source/Utility/ConstString.cpp
index ea897dc611cc94..4535771adfb735 100644
--- a/lldb/source/Utility/ConstString.cpp
+++ b/lldb/source/Utility/ConstString.cpp
@@ -77,10 +77,10 @@ class Pool {
 return 0;
   }
 
-  StringPoolValueType GetMangledCounterpart(const char *ccstr) {
+  StringPoolValueType GetMangledCounterpart(const char *ccstr) const {
 if (ccstr != nullptr) {
-  const PoolEntry &pool = selectPool(llvm::StringRef(ccstr));
-  llvm::sys::SmartScopedReader rlock(pool.m_mutex);
+  const uint8_t h = hash(llvm::StringRef(ccstr));
+  llvm::sys::SmartScopedReader rlock(m_string_pools[h].m_mutex);
   return GetStringMapEntryFromKeyData(ccstr).getValue();
 }
 return nullptr;
@@ -100,20 +100,19 @@ class Pool {
 
   const char *GetConstCStringWithStringRef(llvm::StringRef string_ref) {
 if (string_ref.data()) {
-  const uint32_t string_hash = StringPool::hash(string_ref);
-  PoolEntry &pool = selectPool(string_hash);
+  const uint8_t h = hash(string_ref);
 
   {
-llvm::sys::SmartScopedReader rlock(pool.m_mutex);
-auto it = pool.m_string_map.find(string_ref, string_hash);
-if (it != pool.m_string_map.end())
+llvm::sys::SmartScopedReader rlock(m_string_pools[h].m_mutex);
+auto it = m_string_pools[h].m_string_map.find(string_ref);
+if (it != m_string_pools[h].m_string_map.end())
   return it->getKeyData();
   }
 
-  llvm::sys::SmartScopedWriter wlock(pool.m_mutex);
+  llvm::sys::SmartScopedWriter wlock(m_string_pools[h].m_mutex);
   StringPoolEntryType &entry =
-  *pool.m_string_map
-   .insert(std::make_pair(string_ref, nullptr), string_hash)
+  *m_string_pools[h]
+   .m_string_map.insert(std::make_pair(string_ref, nullptr))
.first;
   return entry.getKeyData();
 }
@@ -126,14 +125,12 @@ class Pool {
 const char *demangled_ccstr = nullptr;
 
 {
-  const uint32_t demangled_hash = StringPool::hash(demangled);
-  PoolEntry &pool = selectPool(demangled_hash);
-  llvm::sys::SmartScopedWriter wlock(pool.m_mutex);
+  const uint8_t h = hash(demangled);
+  llvm::sys::SmartScopedWriter wlock(m_string_pools[h].m_mutex);
 
   // Make or update string pool entry with the mangled counterpart
-  StringPool &map = pool.m_string_map;
-  StringPoolEntryType &entry =
-  *map.try_emplace_with_hash(demangled, demangled_hash).first;
+  StringPool &map = m_string_pools[h].m_string_map;
+  StringPoolEntryType &entry = *map.try_emplace(demangled).first;
 
   entry.second = mangled_ccstr;
 
@@ -144,8 +141,8 @@ class Pool {
 {
   // Now assign the demangled const string as the counterpart of the
   // mangled const string...
-  PoolEntry &pool = selectPool(llvm::StringRef(mangled_ccstr));
-  llvm::sys::SmartScopedWriter wlock(pool.m_mutex);
+  const uint8_t h = hash(llvm::StringRef(mangled_ccstr));
+  llvm::sys::SmartScopedWriter wlock(m_string_pools[h].m_mutex);
   GetStringMapEntryFromKeyData(mangled_ccstr).setValue(demangled_ccstr);
 }
 
@@ -174,20 +171,17 @@ class Pool {
   }
 
 protected:
+  uint8_t hash(llvm::StringRef s) const {
+uint32_t h = llvm::djbHash(s);
+return ((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff;
+  }
+
   struct PoolEntry {
 mutable llvm::sys::SmartRWMutex m_mutex;
 StringPool m_string_map;
   };
 
   std::array m_string_pools;
-
-  PoolEntry &selectPool(const llvm::StringRef &s) {
-return selectPool(StringPool::hash(s));
-  }
-
-  PoolEntry &selectPool(uint32_t h) {
-return m_string_pools[((h >> 24) ^ (h >> 16) ^ (h >> 8) ^ h) & 0xff];
-  }
 };
 
 // Frameworks and dylibs aren't supposed to have global C++ initializers so we
@@ -203,7 +197,7 @@ static Pool &StringPool() {
   static Pool *g_string_pool = nullptr;
 
   llvm::call_once(g_pool_initialization_flag,
-  []() { g_string_pool = new Pool(); });
+ []() { g_string_pool = new Pool(); });
 
   return *g_string_p

[Lldb-commits] [flang] [llvm] [clang] [clang-tools-extra] [lld] [lldb] [libcxx] [openmp] [libc] [mlir] [CanonicalizeFreezeInLoops] fix duplicate removal (PR #74716)

2023-12-14 Thread Wei Tao via lldb-commits

https://github.com/Friedrich20 updated 
https://github.com/llvm/llvm-project/pull/74716

>From 5ef11803b597fec44b64239824a4c9d3280cfea6 Mon Sep 17 00:00:00 2001
From: Wei Tao 
Date: Thu, 7 Dec 2023 21:33:40 +0800
Subject: [PATCH] [LLVM][CanonicalizeFreezeInLoops] fix duplicate removal

---
 .../Transforms/Utils/CanonicalizeFreezeInLoops.cpp  | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp 
b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
index fb4d8288537725..ff1eb17e0c2488 100644
--- a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
+++ b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
@@ -151,11 +151,18 @@ bool CanonicalizeFreezeInLoopsImpl::run() {
   }
 }
 
+bool Exist = false;
 auto Visit = [&](User *U) {
   if (auto *FI = dyn_cast(U)) {
-LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
-Info.FI = FI;
-Candidates.push_back(Info);
+for (const auto &Candidate : Candidates) {
+  auto *FI_cand = Candidate.FI;
+  Exist = (FI_cand == FI) ? true : Exist;
+}
+if (!Exist) {
+  LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
+  Info.FI = FI;
+  Candidates.push_back(Info);
+}
   }
 };
 for_each(PHI.users(), Visit);

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


[Lldb-commits] [flang] [llvm] [clang] [clang-tools-extra] [lld] [lldb] [libcxx] [openmp] [libc] [mlir] [CanonicalizeFreezeInLoops] fix duplicate removal (PR #74716)

2023-12-14 Thread Wei Tao via lldb-commits

https://github.com/Friedrich20 updated 
https://github.com/llvm/llvm-project/pull/74716

>From 5ef11803b597fec44b64239824a4c9d3280cfea6 Mon Sep 17 00:00:00 2001
From: Wei Tao 
Date: Thu, 7 Dec 2023 21:33:40 +0800
Subject: [PATCH] [LLVM][CanonicalizeFreezeInLoops] fix duplicate removal

---
 .../Transforms/Utils/CanonicalizeFreezeInLoops.cpp  | 13 ++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp 
b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
index fb4d8288537725..ff1eb17e0c2488 100644
--- a/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
+++ b/llvm/lib/Transforms/Utils/CanonicalizeFreezeInLoops.cpp
@@ -151,11 +151,18 @@ bool CanonicalizeFreezeInLoopsImpl::run() {
   }
 }
 
+bool Exist = false;
 auto Visit = [&](User *U) {
   if (auto *FI = dyn_cast(U)) {
-LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
-Info.FI = FI;
-Candidates.push_back(Info);
+for (const auto &Candidate : Candidates) {
+  auto *FI_cand = Candidate.FI;
+  Exist = (FI_cand == FI) ? true : Exist;
+}
+if (!Exist) {
+  LLVM_DEBUG(dbgs() << "canonfr: found: " << *FI << "\n");
+  Info.FI = FI;
+  Candidates.push_back(Info);
+}
   }
 };
 for_each(PHI.users(), Visit);

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


[Lldb-commits] [clang] [llvm] [libcxx] [lldb] [libc] [openmp] [clang-tools-extra] [compiler-rt] [flang] [libcxxabi] [lld] [mlir] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-14 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73686

>From bc152095691b32d1ad8539dfd60f5089df5eed8d Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Tue, 28 Nov 2023 10:39:44 -0800
Subject: [PATCH 01/11] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20?=
 =?UTF-8?q?initial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 llvm/docs/LangRef.rst |   7 +-
 llvm/include/llvm/CodeGen/AsmPrinter.h|   6 +-
 llvm/lib/CodeGen/GlobalISel/CallLowering.cpp  |   7 +-
 llvm/lib/IR/Verifier.cpp  |  12 +-
 llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 308 ++
 llvm/lib/Target/X86/X86AsmPrinter.cpp |  28 ++
 llvm/lib/Target/X86/X86AsmPrinter.h   |   1 +
 .../AArch64/GlobalISel/call-lowering-ifunc.ll |  37 +++
 llvm/test/CodeGen/AArch64/addrsig-macho.ll|   4 +-
 llvm/test/CodeGen/AArch64/ifunc-asm.ll|  82 +
 llvm/test/CodeGen/X86/ifunc-asm.ll|  28 +-
 llvm/test/Verifier/ifunc-macho.ll |  42 +++
 12 files changed, 539 insertions(+), 23 deletions(-)
 create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ifunc-asm.ll
 create mode 100644 llvm/test/Verifier/ifunc-macho.ll

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e448c5ed5c5d94..cb222e979db29d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -934,10 +934,11 @@ IFuncs
 ---
 
 IFuncs, like as aliases, don't create any new data or func. They are just a new
-symbol that dynamic linker resolves at runtime by calling a resolver function.
+symbol that is resolved at runtime by calling a resolver function.
 
-IFuncs have a name and a resolver that is a function called by dynamic linker
-that returns address of another function associated with the name.
+On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
+MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 2731ef452c79cb..48fa6c478464c7 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -882,7 +882,11 @@ class AsmPrinter : public MachineFunctionPass {
 
   GCMetadataPrinter *getOrCreateGCPrinter(GCStrategy &S);
   void emitGlobalAlias(Module &M, const GlobalAlias &GA);
-  void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+protected:
+  virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+private:
 
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 2527b143128967..e0080b145d4f99 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -144,7 +144,12 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   // Try looking through a bitcast from one function type to another.
   // Commonly happens with calls to objc_msgSend().
   const Value *CalleeV = CB.getCalledOperand()->stripPointerCasts();
-  if (const Function *F = dyn_cast(CalleeV))
+  if (const GlobalIFunc *IF = dyn_cast(CalleeV);
+  IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
+// ld64 requires that .symbol_resolvers to be called via a stub, so these
+// must always be a diret call.
+Info.Callee = MachineOperand::CreateGA(IF, 0);
+  } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);
   else
 Info.Callee = MachineOperand::CreateReg(GetCalleeReg(), false);
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 5560c037aa3ee6..94e76a43bf38d6 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,6 +959,7 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
+
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2239,13 +2240,10 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features")) {
-Triple T(M.getTargetTriple());
-if (T.isX86()) {
-  StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
-  Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
-"512-bit vector ar

[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo created 
https://github.com/llvm/llvm-project/pull/75515

This is very straightforward and these are the most important details:

- All the cpp code has been moved to a subfolder for cleanness. There's a 
specific commit in the list of commits of this PR that just does that, in case 
that helps reviewing this.
- A new folder `src-ts` has been created for the typescript code
- The ts extension can be used in two ways: as a regular vscode extension and 
as a library. There file `extension.ts` explains which entry point to use.
- The README has been updated the mention how to install the extension, which 
is simpler than before. There are two additional sections for rebuilding and 
formatting.
- The ts code I added merely sets up the debug adapter using two possible 
options: reading the lldb-dap path from vscode settings or from a config object 
passed by users of the extension is used as a library. I did this to show how 
we can support easily both worlds.

>From f5a7a59dc4bd2601403abae06aba7fc534974b7a Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Thu, 14 Dec 2023 11:52:18 -0500
Subject: [PATCH 1/2] Move files to src-cpp

---
 lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.cpp  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.h| 0
 lldb/tools/lldb-dap/{ => src-cpp}/CMakeLists.txt  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/DAP.cpp | 0
 lldb/tools/lldb-dap/{ => src-cpp}/DAP.h   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/DAPForward.h| 0
 lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.cpp | 0
 lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.h   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.cpp  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.h| 0
 lldb/tools/lldb-dap/{ => src-cpp}/IOStream.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/IOStream.h  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/Options.td  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.h  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.h  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/lldb-dap-Info.plist.in  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/lldb-dap.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/package.json| 0
 30 files changed, 0 insertions(+), 0 deletions(-)
 rename lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/CMakeLists.txt (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/DAP.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/DAP.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/DAPForward.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/IOStream.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/IOStream.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/Options.td (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/lldb-dap-Info.plist.in (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ll

[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Walter Erquinigo (walter-erquinigo)


Changes

This is very straightforward and these are the most important details:

- All the cpp code has been moved to a subfolder for cleanness. There's a 
specific commit in the list of commits of this PR that just does that, in case 
that helps reviewing this.
- A new folder `src-ts` has been created for the typescript code
- The ts extension can be used in two ways: as a regular vscode extension and 
as a library. There file `extension.ts` explains which entry point to use.
- The README has been updated the mention how to install the extension, which 
is simpler than before. There are two additional sections for rebuilding and 
formatting.
- The ts code I added merely sets up the debug adapter using two possible 
options: reading the lldb-dap path from vscode settings or from a config object 
passed by users of the extension is used as a library. I did this to show how 
we can support easily both worlds.

---

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


43 Files Affected:

- (added) lldb/tools/lldb-dap/.gitignore (+5) 
- (added) lldb/tools/lldb-dap/.vscode/launch.json (+24) 
- (added) lldb/tools/lldb-dap/.vscode/tasks.json (+33) 
- (modified) lldb/tools/lldb-dap/CMakeLists.txt (+1-60) 
- (added) lldb/tools/lldb-dap/LICENSE.TXT (+234) 
- (modified) lldb/tools/lldb-dap/README.md (+27-38) 
- (added) lldb/tools/lldb-dap/package-lock.json (+1457) 
- (modified) lldb/tools/lldb-dap/package.json (+31-34) 
- (renamed) lldb/tools/lldb-dap/src-cpp/BreakpointBase.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/BreakpointBase.h () 
- (added) lldb/tools/lldb-dap/src-cpp/CMakeLists.txt (+60) 
- (renamed) lldb/tools/lldb-dap/src-cpp/DAP.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/DAP.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/DAPForward.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/ExceptionBreakpoint.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/ExceptionBreakpoint.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/FifoFiles.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/FifoFiles.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/FunctionBreakpoint.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/FunctionBreakpoint.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/IOStream.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/IOStream.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/JSONUtils.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/JSONUtils.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/LLDBUtils.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/LLDBUtils.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/Options.td () 
- (renamed) lldb/tools/lldb-dap/src-cpp/OutputRedirector.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/OutputRedirector.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/ProgressEvent.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/ProgressEvent.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/RunInTerminal.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/RunInTerminal.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/SourceBreakpoint.cpp () 
- (renamed) lldb/tools/lldb-dap/src-cpp/SourceBreakpoint.h () 
- (renamed) lldb/tools/lldb-dap/src-cpp/lldb-dap-Info.plist.in () 
- (renamed) lldb/tools/lldb-dap/src-cpp/lldb-dap.cpp () 
- (added) lldb/tools/lldb-dap/src-ts/debug-adapter-factory.ts (+28) 
- (added) lldb/tools/lldb-dap/src-ts/disposable-context.ts (+27) 
- (added) lldb/tools/lldb-dap/src-ts/extension.ts (+35) 
- (added) lldb/tools/lldb-dap/src-ts/types.ts (+18) 
- (added) lldb/tools/lldb-dap/tsconfig.json (+16) 
- (added) lldb/tools/lldb-dap/tsfmt.json (+17) 


``diff
diff --git a/lldb/tools/lldb-dap/.gitignore b/lldb/tools/lldb-dap/.gitignore
new file mode 100644
index 00..a86a56c54d2e0d
--- /dev/null
+++ b/lldb/tools/lldb-dap/.gitignore
@@ -0,0 +1,5 @@
+out
+node_modules
+.vscode-test
+*.vsix
+!.vscode
diff --git a/lldb/tools/lldb-dap/.vscode/launch.json 
b/lldb/tools/lldb-dap/.vscode/launch.json
new file mode 100644
index 00..8241a5aca03543
--- /dev/null
+++ b/lldb/tools/lldb-dap/.vscode/launch.json
@@ -0,0 +1,24 @@
+{
+   // Use IntelliSense to learn about possible attributes.
+   // Hover to view descriptions of existing attributes.
+   // For more information, visit: 
https://go.microsoft.com/fwlink/?linkid=830387
+   "version": "0.2.0",
+   "configurations": [
+   {
+   "type": "extensionHost",
+   "request": "launch",
+   "name": "Run Extension",
+   "runtimeExecutable": "${execPath}",
+   "args": [
+   "--extensionDevelopmentPath=${workspaceFolder}"
+   ],
+   "outFiles": [
+   "${workspaceFolder}/out/**/*.js"
+   ],
+   "preLaunchTask": {
+  

[Lldb-commits] [lldb] Fix a crash from character type confusion interaction with libedit (PR #75388)

2023-12-14 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] 0544c78 - Fix a crash from character type confusion interaction with libedit (#75388)

2023-12-14 Thread via lldb-commits

Author: Kevin Frei
Date: 2023-12-14T11:10:51-08:00
New Revision: 0544c781728a665806b069cb8202acd4f6981a0a

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

LOG: Fix a crash from character type confusion interaction with libedit (#75388)

If you type `settings show ` LLDB might crash, depending on the
version of libedit you're compiled with, and whether you're compiled
with `-DLLDB_EDITLINE_USE_WCHAR=0` (and depending on how the optimizer
lays out the stack...)

The issue has to do with trying to figure out whether the libedit
`getchar` callback is supposed to read a wide or 8 bit character. In
order to maintain backward compatibility, there's really no 'clean' way
to do it. We just have to make sure that we're invoking el_[w]getc with
a buffer that is as wide as the getchar callback (registered by the
`SetGetCharacterFunction` function further down in `Editline.cpp`.

So, it's 'fixed' with a comment, and a wider version of the 'reply'
variable.

Co-authored-by: Kevin Frei 

Added: 


Modified: 
lldb/include/lldb/Host/Editline.h
lldb/source/Host/common/Editline.cpp

Removed: 




diff  --git a/lldb/include/lldb/Host/Editline.h 
b/lldb/include/lldb/Host/Editline.h
index c598244150788d..9049b106f02a34 100644
--- a/lldb/include/lldb/Host/Editline.h
+++ b/lldb/include/lldb/Host/Editline.h
@@ -75,6 +75,8 @@ using EditLineCharType = char;
 // to wchar_t. It is not possible to detect 
diff erentiate between the two
 // versions exactly, but this is a pretty good approximation and allows us to
 // build against almost any editline version out there.
+// It does, however, require extra care when invoking el_getc, as the type
+// of the input is a single char buffer, but the callback will write a wchar_t.
 #if LLDB_EDITLINE_USE_WCHAR || defined(EL_CLIENTDATA) || LLDB_HAVE_EL_RFUNC_T
 using EditLineGetCharType = wchar_t;
 #else

diff  --git a/lldb/source/Host/common/Editline.cpp 
b/lldb/source/Host/common/Editline.cpp
index 82e17ec753ab23..ce707e530d008b 100644
--- a/lldb/source/Host/common/Editline.cpp
+++ b/lldb/source/Host/common/Editline.cpp
@@ -978,8 +978,14 @@ void Editline::DisplayCompletions(
   break;
 
 fprintf(editline.m_output_file, "More (Y/n/a): ");
-char reply = 'n';
-int got_char = el_getc(editline.m_editline, &reply);
+// The type for the output and the type for the parameter are 
diff erent,
+// to allow interoperability with older versions of libedit. The container
+// for the reply must be as wide as what our implementation is using,
+// but libedit may use a narrower type depending on the build
+// configuration.
+EditLineGetCharType reply = L'n';
+int got_char = el_wgetc(editline.m_editline,
+reinterpret_cast(&reply));
 // Check for a ^C or other interruption.
 if (editline.m_editor_status == EditorStatus::Interrupted) {
   editline.m_editor_status = EditorStatus::Editing;



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


[Lldb-commits] [lld] [clang] [libcxx] [llvm] [libc] [mlir] [libcxxabi] [openmp] [lldb] [clang-tools-extra] [compiler-rt] [flang] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-14 Thread Ahmed Bougacha via lldb-commits


@@ -2169,8 +2169,11 @@ void AsmPrinter::emitGlobalIFunc(Module &M, const 
GlobalIFunc &GI) {
 MCSymbol *LocalAlias = getSymbolPreferLocal(GI);
 if (LocalAlias != Name)
   OutStreamer->emitAssignment(LocalAlias, Expr);
-  } else if (TM.getTargetTriple().isOSBinFormatMachO() &&
- getIFuncMCSubtargetInfo()) {
+
+return;
+  }
+
+  if (TM.getTargetTriple().isOSBinFormatMachO() && getIFuncMCSubtargetInfo()) {

ahmedbougacha wrote:

oh I meant literally:
```
  if (!TM.getTargetTriple().isOSBinFormatMachO() || !getIFuncMCSubtargetInfo())
  llvm::report_fatal_error("IFuncs are not supported on this platform");
```

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


[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/75515

>From f5a7a59dc4bd2601403abae06aba7fc534974b7a Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Thu, 14 Dec 2023 11:52:18 -0500
Subject: [PATCH 1/2] Move files to src-cpp

---
 lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.cpp  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.h| 0
 lldb/tools/lldb-dap/{ => src-cpp}/CMakeLists.txt  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/DAP.cpp | 0
 lldb/tools/lldb-dap/{ => src-cpp}/DAP.h   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/DAPForward.h| 0
 lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.cpp | 0
 lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.h   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.cpp  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.h| 0
 lldb/tools/lldb-dap/{ => src-cpp}/IOStream.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/IOStream.h  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/Options.td  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.h  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.cpp   | 0
 lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.h | 0
 lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.h  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/lldb-dap-Info.plist.in  | 0
 lldb/tools/lldb-dap/{ => src-cpp}/lldb-dap.cpp| 0
 lldb/tools/lldb-dap/{ => src-cpp}/package.json| 0
 30 files changed, 0 insertions(+), 0 deletions(-)
 rename lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/BreakpointBase.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/CMakeLists.txt (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/DAP.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/DAP.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/DAPForward.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ExceptionBreakpoint.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FifoFiles.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/FunctionBreakpoint.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/IOStream.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/IOStream.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/JSONUtils.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/LLDBUtils.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/Options.td (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/OutputRedirector.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/ProgressEvent.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/RunInTerminal.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/SourceBreakpoint.h (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/lldb-dap-Info.plist.in (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/lldb-dap.cpp (100%)
 rename lldb/tools/lldb-dap/{ => src-cpp}/package.json (100%)

diff --git a/lldb/tools/lldb-dap/BreakpointBase.cpp 
b/lldb/tools/lldb-dap/src-cpp/BreakpointBase.cpp
similarity index 100%
rename from lldb/tools/lldb-dap/BreakpointBase.cpp
rename to lldb/tools/lldb-dap/src-cpp/BreakpointBase.cpp
diff --git a/lldb/tools/lldb-dap/BreakpointBase.h 
b/lldb/tools/lldb-dap/src-cpp/BreakpointBase.h
similarity index 100%
rename from lldb/tools/lldb-dap/BreakpointBase.h
rename to lldb/tools/lldb-dap/src-cpp/BreakpointBase.h
diff --git a/lldb/tools/lldb-dap/CMakeLists.txt 
b/lldb/tools/lldb-dap/src-cpp/CMakeLists.txt
similarity index 100%
rename from lldb/tools/lldb-dap/CMakeLists.txt
rename to lldb/tools/lldb-dap/src-cpp/CMakeLists.txt
diff --git a/lldb/tools/lldb-dap/DAP.cpp b/lldb/tools/lldb-dap/src-cpp/DAP.cpp
similarity index 100%
rename from lldb/tools/lldb-dap/DAP.cpp
rename to lldb/tool

[Lldb-commits] [lldb] Fix lldb-dap pickProcess command for selecting process for debugger attachment (PR #75342)

2023-12-14 Thread Walter Erquinigo via lldb-commits

walter-erquinigo wrote:

Here it is https://github.com/llvm/llvm-project/pull/75515!

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


[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [clang] [llvm] [mlir] [lldb] [clang-tools-extra] [compiler-rt] [flang] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Zequan Wu via lldb-commits

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


[Lldb-commits] [lldb] 1bce61e - [lldb] Remove PopPlan asserts and skip test on Arm/AArch64 Linux

2023-12-14 Thread David Spickett via lldb-commits

Author: David Spickett
Date: 2023-12-14T19:17:49Z
New Revision: 1bce61e6b01b38e04260be4f422bbae59c34c766

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

LOG: [lldb] Remove PopPlan asserts and skip test on Arm/AArch64 Linux

This reverts commit 481bb62e50317cf20df9493aad842790162ac3e7 and
71b4d7498ffecca5957fa0a63b1abf141d7b8441, along with the logging
and assert I had added to the test previously.

Now that I've caught it failing on Arm:
https://lab.llvm.org/buildbot/#/builders/17/builds/46598

Now I have enough to investigate, skip the test on the effected
platforms while I do that.

Added: 


Modified: 
lldb/source/Target/Thread.cpp
lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py

Removed: 




diff  --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp
index 4801e3e58d9ef1..865cee97e6d878 100644
--- a/lldb/source/Target/Thread.cpp
+++ b/lldb/source/Target/Thread.cpp
@@ -717,17 +717,6 @@ void Thread::DidResume() {
 
 void Thread::DidStop() { SetState(eStateStopped); }
 
-#define CHECK_BEFORE_POP_PLAN  
\
-  {
\
-uint32_t i = 0;
\
-ThreadPlanSP p;
\
-while ((p = GetPlans().GetPlanByIndex(i, false)))  
\
-  i++; 
\
-(void)i;   
\
-assert(i != 1 &&   
\
-   "Cannot pop plan when there is only one plan (the base plan)"); 
\
-  }
-
 bool Thread::ShouldStop(Event *event_ptr) {
   ThreadPlan *current_plan = GetCurrentPlan();
 
@@ -842,7 +831,6 @@ bool Thread::ShouldStop(Event *event_ptr) {
 do {
   if (should_stop)
 current_plan->WillStop();
-  CHECK_BEFORE_POP_PLAN;
   PopPlan();
 } while ((current_plan = GetCurrentPlan()) != prev_plan_ptr);
 // Now, if the responsible plan was not "Okay to discard" then
@@ -895,7 +883,6 @@ bool Thread::ShouldStop(Event *event_ptr) {
   // If a Controlling Plan wants to stop, we let it. Otherwise, see if
   // the plan's parent wants to stop.
 
-  CHECK_BEFORE_POP_PLAN;
   PopPlan();
   if (should_stop && current_plan->IsControllingPlan() &&
   !current_plan->OkayToDiscard()) {
@@ -944,7 +931,6 @@ bool Thread::ShouldStop(Event *event_ptr) {
   // plan is complete but does not explain the stop (example: step to a
   // line with breakpoint), let us move the plan to
   // completed_plan_stack anyway
-  CHECK_BEFORE_POP_PLAN;
   PopPlan();
 } else
   DiscardPlan();

diff  --git 
a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py 
b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
index b8675532e6394f..dc736d07d885ef 100644
--- a/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
+++ b/lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py
@@ -34,6 +34,10 @@ def copy_to_main(self, src, dst):
 # The rerun tests indicate rerunning on Windows doesn't really work, so
 # this one won't either.
 @skipIfWindows
+# On Arm and AArch64 Linux, this test attempts to pop a thread plan when
+# we only have the base plan remaining. Skip it until we can figure out
+# the bug this is exposing.
+@skipIf(oslist=["linux"], archs=["arm", "aarch64"])
 def test_OneTargetOneDebugger(self):
 self.do_test(True, True)
 
@@ -50,11 +54,6 @@ def test_OneTargetTwoDebuggers(self):
 self.do_test(True, False)
 
 def do_test(self, one_target, one_debugger):
-# Here to debug flakiness on Arm, remove later!
-log_cmd_result = lldb.SBCommandReturnObject()
-interp = self.dbg.GetCommandInterpreter()
-interp.HandleCommand("log enable lldb step", log_cmd_result)
-
 # Make sure that if we have one target, and we run, then
 # change the binary and rerun, the binary (and any .o files
 # if using dwarf in .o file debugging) get removed from the



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


[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-14 Thread David Spickett via lldb-commits

DavidSpickett wrote:

I've caught it happening on Arm. We appear to be trying to pop the base plan 
after finishing a single step, going to read through the code tomorrow to 
figure out why.

In the meantime, I've removed all my modifications and skipped it on Arm and 
AArch64 Linux.

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


[Lldb-commits] [lldb] [libc] [mlir] [llvm] [clang] [lld] [compiler-rt] [flang] [openmp] [clang-tools-extra] [libcxxabi] [libcxx] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-14 Thread Jon Roelofs via lldb-commits


@@ -2169,8 +2169,11 @@ void AsmPrinter::emitGlobalIFunc(Module &M, const 
GlobalIFunc &GI) {
 MCSymbol *LocalAlias = getSymbolPreferLocal(GI);
 if (LocalAlias != Name)
   OutStreamer->emitAssignment(LocalAlias, Expr);
-  } else if (TM.getTargetTriple().isOSBinFormatMachO() &&
- getIFuncMCSubtargetInfo()) {
+
+return;
+  }
+
+  if (TM.getTargetTriple().isOSBinFormatMachO() && getIFuncMCSubtargetInfo()) {

jroelofs wrote:

oh, I see. sure.

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


[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Greg Clayton via lldb-commits

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

Just fix an init as suggested and this is good to go.

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


[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -434,20 +434,54 @@ ExpressionContext 
DAP::DetectExpressionContext(lldb::SBFrame &frame,
   return ExpressionContext::Variable;
 }
 
-void DAP::RunLLDBCommands(llvm::StringRef prefix,
-  const std::vector &commands) {
-  SendOutput(OutputType::Console,
- llvm::StringRef(::RunLLDBCommands(prefix, commands)));
+bool DAP::RunLLDBCommands(llvm::StringRef prefix,
+  llvm::ArrayRef commands) {
+  bool required_command_failed;

clayborg wrote:

Initialize this to `false`

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


[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -11,40 +11,81 @@
 
 namespace lldb_dap {
 
-void RunLLDBCommands(llvm::StringRef prefix,
+bool RunLLDBCommands(llvm::StringRef prefix,
  const llvm::ArrayRef &commands,
- llvm::raw_ostream &strm) {
+ llvm::raw_ostream &strm, bool parse_command_directives) {
   if (commands.empty())
-return;
+return true;
+
+  bool did_print_prefix = false;
+
   lldb::SBCommandInterpreter interp = g_dap.debugger.GetCommandInterpreter();
-  if (!prefix.empty())
-strm << prefix << "\n";
-  for (const auto &command : commands) {
+  for (llvm::StringRef command : commands) {
 lldb::SBCommandReturnObject result;
-strm << "(lldb) " << command << "\n";
-interp.HandleCommand(command.c_str(), result);
-auto output_len = result.GetOutputSize();
-if (output_len) {
-  const char *output = result.GetOutput();
-  strm << output;
+bool quiet_on_success = false;
+bool check_error = false;
+
+while (parse_command_directives) {
+  if (command.starts_with("?")) {
+command = command.drop_front();
+quiet_on_success = true;
+  } else if (command.starts_with("!")) {
+command = command.drop_front();
+check_error = true;
+  } else {
+break;
+  }
 }
-auto error_len = result.GetErrorSize();
-if (error_len) {
-  const char *error = result.GetError();
-  strm << error;
+
+interp.HandleCommand(command.str().c_str(), result);
+const bool got_error = !result.Succeeded();
+// The if statement below is assuming we always print out `!` prefixed
+// lines. The only time we don't print is when we have `quiet_on_success ==
+// true` and we don't have an error.
+if (quiet_on_success ? got_error : true) {
+  if (!did_print_prefix && !prefix.empty()) {
+strm << prefix << "\n";
+did_print_prefix = true;
+  }
+  strm << "(lldb) " << command << "\n";
+  auto output_len = result.GetOutputSize();
+  if (output_len) {
+const char *output = result.GetOutput();
+strm << output;
+  }
+  auto error_len = result.GetErrorSize();
+  if (error_len) {
+const char *error = result.GetError();
+strm << error;
+  }
 }
+if (check_error && got_error)
+  return false; // Stop running commands.
   }
+  return true;
 }
 
 std::string RunLLDBCommands(llvm::StringRef prefix,
-const llvm::ArrayRef &commands) {
+const llvm::ArrayRef &commands,
+bool &required_command_failed,
+bool parse_command_directives) {
+  required_command_failed = false;
   std::string s;
   llvm::raw_string_ostream strm(s);
-  RunLLDBCommands(prefix, commands, strm);
+  required_command_failed =
+  !RunLLDBCommands(prefix, commands, strm, parse_command_directives);
   strm.flush();
   return s;
 }
 
+std::string
+RunLLDBCommandsVerbatim(llvm::StringRef prefix,
+const llvm::ArrayRef &commands) {
+  bool required_command_failed;

clayborg wrote:

init to `false` just in case code changes later.

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


[Lldb-commits] [mlir] [compiler-rt] [clang] [lld] [lldb] [clang-tools-extra] [llvm] [libcxx] [openmp] [libcxxabi] [libc] [flang] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-14 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73686

>From bc152095691b32d1ad8539dfd60f5089df5eed8d Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Tue, 28 Nov 2023 10:39:44 -0800
Subject: [PATCH 01/11] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20?=
 =?UTF-8?q?initial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 llvm/docs/LangRef.rst |   7 +-
 llvm/include/llvm/CodeGen/AsmPrinter.h|   6 +-
 llvm/lib/CodeGen/GlobalISel/CallLowering.cpp  |   7 +-
 llvm/lib/IR/Verifier.cpp  |  12 +-
 llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 308 ++
 llvm/lib/Target/X86/X86AsmPrinter.cpp |  28 ++
 llvm/lib/Target/X86/X86AsmPrinter.h   |   1 +
 .../AArch64/GlobalISel/call-lowering-ifunc.ll |  37 +++
 llvm/test/CodeGen/AArch64/addrsig-macho.ll|   4 +-
 llvm/test/CodeGen/AArch64/ifunc-asm.ll|  82 +
 llvm/test/CodeGen/X86/ifunc-asm.ll|  28 +-
 llvm/test/Verifier/ifunc-macho.ll |  42 +++
 12 files changed, 539 insertions(+), 23 deletions(-)
 create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ifunc-asm.ll
 create mode 100644 llvm/test/Verifier/ifunc-macho.ll

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e448c5ed5c5d94..cb222e979db29d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -934,10 +934,11 @@ IFuncs
 ---
 
 IFuncs, like as aliases, don't create any new data or func. They are just a new
-symbol that dynamic linker resolves at runtime by calling a resolver function.
+symbol that is resolved at runtime by calling a resolver function.
 
-IFuncs have a name and a resolver that is a function called by dynamic linker
-that returns address of another function associated with the name.
+On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
+MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 2731ef452c79cb..48fa6c478464c7 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -882,7 +882,11 @@ class AsmPrinter : public MachineFunctionPass {
 
   GCMetadataPrinter *getOrCreateGCPrinter(GCStrategy &S);
   void emitGlobalAlias(Module &M, const GlobalAlias &GA);
-  void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+protected:
+  virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+private:
 
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 2527b143128967..e0080b145d4f99 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -144,7 +144,12 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   // Try looking through a bitcast from one function type to another.
   // Commonly happens with calls to objc_msgSend().
   const Value *CalleeV = CB.getCalledOperand()->stripPointerCasts();
-  if (const Function *F = dyn_cast(CalleeV))
+  if (const GlobalIFunc *IF = dyn_cast(CalleeV);
+  IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
+// ld64 requires that .symbol_resolvers to be called via a stub, so these
+// must always be a diret call.
+Info.Callee = MachineOperand::CreateGA(IF, 0);
+  } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);
   else
 Info.Callee = MachineOperand::CreateReg(GetCalleeReg(), false);
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 5560c037aa3ee6..94e76a43bf38d6 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,6 +959,7 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
+
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2239,13 +2240,10 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features")) {
-Triple T(M.getTargetTriple());
-if (T.isX86()) {
-  StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
-  Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
-"512-bit vector ar

[Lldb-commits] [clang-tools-extra] [libc] [openmp] [lld] [compiler-rt] [libcxxabi] [clang] [libcxx] [lldb] [mlir] [flang] [llvm] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-14 Thread Ahmed Bougacha via lldb-commits

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

Neat, ty!

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


[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-14 Thread via lldb-commits

jimingham wrote:

It came from the test case I copied to this one but wasn't appropriate.  Should 
have been deleted, not commented out.

Jim

> On Dec 13, 2023, at 3:44 PM, Adrian Prantl ***@***.***> wrote:
> 
> 
> @adrian-prantl commented on this pull request.
> 
> In lldb/test/API/python_api/global_module_cache/TestGlobalModuleCache.py 
> :
> 
> > +"""
> +Test the use of the global module cache in lldb
> +"""
> +
> +import lldb
> +
> +from lldbsuite.test.decorators import *
> +from lldbsuite.test.lldbtest import *
> +from lldbsuite.test import lldbutil
> +import os
> +import shutil
> +from pathlib import Path
> +import time
> +
> +class GlobalModuleCacheTestCase(TestBase):
> +# NO_DEBUG_INFO_TESTCASE = True
> why is this commented out?
> 
> —
> Reply to this email directly, view it on GitHub 
> ,
>  or unsubscribe 
> .
> You are receiving this because you modified the open/close state.
> 



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


[Lldb-commits] [lldb] Add a test for evicting unreachable modules from the global module cache (PR #74894)

2023-12-14 Thread via lldb-commits

jimingham wrote:

This test does kill off a process by destroying the Debugger that owned the 
process.  It would be interesting to see if changing the test to explicitly 
kill the process, then its target, then the Debugger makes the crash go away.  
That should not be necessary of course, but if that fixes the problem it will 
help narrow down the cause.

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


[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -1133,63 +1175,64 @@ llvm::json::Value CreateVariable(lldb::SBValue v, 
int64_t variablesReference,
  int64_t varID, bool format_hex,
  bool is_name_duplicated,
  std::optional custom_name) {
+  VariableDescription desc(v, format_hex, is_name_duplicated, custom_name);
   llvm::json::Object object;
-  EmplaceSafeString(
-  object, "name",
-  custom_name ? *custom_name
-  : CreateUniqueVariableNameForDisplay(v, is_name_duplicated));
+  EmplaceSafeString(object, "name", desc.name);
+  EmplaceSafeString(object, "value", desc.display_value);
+
+  llvm::json::Object extensions;
+  if (desc.error)
+EmplaceSafeString(extensions, "error", *desc.error);
+  if (!desc.lldb_value.empty())
+EmplaceSafeString(extensions, "lldbValue", desc.lldb_value);
+  if (!desc.summary.empty())
+EmplaceSafeString(extensions, "summary", desc.summary);
+  if (desc.auto_summary)
+EmplaceSafeString(extensions, "autoSummary", *desc.auto_summary);
+  if (!desc.evaluate_name.empty())
+EmplaceSafeString(object, "evaluateName", desc.evaluate_name);

clayborg wrote:

Maybe add a method to the `VariableDescription` class like 
`VariableDescription::AddExtensions(...)`. There are a lot of accesses to the 
internals of `VariableDescription`

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


[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -153,10 +153,18 @@ def do_test_scopes_variables_setVariable_evaluate(
 buffer_children = make_buffer_verify_dict(0, 32)
 verify_locals = {
 "argc": {
-"equals": {"type": "int", "value": "1"},
-"declaration": {
-"equals": {"line": 12, "column": 14},
-"contains": {"path": ["lldb-dap", "variables", 
"main.cpp"]},
+"equals": {
+"type": "int",
+"value": "1",
+},
+"$__lldb_extensions": {
+"equals": {
+"lldbValue": "1",

clayborg wrote:

`rawValue` or just `value` now that this is in the `$__lldb_extensions` key? I 
assume this is the raw `SBValue::GetValue()` only here? Does this not show up 
if there is no value (structs and class instances have no values). We could 
mark it as optional if it isn't already

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


[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/74808

>From 4e6bfb5f26f7744db1cb4a37d0e342195ae0ff8a Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 8 Dec 2023 00:11:19 -0500
Subject: [PATCH 1/2] [lldb-dap] Implement quiet commands

This adds support for optionally prefixing any command with `?`, which 
effectively prevents the output of these commands to be printed to the console 
unless they fail. This comes handy when programmaticaly running commands on 
behalf of the user without wanting them to know unless they fail.

In a later PR I plan to implement the `!` prefix for commands that abort 
lldb-dap upon errors.
---
 .../test/tools/lldb-dap/lldbdap_testcase.py   |  7 ++
 .../test/API/tools/lldb-dap/commands/Makefile |  3 +
 .../lldb-dap/commands/TestDAP_commands.py | 80 +++
 .../test/API/tools/lldb-dap/commands/main.cpp |  1 +
 lldb/tools/lldb-dap/DAP.cpp   | 50 ++--
 lldb/tools/lldb-dap/DAP.h | 17 ++--
 lldb/tools/lldb-dap/LLDBUtils.cpp | 77 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 37 -
 lldb/tools/lldb-dap/lldb-dap.cpp  | 51 +---
 lldb/tools/lldb-dap/package.json  | 24 +++---
 10 files changed, 287 insertions(+), 60 deletions(-)
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/Makefile
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/main.cpp

diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 4ccd6014e54be6..7436b9900e98b0 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -291,6 +291,7 @@ def attach(
 postRunCommands=None,
 sourceMap=None,
 sourceInitFile=False,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and attach to the process.
@@ -322,6 +323,8 @@ def cleanup():
 postRunCommands=postRunCommands,
 sourceMap=sourceMap,
 )
+if expectFailure:
+return response
 if not (response and response["success"]):
 self.assertTrue(
 response["success"], "attach failed (%s)" % 
(response["message"])
@@ -437,6 +440,8 @@ def build_and_launch(
 commandEscapePrefix=None,
 customFrameFormat=None,
 customThreadFormat=None,
+launchCommands=None,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and launch the process.
@@ -470,4 +475,6 @@ def build_and_launch(
 commandEscapePrefix=commandEscapePrefix,
 customFrameFormat=customFrameFormat,
 customThreadFormat=customThreadFormat,
+launchCommands=launchCommands,
+expectFailure=expectFailure,
 )
diff --git a/lldb/test/API/tools/lldb-dap/commands/Makefile 
b/lldb/test/API/tools/lldb-dap/commands/Makefile
new file mode 100644
index 00..8b20bcb050
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py 
b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
new file mode 100644
index 00..226b9385fe719a
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
@@ -0,0 +1,80 @@
+import os
+
+import dap_server
+import lldbdap_testcase
+from lldbsuite.test import lldbtest, lldbutil
+from lldbsuite.test.decorators import *
+
+
+class TestDAP_commands(lldbdap_testcase.DAPTestCaseBase):
+def test_command_directive_quiet_on_success(self):
+program = self.getBuildArtifact("a.out")
+command_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
false"
+)
+command_not_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
true"
+)
+self.build_and_launch(
+program,
+initCommands=["?" + command_quiet, command_not_quiet],
+terminateCommands=["?" + command_quiet, command_not_quiet],
+stopCommands=["?" + command_quiet, command_not_quiet],
+exitCommands=["?" + command_quiet, command_not_quiet],
+)
+full_output = self.collect_console(duration=1.0)
+self.assertNotIn(command_quiet, full_output)
+self.assertIn(command_not_quiet, full_output)
+
+def do_test_abort_on_error(
+self,
+use_init_commands=False,
+use_launch_commands=False,
+use_pre_run_commands=False,
+use_post_run_co

[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/74808

>From 4e6bfb5f26f7744db1cb4a37d0e342195ae0ff8a Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 8 Dec 2023 00:11:19 -0500
Subject: [PATCH 1/3] [lldb-dap] Implement quiet commands

This adds support for optionally prefixing any command with `?`, which 
effectively prevents the output of these commands to be printed to the console 
unless they fail. This comes handy when programmaticaly running commands on 
behalf of the user without wanting them to know unless they fail.

In a later PR I plan to implement the `!` prefix for commands that abort 
lldb-dap upon errors.
---
 .../test/tools/lldb-dap/lldbdap_testcase.py   |  7 ++
 .../test/API/tools/lldb-dap/commands/Makefile |  3 +
 .../lldb-dap/commands/TestDAP_commands.py | 80 +++
 .../test/API/tools/lldb-dap/commands/main.cpp |  1 +
 lldb/tools/lldb-dap/DAP.cpp   | 50 ++--
 lldb/tools/lldb-dap/DAP.h | 17 ++--
 lldb/tools/lldb-dap/LLDBUtils.cpp | 77 +-
 lldb/tools/lldb-dap/LLDBUtils.h   | 37 -
 lldb/tools/lldb-dap/lldb-dap.cpp  | 51 +---
 lldb/tools/lldb-dap/package.json  | 24 +++---
 10 files changed, 287 insertions(+), 60 deletions(-)
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/Makefile
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
 create mode 100644 lldb/test/API/tools/lldb-dap/commands/main.cpp

diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 4ccd6014e54be6..7436b9900e98b0 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -291,6 +291,7 @@ def attach(
 postRunCommands=None,
 sourceMap=None,
 sourceInitFile=False,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and attach to the process.
@@ -322,6 +323,8 @@ def cleanup():
 postRunCommands=postRunCommands,
 sourceMap=sourceMap,
 )
+if expectFailure:
+return response
 if not (response and response["success"]):
 self.assertTrue(
 response["success"], "attach failed (%s)" % 
(response["message"])
@@ -437,6 +440,8 @@ def build_and_launch(
 commandEscapePrefix=None,
 customFrameFormat=None,
 customThreadFormat=None,
+launchCommands=None,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and launch the process.
@@ -470,4 +475,6 @@ def build_and_launch(
 commandEscapePrefix=commandEscapePrefix,
 customFrameFormat=customFrameFormat,
 customThreadFormat=customThreadFormat,
+launchCommands=launchCommands,
+expectFailure=expectFailure,
 )
diff --git a/lldb/test/API/tools/lldb-dap/commands/Makefile 
b/lldb/test/API/tools/lldb-dap/commands/Makefile
new file mode 100644
index 00..8b20bcb050
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py 
b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
new file mode 100644
index 00..226b9385fe719a
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
@@ -0,0 +1,80 @@
+import os
+
+import dap_server
+import lldbdap_testcase
+from lldbsuite.test import lldbtest, lldbutil
+from lldbsuite.test.decorators import *
+
+
+class TestDAP_commands(lldbdap_testcase.DAPTestCaseBase):
+def test_command_directive_quiet_on_success(self):
+program = self.getBuildArtifact("a.out")
+command_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
false"
+)
+command_not_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
true"
+)
+self.build_and_launch(
+program,
+initCommands=["?" + command_quiet, command_not_quiet],
+terminateCommands=["?" + command_quiet, command_not_quiet],
+stopCommands=["?" + command_quiet, command_not_quiet],
+exitCommands=["?" + command_quiet, command_not_quiet],
+)
+full_output = self.collect_console(duration=1.0)
+self.assertNotIn(command_quiet, full_output)
+self.assertIn(command_not_quiet, full_output)
+
+def do_test_abort_on_error(
+self,
+use_init_commands=False,
+use_launch_commands=False,
+use_pre_run_commands=False,
+use_post_run_co

[Lldb-commits] [lldb] [lldb-dap] Implement command directives (PR #74808)

2023-12-14 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [lldb] aa20767 - [lldb-dap] Implement command directives (#74808)

2023-12-14 Thread via lldb-commits

Author: Walter Erquinigo
Date: 2023-12-14T15:04:35-05:00
New Revision: aa207674f9e6caf5bc29c1b4925183a398382d6f

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

LOG: [lldb-dap] Implement command directives (#74808)

This adds support for optionally prefixing any command with `?` and/or
`!`.
- `?` prevents the output of a commands to be printed to the console
unless it fails.
- `!` aborts the dap if the command fails.

They come in handy when programmatically running commands on behalf of
the user without wanting them to know unless they fail, or when a
critical setup is required as part of launchCommands and it's better to
abort on failures than to silently skip.

Added: 
lldb/test/API/tools/lldb-dap/commands/Makefile
lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
lldb/test/API/tools/lldb-dap/commands/main.cpp

Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
lldb/tools/lldb-dap/DAP.cpp
lldb/tools/lldb-dap/DAP.h
lldb/tools/lldb-dap/LLDBUtils.cpp
lldb/tools/lldb-dap/LLDBUtils.h
lldb/tools/lldb-dap/lldb-dap.cpp
lldb/tools/lldb-dap/package.json

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 4ccd6014e54be6..7436b9900e98b0 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -291,6 +291,7 @@ def attach(
 postRunCommands=None,
 sourceMap=None,
 sourceInitFile=False,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and attach to the process.
@@ -322,6 +323,8 @@ def cleanup():
 postRunCommands=postRunCommands,
 sourceMap=sourceMap,
 )
+if expectFailure:
+return response
 if not (response and response["success"]):
 self.assertTrue(
 response["success"], "attach failed (%s)" % 
(response["message"])
@@ -437,6 +440,8 @@ def build_and_launch(
 commandEscapePrefix=None,
 customFrameFormat=None,
 customThreadFormat=None,
+launchCommands=None,
+expectFailure=False,
 ):
 """Build the default Makefile target, create the DAP debug adaptor,
 and launch the process.
@@ -470,4 +475,6 @@ def build_and_launch(
 commandEscapePrefix=commandEscapePrefix,
 customFrameFormat=customFrameFormat,
 customThreadFormat=customThreadFormat,
+launchCommands=launchCommands,
+expectFailure=expectFailure,
 )

diff  --git a/lldb/test/API/tools/lldb-dap/commands/Makefile 
b/lldb/test/API/tools/lldb-dap/commands/Makefile
new file mode 100644
index 00..8b20bcb050
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules

diff  --git a/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py 
b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
new file mode 100644
index 00..226b9385fe719a
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/commands/TestDAP_commands.py
@@ -0,0 +1,80 @@
+import os
+
+import dap_server
+import lldbdap_testcase
+from lldbsuite.test import lldbtest, lldbutil
+from lldbsuite.test.decorators import *
+
+
+class TestDAP_commands(lldbdap_testcase.DAPTestCaseBase):
+def test_command_directive_quiet_on_success(self):
+program = self.getBuildArtifact("a.out")
+command_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
false"
+)
+command_not_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zeroes 
true"
+)
+self.build_and_launch(
+program,
+initCommands=["?" + command_quiet, command_not_quiet],
+terminateCommands=["?" + command_quiet, command_not_quiet],
+stopCommands=["?" + command_quiet, command_not_quiet],
+exitCommands=["?" + command_quiet, command_not_quiet],
+)
+full_output = self.collect_console(duration=1.0)
+self.assertNotIn(command_quiet, full_output)
+self.assertIn(command_not_quiet, full_output)
+
+def do_test_abort_on_error(
+self,
+use_init_commands=False,
+use_launch_commands=False,
+use_pre_run_commands=False,
+use_post_run_commands=False,
+):
+program = self.getBuildArtifact("a.out")
+command_quiet = (
+"settings set target.show-hex-variable-values-with-leading-zero

[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

2023-12-14 Thread Walter Erquinigo via lldb-commits


@@ -1133,63 +1175,64 @@ llvm::json::Value CreateVariable(lldb::SBValue v, 
int64_t variablesReference,
  int64_t varID, bool format_hex,
  bool is_name_duplicated,
  std::optional custom_name) {
+  VariableDescription desc(v, format_hex, is_name_duplicated, custom_name);
   llvm::json::Object object;
-  EmplaceSafeString(
-  object, "name",
-  custom_name ? *custom_name
-  : CreateUniqueVariableNameForDisplay(v, is_name_duplicated));
+  EmplaceSafeString(object, "name", desc.name);
+  EmplaceSafeString(object, "value", desc.display_value);
+
+  llvm::json::Object extensions;
+  if (desc.error)
+EmplaceSafeString(extensions, "error", *desc.error);
+  if (!desc.lldb_value.empty())
+EmplaceSafeString(extensions, "lldbValue", desc.lldb_value);
+  if (!desc.summary.empty())
+EmplaceSafeString(extensions, "summary", desc.summary);
+  if (desc.auto_summary)
+EmplaceSafeString(extensions, "autoSummary", *desc.auto_summary);
+  if (!desc.evaluate_name.empty())
+EmplaceSafeString(object, "evaluateName", desc.evaluate_name);

walter-erquinigo wrote:

sure!

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


[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

2023-12-14 Thread Walter Erquinigo via lldb-commits


@@ -153,10 +153,18 @@ def do_test_scopes_variables_setVariable_evaluate(
 buffer_children = make_buffer_verify_dict(0, 32)
 verify_locals = {
 "argc": {
-"equals": {"type": "int", "value": "1"},
-"declaration": {
-"equals": {"line": 12, "column": 14},
-"contains": {"path": ["lldb-dap", "variables", 
"main.cpp"]},
+"equals": {
+"type": "int",
+"value": "1",
+},
+"$__lldb_extensions": {
+"equals": {
+"lldbValue": "1",

walter-erquinigo wrote:

Yes, it's the same as SBValue::GetValue()

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


[Lldb-commits] [flang] [libcxxabi] [libcxx] [clang-tools-extra] [llvm] [lld] [compiler-rt] [mlir] [openmp] [libc] [clang] [lldb] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-14 Thread Jon Roelofs via lldb-commits

https://github.com/jroelofs updated 
https://github.com/llvm/llvm-project/pull/73686

>From bc152095691b32d1ad8539dfd60f5089df5eed8d Mon Sep 17 00:00:00 2001
From: Jon Roelofs 
Date: Tue, 28 Nov 2023 10:39:44 -0800
Subject: [PATCH 01/11] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20?=
 =?UTF-8?q?initial=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.4
---
 llvm/docs/LangRef.rst |   7 +-
 llvm/include/llvm/CodeGen/AsmPrinter.h|   6 +-
 llvm/lib/CodeGen/GlobalISel/CallLowering.cpp  |   7 +-
 llvm/lib/IR/Verifier.cpp  |  12 +-
 llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp | 308 ++
 llvm/lib/Target/X86/X86AsmPrinter.cpp |  28 ++
 llvm/lib/Target/X86/X86AsmPrinter.h   |   1 +
 .../AArch64/GlobalISel/call-lowering-ifunc.ll |  37 +++
 llvm/test/CodeGen/AArch64/addrsig-macho.ll|   4 +-
 llvm/test/CodeGen/AArch64/ifunc-asm.ll|  82 +
 llvm/test/CodeGen/X86/ifunc-asm.ll|  28 +-
 llvm/test/Verifier/ifunc-macho.ll |  42 +++
 12 files changed, 539 insertions(+), 23 deletions(-)
 create mode 100644 llvm/test/CodeGen/AArch64/GlobalISel/call-lowering-ifunc.ll
 create mode 100644 llvm/test/CodeGen/AArch64/ifunc-asm.ll
 create mode 100644 llvm/test/Verifier/ifunc-macho.ll

diff --git a/llvm/docs/LangRef.rst b/llvm/docs/LangRef.rst
index e448c5ed5c5d94..cb222e979db29d 100644
--- a/llvm/docs/LangRef.rst
+++ b/llvm/docs/LangRef.rst
@@ -934,10 +934,11 @@ IFuncs
 ---
 
 IFuncs, like as aliases, don't create any new data or func. They are just a new
-symbol that dynamic linker resolves at runtime by calling a resolver function.
+symbol that is resolved at runtime by calling a resolver function.
 
-IFuncs have a name and a resolver that is a function called by dynamic linker
-that returns address of another function associated with the name.
+On ELF platforms, IFuncs are resolved by the dynamic linker at load time. On
+MachO platforms, they are lowered in terms of ``.symbol_resolver``s, which
+lazily resolve the callee the first time they are called.
 
 IFunc may have an optional :ref:`linkage type ` and an optional
 :ref:`visibility style `.
diff --git a/llvm/include/llvm/CodeGen/AsmPrinter.h 
b/llvm/include/llvm/CodeGen/AsmPrinter.h
index 2731ef452c79cb..48fa6c478464c7 100644
--- a/llvm/include/llvm/CodeGen/AsmPrinter.h
+++ b/llvm/include/llvm/CodeGen/AsmPrinter.h
@@ -882,7 +882,11 @@ class AsmPrinter : public MachineFunctionPass {
 
   GCMetadataPrinter *getOrCreateGCPrinter(GCStrategy &S);
   void emitGlobalAlias(Module &M, const GlobalAlias &GA);
-  void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+protected:
+  virtual void emitGlobalIFunc(Module &M, const GlobalIFunc &GI);
+
+private:
 
   /// This method decides whether the specified basic block requires a label.
   bool shouldEmitLabelForBasicBlock(const MachineBasicBlock &MBB) const;
diff --git a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp 
b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
index 2527b143128967..e0080b145d4f99 100644
--- a/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/CallLowering.cpp
@@ -144,7 +144,12 @@ bool CallLowering::lowerCall(MachineIRBuilder &MIRBuilder, 
const CallBase &CB,
   // Try looking through a bitcast from one function type to another.
   // Commonly happens with calls to objc_msgSend().
   const Value *CalleeV = CB.getCalledOperand()->stripPointerCasts();
-  if (const Function *F = dyn_cast(CalleeV))
+  if (const GlobalIFunc *IF = dyn_cast(CalleeV);
+  IF && MF.getTarget().getTargetTriple().isOSBinFormatMachO()) {
+// ld64 requires that .symbol_resolvers to be called via a stub, so these
+// must always be a diret call.
+Info.Callee = MachineOperand::CreateGA(IF, 0);
+  } else if (const Function *F = dyn_cast(CalleeV))
 Info.Callee = MachineOperand::CreateGA(F, 0);
   else
 Info.Callee = MachineOperand::CreateReg(GetCalleeReg(), false);
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 5560c037aa3ee6..94e76a43bf38d6 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -959,6 +959,7 @@ void Verifier::visitGlobalIFunc(const GlobalIFunc &GI) {
   GlobalIFunc::getResolverFunctionType(GI.getValueType());
   Check(ResolverTy == ResolverFuncTy->getPointerTo(GI.getAddressSpace()),
 "IFunc resolver has incorrect type", &GI);
+
 }
 
 void Verifier::visitNamedMDNode(const NamedMDNode &NMD) {
@@ -2239,13 +2240,10 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, 
AttributeList Attrs,
   }
 
   // Check EVEX512 feature.
-  if (MaxParameterWidth >= 512 && Attrs.hasFnAttr("target-features")) {
-Triple T(M.getTargetTriple());
-if (T.isX86()) {
-  StringRef TF = Attrs.getFnAttr("target-features").getValueAsString();
-  Check(!TF.contains("+avx512f") || !TF.contains("-evex512"),
-"512-bit vector ar

[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

2023-12-14 Thread Walter Erquinigo via lldb-commits

https://github.com/walter-erquinigo updated 
https://github.com/llvm/llvm-project/pull/75244

>From b8c91437e95d45d2435e264084b1118491a2318c Mon Sep 17 00:00:00 2001
From: walter erquinigo 
Date: Fri, 8 Dec 2023 12:58:30 -0500
Subject: [PATCH] [lldb-dap] Emit more structured info along with variables

In order to allow smarter vscode extensions, it's useful to send additional 
structured information of SBValues to the client. Specifically, I'm now sending 
error, summary, autoSummary and inMemoryValue in addition to the existing 
properties being sent. This is cheap because these properties have to be 
calculated anyway to generate the display value of the variable, but they are 
now available for extensions to better analyze variables. For example, if the 
error field is not present, the extension might be able to provide cool 
features, and the current way to do that is to look for the " 
TryCreateAutoSummary(lldb::SBValue value) {
   return TryCreateAutoSummaryForContainer(value);
 }
 
-std::string ValueToString(lldb::SBValue v) {
-  std::string result;
-  llvm::raw_string_ostream strm(result);
-
-  lldb::SBError error = v.GetError();
-  if (!error.Success()) {
-strm << "";
-  } else {
-llvm::StringRef value = v.GetValue();
-llvm::StringRef nonAutoSummary = v.GetSummary();
-std::optional summary = !nonAutoSummary.empty()
- ? nonAutoSummary.str()
- : TryCreateAutoSummary(v);
-if (!value.empty()) {
-  strm << value;
-  if (summary)
-strm << ' ' << *summary;
-} else if (summary) {
-  strm << *summary;
-
-  // As last resort, we print its type and address if available.
-} else {
-  if (llvm::StringRef type_name = v.GetType().GetDisplayTypeName();
-  !type_name.empty()) {
-strm << type_name;
-lldb::addr_t address = v.GetLoadAddress();
-if (address != LLDB_INVALID_ADDRESS)
-  strm << " @ " << llvm::format_hex(address, 0);
-  }
-}
-  }
-  return result;
-}
-
-void SetValueForKey(lldb::SBValue &v, llvm::json::Object &object,
-llvm::StringRef key) {
-  std::string result = ValueToString(v);
-  EmplaceSafeString(object, key, result);
-}
-
 void FillResponse(const llvm::json::Object &request,
   llvm::json::Object &response) {
   // Fill in all of the needed response fields to a "request" and set "success"
@@ -1044,6 +1004,92 @@ std::string 
CreateUniqueVariableNameForDisplay(lldb::SBValue v,
   return name_builder.GetData();
 }
 
+VariableDescription::VariableDescription(lldb::SBValue v, bool format_hex,
+ bool is_name_duplicated,
+ std::optional 
custom_name)
+: v(v) {
+  name = custom_name
+ ? *custom_name
+ : CreateUniqueVariableNameForDisplay(v, is_name_duplicated);
+
+  type_obj = v.GetType();
+  std::string raw_display_type_name =
+  llvm::StringRef(type_obj.GetDisplayTypeName()).str();
+  display_type_name =
+  !raw_display_type_name.empty() ? raw_display_type_name : NO_TYPENAME;
+
+  if (format_hex)
+v.SetFormat(lldb::eFormatHex);
+
+  llvm::raw_string_ostream os_display_value(display_value);
+
+  if (lldb::SBError sb_error = v.GetError(); sb_error.Fail()) {
+error = sb_error.GetCString();
+os_display_value << "";
+  } else {
+value = llvm::StringRef(v.GetValue()).str();
+summary = llvm::StringRef(v.GetSummary()).str();
+if (summary.empty())
+  auto_summary = TryCreateAutoSummary(v);
+
+std::optional effective_summary =
+!summary.empty() ? summary : auto_summary;
+
+if (!value.empty()) {
+  os_display_value << value;
+  if (effective_summary)
+os_display_value << " " << *effective_summary;
+} else if (effective_summary) {
+  os_display_value << *effective_summary;
+
+  // As last resort, we print its type and address if available.
+} else {
+  if (!raw_display_type_name.empty()) {
+os_display_value << raw_display_type_name;
+lldb::addr_t address = v.GetLoadAddress();
+if (address != LLDB_INVALID_ADDRESS)
+  os_display_value << " @ " << llvm::format_hex(address, 0);
+  }
+}
+  }
+
+  lldb::SBStream evaluateStream;
+  v.GetExpressionPath(evaluateStream);
+  evaluate_name = llvm::StringRef(evaluateStream.GetData()).str();
+}
+
+llvm::json::Object VariableDescription::GetVariableExtensionsJSON() {
+  llvm::json::Object extensions;
+  if (error)
+EmplaceSafeString(extensions, "error", *error);
+  if (!value.empty())
+EmplaceSafeString(extensions, "value", value);
+  if (!summary.empty())
+EmplaceSafeString(extensions, "summary", summary);
+  if (auto_summary)
+EmplaceSafeString(extensions, "autoSummary", *auto_summary);
+
+  if (lldb::SBDeclaration decl = v.GetDeclaration(); decl.IsValid()) {
+llvm::json::Object decl_obj;
+if (lld

[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -0,0 +1,5 @@
+out
+node_modules
+.vscode-test
+*.vsix
+!.vscode

clayborg wrote:

Can we just create a `vscode` folder (no leading `.`) and remove this file? Why 
do we need `out` and `node_modlues` to be added to this? Does `npm` create temp 
files here for some reason?

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


[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -0,0 +1,21 @@
+import * as vscode from 'vscode';

clayborg wrote:

Wanted to mention again that maybe we make a directory that contains the needed 
typescript sources that will be in the exact format needed for installing an 
extension? So if we have `lldb/tools/lldb-dap/dap-extension` which contains all 
of the sources in the exact hierarchy needed so to install the extension we 
just basically can do something like:
```
$ rsync -av lldb/tools/lldb-dap/dap-extension` 
~/.vscode/extensions/llvm-org.lldb-dap-0.1.0
```
This would copy the entire directory hierarchy over so this directory would 
always be exactly as it will appear in the ~/.vscode/extensions directory.

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


[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -27,58 +31,43 @@ get a full featured debugger with a well defined protocol.
 
 # Installation for Visual Studio Code
 
-Installing the plug-in involves creating a directory in any location outside of
-`~/.vscode/extensions`. For example, `~/vscode-lldb` is a valid one. You'll 
also
-need a subfolder `bin`, e.g. `~/vscode-lldb/bin`. Then copy the `package.json`
-file that is in the same directory as this documentation into it, and symlink
-the `lldb-dap` binary into the `bin` directory inside the plug-in directory.
+Installing the plug-in is very straightforward and involves just a few steps:
 
-Finally, on VS Code, execute the command
-`Developer: Install Extension from Location` and pick the folder you just
-created, which would be `~/vscode-lldb` following the example above.
-
-If you want to make a stand alone plug-in that you can send to others on UNIX
-systems:
+- Install a modern version of node (e.g. `v20.0.0`).
+- On VS Code, execute the command `Install 'code' command in PATH`. You need to
+  do it only once. This enables the command `code` in the PATH.
+- In the `lldb-dap` folder, package and install the extension:

clayborg wrote:

Maybe we can checking a python script that just does this instead of talking 
about all the things we need to do? To make this easier, we could make sure a 
directory could contain all of the stuff in the right structure so we would 
just copy a folder like ` lldb/tools/lldb-dap/extension` over into the 
`~/.vscode/extensions/` with a rename. This might be a good place for all 
of the typescript to be checked in instead of the `src-ts` directory?

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


[Lldb-commits] [lldb] [lldb-dap] Create a typescript extension for lldb-dap (PR #75515)

2023-12-14 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

My suggestions would be:
- don't move any C++ files, just leave them where they are
- make a directory that can be copied into `~/.vscode/extensions` as is so that 
creating the extension doesn't involve grabbing files from many locations
- `git move` any files that already are needed in the extension directory to 
this new folder (like `package.json`)

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


[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-12-14 Thread Michael Christensen via lldb-commits

mdko wrote:

@jimingham @clayborg IIUC I don't have merge permissions, otherwise I'd squash 
and merge this myself. Please let me know if there's anything I should do at 
this point. Thanks!

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


[Lldb-commits] [lldb] [clang] [llvm] [clang] Split out DebugOptions.def into its own top-level options group. (PR #75530)

2023-12-14 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-clang

Author: Juergen Ributzka (ributzka)


Changes

This change moves all debug options out of the CodeGenOptions and creates a
dedicated top-level DebugOptions data struture. All uses of the debug options
are updated to reference the new location. No functional changes are intented
with this change.


---

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


50 Files Affected:

- (modified) clang/include/clang/Basic/CodeGenOptions.def (-3) 
- (modified) clang/include/clang/Basic/CodeGenOptions.h (+1-50) 
- (modified) clang/include/clang/Basic/DebugOptions.def (+7-8) 
- (added) clang/include/clang/Basic/DebugOptions.h (+111) 
- (modified) clang/include/clang/Basic/TargetInfo.h (-2) 
- (modified) clang/include/clang/CodeGen/BackendUtil.h (+4-2) 
- (modified) clang/include/clang/CodeGen/ModuleBuilder.h (+2-1) 
- (modified) clang/include/clang/Driver/Options.td (+35-33) 
- (modified) clang/include/clang/Driver/ToolChain.h (+3-3) 
- (modified) clang/include/clang/Frontend/CompilerInstance.h (+9-6) 
- (modified) clang/include/clang/Frontend/CompilerInvocation.h (+30-11) 
- (modified) clang/lib/Basic/CMakeLists.txt (+1) 
- (modified) clang/lib/Basic/CodeGenOptions.cpp (+2-35) 
- (added) clang/lib/Basic/DebugOptions.cpp (+40) 
- (modified) clang/lib/CodeGen/BackendConsumer.h (+8-5) 
- (modified) clang/lib/CodeGen/BackendUtil.cpp (+56-47) 
- (modified) clang/lib/CodeGen/CGBlocks.cpp (+3-2) 
- (modified) clang/lib/CodeGen/CGDebugInfo.cpp (+108-112) 
- (modified) clang/lib/CodeGen/CGDebugInfo.h (+2-2) 
- (modified) clang/lib/CodeGen/CGDecl.cpp (+4-3) 
- (modified) clang/lib/CodeGen/CGHLSLRuntime.cpp (+3-2) 
- (modified) clang/lib/CodeGen/CGOpenMPRuntime.cpp (+10-12) 
- (modified) clang/lib/CodeGen/CGStmt.cpp (+3-2) 
- (modified) clang/lib/CodeGen/CGStmtOpenMP.cpp (+4-3) 
- (modified) clang/lib/CodeGen/CGVTables.cpp (+14-14) 
- (modified) clang/lib/CodeGen/CodeGenAction.cpp (+54-55) 
- (modified) clang/lib/CodeGen/CodeGenFunction.cpp (+3-2) 
- (modified) clang/lib/CodeGen/CodeGenModule.cpp (+16-15) 
- (modified) clang/lib/CodeGen/CodeGenModule.h (+5-1) 
- (modified) clang/lib/CodeGen/ModuleBuilder.cpp (+10-8) 
- (modified) clang/lib/CodeGen/ObjectFilePCHContainerOperations.cpp (+15-14) 
- (modified) clang/lib/Driver/ToolChains/Clang.cpp (+35-35) 
- (modified) clang/lib/Driver/ToolChains/CommonArgs.cpp (+13-13) 
- (modified) clang/lib/Driver/ToolChains/CommonArgs.h (+2-3) 
- (modified) clang/lib/Driver/ToolChains/Cuda.cpp (+3-3) 
- (modified) clang/lib/Driver/ToolChains/Cuda.h (+1-1) 
- (modified) clang/lib/Driver/ToolChains/Flang.cpp (+3-3) 
- (modified) clang/lib/Driver/ToolChains/HIPSPV.cpp (+2-2) 
- (modified) clang/lib/Driver/ToolChains/HIPSPV.h (+1-1) 
- (modified) clang/lib/Driver/ToolChains/MSVC.h (+3-4) 
- (modified) clang/lib/Frontend/CompilerInstance.cpp (+9-11) 
- (modified) clang/lib/Frontend/CompilerInvocation.cpp (+113-89) 
- (modified) clang/lib/Frontend/Rewrite/FrontendActions.cpp (+2-2) 
- (modified) clang/lib/Tooling/DependencyScanning/ModuleDepCollector.cpp (+2-2) 
- (modified) clang/tools/clang-import-test/clang-import-test.cpp (+2-2) 
- (modified) clang/unittests/CodeGen/TestCompiler.h (+2-1) 
- (modified) clang/unittests/Frontend/CodeGenActionTest.cpp (+1-1) 
- (modified) clang/unittests/Frontend/CompilerInvocationTest.cpp (+9-9) 
- (modified) 
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp (+1-1) 
- (modified) llvm/include/llvm/Frontend/Debug/Options.h (+2-2) 


``diff
diff --git a/clang/include/clang/Basic/CodeGenOptions.def 
b/clang/include/clang/Basic/CodeGenOptions.def
index 0acb5ae134ea24..7508163458c42b 100644
--- a/clang/include/clang/Basic/CodeGenOptions.def
+++ b/clang/include/clang/Basic/CodeGenOptions.def
@@ -430,9 +430,6 @@ ENUM_CODEGENOPT(ZeroCallUsedRegs, 
llvm::ZeroCallUsedRegs::ZeroCallUsedRegsKind,
 /// non-deleting destructors. (No effect on Microsoft ABI.)
 CODEGENOPT(CtorDtorReturnThis, 1, 0)
 
-/// FIXME: Make DebugOptions its own top-level .def file.
-#include "DebugOptions.def"
-
 #undef CODEGENOPT
 #undef ENUM_CODEGENOPT
 #undef VALUE_CODEGENOPT
diff --git a/clang/include/clang/Basic/CodeGenOptions.h 
b/clang/include/clang/Basic/CodeGenOptions.h
index 6952b48e898a81..6db8c73a66b18a 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -15,15 +15,11 @@
 
 #include "clang/Basic/Sanitizers.h"
 #include "clang/Basic/XRayInstr.h"
-#include "llvm/ADT/FloatingPointMode.h"
-#include "llvm/Frontend/Debug/Options.h"
 #include "llvm/Frontend/Driver/CodeGenOptions.h"
 #include "llvm/Support/CodeGen.h"
 #include "llvm/Support/Regex.h"
 #include "llvm/Target/TargetOptions.h"
 #include "llvm/Transforms/Instrumentation/AddressSanitizerOptions.h"
-#include 
-#include 
 #include 
 #include 
 
@@ -98,12 +94,6 @@ class CodeGenOptions : public CodeGenOptionsBase {
 IAD_Intel,
   };
 
-  enum Debu

[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)

2023-12-14 Thread Adrian Prantl via lldb-commits

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

Thanks for addressing all my feedback!

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


[Lldb-commits] [llvm] [lldb] DEBUGINFOD based DWP acquisition for LLDB (PR #70996)

2023-12-14 Thread Kevin Frei via lldb-commits

kevinfrei wrote:

I'll try to get this together tonight or tomorrow morning.

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


[Lldb-commits] [clang] [clang-tools-extra] [flang] [mlir] [lldb] [compiler-rt] [llvm] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Paul Kirth via lldb-commits

ilovepi wrote:

I think our Linux CI is seeing failures related to this patch:
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-arm64/b8761705440671462977/overview

 Profile-aarch64 :: instrprof-binary-correlate.c is failing on that bot for 
both x86_64 and arm64.

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


[Lldb-commits] [clang] [clang-tools-extra] [flang] [mlir] [lldb] [compiler-rt] [llvm] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Paul Kirth via lldb-commits

ilovepi wrote:

Test output:
```
 TEST 'Profile-aarch64 :: instrprof-binary-correlate.c' 
FAILED 
Exit Code: 1

Command Output (stdout):
--
Binary files 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.profdata
 and 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp-1.profdata
 differ

--
Command Output (stderr):
--
RUN: at line 3: /b/s/w/ir/x/w/llvm_build/./bin/clang-Wthread-safety 
-Wthread-safety-reference -Wthread-safety-beta   -ldl -o 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
 -fprofile-instr-generate -fcoverage-mapping 
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/profile/Inputs/instrprof-debug-info-correlate-main.cpp
 
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/profile/Inputs/instrprof-debug-info-correlate-foo.cpp
+ /b/s/w/ir/x/w/llvm_build/./bin/clang -Wthread-safety 
-Wthread-safety-reference -Wthread-safety-beta -ldl -o 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
 -fprofile-instr-generate -fcoverage-mapping 
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/profile/Inputs/instrprof-debug-info-correlate-main.cpp
 
/b/s/w/ir/x/w/llvm-llvm-project/compiler-rt/test/profile/Inputs/instrprof-debug-info-correlate-foo.cpp
RUN: at line 4: env 
LLVM_PROFILE_FILE=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.profraw
  
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
+ env 
LLVM_PROFILE_FILE=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.profraw
 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
RUN: at line 5: llvm-profdata merge -o 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.profdata
 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.profraw
+ llvm-profdata merge -o 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.profdata
 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.profraw
RUN: at line 6: llvm-cov report 
--instr-profile=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.profdata
 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
 > 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.report
+ llvm-cov report 
--instr-profile=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.profdata
 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
RUN: at line 7: llvm-cov show 
--instr-profile=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.profdata
 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
 > 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.show
+ llvm-cov show 
--instr-profile=/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal.profdata
 
/b/s/w/ir/x/w/llvm_build/runtimes/runtimes-aarch64-unknown-linux-gnu-bins/compiler-rt/test/profile/Profile-aarch64/Output/instrprof-binary-correlate.c.tmp.normal
RUN: at line 10: /b/s/w/ir/x/w/llvm_bui

[Lldb-commits] [clang] [clang-tools-extra] [flang] [mlir] [lldb] [compiler-rt] [llvm] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Paul Kirth via lldb-commits

ilovepi wrote:

Seems like a mismatch on the diff, so maybe the check is too stringent.

If this will take a while to fix, would you mind reverting until it can be 
addressed?

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


[Lldb-commits] [lldb] [clang-tools-extra] [mlir] [lld] [libcxxabi] [libc] [libcxx] [compiler-rt] [openmp] [flang] [clang] [llvm] [llvm] Support IFuncs on Darwin platforms (PR #73686)

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [lldb] [clang-tools-extra] [mlir] [lld] [libcxxabi] [libc] [libcxx] [compiler-rt] [openmp] [flang] [clang] [llvm] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [flang] [lldb] [llvm] [openmp] [libcxx] [mlir] [compiler-rt] [libcxxabi] [libc] [lld] [clang-tools-extra] [clang] [clang] Support __attribute__((ifunc(...))) on Darwin platforms (PR #73

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [lldb] [clang-tools-extra] [mlir] [lld] [libcxxabi] [libc] [libcxx] [compiler-rt] [openmp] [flang] [clang] [llvm] [clang] Function Multi Versioning supports IFunc lowerings on Darwin pl

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [llvm] [libcxxabi] [libc] [mlir] [lld] [openmp] [lldb] [clang-tools-extra] [compiler-rt] [clang] [flang] [libcxx] [clang] Function Multi Versioning supports IFunc lowerings on Darwin pl

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [compiler-rt] [flang] [clang] [llvm] [lldb] [openmp] [mlir] [clang-tools-extra] [libc] [GlobalISel] Always direct-call IFuncs and Aliases (PR #74902)

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [compiler-rt] [flang] [llvm] [clang-tools-extra] [lld] [clang] [libcxx] [lldb] [openmp] [libcxxabi] [mlir] [libc] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [llvm] [libcxxabi] [libc] [mlir] [lld] [openmp] [lldb] [clang-tools-extra] [compiler-rt] [clang] [flang] [libcxx] [builtins][arm64] Build __init_cpu_features_resolver on Apple platforms

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [llvm] [libc] [mlir] [openmp] [lldb] [clang-tools-extra] [compiler-rt] [clang] [flang] [GlobalISel] Always direct-call IFuncs and Aliases (PR #74902)

2023-12-14 Thread Jon Roelofs via lldb-commits

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


[Lldb-commits] [llvm] [mlir] [lldb] [clang-tools-extra] [compiler-rt] [clang] [flang] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Zequan Wu via lldb-commits

ZequanWu wrote:

> Seems like a mismatch on the diff, so maybe the check is too stringent.
> 
> If this will take a while to fix, would you mind reverting until it can be 
> addressed?

It passed for me locally on x64. Maybe I should use `diff <(llvm-profdata show 
--all-functions --counts %t.normal.profdata) <(llvm-profdata show 
--all-functions --counts %t.d4.profdata)` like it does on debug-info correlate 
test:
https://github.com/llvm/llvm-project/blob/29e043cb5c2efaad7fb203fb8240a91b77ca0c5b/compiler-rt/test/profile/Linux/instrprof-debug-info-correlate.c#L10

Sent a possible fix at: 
https://github.com/llvm/llvm-project/commit/f34325307eb36d6032ccea3773e3e0c1746b7f98,
 hope that fixes it.



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


[Lldb-commits] [lldb] e692d08 - [LLDB] Add more helper functions to CompilerType class (second try). (#73472)

2023-12-14 Thread via lldb-commits

Author: cmtice
Date: 2023-12-14T14:10:19-08:00
New Revision: e692d0836003dead19070e5f7d199a48fa082f72

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

LOG: [LLDB] Add more helper functions to CompilerType class (second try). 
(#73472)

This adds 23 new helper functions to LLDB's CompilerType class, things
like IsSmartPtrType, IsPromotableIntegerType,
GetNumberofNonEmptyBaseClasses, and GetTemplateArgumentType (to name a
few).

It also has run clang-format on the files CompilerType.{h,cpp}.

These helper functions are needed as part of the implementation for the
Data Inspection Language, (see
https://discourse.llvm.org/t/rfc-data-inspection-language/69893).

Added: 


Modified: 
lldb/include/lldb/Symbol/CompilerType.h
lldb/source/Symbol/CompilerType.cpp

Removed: 




diff  --git a/lldb/include/lldb/Symbol/CompilerType.h 
b/lldb/include/lldb/Symbol/CompilerType.h
index 0a9533a1ac0efc..414c44275aaafc 100644
--- a/lldb/include/lldb/Symbol/CompilerType.h
+++ b/lldb/include/lldb/Symbol/CompilerType.h
@@ -194,6 +194,60 @@ class CompilerType {
   bool IsTypedefType() const;
 
   bool IsVoidType() const;
+
+  /// This is used when you don't care about the signedness of the integer.
+  bool IsInteger() const;
+
+  bool IsFloat() const;
+
+  /// This is used when you don't care about the signedness of the enum.
+  bool IsEnumerationType() const;
+
+  bool IsUnscopedEnumerationType() const;
+
+  bool IsIntegerOrUnscopedEnumerationType() const;
+
+  bool IsSigned() const;
+
+  bool IsNullPtrType() const;
+
+  bool IsBoolean() const;
+
+  bool IsEnumerationIntegerTypeSigned() const;
+
+  bool IsScalarOrUnscopedEnumerationType() const;
+
+  bool IsPromotableIntegerType() const;
+
+  bool IsPointerToVoid() const;
+
+  bool IsRecordType() const;
+
+   Checks whether `target_base` is a virtual base of `type` (direct or
+  /// indirect). If it is, stores the first virtual base type on the path from
+  /// `type` to `target_type`. Parameter "virtual_base" is where the first
+  /// virtual base type gets stored. Parameter "carry_virtual" is used to
+  /// denote that we're in a recursive check of virtual base classes and we
+  /// have already seen a virtual base class (so should only check direct
+  /// base classes).
+  /// Note: This may only be defined in TypeSystemClang.
+  bool IsVirtualBase(CompilerType target_base, CompilerType *virtual_base,
+ bool carry_virtual = false) const;
+
+  /// This may only be defined in TypeSystemClang.
+  bool IsContextuallyConvertibleToBool() const;
+
+  bool IsBasicType() const;
+
+  std::string TypeDescription();
+
+  bool CompareTypes(CompilerType rhs) const;
+
+  const char *GetTypeTag();
+
+  /// Go through the base classes and count non-empty ones.
+  uint32_t GetNumberOfNonEmptyBaseClasses();
+
   /// \}
 
   /// Type Completion.

diff  --git a/lldb/source/Symbol/CompilerType.cpp 
b/lldb/source/Symbol/CompilerType.cpp
index 78cc8dad94a9c5..76b79daa6ac154 100644
--- a/lldb/source/Symbol/CompilerType.cpp
+++ b/lldb/source/Symbol/CompilerType.cpp
@@ -302,6 +302,192 @@ bool CompilerType::IsBeingDefined() const {
   return false;
 }
 
+bool CompilerType::IsInteger() const {
+  bool is_signed = false; // May be reset by the call below.
+  return IsIntegerType(is_signed);
+}
+
+bool CompilerType::IsFloat() const {
+  uint32_t count = 0;
+  bool is_complex = false;
+  return IsFloatingPointType(count, is_complex);
+}
+
+bool CompilerType::IsEnumerationType() const {
+  bool is_signed = false; // May be reset by the call below.
+  return IsEnumerationType(is_signed);
+}
+
+bool CompilerType::IsUnscopedEnumerationType() const {
+  return IsEnumerationType() && !IsScopedEnumerationType();
+}
+
+bool CompilerType::IsIntegerOrUnscopedEnumerationType() const {
+  return IsInteger() || IsUnscopedEnumerationType();
+}
+
+bool CompilerType::IsSigned() const {
+  return GetTypeInfo() & lldb::eTypeIsSigned;
+}
+
+bool CompilerType::IsNullPtrType() const {
+  return GetCanonicalType().GetBasicTypeEnumeration() ==
+ lldb::eBasicTypeNullPtr;
+}
+
+bool CompilerType::IsBoolean() const {
+  return GetCanonicalType().GetBasicTypeEnumeration() == lldb::eBasicTypeBool;
+}
+
+bool CompilerType::IsEnumerationIntegerTypeSigned() const {
+  if (IsValid())
+return GetEnumerationIntegerType().GetTypeInfo() & lldb::eTypeIsSigned;
+
+  return false;
+}
+
+bool CompilerType::IsScalarOrUnscopedEnumerationType() const {
+  return IsScalarType() || IsUnscopedEnumerationType();
+}
+
+bool CompilerType::IsPromotableIntegerType() const {
+  // Unscoped enums are always considered as promotable, even if their
+  // underlying type does not need to be promoted (e.g. "int").
+  if (IsUnscopedEnumerationType())
+return true;
+
+  switch (GetCanonicalTyp

[Lldb-commits] [lldb] [LLDB] Add more helper functions to CompilerType class (second try). (PR #73472)

2023-12-14 Thread via lldb-commits

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


[Lldb-commits] [lldb] [mlir] [clang-tools-extra] [clang] [flang] [llvm] [compiler-rt] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Paul Kirth via lldb-commits

ilovepi wrote:

Our next cI run should finish in about 25 minutes, so we'll find out soon. 
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8761696932167687409/overview

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


[Lldb-commits] [mlir] [clang-tools-extra] [lldb] [llvm] [flang] [clang] [compiler-rt] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Paul Kirth via lldb-commits

ilovepi wrote:

Well, seems like someone broke ToT w/ a compiler error. I'll let you know if 
the forward fix fails to address the issue.

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


[Lldb-commits] [libunwind] [libcxx] [compiler-rt] [clang-tools-extra] [lld] [libc] [clang] [libcxxabi] [llvm] [flang] [lldb] [openmp] [mlir] [libc++] Implement ranges::contains (PR #65148)

2023-12-14 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/23] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec14..024aa8959fb720 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 00..647b7ea34be342
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef8..003bf132b38b4d 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying

[Lldb-commits] [flang] [lldb] [compiler-rt] [libcxxabi] [clang] [llvm] [libcxx] [libunwind] [lld] [openmp] [clang-tools-extra] [mlir] [libc] [libc++] Implement ranges::contains (PR #65148)

2023-12-14 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/23] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec14..024aa8959fb720 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 00..647b7ea34be342
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef8..003bf132b38b4d 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying

[Lldb-commits] [libcxx] [llvm] [clang-tools-extra] [compiler-rt] [openmp] [flang] [libunwind] [lld] [mlir] [libc] [clang] [lldb] [libcxxabi] [libc++] Implement ranges::contains (PR #65148)

2023-12-14 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/24] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec14..024aa8959fb720 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 00..647b7ea34be342
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef8..003bf132b38b4d 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying

[Lldb-commits] [clang-tools-extra] [compiler-rt] [clang] [llvm] [flang] [lldb] [mlir] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Zequan Wu via lldb-commits

ZequanWu wrote:

> Well, seems like someone broke ToT w/ a compiler error. I'll let you know if 
> the forward fix fails to address the issue.

The latest build passed: 
https://luci-milo.appspot.com/ui/p/fuchsia/builders/toolchain.ci/clang-linux-x64/b8761696377585255057/overview.

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


[Lldb-commits] [llvm] [flang] [clang-tools-extra] [mlir] [compiler-rt] [lldb] [clang] [Profile] Add binary profile correlation for code coverage. (PR #69493)

2023-12-14 Thread Paul Kirth via lldb-commits

ilovepi wrote:

Indeed. Thank you!

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


[Lldb-commits] [lldb] 4051942 - Add option to pass thread ID to thread select command (#73596)

2023-12-14 Thread via lldb-commits

Author: Michael Christensen
Date: 2023-12-14T15:19:38-08:00
New Revision: 405194257506685ca11848fbaff79c4333c18c3b

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

LOG: Add option to pass thread ID to thread select command (#73596)

We'd like a way to select the current thread by its thread ID (rather
than its internal LLDB thread index).

This PR adds a `-t` option (`--thread_id` long option) that tells the
`thread select` command to interpret the `` argument as a
thread ID.

Here's an example of it working:
```
michristensen@devbig356 llvm/llvm-project (thread-select-tid) » 
../Debug/bin/lldb ~/scratch/cpp/threading/a.out
(lldb) target create "/home/michristensen/scratch/cpp/threading/a.out"
Current executable set to '/home/michristensen/scratch/cpp/threading/a.out' 
(x86_64).
(lldb) b 18
Breakpoint 1: where = a.out`main + 80 at main.cpp:18:12, address = 
0x0850
(lldb) run
Process 215715 launched: '/home/michristensen/scratch/cpp/threading/a.out' 
(x86_64)
This is a thread, i=1
This is a thread, i=2
This is a thread, i=3
This is a thread, i=4
This is a thread, i=5
Process 215715 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x55400850 a.out`main at main.cpp:18:12
   15 for (int i = 0; i < 5; i++) {
   16   pthread_create(&thread_ids[i], NULL, foo, NULL);
   17 }
-> 18 for (int i = 0; i < 5; i++) {
   19   pthread_join(thread_ids[i], NULL);
   20 }
   21 return 0;
(lldb) thread select 2
* thread #2, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread info
thread #2: tid = 216047, 0x768f9918 libc.so.6`__nanosleep + 72, name = 
'a.out'

(lldb) thread list
Process 215715 stopped
  thread #1: tid = 215715, 0x55400850 a.out`main at main.cpp:18:12, 
name = 'a.out', stop reason = breakpoint 1.1
* thread #2: tid = 216047, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #3: tid = 216048, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #4: tid = 216049, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #5: tid = 216050, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
  thread #6: tid = 216051, 0x768f9918 libc.so.6`__nanosleep + 72, name 
= 'a.out'
(lldb) thread select 215715
error: invalid thread #215715.
(lldb) thread select -t 215715
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
frame #0: 0x55400850 a.out`main at main.cpp:18:12
   15 for (int i = 0; i < 5; i++) {
   16   pthread_create(&thread_ids[i], NULL, foo, NULL);
   17 }
-> 18 for (int i = 0; i < 5; i++) {
   19   pthread_join(thread_ids[i], NULL);
   20 }
   21 return 0;
(lldb) thread select -t 216051
* thread #6, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread select 3
* thread #3, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread select -t 216048
* thread #3, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) thread select --thread_id 216048
* thread #3, name = 'a.out'
frame #0: 0x768f9918 libc.so.6`__nanosleep + 72
libc.so.6`__nanosleep:
->  0x768f9918 <+72>: cmpq   $-0x1000, %rax ; imm = 0xF000
0x768f991e <+78>: ja 0x768f9952 ; <+130>
0x768f9920 <+80>: movl   %edx, %edi
0x768f9922 <+82>: movl   %eax, 0xc(%rsp)
(lldb) help thread select
Change the currently selected thread.

Syntax: thread select  

Command Options Usage:
  thread select [-t] 

   -t ( --thread_id )
Provide a thread ID instead of a thread index.

 This command takes options and free-form arguments.  If your arguments
 resemble option specifiers (i.e., they start with a - or --), you must use
 ' -- ' between the end of the command options and the beginning of the
 

[Lldb-commits] [lldb] Add option to pass thread ID to thread select command (PR #73596)

2023-12-14 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [libcxxabi] [llvm] [libunwind] [openmp] [libc] [flang] [clang-tools-extra] [libcxx] [mlir] [compiler-rt] [lldb] [lld] [clang] [libc++] Implement ranges::contains (PR #65148)

2023-12-14 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/24] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec14..024aa8959fb720 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 00..647b7ea34be342
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef8..003bf132b38b4d 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying

[Lldb-commits] [lldb] Make only one function that needs to be implemented when searching for types (PR #74786)

2023-12-14 Thread Greg Clayton via lldb-commits

clayborg wrote:

> > If we need to expected fail the python test on window until we can look 
> > into it, I would vote to do this.
> 
> As it happens, I'm using the buildbot machine to reproduce this. So it's not 
> doing any more builds for now. I'll put in workarounds if I don't find the 
> issue by Friday.

Thank you. I tried installing Window on Parallels Desktop 19 on my mac but the 
VS 2019 doesn't run on arm64 macs, so I couldn't even build the latest 
upstream. 

I also was able to build on a windows SSH, but there are no command line 
debuggers for windows that I know of. I tried debugging by building LLDB on 
here and was able to debug, but not effectively enough to figure anything out. 

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


[Lldb-commits] [lldb] [lldb-dap] Emit more structured info along with variables (PR #75244)

2023-12-14 Thread Greg Clayton via lldb-commits


@@ -165,7 +173,14 @@ def do_test_scopes_variables_setVariable_evaluate(
 "hasVariablesReference": True,
 },
 "pt": {
-"equals": {"type": "PointType"},
+"equals": {
+"type": "PointType",
+},
+**(
+{"$__lldb_extensions": {"equals": {"autoSummary": "{x:11, 
y:22}"}}}
+if enableAutoVariableSummaries
+else {}
+),

clayborg wrote:

This doesn't look like it is correctly encoded? Typos?

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


[Lldb-commits] [llvm] [libc] [libunwind] [mlir] [clang] [flang] [libcxxabi] [clang-tools-extra] [lld] [compiler-rt] [openmp] [libcxx] [lldb] [libc++] Implement ranges::contains (PR #65148)

2023-12-14 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/25] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec14..024aa8959fb720 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 00..647b7ea34be342
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef8..003bf132b38b4d 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying

[Lldb-commits] [compiler-rt] [libc] [openmp] [libcxx] [libcxxabi] [libunwind] [lldb] [lld] [flang] [mlir] [clang-tools-extra] [llvm] [clang] [libc++] Implement ranges::contains (PR #65148)

2023-12-14 Thread via lldb-commits

https://github.com/ZijunZhaoCCK updated 
https://github.com/llvm/llvm-project/pull/65148

>From 02e9afd761228f401df4d9f8dfaaca44ffae0c6e Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Thu, 31 Aug 2023 20:08:32 +
Subject: [PATCH 01/25] [libc++] Implement ranges::contains

Differential Revision: https://reviews.llvm.org/D159232
---
 libcxx/include/CMakeLists.txt |   1 +
 libcxx/include/__algorithm/ranges_contains.h  |  60 ++
 libcxx/include/algorithm  |   9 +
 ...obust_against_copying_projections.pass.cpp |   4 +
 .../alg.contains/ranges.contains.pass.cpp | 190 ++
 .../niebloid.compile.pass.cpp |   1 +
 6 files changed, 265 insertions(+)
 create mode 100644 libcxx/include/__algorithm/ranges_contains.h
 create mode 100644 
libcxx/test/std/algorithms/alg.nonmodifying/alg.contains/ranges.contains.pass.cpp

diff --git a/libcxx/include/CMakeLists.txt b/libcxx/include/CMakeLists.txt
index 77a7269121ec14..024aa8959fb720 100644
--- a/libcxx/include/CMakeLists.txt
+++ b/libcxx/include/CMakeLists.txt
@@ -104,6 +104,7 @@ set(files
   __algorithm/ranges_any_of.h
   __algorithm/ranges_binary_search.h
   __algorithm/ranges_clamp.h
+  __algorithm/ranges_contains.h
   __algorithm/ranges_copy.h
   __algorithm/ranges_copy_backward.h
   __algorithm/ranges_copy_if.h
diff --git a/libcxx/include/__algorithm/ranges_contains.h 
b/libcxx/include/__algorithm/ranges_contains.h
new file mode 100644
index 00..647b7ea34be342
--- /dev/null
+++ b/libcxx/include/__algorithm/ranges_contains.h
@@ -0,0 +1,60 @@
+//===--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+#define _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
+
+#include <__algorithm/in_in_result.h>
+#include <__algorithm/ranges_find.h>
+#include <__config>
+#include <__functional/identity.h>
+#include <__functional/ranges_operations.h>
+#include <__functional/reference_wrapper.h>
+#include <__iterator/concepts.h>
+#include <__iterator/indirectly_comparable.h>
+#include <__iterator/projected.h>
+#include <__ranges/access.h>
+#include <__ranges/concepts.h>
+#include <__utility/move.h>
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+#if _LIBCPP_STD_VER >= 23
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace ranges {
+namespace __contains {
+struct __fn {
+  template  _Sent, class _Type, 
class _Proj = identity>
+requires indirect_binary_predicate, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Iter __first, _Sent __last, const _Type& __value, _Proj __proj = 
{}) const {
+return ranges::find(std::move(__first), std::move(__last), __value, 
std::ref(__proj)) != __last;
+  }
+
+  template 
+requires indirect_binary_predicate, _Proj>, const _Type*>
+  _LIBCPP_NODISCARD_EXT _LIBCPP_HIDE_FROM_ABI constexpr bool
+  operator()(_Range&& __range, const _Type& __value, _Proj __proj = {}) const {
+return ranges::find(ranges::begin(__range), ranges::end(__range), __value, 
std::ref(__proj)) != ranges::end(__range);
+  }
+};
+} // namespace __contains
+inline namespace __cpo {
+inline constexpr auto contains = __contains::__fn{};
+} // namespace __cpo
+} // namespace ranges
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // _LIBCPP_STD_VER >= 23
+
+#endif // _LIBCPP___ALGORITHM_RANGES_CONTAINS_H
diff --git a/libcxx/include/algorithm b/libcxx/include/algorithm
index 76e0d22bf73ef8..003bf132b38b4d 100644
--- a/libcxx/include/algorithm
+++ b/libcxx/include/algorithm
@@ -226,6 +226,14 @@ namespace ranges {
   template
 using copy_backward_result = in_out_result;
 // since C++20
 
+  template S, class T, class Proj = identity>
+requires indirect_binary_predicate, 
const T*>
+constexpr bool ranges::contains(I first, S last, const T& value, Proj proj 
= {});   // since C++23
+
+  template
+requires indirect_binary_predicate, Proj>, const T*>
+constexpr bool ranges::contains(R&& r, const T& value, Proj proj = {});
 // since C++23
+
   template S, weakly_incrementable O>
 requires indirectly_copyable
 constexpr ranges::copy_result ranges::copy(I first, S last, O 
result);// since C++20
@@ -1827,6 +1835,7 @@ template 
 #include <__algorithm/ranges_any_of.h>
 #include <__algorithm/ranges_binary_search.h>
 #include <__algorithm/ranges_clamp.h>
+#include <__algorithm/ranges_contains.h>
 #include <__algorithm/ranges_copy.h>
 #include <__algorithm/ranges_copy_backward.h>
 #include <__algorithm/ranges_copy_if.h>
diff --git 
a/libcxx/test/libcxx/algorithms/ranges_robust_against_copying

  1   2   >