[Lldb-commits] [lldb] 90e6808 - Skip two WatchpointAlgorithm tests for 32-bit lldb's

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T23:58:06-08:00
New Revision: 90e68086d8fdbfb32dfc7e7e3498f44365274ce8

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

LOG: Skip two WatchpointAlgorithm tests for 32-bit lldb's

After iterating with the arm-ubuntu CI bot, I found the crash (a
std::bad_alloc exception being thrown) was caused by these two
entries when built on a 32-bit machine.  I probably have an assumption
about size_t being 64-bits in WatchpointAlgorithms and we have a
problem when it's actually 32-bits and we're dealing with a real
64-bit address.  All of the cases where the address can be represented
in the low 32-bits of the addr_t work correctly, so for now I'm
skipping these two unit tests when building lldb on a 32-bit host
until I can review that method and possibly switch to explicit
uin64_t's.
.

Added: 


Modified: 
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp

Removed: 




diff  --git a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp 
b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
index 0b2ba6c70bb74..ba99c6bf4fabf 100644
--- a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
+++ b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
@@ -43,6 +43,11 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 
   // clang-format off
   std::vector doubleword_max = {
+#if defined(__LP64__)
+// These two tests don't work if lldb is built on
+// a 32-bit system (likely with a 32-bit size_t).
+// A 32-bit lldb debugging a 64-bit process isn't 
+// critical right now.
 {
   {0x7fffe83b, 1},
   {{0x7fffe83b, 1}}
@@ -51,6 +56,7 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
   {0x7fffe838, 2},
   {{0x7fffe838, 2}}
 },
+#endif
 {
   {0x1012, 8},
   {{0x1010, 8}, {0x1018, 8}}



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


[Lldb-commits] [lldb] eaa3d5e - Done iterating with arm-ubuntu bot, I see the problem test.

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T23:58:06-08:00
New Revision: eaa3d5e26665ca85d488e9194b9fbe304db6fa21

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

LOG: Done iterating with arm-ubuntu bot, I see the problem test.
Go back to the original form of this file before I add temp
workaround.

Added: 


Modified: 
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp

Removed: 




diff  --git a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp 
b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
index d100bb000ebd1..0b2ba6c70bb74 100644
--- a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
+++ b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
@@ -43,7 +43,6 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 
   // clang-format off
   std::vector doubleword_max = {
-#if 0
 {
   {0x7fffe83b, 1},
   {{0x7fffe83b, 1}}
@@ -52,7 +51,6 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
   {0x7fffe838, 2},
   {{0x7fffe838, 2}}
 },
-#endif
 {
   {0x1012, 8},
   {{0x1010, 8}, {0x1018, 8}}



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


[Lldb-commits] [lldb] 54f324f - Trying to refine which test is crashing on arm-ubuntu.

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T23:18:18-08:00
New Revision: 54f324f377a92a64fcc5c1d401da9b07bf50a2f1

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

LOG: Trying to refine which test is crashing on arm-ubuntu.

Added: 


Modified: 
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp

Removed: 




diff  --git a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp 
b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
index bcef6d332c3f8..d100bb000ebd1 100644
--- a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
+++ b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
@@ -41,9 +41,9 @@ void check_testcase(testcase test,
 
 TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 
-#if 0
   // clang-format off
   std::vector doubleword_max = {
+#if 0
 {
   {0x7fffe83b, 1},
   {{0x7fffe83b, 1}}
@@ -52,6 +52,7 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
   {0x7fffe838, 2},
   {{0x7fffe838, 2}}
 },
+#endif
 {
   {0x1012, 8},
   {{0x1010, 8}, {0x1018, 8}}
@@ -78,22 +79,18 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 },
   };
   // clang-format on
-  printf("Running doubleword max test cases\n");
   for (testcase test : doubleword_max) {
 addr_t user_addr = test.user.addr;
 size_t user_size = test.user.size;
 size_t min_byte_size = 1;
 size_t max_byte_size = 8;
 size_t address_byte_size = 8;
-printf("Calling with addr 0x%llx size %zu\n", user_addr, user_size);
 auto result = WatchpointAlgorithmsTest::PowerOf2Watchpoints(
 user_addr, user_size, min_byte_size, max_byte_size, address_byte_size);
 
-printf("Checking returned values\n");
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }
-#endif
 
   // clang-format off
   std::vector word_max = {
@@ -107,18 +104,15 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 },
   };
   // clang-format on
-  printf("Running word max test cases\n");
   for (testcase test : word_max) {
 addr_t user_addr = test.user.addr;
 size_t user_size = test.user.size;
 size_t min_byte_size = 1;
 size_t max_byte_size = 4;
 size_t address_byte_size = 4;
-printf("Calling with addr 0x%llx size %zu\n", user_addr, user_size);
 auto result = WatchpointAlgorithmsTest::PowerOf2Watchpoints(
 user_addr, user_size, min_byte_size, max_byte_size, address_byte_size);
 
-printf("Checking returned values\n");
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }
@@ -166,18 +160,15 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 },
   };
   // clang-format on
-  printf("Running word twogig test cases\n");
   for (testcase test : twogig_max) {
 addr_t user_addr = test.user.addr;
 size_t user_size = test.user.size;
 size_t min_byte_size = 1;
 size_t max_byte_size = INT32_MAX;
 size_t address_byte_size = 8;
-printf("Calling with addr 0x%llx size %zu\n", user_addr, user_size);
 auto result = WatchpointAlgorithmsTest::PowerOf2Watchpoints(
 user_addr, user_size, min_byte_size, max_byte_size, address_byte_size);
 
-printf("Checking returned values\n");
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }



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


[Lldb-commits] [lldb] 021a2b4 - Uncomment the 2GB max tests and see if that works on arm-ubuntu

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T22:58:38-08:00
New Revision: 021a2b4ba254eb9e06fece5c18e5596cbb4896e6

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

LOG: Uncomment the 2GB max tests and see if that works on arm-ubuntu

Added: 


Modified: 
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp

Removed: 




diff  --git a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp 
b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
index d93f0f1d03ee0..bcef6d332c3f8 100644
--- a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
+++ b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
@@ -123,7 +123,6 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
address_byte_size);
   }
 
-#if 0
   // clang-format off
   std::vector twogig_max = {
 {
@@ -182,6 +181,5 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }
-#endif
 
 }



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


[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread Greg Clayton via lldb-commits

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


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


[Lldb-commits] [lldb] fdd98e5 - Skip 2 of the three test sets to narrow down the arm-ubuntu

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T22:06:23-08:00
New Revision: fdd98e506d77514d8cbd5099e8fc98130244f6ff

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

LOG: Skip 2 of the three test sets to narrow down the arm-ubuntu
CI bot crash when running this unittest.  The printfs aren't
printing into the CI log output.

Added: 


Modified: 
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp

Removed: 




diff  --git a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp 
b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
index b2b38791a9fd1..d93f0f1d03ee0 100644
--- a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
+++ b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
@@ -41,6 +41,7 @@ void check_testcase(testcase test,
 
 TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 
+#if 0
   // clang-format off
   std::vector doubleword_max = {
 {
@@ -92,6 +93,7 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }
+#endif
 
   // clang-format off
   std::vector word_max = {
@@ -121,6 +123,7 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
address_byte_size);
   }
 
+#if 0
   // clang-format off
   std::vector twogig_max = {
 {
@@ -179,4 +182,6 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }
+#endif
+
 }



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


[Lldb-commits] [lldb] 3b76b86 - Add debug prints to diagnose a crash on arm-ubuntu bot

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T21:38:07-08:00
New Revision: 3b76b86491d13ced848f2ed6f411754f54befaba

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

LOG: Add debug prints to diagnose a crash on arm-ubuntu bot

Added: 


Modified: 
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp

Removed: 




diff  --git a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp 
b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
index 907ee314a33c1..b2b38791a9fd1 100644
--- a/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
+++ b/lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp
@@ -77,15 +77,18 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 },
   };
   // clang-format on
+  printf("Running doubleword max test cases\n");
   for (testcase test : doubleword_max) {
 addr_t user_addr = test.user.addr;
 size_t user_size = test.user.size;
 size_t min_byte_size = 1;
 size_t max_byte_size = 8;
 size_t address_byte_size = 8;
+printf("Calling with addr 0x%llx size %zu\n", user_addr, user_size);
 auto result = WatchpointAlgorithmsTest::PowerOf2Watchpoints(
 user_addr, user_size, min_byte_size, max_byte_size, address_byte_size);
 
+printf("Checking returned values\n");
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }
@@ -102,15 +105,18 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 },
   };
   // clang-format on
+  printf("Running word max test cases\n");
   for (testcase test : word_max) {
 addr_t user_addr = test.user.addr;
 size_t user_size = test.user.size;
 size_t min_byte_size = 1;
 size_t max_byte_size = 4;
 size_t address_byte_size = 4;
+printf("Calling with addr 0x%llx size %zu\n", user_addr, user_size);
 auto result = WatchpointAlgorithmsTest::PowerOf2Watchpoints(
 user_addr, user_size, min_byte_size, max_byte_size, address_byte_size);
 
+printf("Checking returned values\n");
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }
@@ -158,15 +164,18 @@ TEST(WatchpointAlgorithmsTests, PowerOf2Watchpoints) {
 },
   };
   // clang-format on
+  printf("Running word twogig test cases\n");
   for (testcase test : twogig_max) {
 addr_t user_addr = test.user.addr;
 size_t user_size = test.user.size;
 size_t min_byte_size = 1;
 size_t max_byte_size = INT32_MAX;
 size_t address_byte_size = 8;
+printf("Calling with addr 0x%llx size %zu\n", user_addr, user_size);
 auto result = WatchpointAlgorithmsTest::PowerOf2Watchpoints(
 user_addr, user_size, min_byte_size, max_byte_size, address_byte_size);
 
+printf("Checking returned values\n");
 check_testcase(test, result, min_byte_size, max_byte_size,
address_byte_size);
   }



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


[Lldb-commits] [libcxx] [llvm] [lldb] [clang-tools-extra] [libc] [clang] [flang] [compiler-rt] [lld] Make clang report invalid target versions for all environment types. (PR #78655)

2024-01-31 Thread via lldb-commits

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

>From f440f44e7e270d4636ad39f4e4223c904e496d3a Mon Sep 17 00:00:00 2001
From: zijunzhao 
Date: Fri, 19 Jan 2024 00:47:05 +
Subject: [PATCH 1/5] Make clang report invalid target versions for all
 environment.

Followup for https://github.com/llvm/llvm-project/pull/75373

1. Make this feature not just available for android, but everyone.
2. Correct some target triples/
3. Add opencl to the environment type list.
---
 clang/lib/Driver/Driver.cpp  | 19 ++-
 clang/test/CodeGen/fp128_complex.c   |  2 +-
 clang/test/Driver/mips-features.c|  4 ++--
 clang/test/Frontend/fixed_point_bit_widths.c |  4 ++--
 llvm/include/llvm/TargetParser/Triple.h  |  2 +-
 llvm/lib/TargetParser/Triple.cpp | 14 ++
 6 files changed, 30 insertions(+), 15 deletions(-)

diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 1889ea28079df..2d6986d145483 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -1430,15 +1430,16 @@ Compilation *Driver::BuildCompilation(ArrayRef ArgList) {
   const ToolChain  = getToolChain(
   *UArgs, computeTargetTriple(*this, TargetTriple, *UArgs));
 
-  if (TC.getTriple().isAndroid()) {
-llvm::Triple Triple = TC.getTriple();
-StringRef TripleVersionName = Triple.getEnvironmentVersionString();
-
-if (Triple.getEnvironmentVersion().empty() && TripleVersionName != "") {
-  Diags.Report(diag::err_drv_triple_version_invalid)
-  << TripleVersionName << TC.getTripleString();
-  ContainsError = true;
-}
+  // Check if the environment version is valid.
+  llvm::Triple Triple = TC.getTriple();
+  StringRef TripleVersionName = Triple.getEnvironmentVersionString();
+  StringRef TripleObjectFormat = 
Triple.getObjectFormatTypeName(Triple.getObjectFormat());
+
+  if (Triple.getEnvironmentVersion().empty() && TripleVersionName != ""
+&& TripleVersionName != TripleObjectFormat) {
+Diags.Report(diag::err_drv_triple_version_invalid)
+<< TripleVersionName << TC.getTripleString();
+ContainsError = true;
   }
 
   // Report warning when arm64EC option is overridden by specified target
diff --git a/clang/test/CodeGen/fp128_complex.c 
b/clang/test/CodeGen/fp128_complex.c
index 48659d2241684..0e87cbe8ce812 100644
--- a/clang/test/CodeGen/fp128_complex.c
+++ b/clang/test/CodeGen/fp128_complex.c
@@ -1,4 +1,4 @@
-// RUN: %clang -target aarch64-linux-gnuabi %s -S -emit-llvm -o - | FileCheck 
%s
+// RUN: %clang -target aarch64-linux-gnueabi %s -S -emit-llvm -o - | FileCheck 
%s
 
 _Complex long double a, b, c, d;
 void test_fp128_compound_assign(void) {
diff --git a/clang/test/Driver/mips-features.c 
b/clang/test/Driver/mips-features.c
index fad6009ffb89b..18edcd05ea85c 100644
--- a/clang/test/Driver/mips-features.c
+++ b/clang/test/Driver/mips-features.c
@@ -400,12 +400,12 @@
 // LONG-CALLS-DEF-NOT: "long-calls"
 //
 // -mbranch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mbranch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=BRANCH-LIKELY %s
 // BRANCH-LIKELY: argument unused during compilation: '-mbranch-likely'
 //
 // -mno-branch-likely
-// RUN: %clang -target -mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
+// RUN: %clang -target mips-mti-linux-gnu -### -c %s -mno-branch-likely 2>&1 \
 // RUN:   | FileCheck --check-prefix=NO-BRANCH-LIKELY %s
 // NO-BRANCH-LIKELY: argument unused during compilation: '-mno-branch-likely'
 
diff --git a/clang/test/Frontend/fixed_point_bit_widths.c 
b/clang/test/Frontend/fixed_point_bit_widths.c
index ac8db49ed516a..e56f787e824f2 100644
--- a/clang/test/Frontend/fixed_point_bit_widths.c
+++ b/clang/test/Frontend/fixed_point_bit_widths.c
@@ -1,7 +1,7 @@
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - %s | FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-ubuntu-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 // RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=ppc64 %s | 
FileCheck %s
-// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - 
--target=x86_64-scei-ps4-windows10pro-fast %s | FileCheck %s
+// RUN: %clang -x c -ffixed-point -S -emit-llvm -o - --target=x86_64-scei-ps4 
%s | FileCheck %s
 
 /* Primary signed _Accum */
 
diff --git a/llvm/include/llvm/TargetParser/Triple.h 
b/llvm/include/llvm/TargetParser/Triple.h
index 95014a546f724..525ea6df3643c 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -273,7 +273,7 @@ class Triple {
 Callable,
 Mesh,
 Amplification,
-
+OpenCL,
 OpenHOS,
 
 LastEnvironmentType = OpenHOS
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 

[Lldb-commits] [lldb] 147d7a6 - [lldb] Add support for large watchpoints in lldb (#79962)

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T21:03:38-08:00
New Revision: 147d7a64f8493e78669581097a3ff06c985aa3a1

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

LOG: [lldb] Add support for large watchpoints in lldb (#79962)

This patch is the next piece of work in my Large Watchpoint proposal,
https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116

This patch breaks a user's watchpoint into one or more
WatchpointResources which reflect what the hardware registers can cover.
This means we can watch objects larger than 8 bytes, and we can watched
unaligned address ranges. On a typical 64-bit target with 4 watchpoint
registers you can watch 32 bytes of memory if the start address is
doubleword aligned.

Additionally, if the remote stub implements AArch64 MASK style
watchpoints (e.g. debugserver on Darwin), we can watch any power-of-2
size region of memory up to 2GB, aligned to that same size.

I updated the Watchpoint constructor and CommandObjectWatchpoint to
create a CompilerType of Array when the size of the watched
region is greater than pointer-size and we don't have a variable type to
use. For pointer-size and smaller, we can display the watched granule as
an integer value; for larger-than-pointer-size we will display as an
array of bytes.

I have `watchpoint list` now print the WatchpointResources used to
implement the watchpoint.

I added a WatchpointAlgorithm class which has a top-level static method
that takes an enum flag mask WatchpointHardwareFeature and a user
address and size, and returns a vector of WatchpointResources covering
the request. It does not take into account the number of watchpoint
registers the target has, or the number still available for use. Right
now there is only one algorithm, which monitors power-of-2 regions of
memory. For up to pointer-size, this is what Intel hardware supports.
AArch64 Byte Address Select watchpoints can watch any number of
contiguous bytes in a pointer-size memory granule, that is not currently
supported so if you ask to watch bytes 3-5, the algorithm will watch the
entire doubleword (8 bytes). The newly default "modify" style means we
will silently ignore modifications to bytes outside the watched range.

I've temporarily skipped TestLargeWatchpoint.py for all targets. It was
only run on Darwin when using the in-tree debugserver, which was a proxy
for "debugserver supports MASK watchpoints". I'll be adding the
aforementioned feature flag from the stub and enabling full mask
watchpoints when a debugserver with that feature is enabled, and
re-enable this test.

I added a new TestUnalignedLargeWatchpoint.py which only has one test
but it's a great one, watching a 22-byte range that is unaligned and
requires four 8-byte watchpoints to cover.

I also added a unit test, WatchpointAlgorithmsTests, which has a number
of simple tests against WatchpointAlgorithms::PowerOf2Watchpoints. I
think there's interesting possible different approaches to how we cover
these; I note in the unit test that a user requesting a watch on address
0x12e0 of 120 bytes will be covered by two watchpoints today, a
128-bytes at 0x1280 and at 0x1300. But it could be done with a 16-byte
watchpoint at 0x12e0 and a 128-byte at 0x1300, which would have fewer
false positives/private stops. As we try refining this one, it's helpful
to have a collection of tests to make sure things don't regress.

I tested this on arm64 macOS, (genuine) x86_64 macOS, and AArch64
Ubuntu. I have not modifed the Windows process plugins yet, I might try
that as a standalone patch, I'd be making the change blind, but the
necessary changes (see ProcessGDBRemote::EnableWatchpoint) are pretty
small so it might be obvious enough that I can change it and see what
the Windows CI thinks.

There isn't yet a packet (or a qSupported feature query) for the gdb
remote serial protocol stub to communicate its watchpoint capabilities
to lldb. I'll be doing that in a patch right after this is landed,
having debugserver advertise its capability of AArch64 MASK watchpoints,
and have ProcessGDBRemote add eWatchpointHardwareArmMASK to
WatchpointAlgorithms so we can watch larger than 32-byte requests on
Darwin.

I haven't yet tackled WatchpointResource *sharing* by multiple
Watchpoints. This is all part of the goal, especially when we may be
watching a larger memory range than the user requested, if they then add
another watchpoint next to their first request, it may be covered by the
same WatchpointResource (hardware watchpoint register). Also one "read"
watchpoint and one "write" watchpoint on the same memory granule need to
be handled, making the WatchpointResource cover all requests.

As WatchpointResources aren't shared among multiple Watchpoints yet,
there's no handling of running the conditions/commands/etc on multiple
Watchpoints when their shared WatchpointResource is 

[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread via lldb-commits

https://github.com/jeffreytan81 updated 
https://github.com/llvm/llvm-project/pull/80218

>From abfec9a970dd5fb4d5612638e14208555afe582e Mon Sep 17 00:00:00 2001
From: jeffreytan81 
Date: Wed, 31 Jan 2024 15:53:46 -0800
Subject: [PATCH 1/3] Fix debug info size statistics for split dwarf

---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |   23 +
 .../SymbolFile/DWARF/SymbolFileDWARF.h|2 +
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp   |   11 +
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h |2 +
 .../target/debuginfo/TestDebugInfoSize.py |  133 ++
 .../target/debuginfo/a.out-foo.dwo.yaml   |   37 +
 .../target/debuginfo/a.out-main.dwo.yaml  |   37 +
 .../API/commands/target/debuginfo/a.out.yaml  | 1273 +
 8 files changed, 1518 insertions(+)
 create mode 100644 lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out-foo.dwo.yaml
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out-main.dwo.yaml
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out.yaml

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index fed97858c83f8..7ab75a9ce2c6b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2667,6 +2667,29 @@ static bool 
UpdateCompilerContextForSimpleTemplateNames(TypeQuery ) {
   }
   return any_context_updated;
 }
+
+uint64_t SymbolFileDWARF::GetDebugInfoSize() {
+  DWARFDebugInfo  = DebugInfo();
+  uint32_t num_comp_units = info.GetNumUnits();
+
+  uint64_t debug_info_size = SymbolFileCommon::GetDebugInfoSize();
+  // In dwp scenario, debug info == skeleton debug info + dwp debug info.
+  if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
+return debug_info_size + dwp_sp->GetDebugInfoSize();
+
+  // In dwo scenario, debug info == skeleton debug info + all dwo debug info.
+  for (uint32_t i = 0; i < num_comp_units; i++) {
+DWARFUnit *cu = info.GetUnitAtIndex(i);
+if (cu == nullptr)
+  continue;
+
+SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();
+if (dwo)
+  debug_info_size += dwo->GetDebugInfoSize();
+  }
+  return debug_info_size;
+}
+
 void SymbolFileDWARF::FindTypes(const TypeQuery , TypeResults ) {
 
   // Make sure we haven't already searched this SymbolFile before.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 26a9502f90aa0..6d87530acf833 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -186,6 +186,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
   GetMangledNamesForFunction(const std::string _qualified_name,
  std::vector _names) override;
 
+  uint64_t GetDebugInfoSize() override;
+
   void FindTypes(const lldb_private::TypeQuery ,
  lldb_private::TypeResults ) override;
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index ca698a84a9146..b52cb514fb190 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -85,6 +85,17 @@ lldb::offset_t SymbolFileDWARFDwo::GetVendorDWARFOpcodeSize(
   return GetBaseSymbolFile().GetVendorDWARFOpcodeSize(data, data_offset, op);
 }
 
+uint64_t SymbolFileDWARFDwo::GetDebugInfoSize() {
+  // Directly get debug info from current dwo object file's section list
+  // instead of asking SymbolFileCommon::GetDebugInfo() which parses from
+  // owning module which is wrong.
+  SectionList *section_list =
+  m_objfile_sp->GetSectionList(/*update_module_section_list=*/false);
+  if (section_list)
+return section_list->GetDebugInfoSize();
+  return 0;
+}
+
 bool SymbolFileDWARFDwo::ParseVendorDWARFOpcode(
 uint8_t op, const lldb_private::DataExtractor ,
 lldb::offset_t , std::vector ) const {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 9f5950e51b0c1..5c4b36328cbac 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -47,6 +47,8 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
   const lldb::offset_t data_offset,
   const uint8_t op) const override;
 
+  uint64_t GetDebugInfoSize() override;
+
   bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor ,
   lldb::offset_t ,
   std::vector ) const override;
diff --git a/lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py 

[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread via lldb-commits


@@ -2667,6 +2667,29 @@ static bool 
UpdateCompilerContextForSimpleTemplateNames(TypeQuery ) {
   }
   return any_context_updated;
 }
+
+uint64_t SymbolFileDWARF::GetDebugInfoSize() {
+  DWARFDebugInfo  = DebugInfo();
+  uint32_t num_comp_units = info.GetNumUnits();
+
+  uint64_t debug_info_size = SymbolFileCommon::GetDebugInfoSize();
+  // In dwp scenario, debug info == skeleton debug info + dwp debug info.
+  if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
+return debug_info_size + dwp_sp->GetDebugInfoSize();
+
+  // In dwo scenario, debug info == skeleton debug info + all dwo debug info.
+  for (uint32_t i = 0; i < num_comp_units; i++) {
+DWARFUnit *cu = info.GetUnitAtIndex(i);
+if (cu == nullptr)
+  continue;
+
+SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();

jeffreytan81 wrote:

I think that makes sense but I would leave that to @kusmour who is working on a 
follow-up patch to only load dwo files already loaded from "statistics dump". 

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

@adrian-prantl I've added a log message with the `Error` itself being logged as 
well. That said, printing any information specific to the entry itself would 
require parsing other Form and, given that we already failed to parse one, I 
figured it would be better not to attempt parsing more while logging.

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan updated 
https://github.com/llvm/llvm-project/pull/79932

>From ee09231ea101d97c1607552e161adcfe911a23f5 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Mon, 29 Jan 2024 18:25:42 -0800
Subject: [PATCH 1/3] [lldb][DWARFIndex] Use IDX_parent to implement
 GetFullyQualifiedType query

This commit changes DebugNamesDWARFIndex so that it now overrides
`GetFullyQualifiedType` and attempts to use DW_IDX_parent, when available, to
speed up such queries. When this type of information is not available, the
base-class implementation is used.

With this commit, we now achieve the 4x speedups reported in [1].

[1]: 
https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-speed/74151/38
---
 .../SymbolFile/DWARF/DWARFDeclContext.h   |   4 +
 .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp |  99 +
 .../SymbolFile/DWARF/DebugNamesDWARFIndex.h   |   9 +
 .../SymbolFile/DWARF/SymbolFileDWARF.h|   3 +
 .../unittests/SymbolFile/DWARF/CMakeLists.txt |   1 +
 .../DWARF/DWARFDebugNamesIndexTest.cpp| 210 ++
 6 files changed, 326 insertions(+)
 create mode 100644 lldb/unittests/SymbolFile/DWARF/DWARFDebugNamesIndexTest.cpp

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
index a20a862d34029..7e6c5f51f4beb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
@@ -47,6 +47,10 @@ class DWARFDeclContext {
 
   DWARFDeclContext() : m_entries() {}
 
+  DWARFDeclContext(llvm::ArrayRef entries) {
+llvm::append_range(m_entries, entries);
+  }
+
   void AppendDeclContext(dw_tag_t tag, const char *name) {
 m_entries.push_back(Entry(tag, name));
   }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index b718f98340a70..6891d2fb6f610 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Stream.h"
+#include "llvm/ADT/Sequence.h"
 #include 
 
 using namespace lldb_private;
@@ -218,6 +219,104 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+static std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) { // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  // Fallback: use the base class implementation.
+  auto fallback_impl = [&](const DebugNames::Entry ) {
+return ProcessEntry(entry, [&](DWARFDIE die) {
+  return GetFullyQualifiedTypeImpl(context, die, callback);
+});
+  };
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+auto parent_chain = getParentChain(entry, parent_names.size() + 1);
+
+if (!parent_chain) {
+  if (!fallback_impl(entry))
+return;
+  continue;
+}
+
+if (SameParentChain(parent_names, *parent_chain) &&
+!ProcessEntry(entry, callback))
+  return;
+  }
+}
+
+bool DebugNamesDWARFIndex::SameParentChain(
+llvm::ArrayRef parent_names,
+llvm::ArrayRef parent_entries) const {
+
+  if (parent_entries.size() != parent_names.size())
+return false;
+
+  auto SameAsEntryATName = [this](llvm::StringRef name,
+  const DebugNames::Entry ) {
+auto maybe_dieoffset = entry.getDIEUnitOffset();
+if 

[Lldb-commits] [lldb] Don't cause a premature UpdateIfNeeded when checking in SBValue::GetSP (PR #80222)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -458,7 +458,12 @@ class ValueObject {
   virtual bool GetDeclaration(Declaration );
 
   // The functions below should NOT be modified by subclasses
+  // This gets the current error for this ValueObject, it may update the value
+  // to ensure that the error is up to date.
   const Status ();
+  
+  // Check the current error state without updating the value:
+  const Status () { return m_error; }

clayborg wrote:

`PeekError()`?

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


[Lldb-commits] [lldb] Don't cause a premature UpdateIfNeeded when checking in SBValue::GetSP (PR #80222)

2024-01-31 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

LGTM with a possible rename mentioned in inline comments. Anyone else have 
anything?

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


[Lldb-commits] [lldb] Don't cause a premature UpdateIfNeeded when checking in SBValue::GetSP (PR #80222)

2024-01-31 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] Don't cause a premature UpdateIfNeeded when checking in SBValue::GetSP (PR #80222)

2024-01-31 Thread via lldb-commits

github-actions[bot] wrote:




:warning: C/C++ code formatter, clang-format found issues in your code. 
:warning:



You can test this locally with the following command:


``bash
git-clang-format --diff a03a6e99647318a86ea398c42e241da43e3c550e 
c6d76783fce826f01fe4713e3cc58504d591aebf -- 
lldb/include/lldb/Core/ValueObject.h lldb/source/API/SBValue.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index db8023618b..e18ad3153a 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -461,7 +461,7 @@ public:
   // This gets the current error for this ValueObject, it may update the value
   // to ensure that the error is up to date.
   const Status ();
-  
+
   // Check the current error state without updating the value:
   const Status () { return m_error; }
 
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 182ae669d8..1069ec0e42 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -117,7 +117,7 @@ public:
 if (!target) {
   // If we can't get the target, the error might still be useful:
   if (value_sp->CheckError().Fail())
-return value_sp;  
+return value_sp;
   return ValueObjectSP();
 }
 lock = std::unique_lock(target->GetAPIMutex());

``




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


[Lldb-commits] [lldb] Don't cause a premature UpdateIfNeeded when checking in SBValue::GetSP (PR #80222)

2024-01-31 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (jimingham)


Changes

Don't cause a premature UpdateIfNeeded when checking whether an otherwise 
invalid SBValue with a useful error should be handed out from GetSP.

This is a follow-on to e8a2fd5e7be2.  In that change, I used GetError to check 
for an error at the beginning of GetSP, before checking for a valid Target or a 
stopped Process.  But GetError calls UpdateIfNeeded.  Normally that's not a 
problem as somewhere along UpdateIfNeeded the code will realize it can't update 
and return w/o doing any harm.

But when running lldb in a multithreaded environment (e.g. in Xcode) if you are 
very unlucky you can get the update to start before you proceed and then just 
stall waiting to get access to gdb-remote while the process is running.

The change is to add ValueObject::CheckError that returns the error w/o 
UpdatingIfNeeded, and use that in SBValue::GetSP in the places where we would 
normally return an invalid SP.

I tried to make a test for this but it's unobservable unless you are very 
unlucky, and I couldn't figure out a way to be consistently unlucky.

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


2 Files Affected:

- (modified) lldb/include/lldb/Core/ValueObject.h (+5) 
- (modified) lldb/source/API/SBValue.cpp (+11-6) 


``diff
diff --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 4c0b0b2dae6cd..db8023618b7f6 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -458,7 +458,12 @@ class ValueObject {
   virtual bool GetDeclaration(Declaration );
 
   // The functions below should NOT be modified by subclasses
+  // This gets the current error for this ValueObject, it may update the value
+  // to ensure that the error is up to date.
   const Status ();
+  
+  // Check the current error state without updating the value:
+  const Status () { return m_error; }
 
   ConstString GetName() const { return m_name; }
 
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 89d26a1fbe282..182ae669d880b 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -114,13 +114,12 @@ class ValueImpl {
 lldb::ValueObjectSP value_sp = m_valobj_sp;
 
 Target *target = value_sp->GetTargetSP().get();
-// If this ValueObject holds an error, then it is valuable for that.
-if (value_sp->GetError().Fail())
-  return value_sp;
-
-if (!target)
+if (!target) {
+  // If we can't get the target, the error might still be useful:
+  if (value_sp->CheckError().Fail())
+return value_sp;  
   return ValueObjectSP();
-
+}
 lock = std::unique_lock(target->GetAPIMutex());
 
 ProcessSP process_sp(value_sp->GetProcessSP());
@@ -128,7 +127,13 @@ class ValueImpl {
   // We don't allow people to play around with ValueObject if the process
   // is running. If you want to look at values, pause the process, then
   // look.
+  // However, if this VO already had an error, then that is worth showing
+  // the user.  However, we can't update it so use CheckError not GetError.
   error.SetErrorString("process must be stopped.");
+
+  if (value_sp->CheckError().Fail())
+return value_sp;
+
   return ValueObjectSP();
 }
 

``




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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -218,6 +219,106 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) {
+  // Bad data.
+  consumeError(parent.takeError());

felipepiovezan wrote:

Good point, let me look into it

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


[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread Adrian Prantl via lldb-commits


@@ -0,0 +1,132 @@
+"""
+Test SBTarget.GetStatistics() reporting for dwo files.
+"""
+
+import json
+import os
+
+from lldbsuite.test import lldbtest, lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test_event.build_exception import BuildError
+
+
+SKELETON_DEBUGINFO_SIZE = 602
+MAIN_DWO_DEBUGINFO_SIZE = 385
+FOO_DWO_DEBUGINFO_SIZE = 380
+
+
+class TestDebugInfoSize(lldbtest.TestBase):
+def get_output_from_yaml(self):
+exe = self.getBuildArtifact("a.out")
+main_dwo = self.getBuildArtifact("a.out-main.dwo")
+foo_dwo = self.getBuildArtifact("a.out-foo.dwo")
+
+src_dir = self.getSourceDir()
+exe_yaml_path = os.path.join(src_dir, "a.out.yaml")
+self.yaml2obj(exe_yaml_path, exe)
+
+main_dwo_yaml_path = os.path.join(src_dir, "a.out-main.dwo.yaml")
+self.yaml2obj(main_dwo_yaml_path, main_dwo)
+
+foo_dwo_yaml_path = os.path.join(src_dir, "a.out-foo.dwo.yaml")
+self.yaml2obj(foo_dwo_yaml_path, foo_dwo)
+return (exe, main_dwo, foo_dwo)
+
+@add_test_categories(["dwo"])
+def test_dwo(self):
+(exe, main_dwo, foo_dwo) = self.get_output_from_yaml()
+
+# Make sure dwo files exist
+self.assertTrue(os.path.exists(main_dwo), f'Make sure "{main_dwo}" 
file exists')
+self.assertTrue(os.path.exists(foo_dwo), f'Make sure "{foo_dwo}" file 
exists')
+
+target = self.dbg.CreateTarget(exe)
+self.assertTrue(target, lldbtest.VALID_TARGET)
+
+stats = target.GetStatistics()
+stream = lldb.SBStream()
+res = stats.GetAsJSON(stream)
+debug_stats = json.loads(stream.GetData())
+self.assertEqual(

adrian-prantl wrote:

self.assertIn

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


[Lldb-commits] [lldb] Don't cause a premature UpdateIfNeeded when checking in SBValue::GetSP (PR #80222)

2024-01-31 Thread via lldb-commits

https://github.com/jimingham created 
https://github.com/llvm/llvm-project/pull/80222

Don't cause a premature UpdateIfNeeded when checking whether an otherwise 
invalid SBValue with a useful error should be handed out from GetSP.

This is a follow-on to e8a2fd5e7be2.  In that change, I used GetError to check 
for an error at the beginning of GetSP, before checking for a valid Target or a 
stopped Process.  But GetError calls UpdateIfNeeded.  Normally that's not a 
problem as somewhere along UpdateIfNeeded the code will realize it can't update 
and return w/o doing any harm.

But when running lldb in a multithreaded environment (e.g. in Xcode) if you are 
very unlucky you can get the update to start before you proceed and then just 
stall waiting to get access to gdb-remote while the process is running.

The change is to add ValueObject::CheckError that returns the error w/o 
UpdatingIfNeeded, and use that in SBValue::GetSP in the places where we would 
normally return an invalid SP.

I tried to make a test for this but it's unobservable unless you are very 
unlucky, and I couldn't figure out a way to be consistently unlucky.

>From c6d76783fce826f01fe4713e3cc58504d591aebf Mon Sep 17 00:00:00 2001
From: Jim Ingham 
Date: Fri, 8 Dec 2023 14:57:23 -0800
Subject: [PATCH] Don't cause a premature UpdateIfNeeded when checking whether
 an otherwise invalid SBValue with a useful error should be handed out from
 GetSP.

This is a follow-on to e8a2fd5e7be2.  In that change, I used
GetError to check for an error at the beginning of GetSP, before
checking for a valid Target or a stopped Process.  But GetError
calls UpdateIfNeeded.  Normally that's not a problem as somewhere
along UpdateIfNeeded the code will realize it can't update and
return w/o doing any harm.

But when running lldb in a multithreaded environment (e.g. in
Xcode) if you are very unlucky you can get the update to start
before you proceed and then just stall waiting to get access to
gdb-remote while the process is running.

The change is to add ValueObject::CheckError that returns the error
w/o UpdatingIfNeeded, and use that in SBValue::GetSP in the places
where we would normally return an invalid SP.

I tried to make a test for this but it's unobservable unless you are
very unlucky, and I couldn't figure out a way to be consistently
unlucky.
---
 lldb/include/lldb/Core/ValueObject.h |  5 +
 lldb/source/API/SBValue.cpp  | 17 +++--
 2 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/lldb/include/lldb/Core/ValueObject.h 
b/lldb/include/lldb/Core/ValueObject.h
index 4c0b0b2dae6cd..db8023618b7f6 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -458,7 +458,12 @@ class ValueObject {
   virtual bool GetDeclaration(Declaration );
 
   // The functions below should NOT be modified by subclasses
+  // This gets the current error for this ValueObject, it may update the value
+  // to ensure that the error is up to date.
   const Status ();
+  
+  // Check the current error state without updating the value:
+  const Status () { return m_error; }
 
   ConstString GetName() const { return m_name; }
 
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 89d26a1fbe282..182ae669d880b 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -114,13 +114,12 @@ class ValueImpl {
 lldb::ValueObjectSP value_sp = m_valobj_sp;
 
 Target *target = value_sp->GetTargetSP().get();
-// If this ValueObject holds an error, then it is valuable for that.
-if (value_sp->GetError().Fail())
-  return value_sp;
-
-if (!target)
+if (!target) {
+  // If we can't get the target, the error might still be useful:
+  if (value_sp->CheckError().Fail())
+return value_sp;  
   return ValueObjectSP();
-
+}
 lock = std::unique_lock(target->GetAPIMutex());
 
 ProcessSP process_sp(value_sp->GetProcessSP());
@@ -128,7 +127,13 @@ class ValueImpl {
   // We don't allow people to play around with ValueObject if the process
   // is running. If you want to look at values, pause the process, then
   // look.
+  // However, if this VO already had an error, then that is worth showing
+  // the user.  However, we can't update it so use CheckError not GetError.
   error.SetErrorString("process must be stopped.");
+
+  if (value_sp->CheckError().Fail())
+return value_sp;
+
   return ValueObjectSP();
 }
 

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


[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -0,0 +1,132 @@
+"""
+Test SBTarget.GetStatistics() reporting for dwo files.
+"""
+
+import json
+import os
+
+from lldbsuite.test import lldbtest, lldbutil
+from lldbsuite.test.decorators import *
+from lldbsuite.test_event.build_exception import BuildError
+
+
+SKELETON_DEBUGINFO_SIZE = 602
+MAIN_DWO_DEBUGINFO_SIZE = 385
+FOO_DWO_DEBUGINFO_SIZE = 380
+
+
+class TestDebugInfoSize(lldbtest.TestBase):

clayborg wrote:

Add this just inside the class:
```
class TestDebugInfoSize(lldbtest.TestBase):
# Concurrency is the primary test factor here, not debug info variants.
NO_DEBUG_INFO_TESTCASE = True
```
This creates its own binaries and doesn't need to be run for all of the DWARF 
variants

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


[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -2667,6 +2667,29 @@ static bool 
UpdateCompilerContextForSimpleTemplateNames(TypeQuery ) {
   }
   return any_context_updated;
 }
+
+uint64_t SymbolFileDWARF::GetDebugInfoSize() {
+  DWARFDebugInfo  = DebugInfo();
+  uint32_t num_comp_units = info.GetNumUnits();
+
+  uint64_t debug_info_size = SymbolFileCommon::GetDebugInfoSize();
+  // In dwp scenario, debug info == skeleton debug info + dwp debug info.
+  if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
+return debug_info_size + dwp_sp->GetDebugInfoSize();
+
+  // In dwo scenario, debug info == skeleton debug info + all dwo debug info.
+  for (uint32_t i = 0; i < num_comp_units; i++) {
+DWARFUnit *cu = info.GetUnitAtIndex(i);
+if (cu == nullptr)
+  continue;
+
+SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();

clayborg wrote:

This call will force the .dwo files to be loaded, even if they are not. I would 
suggest adding a default boolean parameter to this function in 
SymbolFileWARFDwo.h:
```
  SymbolFileDWARFDwo *GetDwoSymbolFile(bool load_if_needed = true);
```
And then change the implementation to:
```
SymbolFileDWARFDwo *DWARFUnit::GetDwoSymbolFile(bool load_if_needed) {
  if (load_if_needed)
ExtractUnitDIEIfNeeded();
  if (m_dwo)
return ::cast(m_dwo->GetSymbolFileDWARF());
  return nullptr;
}
```
This way we won't end up pulling in all of the debug info just to answer the 
questions.

It all comes down to what we want to know from a call to 
`SymbolFileDWARF::GetDebugInfoSize()`:
- total currently loaded debug info (then my suggestion above stands)
- total possible debug info size (ignore suggestion)

So I would suggest we figure this out and then document the 
`SymbolFile::GetDebugInfoSize()` headerdoc appropriately.


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


[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread via lldb-commits

https://github.com/jeffreytan81 updated 
https://github.com/llvm/llvm-project/pull/80218

>From abfec9a970dd5fb4d5612638e14208555afe582e Mon Sep 17 00:00:00 2001
From: jeffreytan81 
Date: Wed, 31 Jan 2024 15:53:46 -0800
Subject: [PATCH 1/2] Fix debug info size statistics for split dwarf

---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |   23 +
 .../SymbolFile/DWARF/SymbolFileDWARF.h|2 +
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp   |   11 +
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h |2 +
 .../target/debuginfo/TestDebugInfoSize.py |  133 ++
 .../target/debuginfo/a.out-foo.dwo.yaml   |   37 +
 .../target/debuginfo/a.out-main.dwo.yaml  |   37 +
 .../API/commands/target/debuginfo/a.out.yaml  | 1273 +
 8 files changed, 1518 insertions(+)
 create mode 100644 lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out-foo.dwo.yaml
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out-main.dwo.yaml
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out.yaml

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index fed97858c83f8..7ab75a9ce2c6b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2667,6 +2667,29 @@ static bool 
UpdateCompilerContextForSimpleTemplateNames(TypeQuery ) {
   }
   return any_context_updated;
 }
+
+uint64_t SymbolFileDWARF::GetDebugInfoSize() {
+  DWARFDebugInfo  = DebugInfo();
+  uint32_t num_comp_units = info.GetNumUnits();
+
+  uint64_t debug_info_size = SymbolFileCommon::GetDebugInfoSize();
+  // In dwp scenario, debug info == skeleton debug info + dwp debug info.
+  if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
+return debug_info_size + dwp_sp->GetDebugInfoSize();
+
+  // In dwo scenario, debug info == skeleton debug info + all dwo debug info.
+  for (uint32_t i = 0; i < num_comp_units; i++) {
+DWARFUnit *cu = info.GetUnitAtIndex(i);
+if (cu == nullptr)
+  continue;
+
+SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();
+if (dwo)
+  debug_info_size += dwo->GetDebugInfoSize();
+  }
+  return debug_info_size;
+}
+
 void SymbolFileDWARF::FindTypes(const TypeQuery , TypeResults ) {
 
   // Make sure we haven't already searched this SymbolFile before.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 26a9502f90aa0..6d87530acf833 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -186,6 +186,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
   GetMangledNamesForFunction(const std::string _qualified_name,
  std::vector _names) override;
 
+  uint64_t GetDebugInfoSize() override;
+
   void FindTypes(const lldb_private::TypeQuery ,
  lldb_private::TypeResults ) override;
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index ca698a84a9146..b52cb514fb190 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -85,6 +85,17 @@ lldb::offset_t SymbolFileDWARFDwo::GetVendorDWARFOpcodeSize(
   return GetBaseSymbolFile().GetVendorDWARFOpcodeSize(data, data_offset, op);
 }
 
+uint64_t SymbolFileDWARFDwo::GetDebugInfoSize() {
+  // Directly get debug info from current dwo object file's section list
+  // instead of asking SymbolFileCommon::GetDebugInfo() which parses from
+  // owning module which is wrong.
+  SectionList *section_list =
+  m_objfile_sp->GetSectionList(/*update_module_section_list=*/false);
+  if (section_list)
+return section_list->GetDebugInfoSize();
+  return 0;
+}
+
 bool SymbolFileDWARFDwo::ParseVendorDWARFOpcode(
 uint8_t op, const lldb_private::DataExtractor ,
 lldb::offset_t , std::vector ) const {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 9f5950e51b0c1..5c4b36328cbac 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -47,6 +47,8 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
   const lldb::offset_t data_offset,
   const uint8_t op) const override;
 
+  uint64_t GetDebugInfoSize() override;
+
   bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor ,
   lldb::offset_t ,
   std::vector ) const override;
diff --git a/lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py 

[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread via lldb-commits

github-actions[bot] wrote:




:warning: Python code formatter, darker found issues in your code. :warning:



You can test this locally with the following command:


``bash
darker --check --diff -r 
cf401f72e1b5aa6be0719ab45c95c10ea06bec9a...abfec9a970dd5fb4d5612638e14208555afe582e
 lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py
``





View the diff from darker here.


``diff
--- TestDebugInfoSize.py2024-01-31 23:53:46.00 +
+++ TestDebugInfoSize.py2024-01-31 23:56:58.224856 +
@@ -14,11 +14,10 @@
 MAIN_DWO_DEBUGINFO_SIZE = 385
 FOO_DWO_DEBUGINFO_SIZE = 380
 
 
 class TestDebugInfoSize(lldbtest.TestBase):
-
 def get_output_from_yaml(self):
 exe = self.getBuildArtifact("a.out")
 main_dwo = self.getBuildArtifact("a.out-main.dwo")
 foo_dwo = self.getBuildArtifact("a.out-foo.dwo")
 

``




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


[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (jeffreytan81)


Changes

`statistics dump` command relies on `SymbolFile::GetDebugInfoSize()` to get 
total debug info size.
The current implementation is missing debug info for split dwarf scenarios 
which requires getting debug info from separate dwo/dwp files.
This patch fixes this issue for split dwarf by parsing debug info from dwp/dwo.

New yaml tests are added.

---

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


8 Files Affected:

- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (+23) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h (+2) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp (+11) 
- (modified) lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h (+2) 
- (added) lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py (+133) 
- (added) lldb/test/API/commands/target/debuginfo/a.out-foo.dwo.yaml (+37) 
- (added) lldb/test/API/commands/target/debuginfo/a.out-main.dwo.yaml (+37) 
- (added) lldb/test/API/commands/target/debuginfo/a.out.yaml (+1273) 


``diff
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index fed97858c83f8..7ab75a9ce2c6b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2667,6 +2667,29 @@ static bool 
UpdateCompilerContextForSimpleTemplateNames(TypeQuery ) {
   }
   return any_context_updated;
 }
+
+uint64_t SymbolFileDWARF::GetDebugInfoSize() {
+  DWARFDebugInfo  = DebugInfo();
+  uint32_t num_comp_units = info.GetNumUnits();
+
+  uint64_t debug_info_size = SymbolFileCommon::GetDebugInfoSize();
+  // In dwp scenario, debug info == skeleton debug info + dwp debug info.
+  if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
+return debug_info_size + dwp_sp->GetDebugInfoSize();
+
+  // In dwo scenario, debug info == skeleton debug info + all dwo debug info.
+  for (uint32_t i = 0; i < num_comp_units; i++) {
+DWARFUnit *cu = info.GetUnitAtIndex(i);
+if (cu == nullptr)
+  continue;
+
+SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();
+if (dwo)
+  debug_info_size += dwo->GetDebugInfoSize();
+  }
+  return debug_info_size;
+}
+
 void SymbolFileDWARF::FindTypes(const TypeQuery , TypeResults ) {
 
   // Make sure we haven't already searched this SymbolFile before.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 26a9502f90aa0..6d87530acf833 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -186,6 +186,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
   GetMangledNamesForFunction(const std::string _qualified_name,
  std::vector _names) override;
 
+  uint64_t GetDebugInfoSize() override;
+
   void FindTypes(const lldb_private::TypeQuery ,
  lldb_private::TypeResults ) override;
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index ca698a84a9146..b52cb514fb190 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -85,6 +85,17 @@ lldb::offset_t SymbolFileDWARFDwo::GetVendorDWARFOpcodeSize(
   return GetBaseSymbolFile().GetVendorDWARFOpcodeSize(data, data_offset, op);
 }
 
+uint64_t SymbolFileDWARFDwo::GetDebugInfoSize() {
+  // Directly get debug info from current dwo object file's section list
+  // instead of asking SymbolFileCommon::GetDebugInfo() which parses from
+  // owning module which is wrong.
+  SectionList *section_list =
+  m_objfile_sp->GetSectionList(/*update_module_section_list=*/false);
+  if (section_list)
+return section_list->GetDebugInfoSize();
+  return 0;
+}
+
 bool SymbolFileDWARFDwo::ParseVendorDWARFOpcode(
 uint8_t op, const lldb_private::DataExtractor ,
 lldb::offset_t , std::vector ) const {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 9f5950e51b0c1..5c4b36328cbac 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -47,6 +47,8 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
   const lldb::offset_t data_offset,
   const uint8_t op) const override;
 
+  uint64_t GetDebugInfoSize() override;
+
   bool ParseVendorDWARFOpcode(uint8_t op, const DataExtractor ,
   lldb::offset_t ,
   std::vector ) const override;
diff --git 

[Lldb-commits] [lldb] Fix debug info size statistics for split dwarf (PR #80218)

2024-01-31 Thread via lldb-commits

https://github.com/jeffreytan81 created 
https://github.com/llvm/llvm-project/pull/80218

`statistics dump` command relies on `SymbolFile::GetDebugInfoSize()` to get 
total debug info size.
The current implementation is missing debug info for split dwarf scenarios 
which requires getting debug info from separate dwo/dwp files.
This patch fixes this issue for split dwarf by parsing debug info from dwp/dwo.

New yaml tests are added.

>From abfec9a970dd5fb4d5612638e14208555afe582e Mon Sep 17 00:00:00 2001
From: jeffreytan81 
Date: Wed, 31 Jan 2024 15:53:46 -0800
Subject: [PATCH] Fix debug info size statistics for split dwarf

---
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  |   23 +
 .../SymbolFile/DWARF/SymbolFileDWARF.h|2 +
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp   |   11 +
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h |2 +
 .../target/debuginfo/TestDebugInfoSize.py |  133 ++
 .../target/debuginfo/a.out-foo.dwo.yaml   |   37 +
 .../target/debuginfo/a.out-main.dwo.yaml  |   37 +
 .../API/commands/target/debuginfo/a.out.yaml  | 1273 +
 8 files changed, 1518 insertions(+)
 create mode 100644 lldb/test/API/commands/target/debuginfo/TestDebugInfoSize.py
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out-foo.dwo.yaml
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out-main.dwo.yaml
 create mode 100644 lldb/test/API/commands/target/debuginfo/a.out.yaml

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
index fed97858c83f8..7ab75a9ce2c6b 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
@@ -2667,6 +2667,29 @@ static bool 
UpdateCompilerContextForSimpleTemplateNames(TypeQuery ) {
   }
   return any_context_updated;
 }
+
+uint64_t SymbolFileDWARF::GetDebugInfoSize() {
+  DWARFDebugInfo  = DebugInfo();
+  uint32_t num_comp_units = info.GetNumUnits();
+
+  uint64_t debug_info_size = SymbolFileCommon::GetDebugInfoSize();
+  // In dwp scenario, debug info == skeleton debug info + dwp debug info.
+  if (std::shared_ptr dwp_sp = GetDwpSymbolFile())
+return debug_info_size + dwp_sp->GetDebugInfoSize();
+
+  // In dwo scenario, debug info == skeleton debug info + all dwo debug info.
+  for (uint32_t i = 0; i < num_comp_units; i++) {
+DWARFUnit *cu = info.GetUnitAtIndex(i);
+if (cu == nullptr)
+  continue;
+
+SymbolFileDWARFDwo *dwo = cu->GetDwoSymbolFile();
+if (dwo)
+  debug_info_size += dwo->GetDebugInfoSize();
+  }
+  return debug_info_size;
+}
+
 void SymbolFileDWARF::FindTypes(const TypeQuery , TypeResults ) {
 
   // Make sure we haven't already searched this SymbolFile before.
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 26a9502f90aa0..6d87530acf833 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -186,6 +186,8 @@ class SymbolFileDWARF : public SymbolFileCommon {
   GetMangledNamesForFunction(const std::string _qualified_name,
  std::vector _names) override;
 
+  uint64_t GetDebugInfoSize() override;
+
   void FindTypes(const lldb_private::TypeQuery ,
  lldb_private::TypeResults ) override;
 
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
index ca698a84a9146..b52cb514fb190 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
@@ -85,6 +85,17 @@ lldb::offset_t SymbolFileDWARFDwo::GetVendorDWARFOpcodeSize(
   return GetBaseSymbolFile().GetVendorDWARFOpcodeSize(data, data_offset, op);
 }
 
+uint64_t SymbolFileDWARFDwo::GetDebugInfoSize() {
+  // Directly get debug info from current dwo object file's section list
+  // instead of asking SymbolFileCommon::GetDebugInfo() which parses from
+  // owning module which is wrong.
+  SectionList *section_list =
+  m_objfile_sp->GetSectionList(/*update_module_section_list=*/false);
+  if (section_list)
+return section_list->GetDebugInfoSize();
+  return 0;
+}
+
 bool SymbolFileDWARFDwo::ParseVendorDWARFOpcode(
 uint8_t op, const lldb_private::DataExtractor ,
 lldb::offset_t , std::vector ) const {
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h 
b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
index 9f5950e51b0c1..5c4b36328cbac 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
@@ -47,6 +47,8 @@ class SymbolFileDWARFDwo : public SymbolFileDWARF {
   const lldb::offset_t data_offset,
   const uint8_t op) const override;
 

[Lldb-commits] [lldb] 40ebe52 - Revert "Reland "[lldb][progress][NFC] Add unit test for progress reports (#79533)""

2024-01-31 Thread Chelsea Cassanova via lldb-commits

Author: Chelsea Cassanova
Date: 2024-01-31T15:31:52-08:00
New Revision: 40ebe522ea5fd56cb383e29c77373b1482d49c0f

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

LOG: Revert "Reland "[lldb][progress][NFC] Add unit test for progress reports 
(#79533)""

This reverts commit a5a8cbb110384825b99228891576f799082f200e.

The test being added by that commit still fails on the assertion that
Debugger::Initialize has been called more than once.

Added: 


Modified: 
lldb/unittests/Core/CMakeLists.txt

Removed: 
lldb/unittests/Core/ProgressReportTest.cpp



diff  --git a/lldb/unittests/Core/CMakeLists.txt 
b/lldb/unittests/Core/CMakeLists.txt
index d40c357e3f463..b3cddd150635b 100644
--- a/lldb/unittests/Core/CMakeLists.txt
+++ b/lldb/unittests/Core/CMakeLists.txt
@@ -7,7 +7,6 @@ add_lldb_unittest(LLDBCoreTests
   FormatEntityTest.cpp
   MangledTest.cpp
   ModuleSpecTest.cpp
-  ProgressReportTest.cpp
   RichManglingContextTest.cpp
   SourceLocationSpecTest.cpp
   SourceManagerTest.cpp

diff  --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
deleted file mode 100644
index 2b25503406186..0
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ /dev/null
@@ -1,127 +0,0 @@
-//===-- ProgressReportTest.cpp 
===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
-#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
-#include "TestingSupport/SubsystemRAII.h"
-#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Progress.h"
-#include "lldb/Host/FileSystem.h"
-#include "lldb/Host/HostInfo.h"
-#include "lldb/Utility/Listener.h"
-#include "gtest/gtest.h"
-#include 
-
-using namespace lldb;
-using namespace lldb_private;
-
-static std::once_flag debugger_initialize_flag;
-class ProgressReportTest : public ::testing::Test {
-  SubsystemRAII subsystems;
-
-  // The debugger's initialization function can't be called with no arguments
-  // so calling it using SubsystemRAII will cause the test build to fail as
-  // SubsystemRAII will call Initialize with no arguments. As such we set it up
-  // here the usual way.
-  void SetUp() override {
-std::call_once(debugger_initialize_flag,
-   []() { Debugger::Initialize(nullptr); });
-  };
-};
-
-TEST_F(ProgressReportTest, TestReportCreation) {
-  std::chrono::milliseconds timeout(100);
-
-  // Set up the debugger, make sure that was done properly.
-  ArchSpec arch("x86_64-apple-macosx-");
-  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, ));
-
-  DebuggerSP debugger_sp = Debugger::CreateInstance();
-  ASSERT_TRUE(debugger_sp);
-
-  // Get the debugger's broadcaster.
-  Broadcaster  = debugger_sp->GetBroadcaster();
-
-  // Create a listener, make sure it can receive events and that it's
-  // listening to the correct broadcast bit.
-  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
-
-  listener_sp->StartListeningForEvents(,
-   Debugger::eBroadcastBitProgress);
-  EXPECT_TRUE(
-  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
-
-  EventSP event_sp;
-  const ProgressEventData *data;
-
-  // Scope this for RAII on the progress objects.
-  // Create progress reports and check that their respective events for having
-  // started and ended are broadcasted.
-  {
-Progress progress1("Progress report 1", "Starting report 1");
-Progress progress2("Progress report 2", "Starting report 2");
-Progress progress3("Progress report 3", "Starting report 3");
-  }
-
-  // Start popping events from the queue, they should have been recevied
-  // in this order:
-  // Starting progress: 1, 2, 3
-  // Ending progress: 3, 2, 1
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
-  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
-
-  ASSERT_EQ(data->GetDetails(), "Starting report 1");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
-
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
-  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
-
-  ASSERT_EQ(data->GetDetails(), "Starting report 2");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  

[Lldb-commits] [lldb] a5a8cbb - Reland "[lldb][progress][NFC] Add unit test for progress reports (#79533)"

2024-01-31 Thread Chelsea Cassanova via lldb-commits

Author: Chelsea Cassanova
Date: 2024-01-31T15:19:39-08:00
New Revision: a5a8cbb110384825b99228891576f799082f200e

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

LOG: Reland "[lldb][progress][NFC] Add unit test for progress reports (#79533)"

This reverts commit 209fe1f3d70d1c4a20bb2687e0d0a94b1bbfa0c6.

The original commit failed to due an assertion failure in the unit test
`ProgressReportTest` that the commit added. The Debugger::Initialize()
function was called more than once which triggered the assertion, so
this commit calls that function under a `std::call_once`.

Added: 
lldb/unittests/Core/ProgressReportTest.cpp

Modified: 
lldb/unittests/Core/CMakeLists.txt

Removed: 




diff  --git a/lldb/unittests/Core/CMakeLists.txt 
b/lldb/unittests/Core/CMakeLists.txt
index b3cddd150635b..d40c357e3f463 100644
--- a/lldb/unittests/Core/CMakeLists.txt
+++ b/lldb/unittests/Core/CMakeLists.txt
@@ -7,6 +7,7 @@ add_lldb_unittest(LLDBCoreTests
   FormatEntityTest.cpp
   MangledTest.cpp
   ModuleSpecTest.cpp
+  ProgressReportTest.cpp
   RichManglingContextTest.cpp
   SourceLocationSpecTest.cpp
   SourceManagerTest.cpp

diff  --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
new file mode 100644
index 0..2b25503406186
--- /dev/null
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -0,0 +1,127 @@
+//===-- ProgressReportTest.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
+#include "TestingSupport/SubsystemRAII.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Progress.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Utility/Listener.h"
+#include "gtest/gtest.h"
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+static std::once_flag debugger_initialize_flag;
+class ProgressReportTest : public ::testing::Test {
+  SubsystemRAII subsystems;
+
+  // The debugger's initialization function can't be called with no arguments
+  // so calling it using SubsystemRAII will cause the test build to fail as
+  // SubsystemRAII will call Initialize with no arguments. As such we set it up
+  // here the usual way.
+  void SetUp() override {
+std::call_once(debugger_initialize_flag,
+   []() { Debugger::Initialize(nullptr); });
+  };
+};
+
+TEST_F(ProgressReportTest, TestReportCreation) {
+  std::chrono::milliseconds timeout(100);
+
+  // Set up the debugger, make sure that was done properly.
+  ArchSpec arch("x86_64-apple-macosx-");
+  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, ));
+
+  DebuggerSP debugger_sp = Debugger::CreateInstance();
+  ASSERT_TRUE(debugger_sp);
+
+  // Get the debugger's broadcaster.
+  Broadcaster  = debugger_sp->GetBroadcaster();
+
+  // Create a listener, make sure it can receive events and that it's
+  // listening to the correct broadcast bit.
+  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
+
+  listener_sp->StartListeningForEvents(,
+   Debugger::eBroadcastBitProgress);
+  EXPECT_TRUE(
+  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
+
+  EventSP event_sp;
+  const ProgressEventData *data;
+
+  // Scope this for RAII on the progress objects.
+  // Create progress reports and check that their respective events for having
+  // started and ended are broadcasted.
+  {
+Progress progress1("Progress report 1", "Starting report 1");
+Progress progress2("Progress report 2", "Starting report 2");
+Progress progress3("Progress report 3", "Starting report 3");
+  }
+
+  // Start popping events from the queue, they should have been recevied
+  // in this order:
+  // Starting progress: 1, 2, 3
+  // Ending progress: 3, 2, 1
+  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+
+  ASSERT_EQ(data->GetDetails(), "Starting report 1");
+  ASSERT_FALSE(data->IsFinite());
+  ASSERT_FALSE(data->GetCompleted());
+  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
+
+  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+
+  ASSERT_EQ(data->GetDetails(), "Starting report 2");
+  

[Lldb-commits] [lldb] [lldb][NFCI] Remove m_being_created from Breakpoint classes (PR #79716)

2024-01-31 Thread Alex Langford via lldb-commits

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


[Lldb-commits] [lldb] db68e92 - [lldb][NFCI] Remove m_being_created from Breakpoint classes (#79716)

2024-01-31 Thread via lldb-commits

Author: Alex Langford
Date: 2024-01-31T14:44:52-08:00
New Revision: db68e9229b54f1d72c0a4445682718d75e532b5d

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

LOG: [lldb][NFCI] Remove m_being_created from Breakpoint classes (#79716)

The purpose of m_being_created in these classes was to prevent
broadcasting an event related to these Breakpoints during the creation
of the breakpoint (i.e. in the constructor). In Breakpoint and
Watchpoint, m_being_created had no effect. That is to say, removing it
does not change behavior.
However, BreakpointLocation does still use m_being_created. In the
constructor, SetThreadID is called which does broadcast an event only if
`m_being_created` is false. Instead of having this logic be roundabout,
the constructor instead calls `SetThreadIDInternal`, which actually
changes the thread ID. `SetThreadID` also will call
`SetThreadIDInternal` in addition to broadcasting a changed event.

Added: 


Modified: 
lldb/include/lldb/Breakpoint/Breakpoint.h
lldb/include/lldb/Breakpoint/BreakpointLocation.h
lldb/include/lldb/Breakpoint/Watchpoint.h
lldb/source/Breakpoint/Breakpoint.cpp
lldb/source/Breakpoint/BreakpointLocation.cpp
lldb/source/Breakpoint/Watchpoint.cpp

Removed: 




diff  --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index 8c4308ab0bc12..0b6bf593be37a 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -637,7 +637,6 @@ class Breakpoint : public 
std::enable_shared_from_this,
   Breakpoint(Target _target, const Breakpoint _to_copy_from);
 
   // For Breakpoint only
-  bool m_being_created;
   bool
   m_hardware; // If this breakpoint is required to use a hardware 
breakpoint
   Target _target; // The target that holds this breakpoint.

diff  --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index 2a4f9fc01bf32..cca00335bc3c6 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -313,6 +313,17 @@ class BreakpointLocation
 
   void UndoBumpHitCount();
 
+  /// Updates the thread ID internally.
+  ///
+  /// This method was created to handle actually mutating the thread ID
+  /// internally because SetThreadID broadcasts an event in addition to 
mutating
+  /// state. The constructor calls this instead of SetThreadID to avoid the
+  /// broadcast.
+  ///
+  /// \param[in] thread_id
+  ///   The new thread ID.
+  void SetThreadIDInternal(lldb::tid_t thread_id);
+
   // Constructors and Destructors
   //
   // Only the Breakpoint can make breakpoint locations, and it owns them.
@@ -337,7 +348,6 @@ class BreakpointLocation
  bool check_for_resolver = true);
 
   // Data members:
-  bool m_being_created;
   bool m_should_resolve_indirect_functions;
   bool m_is_reexported;
   bool m_is_indirect;

diff  --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 22fdfd686c3f1..16b83fbf7f705 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -224,11 +224,8 @@ class Watchpoint : public 
std::enable_shared_from_this,
   CompilerType m_type;
   Status m_error; // An error object describing errors associated with this
   // watchpoint.
-  WatchpointOptions
-  m_options; // Settable watchpoint options, which is a delegate to handle
- // the callback machinery.
-  bool m_being_created;
-
+  WatchpointOptions m_options; // Settable watchpoint options, which is a
+   // delegate to handle the callback machinery.
   std::unique_ptr m_condition_up; // The condition to test.
 
   void SetID(lldb::watch_id_t id) { m_id = id; }

diff  --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index af5dcc9cd88d4..ae845e92762b9 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -44,17 +44,14 @@ const char 
*Breakpoint::g_option_names[static_cast(
 Breakpoint::Breakpoint(Target , SearchFilterSP _sp,
BreakpointResolverSP _sp, bool hardware,
bool resolve_indirect_symbols)
-: m_being_created(true), m_hardware(hardware), m_target(target),
-  m_filter_sp(filter_sp), m_resolver_sp(resolver_sp), m_options(true),
-  m_locations(*this), m_resolve_indirect_symbols(resolve_indirect_symbols),
-  m_hit_counter() {
-  m_being_created = false;
-}
+: m_hardware(hardware), m_target(target), m_filter_sp(filter_sp),
+  m_resolver_sp(resolver_sp), m_options(true), m_locations(*this),
+  

[Lldb-commits] [lldb] [lldb] Fix a crash when using .dwp files and make type lookup reliable with the index cache (PR #79544)

2024-01-31 Thread Greg Clayton via lldb-commits

clayborg wrote:

I think I have taken care of everyone's requests, let me know if there is more 
to do!

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };

clayborg wrote:

As long as we document with headerdoc what each value means, I am good. Then 
users can use code navigation to take them to the definition and find the 
explanation.

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };

clayborg wrote:

Any names that at least tell us what they do more clearly will help. I just 
tried to come up with something off the top of my head...

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Michael Buch via lldb-commits


@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };

Michael137 wrote:

> We need to make sure enum values are 0 and 1 since the python synthetic stuff 
> will return True or False still. It might be nice to move this enum into 
> lldb-enumerations.h so that python can use it in future synthetic child 
> providers, or people can update their synthetic python plugins to use the 
> enum to be more readable.

Will do, thanks!

> do we want to be more clear about what these do and specify they are for 
> children?

I don't mind these names, though new readers might have trouble understanding 
(and might be harder to remember which one to use). But being more precise is 
probably better.

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


[Lldb-commits] [lldb] [lldb] Fix expressions that involve nested structs/classes/unions. (PR #77029)

2024-01-31 Thread Michael Buch via lldb-commits

Michael137 wrote:

> But if it'd require substantial reengineering to clang to get this working - 
> this seems an unfortunate regression to carry in the interim, and it might be 
> worth reverting to the previous (differently buggy, but at least 
> work-around-able) behavior.

To clarify, the regression @dwblaikie reported in 
https://github.com/llvm/llvm-project/issues/79668 was introduced in 
https://github.com/llvm/llvm-project/pull/74786, not in this current PR. IIUC, 
this PR just *partially* fixed 
https://github.com/llvm/llvm-project/issues/53904?

> The new flow could be:
> 
> * any struct/class gets created as a forward declaration and has the external 
> AST source enabled
> * the external AST calls to complete the type when needed by expression 
> parser or LLDB APIs
> * we complete the type
> * we leave the external AST enabled so we can get called for contained types
> 
> The last item here would require modifications to clang which could be 
> debugger specific changes that are only enabled in a special debug compiler 
> mode so they don't affect the actual compiler. Thoughts?

Following overview of the clang<->lldb call-chain might be useful: 
https://github.com/llvm/llvm-project/issues/53904#issuecomment-1877114034. Not 
sure I fully understand the "we leave the external AST enabled so we can get 
called for contained types" idea. Happy to chat about how to make this work 
though

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


[Lldb-commits] [lldb] [lldb] Fix a crash when using .dwp files and make type lookup reliable with the index cache (PR #79544)

2024-01-31 Thread Greg Clayton via lldb-commits

https://github.com/clayborg updated 
https://github.com/llvm/llvm-project/pull/79544

>From 641f4f34db2fea4c6c6cf354d77e7ba5688d098b Mon Sep 17 00:00:00 2001
From: Greg Clayton 
Date: Thu, 25 Jan 2024 19:21:25 -0800
Subject: [PATCH 1/4] Fix a crash when using .dwp files and make type lookup
 reliable with the index cache.

When using split DWARF with .dwp files we had an issue where sometimes the DWO 
file within the .dwp file would be parsed _before_ the skeleton compile unit. 
The DWO file expects to be able to always be able to get a link back to the 
skeleton compile unit. Prior to this fix, the only time the skeleton compile 
unit backlink would get set, was if the unit headers for the main executable 
have been parsed _and_ if the unit DIE was parsed in that DWARFUnit. This patch 
ensures that we can always get the skeleton compile unit for a DWO file by 
adding a function:

```
DWARFCompileUnit *DWARFUnit::GetSkeletonUnit();
```

Prior to this fix DWARFUnit had some unsafe accessors that were used to store 
two different things:

```
  void *DWARFUnit::GetUserData() const;
  void DWARFUnit::SetUserData(void *d);
```

This was used by SymbolFileDWARF to cache the `lldb_private::CompileUnit *` for 
a SymbolFileDWARF and was also used to store the `DWARFUnit *` for 
SymbolFileDWARFDwo. This patch clears up this unsafe usage by adding two 
separate accessors and ivars for this:
```
lldb_private::CompileUnit *DWARFUnit::GetLLDBCompUnit() const { return 
m_lldb_cu; }
void DWARFUnit::SetLLDBCompUnit(lldb_private::CompileUnit *cu) { m_lldb_cu = 
cu; }
DWARFCompileUnit *DWARFUnit::GetSkeletonUnit();
void DWARFUnit::SetSkeletonUnit(DWARFUnit *skeleton_unit);
```
This will stop anyone from calling `void *DWARFUnit::GetUserData() const;` and 
casting the value to an incorrect value.

A crash could occur in `SymbolFileDWARF::GetCompUnitForDWARFCompUnit()` when 
the `non_dwo_cu`, which is a backlink to the skeleton compile unit, was not set 
and was NULL. There is an assert() in the code, and then the code just will 
kill the program if the assert isn't enabled because the code looked like:
```
  if (dwarf_cu.IsDWOUnit()) {
DWARFCompileUnit *non_dwo_cu =
static_cast(dwarf_cu.GetUserData());
assert(non_dwo_cu);
return non_dwo_cu->GetSymbolFileDWARF().GetCompUnitForDWARFCompUnit(
*non_dwo_cu);
  }
```
This is now fixed by calling the `DWARFUnit::GetSkeletonUnit()` which will 
correctly always get the skeleton compile uint for a DWO file regardless of if 
the skeleton unit headers have been parse or if the skeleton unit DIE wasn't 
parsed yet.

To implement the ability to get the skeleton compile units, I added code the 
DWARFDebugInfo.cpp/.h that make a map of DWO ID -> skeleton DWARFUnit * that 
gets filled in for DWARF5 when the unit headers are parsed. The 
`DWARFUnit::GetSkeletonUnit()` will end up parsing the unit headers of the main 
executable to fill in this map if it already hasn't been done. For DWARF4 and 
earlier we maintain a separate map that gets filled in only for any DWARF4 
compile units that have a DW_AT_dwo_id or DW_AT_gnu_dwo_id attributes. This is 
more expensive, so this is done lazily and in a thread safe manor. This allows 
us to be as efficient as possible when using DWARF5 and also be backward 
compatible with DWARF4 + split DWARF.

There was also an issue that stopped type lookups from succeeding in `DWARFDIE 
SymbolFileDWARF::GetDIE(const DIERef _ref)` where it directly was accessing 
the `m_dwp_symfile` ivar without calling the accessor function that could end 
up needing to locate and load the .dwp file. This was fixed by calling the 
`SymbolFileDWARF::GetDwpSymbolFile()` accessor to ensure we always get a valid 
value back if we can find the .dwp file. Prior to this fix it was down which 
APIs were called and if any APIs were called that loaded the .dwp file, it 
worked fine, but it might not if no APIs were called that did cause it to get 
loaded.

When we have valid debug info indexes and when the lldb index cache was 
enabled, this would cause this issue to show up more often.

I modified an existing test case to test that all of this works correctly and 
doesn't crash.
---
 .../SymbolFile/DWARF/DWARFDebugInfo.cpp   | 77 +--
 .../Plugins/SymbolFile/DWARF/DWARFDebugInfo.h |  4 +
 .../Plugins/SymbolFile/DWARF/DWARFUnit.cpp| 27 ++-
 .../Plugins/SymbolFile/DWARF/DWARFUnit.h  | 28 ++-
 .../SymbolFile/DWARF/SymbolFileDWARF.cpp  | 32 
 .../SymbolFile/DWARF/SymbolFileDWARF.h| 11 +++
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.cpp   | 19 +
 .../SymbolFile/DWARF/SymbolFileDWARFDwo.h | 11 ++-
 .../DWARF/x86/dwp-separate-debug-file.cpp | 38 +
 9 files changed, 216 insertions(+), 31 deletions(-)

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp
index 340b9acf80d02..e59e328c6e7cb 100644
--- 

[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -218,6 +219,106 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) {
+  // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain.
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  // For each entry, grab its parent chain and check if we have a match.
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+std::optional> parent_chain =
+getParentChain(entry, parent_names.size() + 1);

clayborg wrote:

Gotcha, makes sense now. Ignore my comment!

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


[Lldb-commits] [lldb] [lldb] Add support for large watchpoints in lldb (PR #79962)

2024-01-31 Thread Jason Molenda via lldb-commits

jasonmolenda wrote:

Merged this PR and found two unexpected (and one expected that I forgot to skip 
a test on) CI bot failures.  I've collected enough logs to debug them locally I 
think, I reverted this patch from main until I have fixes and I will reland.

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


[Lldb-commits] [lldb] d347c56 - Revert "[lldb] Add support for large watchpoints in lldb (#79962)"

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T12:22:43-08:00
New Revision: d347c564299eeb8ad1fcb58c06914473d6a789d8

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

LOG: Revert "[lldb] Add support for large watchpoints in lldb (#79962)"

This reverts commit 57c66b35a885b571f9897d75d18f1d974c29e533.

Added: 


Modified: 
lldb/include/lldb/lldb-enumerations.h
lldb/packages/Python/lldbsuite/test/concurrent_base.py
lldb/source/Breakpoint/CMakeLists.txt
lldb/source/Breakpoint/Watchpoint.cpp
lldb/source/Breakpoint/WatchpointResource.cpp
lldb/source/Commands/CommandObjectWatchpoint.cpp
lldb/source/Plugins/Process/Utility/StopInfoMachException.cpp
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
lldb/source/Target/StopInfo.cpp

lldb/test/API/functionalities/watchpoint/large-watchpoint/TestLargeWatchpoint.py
lldb/unittests/Breakpoint/CMakeLists.txt

Removed: 
lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h
lldb/source/Breakpoint/WatchpointAlgorithms.cpp
lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/Makefile

lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/TestUnalignedLargeWatchpoint.py
lldb/test/API/functionalities/watchpoint/unaligned-large-watchpoint/main.c
lldb/unittests/Breakpoint/WatchpointAlgorithmsTests.cpp



diff  --git a/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h 
b/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h
deleted file mode 100644
index 9b5bb4e10f8fa..0
--- a/lldb/include/lldb/Breakpoint/WatchpointAlgorithms.h
+++ /dev/null
@@ -1,109 +0,0 @@
-//===-- WatchpointAlgorithms.h --*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#ifndef LLDB_BREAKPOINT_WATCHPOINTALGORITHMS_H
-#define LLDB_BREAKPOINT_WATCHPOINTALGORITHMS_H
-
-#include "lldb/Breakpoint/WatchpointResource.h"
-#include "lldb/Utility/ArchSpec.h"
-#include "lldb/lldb-public.h"
-
-#include 
-
-namespace lldb_private {
-
-class WatchpointAlgorithms {
-
-public:
-  /// Convert a user's watchpoint request into an array of memory
-  /// regions that can be watched by one hardware watchpoint register
-  /// on the current target.
-  ///
-  /// \param[in] addr
-  /// The start address specified by the user.
-  ///
-  /// \param[in] size
-  /// The number of bytes the user wants to watch.
-  ///
-  /// \param[in] read
-  /// True if we are watching for read accesses.
-  ///
-  /// \param[in] write
-  /// True if we are watching for write accesses.
-  /// \a read and \a write may both be true.
-  /// There is no "modify" style for WatchpointResources -
-  /// WatchpointResources are akin to the hardware watchpoint
-  /// registers which are either in terms of read or write.
-  /// "modify" distinction is done at the Watchpoint layer, where
-  /// we check the actual range of bytes the user requested.
-  ///
-  /// \param[in] supported_features
-  /// The bit flags in this parameter are set depending on which
-  /// WatchpointHardwareFeature enum values the current target supports.
-  /// The eWatchpointHardwareFeatureUnknown bit may be set if we
-  /// don't have specific information about what the remote stub
-  /// can support, and a reasonablec default will be used.
-  ///
-  /// \param[in] arch
-  /// The ArchSpec of the current Target.
-  ///
-  /// \return
-  /// A vector of WatchpointResourceSP's, one per hardware watchpoint
-  /// register needed.  We may return more WatchpointResources than the
-  /// target can watch at once; if all resources cannot be set, the
-  /// watchpoint cannot be set.
-  static std::vector AtomizeWatchpointRequest(
-  lldb::addr_t addr, size_t size, bool read, bool write,
-  lldb::WatchpointHardwareFeature supported_features, ArchSpec );
-
-  struct Region {
-lldb::addr_t addr;
-size_t size;
-  };
-
-protected:
-  /// Convert a user's watchpoint request into an array of addr+size that
-  /// can be watched with power-of-2 style hardware watchpoints.
-  ///
-  /// This is the default algorithm if we have no further information;
-  /// most watchpoint implementations can be assumed to be able to watch up
-  /// to pointer-size regions of memory in power-of-2 sizes and alingments.
-  ///
-  /// \param[in] user_addr
-  /// The user's start address.
-  ///
-  /// \param[in] user_size
-  /// The user's specified byte length.
-  ///
-  /// \param[in] min_byte_size
- 

[Lldb-commits] [lldb] cc4af03 - Revert "Add extra printing to TestWatchpointCount.py to debug CI fail"

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T12:22:38-08:00
New Revision: cc4af03a839293ff908b52bb3a79b6ed562fe198

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

LOG: Revert "Add extra printing to TestWatchpointCount.py to debug CI fail"

This reverts commit dad50fefa24e717927a4d3315ae70fe507d624e0.

Added: 


Modified: 
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py

Removed: 




diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py 
b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index be0618bfb4b11..8d7f37aecb25f 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -29,12 +29,6 @@ def test_watchpoint_count(self):
 second_watch = second_var.Watch(True, False, True, error)
 if not error.Success():
 self.fail("Failed to make watchpoint for x2: %s" % 
(error.GetCString()))
-# LWP_TODO: Adding temporary prints to debug a test
-# failure on the x86-64 Debian bot.
-self.runCmd("p ")
-self.runCmd("p ")
-self.runCmd("watchpoint list")
-
 process.Continue()
 
 stop_reason = thread.GetStopReason()
@@ -45,11 +39,6 @@ def test_watchpoint_count(self):
 self.assertEqual(stop_reason_descr, "watchpoint 1")
 
 process.Continue()
-# LWP_TODO: Adding temporary prints to debug a test
-# failure on the x86-64 Debian bot.
-self.runCmd("frame select 0")
-self.runCmd("disassemble")
-
 stop_reason = thread.GetStopReason()
 self.assertStopReason(
 stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x2 not 
hit"



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


[Lldb-commits] [lldb] 46643e0 - Revert "Collecting more logging to debug CI bots"

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T12:22:27-08:00
New Revision: 46643e07d4c1caae3b8fa77be3a4073300785d91

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

LOG: Revert "Collecting more logging to debug CI bots"

This reverts commit cf2533e75ec4360da460bb577e0a4e64f2d8997f.

Added: 


Modified: 
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
lldb/test/Shell/Watchpoint/ExpressionLanguage.test

Removed: 




diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py 
b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index 890b0dac6b9ef..be0618bfb4b11 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -34,8 +34,6 @@ def test_watchpoint_count(self):
 self.runCmd("p ")
 self.runCmd("p ")
 self.runCmd("watchpoint list")
-self.runCmd("frame select 0")
-self.runCmd("bt")
 
 process.Continue()
 
@@ -50,7 +48,6 @@ def test_watchpoint_count(self):
 # LWP_TODO: Adding temporary prints to debug a test
 # failure on the x86-64 Debian bot.
 self.runCmd("frame select 0")
-self.runCmd("bt")
 self.runCmd("disassemble")
 
 stop_reason = thread.GetStopReason()

diff  --git a/lldb/test/Shell/Watchpoint/ExpressionLanguage.test 
b/lldb/test/Shell/Watchpoint/ExpressionLanguage.test
index 245c441d4db4d..3966923778620 100644
--- a/lldb/test/Shell/Watchpoint/ExpressionLanguage.test
+++ b/lldb/test/Shell/Watchpoint/ExpressionLanguage.test
@@ -5,7 +5,6 @@
 settings  show interpreter.stop-command-source-on-error
 # CHECK: interpreter.stop-command-source-on-error (boolean) = false
 
-log enable -v lldb watch
 b main
 run
 # CHECK: stopped



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


[Lldb-commits] [lldb] 19f429a - Revert "Enable verbose watch log channel to debug x86-64-debian bot"

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T12:22:14-08:00
New Revision: 19f429a4bda124c655829f84bb9c1f76c86a547c

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

LOG: Revert "Enable verbose watch log channel to debug x86-64-debian bot"

This reverts commit fa42589fe31924b6176d7a92691c2f760b04ffd8.

Added: 


Modified: 
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py

Removed: 




diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py 
b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index d0bcb2e440b50..890b0dac6b9ef 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -21,9 +21,6 @@ def test_watchpoint_count(self):
 first_var = frame.FindVariable("x1")
 second_var = frame.FindVariable("x2")
 
-self.runCmd("log enable -v lldb watch")
-self.addTearDownHook(lambda: self.runCmd("log disable lldb watch"))
-
 error = lldb.SBError()
 first_watch = first_var.Watch(True, False, True, error)
 if not error.Success():



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


[Lldb-commits] [lldb] e95250c - Revert "Add logging to WatchpointAlgorithm"

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T12:22:20-08:00
New Revision: e95250cda09331779d483e910ab3cfe5d655567c

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

LOG: Revert "Add logging to WatchpointAlgorithm"

This reverts commit d6e1ae248e85295704e199a67405ea2a4c7e98b2.

Added: 


Modified: 
lldb/source/Breakpoint/WatchpointAlgorithms.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp 
b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
index 4e78bd9730521..95a978a17cbfd 100644
--- a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
+++ b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
@@ -10,8 +10,6 @@
 #include "lldb/Breakpoint/WatchpointResource.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/ArchSpec.h"
-#include "lldb/Utility/LLDBLog.h"
-#include "lldb/Utility/Log.h"
 
 #include 
 #include 
@@ -43,13 +41,8 @@ WatchpointAlgorithms::AtomizeWatchpointRequest(
 /*address_byte_size*/ arch.GetAddressByteSize());
   }
 
-  Log *log = GetLog(LLDBLog::Watchpoints);
-  LLDB_LOGV(log, "AtomizeWatchpointRequest user request addr {0:x} size {1}",
-addr, size);
   std::vector resources;
   for (Region  : entries) {
-LLDB_LOGV(log, "AtomizeWatchpointRequest creating resource {0:x} size {1}",
-  ent.addr, ent.size);
 WatchpointResourceSP wp_res_sp =
 std::make_shared(ent.addr, ent.size, read, write);
 resources.push_back(wp_res_sp);



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


[Lldb-commits] [lldb] 9d41fba - Revert "Add one more verbose watchpoint logging for arm-ubuntu"

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T12:22:07-08:00
New Revision: 9d41fba91cc0a1c0cbad1de9fd5a1f78dd540b1c

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

LOG: Revert "Add one more verbose watchpoint logging for arm-ubuntu"

This reverts commit c84f2bac93f38c903bae2e92fc7749d93c2e1112.

Added: 


Modified: 
lldb/source/Breakpoint/WatchpointAlgorithms.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp 
b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
index 21993c5f76945..4e78bd9730521 100644
--- a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
+++ b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
@@ -77,13 +77,6 @@ WatchpointAlgorithms::PowerOf2Watchpoints(addr_t user_addr, 
size_t user_size,
   size_t max_byte_size,
   uint32_t address_byte_size) {
 
-  Log *log = GetLog(LLDBLog::Watchpoints);
-  LLDB_LOGV(log,
-"AtomizeWatchpointRequest user request addr {0:x} size {1} "
-"min_byte_size {2}, max_byte_size {3}, address_byte_size {4}",
-user_addr, user_size, min_byte_size, max_byte_size,
-address_byte_size);
-
   // Can't watch zero bytes.
   if (user_size == 0)
 return {};



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


[Lldb-commits] [lldb] 209fe1f - Revert "[lldb][progress][NFC] Add unit test for progress reports (#79533)"

2024-01-31 Thread Chelsea Cassanova via lldb-commits

Author: Chelsea Cassanova
Date: 2024-01-31T11:58:11-08:00
New Revision: 209fe1f3d70d1c4a20bb2687e0d0a94b1bbfa0c6

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

LOG: Revert "[lldb][progress][NFC] Add unit test for progress reports (#79533)"

This reverts commit 51e0d1b707a15dd3b96e0c4f1a29ca4dfc79cda0.
That commit breaks a unit test:

```
Failed Tests (1):
  lldb-unit :: Core/./LLDBCoreTests/4/8
```

Added: 


Modified: 
lldb/unittests/Core/CMakeLists.txt

Removed: 
lldb/unittests/Core/ProgressReportTest.cpp



diff  --git a/lldb/unittests/Core/CMakeLists.txt 
b/lldb/unittests/Core/CMakeLists.txt
index d40c357e3f463..b3cddd150635b 100644
--- a/lldb/unittests/Core/CMakeLists.txt
+++ b/lldb/unittests/Core/CMakeLists.txt
@@ -7,7 +7,6 @@ add_lldb_unittest(LLDBCoreTests
   FormatEntityTest.cpp
   MangledTest.cpp
   ModuleSpecTest.cpp
-  ProgressReportTest.cpp
   RichManglingContextTest.cpp
   SourceLocationSpecTest.cpp
   SourceManagerTest.cpp

diff  --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
deleted file mode 100644
index 77222560d5702..0
--- a/lldb/unittests/Core/ProgressReportTest.cpp
+++ /dev/null
@@ -1,124 +0,0 @@
-//===-- ProgressReportTest.cpp 
===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
-#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
-#include "TestingSupport/SubsystemRAII.h"
-#include "lldb/Core/Debugger.h"
-#include "lldb/Core/Progress.h"
-#include "lldb/Host/FileSystem.h"
-#include "lldb/Host/HostInfo.h"
-#include "lldb/Utility/Listener.h"
-#include "gtest/gtest.h"
-#include 
-
-using namespace lldb;
-using namespace lldb_private;
-
-class ProgressReportTest : public ::testing::Test {
-  SubsystemRAII subsystems;
-
-  // The debugger's initialization function can't be called with no arguments
-  // so calling it using SubsystemRAII will cause the test build to fail as
-  // SubsystemRAII will call Initialize with no arguments. As such we set it up
-  // here the usual way.
-  void SetUp() override { Debugger::Initialize(nullptr); }
-  void TearDown() override { Debugger::Terminate(); }
-};
-
-TEST_F(ProgressReportTest, TestReportCreation) {
-  std::chrono::milliseconds timeout(100);
-
-  // Set up the debugger, make sure that was done properly.
-  ArchSpec arch("x86_64-apple-macosx-");
-  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, ));
-
-  DebuggerSP debugger_sp = Debugger::CreateInstance();
-  ASSERT_TRUE(debugger_sp);
-
-  // Get the debugger's broadcaster.
-  Broadcaster  = debugger_sp->GetBroadcaster();
-
-  // Create a listener, make sure it can receive events and that it's
-  // listening to the correct broadcast bit.
-  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
-
-  listener_sp->StartListeningForEvents(,
-   Debugger::eBroadcastBitProgress);
-  EXPECT_TRUE(
-  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
-
-  EventSP event_sp;
-  const ProgressEventData *data;
-
-  // Scope this for RAII on the progress objects.
-  // Create progress reports and check that their respective events for having
-  // started and ended are broadcasted.
-  {
-Progress progress1("Progress report 1", "Starting report 1");
-Progress progress2("Progress report 2", "Starting report 2");
-Progress progress3("Progress report 3", "Starting report 3");
-  }
-
-  // Start popping events from the queue, they should have been recevied
-  // in this order:
-  // Starting progress: 1, 2, 3
-  // Ending progress: 3, 2, 1
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
-  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
-
-  ASSERT_EQ(data->GetDetails(), "Starting report 1");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
-
-  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
-  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
-
-  ASSERT_EQ(data->GetDetails(), "Starting report 2");
-  ASSERT_FALSE(data->IsFinite());
-  ASSERT_FALSE(data->GetCompleted());
-  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
-  ASSERT_EQ(data->GetMessage(), "Progress report 2: Starting report 2");
-
-  

[Lldb-commits] [lldb] [lldb][NFCI] Remove m_being_created from Breakpoint classes (PR #79716)

2024-01-31 Thread Alex Langford via lldb-commits

https://github.com/bulbazord updated 
https://github.com/llvm/llvm-project/pull/79716

>From f7bc2e013fb4a5cac93d2c5856983796459fb84b Mon Sep 17 00:00:00 2001
From: Alex Langford 
Date: Sat, 27 Jan 2024 15:54:16 -0800
Subject: [PATCH 1/4] [lldb][NFCI] Remove m_being_created from Breakpoint
 classes

The purpose of m_being_created in these classes was to prevent
broadcasting an event related to these Breakpoints during the creation
of the breakpoint (i.e. in the constructor). In Breakpoint and
Watchpoint, m_being_created had no effect. That is to say, removing it
does not change behavior.
However, BreakpointLocation does still use m_being_created. In the
constructor, SetThreadID is called which does broadcast an event only if
`m_being_created` is false. Instead of having this logic be roundabout,
the constructor instead calls `SetThreadIDInternal`, which actually
changes the thread ID. `SetThreadID` also will call
`SetThreadIDInternal` in addition to broadcasting a changed event.
---
 lldb/include/lldb/Breakpoint/Breakpoint.h |  1 -
 .../lldb/Breakpoint/BreakpointLocation.h  |  3 +-
 lldb/include/lldb/Breakpoint/Watchpoint.h |  2 --
 lldb/source/Breakpoint/Breakpoint.cpp | 22 +---
 lldb/source/Breakpoint/BreakpointLocation.cpp | 34 ++-
 lldb/source/Breakpoint/Watchpoint.cpp |  8 ++---
 6 files changed, 32 insertions(+), 38 deletions(-)

diff --git a/lldb/include/lldb/Breakpoint/Breakpoint.h 
b/lldb/include/lldb/Breakpoint/Breakpoint.h
index 8c4308ab0bc12..0b6bf593be37a 100644
--- a/lldb/include/lldb/Breakpoint/Breakpoint.h
+++ b/lldb/include/lldb/Breakpoint/Breakpoint.h
@@ -637,7 +637,6 @@ class Breakpoint : public 
std::enable_shared_from_this,
   Breakpoint(Target _target, const Breakpoint _to_copy_from);
 
   // For Breakpoint only
-  bool m_being_created;
   bool
   m_hardware; // If this breakpoint is required to use a hardware 
breakpoint
   Target _target; // The target that holds this breakpoint.
diff --git a/lldb/include/lldb/Breakpoint/BreakpointLocation.h 
b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
index 2a4f9fc01bf32..273132c950825 100644
--- a/lldb/include/lldb/Breakpoint/BreakpointLocation.h
+++ b/lldb/include/lldb/Breakpoint/BreakpointLocation.h
@@ -313,6 +313,8 @@ class BreakpointLocation
 
   void UndoBumpHitCount();
 
+  void SetThreadIDInternal(lldb::tid_t thread_id);
+
   // Constructors and Destructors
   //
   // Only the Breakpoint can make breakpoint locations, and it owns them.
@@ -337,7 +339,6 @@ class BreakpointLocation
  bool check_for_resolver = true);
 
   // Data members:
-  bool m_being_created;
   bool m_should_resolve_indirect_functions;
   bool m_is_reexported;
   bool m_is_indirect;
diff --git a/lldb/include/lldb/Breakpoint/Watchpoint.h 
b/lldb/include/lldb/Breakpoint/Watchpoint.h
index 22fdfd686c3f1..fc11a466ba605 100644
--- a/lldb/include/lldb/Breakpoint/Watchpoint.h
+++ b/lldb/include/lldb/Breakpoint/Watchpoint.h
@@ -227,8 +227,6 @@ class Watchpoint : public 
std::enable_shared_from_this,
   WatchpointOptions
   m_options; // Settable watchpoint options, which is a delegate to handle
  // the callback machinery.
-  bool m_being_created;
-
   std::unique_ptr m_condition_up; // The condition to test.
 
   void SetID(lldb::watch_id_t id) { m_id = id; }
diff --git a/lldb/source/Breakpoint/Breakpoint.cpp 
b/lldb/source/Breakpoint/Breakpoint.cpp
index af5dcc9cd88d4..ae845e92762b9 100644
--- a/lldb/source/Breakpoint/Breakpoint.cpp
+++ b/lldb/source/Breakpoint/Breakpoint.cpp
@@ -44,17 +44,14 @@ const char 
*Breakpoint::g_option_names[static_cast(
 Breakpoint::Breakpoint(Target , SearchFilterSP _sp,
BreakpointResolverSP _sp, bool hardware,
bool resolve_indirect_symbols)
-: m_being_created(true), m_hardware(hardware), m_target(target),
-  m_filter_sp(filter_sp), m_resolver_sp(resolver_sp), m_options(true),
-  m_locations(*this), m_resolve_indirect_symbols(resolve_indirect_symbols),
-  m_hit_counter() {
-  m_being_created = false;
-}
+: m_hardware(hardware), m_target(target), m_filter_sp(filter_sp),
+  m_resolver_sp(resolver_sp), m_options(true), m_locations(*this),
+  m_resolve_indirect_symbols(resolve_indirect_symbols), m_hit_counter() {}
 
 Breakpoint::Breakpoint(Target _target, const Breakpoint _bp)
-: m_being_created(true), m_hardware(source_bp.m_hardware),
-  m_target(new_target), m_name_list(source_bp.m_name_list),
-  m_options(source_bp.m_options), m_locations(*this),
+: m_hardware(source_bp.m_hardware), m_target(new_target),
+  m_name_list(source_bp.m_name_list), m_options(source_bp.m_options),
+  m_locations(*this),
   m_resolve_indirect_symbols(source_bp.m_resolve_indirect_symbols),
   m_hit_counter() {}
 
@@ -979,9 +976,8 @@ bool 
Breakpoint::EvaluatePrecondition(StoppointCallbackContext ) {
 
 void Breakpoint::SendBreakpointChangedEvent(
 

[Lldb-commits] [openmp] [libcxx] [clang] [clang-tools-extra] [llvm] [lldb] [mlir] [compiler-rt] [lld] [libc] [libcxxabi] [flang] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits`

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/9] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 

[Lldb-commits] [lldb] c84f2ba - Add one more verbose watchpoint logging for arm-ubuntu

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T11:45:08-08:00
New Revision: c84f2bac93f38c903bae2e92fc7749d93c2e1112

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

LOG: Add one more verbose watchpoint logging for arm-ubuntu

Added: 


Modified: 
lldb/source/Breakpoint/WatchpointAlgorithms.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp 
b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
index 4e78bd9730521..21993c5f76945 100644
--- a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
+++ b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
@@ -77,6 +77,13 @@ WatchpointAlgorithms::PowerOf2Watchpoints(addr_t user_addr, 
size_t user_size,
   size_t max_byte_size,
   uint32_t address_byte_size) {
 
+  Log *log = GetLog(LLDBLog::Watchpoints);
+  LLDB_LOGV(log,
+"AtomizeWatchpointRequest user request addr {0:x} size {1} "
+"min_byte_size {2}, max_byte_size {3}, address_byte_size {4}",
+user_addr, user_size, min_byte_size, max_byte_size,
+address_byte_size);
+
   // Can't watch zero bytes.
   if (user_size == 0)
 return {};



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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -218,6 +219,106 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) {
+  // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain.
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  // For each entry, grab its parent chain and check if we have a match.
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+std::optional> parent_chain =
+getParentChain(entry, parent_names.size() + 1);

felipepiovezan wrote:

> Since we are only fetching the same number of items

Actually, rereading this portion of your comment, this is the faulty 
assumption. We are not fetching the same number of items, we are fetching +1 
items.

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -218,6 +219,106 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) {
+  // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain.
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  // For each entry, grab its parent chain and check if we have a match.
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+std::optional> parent_chain =
+getParentChain(entry, parent_names.size() + 1);

felipepiovezan wrote:

The `parent_names.size() + 1` is only an optimization (we only need one extra 
parent to determine that the parent scopes have a different number of entries)

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -218,6 +219,106 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) {
+  // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain.
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  // For each entry, grab its parent chain and check if we have a match.
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+std::optional> parent_chain =
+getParentChain(entry, parent_names.size() + 1);

felipepiovezan wrote:

Not sure I follow, the intent is to only match things that are 100% identical.
The parent chain size is checked first thing inside `SameParentChain`:

```
bool DebugNamesDWARFIndex::SameParentChain(...) {
  if (parent_entries.size() != parent_names.size())
 return false;
```

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -218,6 +219,106 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) {
+  // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain.
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  // For each entry, grab its parent chain and check if we have a match.
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+std::optional> parent_chain =
+getParentChain(entry, parent_names.size() + 1);

clayborg wrote:

Since we are only fetching the same number of items, does this mean that a 
search for "a::b::c" will match "z::a::b::c" if we only fetch 2 parent items? 
It seems if the parent chain size differs then we want to not match anything?

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


[Lldb-commits] [lldb] [lldb][progress][NFC] Add unit test for progress reports (PR #79533)

2024-01-31 Thread Chelsea Cassanova via lldb-commits

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


[Lldb-commits] [lldb] 51e0d1b - [lldb][progress][NFC] Add unit test for progress reports (#79533)

2024-01-31 Thread via lldb-commits

Author: Chelsea Cassanova
Date: 2024-01-31T11:38:54-08:00
New Revision: 51e0d1b707a15dd3b96e0c4f1a29ca4dfc79cda0

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

LOG: [lldb][progress][NFC] Add unit test for progress reports (#79533)

This test is being added as a way to check the behaviour of how progress
events are broadcasted when reports are started and ended with the
current implementation of progress reports. Here we're mainly checking
and ensuring that the current behaviour is that progress events are
broadcasted individually and placed in the event queue in order of their
creation and deletion.

Added: 
lldb/unittests/Core/ProgressReportTest.cpp

Modified: 
lldb/unittests/Core/CMakeLists.txt

Removed: 




diff  --git a/lldb/unittests/Core/CMakeLists.txt 
b/lldb/unittests/Core/CMakeLists.txt
index b3cddd150635b..d40c357e3f463 100644
--- a/lldb/unittests/Core/CMakeLists.txt
+++ b/lldb/unittests/Core/CMakeLists.txt
@@ -7,6 +7,7 @@ add_lldb_unittest(LLDBCoreTests
   FormatEntityTest.cpp
   MangledTest.cpp
   ModuleSpecTest.cpp
+  ProgressReportTest.cpp
   RichManglingContextTest.cpp
   SourceLocationSpecTest.cpp
   SourceManagerTest.cpp

diff  --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
new file mode 100644
index 0..77222560d5702
--- /dev/null
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -0,0 +1,124 @@
+//===-- ProgressReportTest.cpp 
===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
+#include "TestingSupport/SubsystemRAII.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Progress.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Utility/Listener.h"
+#include "gtest/gtest.h"
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+class ProgressReportTest : public ::testing::Test {
+  SubsystemRAII subsystems;
+
+  // The debugger's initialization function can't be called with no arguments
+  // so calling it using SubsystemRAII will cause the test build to fail as
+  // SubsystemRAII will call Initialize with no arguments. As such we set it up
+  // here the usual way.
+  void SetUp() override { Debugger::Initialize(nullptr); }
+  void TearDown() override { Debugger::Terminate(); }
+};
+
+TEST_F(ProgressReportTest, TestReportCreation) {
+  std::chrono::milliseconds timeout(100);
+
+  // Set up the debugger, make sure that was done properly.
+  ArchSpec arch("x86_64-apple-macosx-");
+  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, ));
+
+  DebuggerSP debugger_sp = Debugger::CreateInstance();
+  ASSERT_TRUE(debugger_sp);
+
+  // Get the debugger's broadcaster.
+  Broadcaster  = debugger_sp->GetBroadcaster();
+
+  // Create a listener, make sure it can receive events and that it's
+  // listening to the correct broadcast bit.
+  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
+
+  listener_sp->StartListeningForEvents(,
+   Debugger::eBroadcastBitProgress);
+  EXPECT_TRUE(
+  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
+
+  EventSP event_sp;
+  const ProgressEventData *data;
+
+  // Scope this for RAII on the progress objects.
+  // Create progress reports and check that their respective events for having
+  // started and ended are broadcasted.
+  {
+Progress progress1("Progress report 1", "Starting report 1");
+Progress progress2("Progress report 2", "Starting report 2");
+Progress progress3("Progress report 3", "Starting report 3");
+  }
+
+  // Start popping events from the queue, they should have been recevied
+  // in this order:
+  // Starting progress: 1, 2, 3
+  // Ending progress: 3, 2, 1
+  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+
+  ASSERT_EQ(data->GetDetails(), "Starting report 1");
+  ASSERT_FALSE(data->IsFinite());
+  ASSERT_FALSE(data->GetCompleted());
+  ASSERT_EQ(data->GetTotal(), Progress::kNonDeterministicTotal);
+  ASSERT_EQ(data->GetMessage(), "Progress report 1: Starting report 1");
+
+  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+
+  ASSERT_EQ(data->GetDetails(), "Starting report 2");
+  ASSERT_FALSE(data->IsFinite());
+  

[Lldb-commits] [lldb] [lldb][progress][NFC] Add unit test for progress reports (PR #79533)

2024-01-31 Thread Chelsea Cassanova via lldb-commits

https://github.com/chelcassanova updated 
https://github.com/llvm/llvm-project/pull/79533

>From 10343b6cdad410e09546dd5a98e29d272300ed2e Mon Sep 17 00:00:00 2001
From: Chelsea Cassanova 
Date: Thu, 25 Jan 2024 16:40:42 -0800
Subject: [PATCH 1/4] [lldb][progress][NFC] Add unit test for progress reports

This test is being added as a way to check the behaviour of how progress
events are broadcasted when reports are started and ended with the
current implementation of progress reports. Here we're mainly checking
and ensuring that the current behaviour is that progress events are
broadcasted individually and placed in the event queue in order of
their creation.
---
 lldb/unittests/Core/CMakeLists.txt |   1 +
 lldb/unittests/Core/ProgressReportTest.cpp | 105 +
 2 files changed, 106 insertions(+)
 create mode 100644 lldb/unittests/Core/ProgressReportTest.cpp

diff --git a/lldb/unittests/Core/CMakeLists.txt 
b/lldb/unittests/Core/CMakeLists.txt
index b3cddd150635b..d40c357e3f463 100644
--- a/lldb/unittests/Core/CMakeLists.txt
+++ b/lldb/unittests/Core/CMakeLists.txt
@@ -7,6 +7,7 @@ add_lldb_unittest(LLDBCoreTests
   FormatEntityTest.cpp
   MangledTest.cpp
   ModuleSpecTest.cpp
+  ProgressReportTest.cpp
   RichManglingContextTest.cpp
   SourceLocationSpecTest.cpp
   SourceManagerTest.cpp
diff --git a/lldb/unittests/Core/ProgressReportTest.cpp 
b/lldb/unittests/Core/ProgressReportTest.cpp
new file mode 100644
index 0..bdc168c9e077d
--- /dev/null
+++ b/lldb/unittests/Core/ProgressReportTest.cpp
@@ -0,0 +1,105 @@
+#include "Plugins/Platform/MacOSX/PlatformMacOSX.h"
+#include "Plugins/Platform/MacOSX/PlatformRemoteMacOSX.h"
+#include "lldb/Core/Debugger.h"
+#include "lldb/Core/Progress.h"
+#include "lldb/Host/FileSystem.h"
+#include "lldb/Host/HostInfo.h"
+#include "lldb/Utility/Listener.h"
+#include "gtest/gtest.h"
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+namespace {
+class ProgressReportTest : public ::testing::Test {
+public:
+  void SetUp() override {
+FileSystem::Initialize();
+HostInfo::Initialize();
+PlatformMacOSX::Initialize();
+Debugger::Initialize(nullptr);
+  }
+  void TearDown() override {
+Debugger::Terminate();
+PlatformMacOSX::Terminate();
+HostInfo::Terminate();
+FileSystem::Terminate();
+  }
+};
+} // namespace
+TEST_F(ProgressReportTest, TestReportCreation) {
+  std::chrono::milliseconds timeout(100);
+
+  // Set up the debugger, make sure that was done properly
+  ArchSpec arch("x86_64-apple-macosx-");
+  Platform::SetHostPlatform(PlatformRemoteMacOSX::CreateInstance(true, ));
+
+  DebuggerSP debugger_sp = Debugger::CreateInstance();
+  ASSERT_TRUE(debugger_sp);
+
+  // Get the debugger's broadcaster
+  Broadcaster  = debugger_sp->GetBroadcaster();
+
+  // Create a listener, make sure it can receive events and that it's
+  // listening to the correct broadcast bit
+  ListenerSP listener_sp = Listener::MakeListener("progress-listener");
+
+  listener_sp->StartListeningForEvents(,
+   Debugger::eBroadcastBitProgress);
+  EXPECT_TRUE(
+  broadcaster.EventTypeHasListeners(Debugger::eBroadcastBitProgress));
+
+  EventSP event_sp;
+  const ProgressEventData *data;
+
+  // Scope this for RAII on the progress objects
+  // Create progress reports and check that their respective events for having
+  // started are broadcasted
+  {
+Progress progress1("Progress report 1", "Starting report 1");
+EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+
+data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+ASSERT_EQ(data->GetDetails(), "Starting report 1");
+
+Progress progress2("Progress report 2", "Starting report 2");
+EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+
+data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+ASSERT_EQ(data->GetDetails(), "Starting report 2");
+
+Progress progress3("Progress report 3", "Starting report 3");
+EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+ASSERT_TRUE(event_sp);
+
+data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+ASSERT_EQ(data->GetDetails(), "Starting report 3");
+
+std::this_thread::sleep_for(timeout);
+  }
+
+  // Progress report objects should be destroyed at this point so
+  // get each report from the queue and check that they've been
+  // destroyed in reverse order
+  std::this_thread::sleep_for(timeout);
+  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+
+  ASSERT_EQ(data->GetTitle(), "Progress report 3");
+  ASSERT_TRUE(data->GetCompleted());
+
+  std::this_thread::sleep_for(timeout);
+  EXPECT_TRUE(listener_sp->GetEvent(event_sp, timeout));
+  data = ProgressEventData::GetEventDataFromEvent(event_sp.get());
+
+  ASSERT_EQ(data->GetTitle(), "Progress report 2");
+  ASSERT_TRUE(data->GetCompleted());
+
+  

[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Greg Clayton via lldb-commits


@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };

clayborg wrote:

We need to make sure enum values are 0 and 1 since the python synthetic stuff 
will return `True` or `False` still. It might be nice to move this enum into 
lldb-enumerations.h so that python can use it in future synthetic child 
providers, or people can update their synthetic python plugins to use the enum 
to be more readable.

As far as names go, do we want to be more clear about what these do and specify 
they are for children? Something like:
```
/// An enumeration that specifies if children need to be re-computed after a 
call to Update().
enum class ChildCacheState {
  Dynamic = 0, ///< Children need to be recomputed dynamically.
  Constant = 1, ///< Children will never change and don't need to be recomputed.
};
```


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


[Lldb-commits] [lldb] d6e1ae2 - Add logging to WatchpointAlgorithm

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T11:09:59-08:00
New Revision: d6e1ae248e85295704e199a67405ea2a4c7e98b2

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

LOG: Add logging to WatchpointAlgorithm

When verbose lldb watch channel is enabled, print the
user requested watchpoint and the resources we've
broken it up into.

Added: 


Modified: 
lldb/source/Breakpoint/WatchpointAlgorithms.cpp

Removed: 




diff  --git a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp 
b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
index 95a978a17cbfd..4e78bd9730521 100644
--- a/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
+++ b/lldb/source/Breakpoint/WatchpointAlgorithms.cpp
@@ -10,6 +10,8 @@
 #include "lldb/Breakpoint/WatchpointResource.h"
 #include "lldb/Target/Process.h"
 #include "lldb/Utility/ArchSpec.h"
+#include "lldb/Utility/LLDBLog.h"
+#include "lldb/Utility/Log.h"
 
 #include 
 #include 
@@ -41,8 +43,13 @@ WatchpointAlgorithms::AtomizeWatchpointRequest(
 /*address_byte_size*/ arch.GetAddressByteSize());
   }
 
+  Log *log = GetLog(LLDBLog::Watchpoints);
+  LLDB_LOGV(log, "AtomizeWatchpointRequest user request addr {0:x} size {1}",
+addr, size);
   std::vector resources;
   for (Region  : entries) {
+LLDB_LOGV(log, "AtomizeWatchpointRequest creating resource {0:x} size {1}",
+  ent.addr, ent.size);
 WatchpointResourceSP wp_res_sp =
 std::make_shared(ent.addr, ent.size, read, write);
 resources.push_back(wp_res_sp);



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


[Lldb-commits] [lldb] fa42589 - Enable verbose watch log channel to debug x86-64-debian bot

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T11:23:23-08:00
New Revision: fa42589fe31924b6176d7a92691c2f760b04ffd8

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

LOG: Enable verbose watch log channel to debug x86-64-debian bot

Added: 


Modified: 
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py

Removed: 




diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py 
b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index 890b0dac6b9ef..d0bcb2e440b50 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -21,6 +21,9 @@ def test_watchpoint_count(self):
 first_var = frame.FindVariable("x1")
 second_var = frame.FindVariable("x2")
 
+self.runCmd("log enable -v lldb watch")
+self.addTearDownHook(lambda: self.runCmd("log disable lldb watch"))
+
 error = lldb.SBError()
 first_watch = first_var.Watch(True, False, True, error)
 if not error.Success():



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


[Lldb-commits] [clang] [compiler-rt] [openmp] [libcxx] [libc] [llvm] [libcxxabi] [clang-tools-extra] [mlir] [lldb] [lld] [flang] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits`

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/8] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 

[Lldb-commits] [clang] [compiler-rt] [openmp] [libcxx] [libc] [llvm] [libcxxabi] [clang-tools-extra] [mlir] [lldb] [lld] [flang] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits`

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/8] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 

[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Adrian Prantl via lldb-commits


@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };

adrian-prantl wrote:

I don't have any better suggestion for a name.

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Adrian Prantl via lldb-commits


@@ -218,6 +219,106 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) {
+  // Bad data.
+  consumeError(parent.takeError());

adrian-prantl wrote:

Should/could we LLDB_LOG this to the dwarf channel here?

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Adrian Prantl via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Adrian Prantl via lldb-commits

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


[Lldb-commits] [llvm] [libcxxabi] [flang] [libc] [clang] [clang-tools-extra] [openmp] [mlir] [libcxx] [lldb] [compiler-rt] [lld] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits`

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/7] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 

[Lldb-commits] [lldb] [lldb] Add support for large watchpoints in lldb (PR #79962)

2024-01-31 Thread Jonas Devlieghere via lldb-commits


@@ -0,0 +1,142 @@
+//===-- WatchpointAlgorithms.cpp 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "lldb/Breakpoint/WatchpointAlgorithms.h"
+#include "lldb/Breakpoint/WatchpointResource.h"
+#include "lldb/Target/Process.h"
+#include "lldb/Utility/ArchSpec.h"
+
+#include 
+#include 
+
+using namespace lldb;
+using namespace lldb_private;
+
+std::vector
+WatchpointAlgorithms::AtomizeWatchpointRequest(
+addr_t addr, size_t size, bool read, bool write,
+WatchpointHardwareFeature supported_features, ArchSpec ) {
+
+  std::vector entries;
+
+  if (supported_features &
+  WatchpointHardwareFeature::eWatchpointHardwareArmMASK) {
+entries =
+PowerOf2Watchpoints(addr, size,
+/*min_byte_size*/ 1,

JDevlieghere wrote:

Still missing the `=` at the end of the comment.

```/*min_byte_size=*/ 1,```

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


[Lldb-commits] [lldb] [lldb] Add support for large watchpoints in lldb (PR #79962)

2024-01-31 Thread Jonas Devlieghere via lldb-commits


@@ -0,0 +1,109 @@
+//===-- WatchpointAlgorithms.h --*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#ifndef LLDB_BREAKPOINT_WATCHPOINTALGORITHMS_H
+#define LLDB_BREAKPOINT_WATCHPOINTALGORITHMS_H
+
+#include "lldb/Breakpoint/WatchpointResource.h"
+#include "lldb/Utility/ArchSpec.h"
+#include "lldb/lldb-public.h"
+
+#include 
+
+namespace lldb_private {
+
+class WatchpointAlgorithms {
+
+public:
+  /// Convert a user's watchpoint request into an array of memory
+  /// regions that can be watched by one hardware watchpoint register
+  /// on the current target.
+  ///
+  /// \param[in] addr
+  /// The start address specified by the user.
+  ///
+  /// \param[in] size
+  /// The number of bytes the user wants to watch.
+  ///
+  /// \param[in] read
+  /// True if we are watching for read accesses.
+  ///
+  /// \param[in] write
+  /// True if we are watching for write accesses.
+  /// \a read and \a write may both be true.
+  /// There is no "modify" style for WatchpointResources -
+  /// WatchpointResources are akin to the hardware watchpoint
+  /// registers which are either in terms of read or write.
+  /// "modify" distinction is done at the Watchpoint layer, where
+  /// we check the actual range of bytes the user requested.
+  ///
+  /// \param[in] supported_features
+  /// The bit flags in this parameter are set depending on which
+  /// WatchpointHardwareFeature enum values the current target supports.
+  /// The eWatchpointHardwareFeatureUnknown bit may be set if we
+  /// don't have specific information about what the remote stub
+  /// can support, and a reasonablec default will be used.
+  ///
+  /// \param[in] arch
+  /// The ArchSpec of the current Target.
+  ///
+  /// \return
+  /// A vector of WatchpointResourceSP's, one per hardware watchpoint
+  /// register needed.  We may return more WatchpointResources than the
+  /// target can watch at once; if all resources cannot be set, the
+  /// watchpoint cannot be set.
+  static std::vector AtomizeWatchpointRequest(
+  lldb::addr_t addr, size_t size, bool read, bool write,
+  lldb::WatchpointHardwareFeature supported_features, ArchSpec );
+
+  struct Region {
+lldb::addr_t addr;
+size_t size;
+  };
+
+protected:
+  /// Convert a user's watchpoint request into an array of addr+size that
+  /// can be watched with power-of-2 style hardware watchpoints.
+  ///
+  /// This is the default algorithm if we have no further information;
+  /// most watchpoint implementations can be assumed to be able to watch up
+  /// to pointer-size regions of memory in power-of-2 sizes and alingments.
+  ///
+  /// \param[in] user_addr
+  /// The user's start address.
+  ///
+  /// \param[in] user_size
+  /// The user's specified byte length.
+  ///
+  /// \param[in] min_byte_size
+  /// The minimum byte size supported on this target.
+  /// In most cases, this will be 1.  AArch64 MASK watchpoints can
+  /// watch a minimum of 8 bytes (although Byte Address Select watchpoints
+  /// can watch 1 to pointer-size bytes in a pointer-size aligned granule).
+  ///
+  /// \param[in] max_byte_size
+  /// The maximum byte size supported for one watchpoint on this target.
+  ///
+  /// \param[in] address_byte_size
+  /// The address byte size on this target.
+  static std::vector PowerOf2Watchpoints(lldb::addr_t user_addr,
+ size_t user_size,
+ size_t min_byte_size,
+ size_t max_byte_size,
+ uint32_t address_byte_size);
+};
+
+// For the unittests to have access to the individual algorithms
+class WatchpointAlgorithmsTest : public WatchpointAlgorithms {
+public:
+  using WatchpointAlgorithms::PowerOf2Watchpoints;
+};

JDevlieghere wrote:

I would've put this in the unittest. 

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


[Lldb-commits] [lldb] [lldb] Fix a crash when using .dwp files and make type lookup reliable with the index cache (PR #79544)

2024-01-31 Thread Adrian Prantl via lldb-commits


@@ -81,27 +81,88 @@ void DWARFDebugInfo::ParseUnitsFor(DIERef::Section section) 
{
 : m_context.getOrLoadDebugInfoData();
   lldb::offset_t offset = 0;
   while (data.ValidOffset(offset)) {
-llvm::Expected unit_sp = DWARFUnit::extract(
-m_dwarf, m_units.size(), data, section, );
+llvm::Expected expected_unit_sp =
+DWARFUnit::extract(m_dwarf, m_units.size(), data, section, );
 
-if (!unit_sp) {
+if (!expected_unit_sp) {

adrian-prantl wrote:

Maybe we could at least LLDB_LOG the error into the dwarf channel?

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


[Lldb-commits] [lldb] [lldb] Fix a crash when using .dwp files and make type lookup reliable with the index cache (PR #79544)

2024-01-31 Thread Adrian Prantl via lldb-commits


@@ -1,15 +1,88 @@
 // REQUIRES: lld
 
-// RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -g -c %s -o %t.o
-// RUN: ld.lld %t.o -o %t
-// RUN: llvm-dwp %t.dwo -o %t.dwp
-// RUN: rm %t.dwo
-// RUN: llvm-objcopy --only-keep-debug %t %t.debug
-// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.debug %t
-// RUN: %lldb %t -o "target variable a" -b | FileCheck %s
+// RUN: %clang -target x86_64-pc-linux -gsplit-dwarf -gdwarf-5 -c %s -o 
%t.dwarf5.o
+// RUN: ld.lld %t.dwarf5.o -o %t.dwarf5
+// RUN: llvm-dwp %t.dwarf5.dwo -o %t.dwarf5.dwp
+// RUN: rm %t.dwarf5.dwo
+// RUN: llvm-objcopy --only-keep-debug %t.dwarf5 %t.dwarf5.debug
+// RUN: llvm-objcopy --strip-all --add-gnu-debuglink=%t.dwarf5.debug %t.dwarf5
+// RUN: %lldb %t.dwarf5 -o "target variable a" -b | FileCheck %s
+
+// Run one time with the index cache enabled to populate the index cache. When
+// we populate the index cache we have to parse all of the DWARF debug info
+// and it is always available.
+// RUN: rm -rf %T/lldb-index-cache

adrian-prantl wrote:

%T is the parent dir of %t. That sounds dangerous because multiple parallel 
tests could write an lldb-index-cache there and create nondeterministic result. 
Could you move the index cache into a test-specific dir like `mkdir -p %t`?

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


[Lldb-commits] [llvm] [libcxxabi] [flang] [libc] [clang] [clang-tools-extra] [openmp] [mlir] [libcxx] [lldb] [compiler-rt] [lld] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits`

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov edited 
https://github.com/llvm/llvm-project/pull/79978
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [openmp] [libcxx] [clang] [clang-tools-extra] [llvm] [lldb] [mlir] [compiler-rt] [lld] [libc] [libcxxabi] [flang] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits`

2024-01-31 Thread Hristo Hristov via lldb-commits


@@ -0,0 +1,34 @@
+//===--===//
+//
+// 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___MEMORY_ALLOCATION_RESULT_H
+#define _LIBCPP___MEMORY_ALLOCATION_RESULT_H
+
+#include <__config>
+#include 
+
+#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
+#  pragma GCC system_header
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+#if _LIBCPP_STD_VER >= 23
+
+template 

H-G-Hristov wrote:

I guess this can be folded into `allocator_traits.h`.

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


[Lldb-commits] [openmp] [libcxx] [clang] [clang-tools-extra] [llvm] [lldb] [mlir] [compiler-rt] [lld] [libc] [libcxxabi] [flang] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits`

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/6] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 

[Lldb-commits] [libcxx] [clang] [clang-tools-extra] [llvm] [lldb] [mlir] [compiler-rt] [lld] [libc] [flang] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits` (PR #79978)

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/6] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 

[Lldb-commits] [lldb] [lldb][NFCI] Remove CommandObjectProcessHandle::VerifyCommandOptionValue (PR #79901)

2024-01-31 Thread Alex Langford via lldb-commits

bulbazord wrote:

@clayborg how does this look to you?

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


[Lldb-commits] [lldb] cf2533e - Collecting more logging to debug CI bots

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T10:39:59-08:00
New Revision: cf2533e75ec4360da460bb577e0a4e64f2d8997f

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

LOG: Collecting more logging to debug CI bots
Watchpoint test fails on arm-ubuntu and x86-64-debian

Added: 


Modified: 
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
lldb/test/Shell/Watchpoint/ExpressionLanguage.test

Removed: 




diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py 
b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index be0618bfb4b11..890b0dac6b9ef 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -34,6 +34,8 @@ def test_watchpoint_count(self):
 self.runCmd("p ")
 self.runCmd("p ")
 self.runCmd("watchpoint list")
+self.runCmd("frame select 0")
+self.runCmd("bt")
 
 process.Continue()
 
@@ -48,6 +50,7 @@ def test_watchpoint_count(self):
 # LWP_TODO: Adding temporary prints to debug a test
 # failure on the x86-64 Debian bot.
 self.runCmd("frame select 0")
+self.runCmd("bt")
 self.runCmd("disassemble")
 
 stop_reason = thread.GetStopReason()

diff  --git a/lldb/test/Shell/Watchpoint/ExpressionLanguage.test 
b/lldb/test/Shell/Watchpoint/ExpressionLanguage.test
index 3966923778620..245c441d4db4d 100644
--- a/lldb/test/Shell/Watchpoint/ExpressionLanguage.test
+++ b/lldb/test/Shell/Watchpoint/ExpressionLanguage.test
@@ -5,6 +5,7 @@
 settings  show interpreter.stop-command-source-on-error
 # CHECK: interpreter.stop-command-source-on-error (boolean) = false
 
+log enable -v lldb watch
 b main
 run
 # CHECK: stopped



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


[Lldb-commits] [lldb] [lldb][progress][NFC] Add unit test for progress reports (PR #79533)

2024-01-31 Thread Jonas Devlieghere via lldb-commits

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

There's a handful of comments that are missing a period. Otherwise this LGTM. 

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Michael Buch via lldb-commits


@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };

Michael137 wrote:

I like `Drop`/`Preserve`, that would make the intent clearer.

Any objections @jimingham @clayborg @adrian-prantl ?

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Dave Lee via lldb-commits


@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };

kastiglione wrote:

what do you think about making this a verb rather than a noun? Something along 
the lines of `CacheAction` with cases `Clear`/`Drop`/`ThrowAway`/etc, and 
`Keep`/`Preserve`/`Reuse`/etc?


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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -218,6 +219,104 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+static std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) { // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  // Fallback: use the base class implementation.
+  auto fallback_impl = [&](const DebugNames::Entry ) {
+return ProcessEntry(entry, [&](DWARFDIE die) {
+  return GetFullyQualifiedTypeImpl(context, die, callback);
+});
+  };

felipepiovezan wrote:

I've inlined this one, please have a look

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits

felipepiovezan wrote:

Addressed all review comments (waiting for a reply on the one comment about 
inlining a lambda)

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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits

https://github.com/felipepiovezan updated 
https://github.com/llvm/llvm-project/pull/79932

>From ee09231ea101d97c1607552e161adcfe911a23f5 Mon Sep 17 00:00:00 2001
From: Felipe de Azevedo Piovezan 
Date: Mon, 29 Jan 2024 18:25:42 -0800
Subject: [PATCH 1/2] [lldb][DWARFIndex] Use IDX_parent to implement
 GetFullyQualifiedType query

This commit changes DebugNamesDWARFIndex so that it now overrides
`GetFullyQualifiedType` and attempts to use DW_IDX_parent, when available, to
speed up such queries. When this type of information is not available, the
base-class implementation is used.

With this commit, we now achieve the 4x speedups reported in [1].

[1]: 
https://discourse.llvm.org/t/rfc-improve-dwarf-5-debug-names-type-lookup-parsing-speed/74151/38
---
 .../SymbolFile/DWARF/DWARFDeclContext.h   |   4 +
 .../SymbolFile/DWARF/DebugNamesDWARFIndex.cpp |  99 +
 .../SymbolFile/DWARF/DebugNamesDWARFIndex.h   |   9 +
 .../SymbolFile/DWARF/SymbolFileDWARF.h|   3 +
 .../unittests/SymbolFile/DWARF/CMakeLists.txt |   1 +
 .../DWARF/DWARFDebugNamesIndexTest.cpp| 210 ++
 6 files changed, 326 insertions(+)
 create mode 100644 lldb/unittests/SymbolFile/DWARF/DWARFDebugNamesIndexTest.cpp

diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
index a20a862d34029..7e6c5f51f4beb 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h
@@ -47,6 +47,10 @@ class DWARFDeclContext {
 
   DWARFDeclContext() : m_entries() {}
 
+  DWARFDeclContext(llvm::ArrayRef entries) {
+llvm::append_range(m_entries, entries);
+  }
+
   void AppendDeclContext(dw_tag_t tag, const char *name) {
 m_entries.push_back(Entry(tag, name));
   }
diff --git a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
index b718f98340a70..6891d2fb6f610 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp
@@ -13,6 +13,7 @@
 #include "lldb/Core/Module.h"
 #include "lldb/Utility/RegularExpression.h"
 #include "lldb/Utility/Stream.h"
+#include "llvm/ADT/Sequence.h"
 #include 
 
 using namespace lldb_private;
@@ -218,6 +219,104 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+static std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) { // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  // Fallback: use the base class implementation.
+  auto fallback_impl = [&](const DebugNames::Entry ) {
+return ProcessEntry(entry, [&](DWARFDIE die) {
+  return GetFullyQualifiedTypeImpl(context, die, callback);
+});
+  };
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+auto parent_chain = getParentChain(entry, parent_names.size() + 1);
+
+if (!parent_chain) {
+  if (!fallback_impl(entry))
+return;
+  continue;
+}
+
+if (SameParentChain(parent_names, *parent_chain) &&
+!ProcessEntry(entry, callback))
+  return;
+  }
+}
+
+bool DebugNamesDWARFIndex::SameParentChain(
+llvm::ArrayRef parent_names,
+llvm::ArrayRef parent_entries) const {
+
+  if (parent_entries.size() != parent_names.size())
+return false;
+
+  auto SameAsEntryATName = [this](llvm::StringRef name,
+  const DebugNames::Entry ) {
+auto maybe_dieoffset = entry.getDIEUnitOffset();
+if 

[Lldb-commits] [lld] [llvm] [libc] [lldb] [compiler-rt] [clang-tools-extra] [flang] [libcxx] [clang] [TTI][RISCV]Improve costs for fixed vector whole reg extract/insert. (PR #80164)

2024-01-31 Thread Alexey Bataev via lldb-commits

https://github.com/alexey-bataev updated 
https://github.com/llvm/llvm-project/pull/80164

>From cfd0dcfa1f5fabd12cf4d7bf8d5a10bd324ace0a Mon Sep 17 00:00:00 2001
From: Alexey Bataev 
Date: Wed, 31 Jan 2024 16:47:49 +
Subject: [PATCH] =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20initia?=
 =?UTF-8?q?l=20version?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Created using spr 1.3.5
---
 .../Target/RISCV/RISCVTargetTransformInfo.cpp |  42 +
 .../RISCV/shuffle-extract_subvector.ll| 174 +-
 .../RISCV/shuffle-insert_subvector.ll |  42 ++---
 .../CostModel/RISCV/shuffle-interleave.ll |   6 +-
 4 files changed, 153 insertions(+), 111 deletions(-)

diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp 
b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index fe1cdb2dfa423..465a05b6497a2 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -326,6 +326,48 @@ InstructionCost 
RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind,
 switch (Kind) {
 default:
   break;
+case TTI::SK_ExtractSubvector:
+  if (isa(SubTp)) {
+unsigned TpRegs = getRegUsageForType(Tp);
+unsigned NumElems =
+divideCeil(Tp->getElementCount().getFixedValue(), TpRegs);
+// Whole vector extract - just the vector itself + (possible) vsetvli.
+// TODO: consider adding the cost for vsetvli.
+if (Index % NumElems == 0) {
+  std::pair SubLT =
+  getTypeLegalizationCost(SubTp);
+  return Index == 0
+ ? TTI::TCC_Free
+ : SubLT.first * getRISCVInstructionCost(RISCV::VMV_V_V,
+ SubLT.second,
+ CostKind);
+}
+  }
+  break;
+case TTI::SK_InsertSubvector:
+  if (auto *FSubTy = dyn_cast(SubTp)) {
+unsigned TpRegs = getRegUsageForType(Tp);
+unsigned SubTpRegs = getRegUsageForType(SubTp);
+unsigned NextSubTpRegs = getRegUsageForType(FixedVectorType::get(
+Tp->getElementType(), FSubTy->getNumElements() + 1));
+unsigned NumElems =
+divideCeil(Tp->getElementCount().getFixedValue(), TpRegs);
+// Whole vector insert - just the vector itself + (possible) vsetvli.
+// TODO: consider adding the cost for vsetvli.
+if (Index % NumElems == 0 &&
+(any_of(Args, UndefValue::classof) ||
+ (SubTpRegs != 0 && SubTpRegs != NextSubTpRegs &&
+  TpRegs / SubTpRegs > 1))) {
+  std::pair SubLT =
+  getTypeLegalizationCost(SubTp);
+  return Index == 0
+ ? TTI::TCC_Free
+ : SubLT.first * getRISCVInstructionCost(RISCV::VMV_V_V,
+ SubLT.second,
+ CostKind);
+}
+  }
+  break;
 case TTI::SK_PermuteSingleSrc: {
   if (Mask.size() >= 2 && LT.second.isFixedLengthVector()) {
 MVT EltTp = LT.second.getVectorElementType();
diff --git a/llvm/test/Analysis/CostModel/RISCV/shuffle-extract_subvector.ll 
b/llvm/test/Analysis/CostModel/RISCV/shuffle-extract_subvector.ll
index 76cb1955a2b37..901d66e1124d8 100644
--- a/llvm/test/Analysis/CostModel/RISCV/shuffle-extract_subvector.ll
+++ b/llvm/test/Analysis/CostModel/RISCV/shuffle-extract_subvector.ll
@@ -9,15 +9,15 @@
 
 define void @test_vXf64(<4 x double> %src256, <8 x double> %src512) {
 ; CHECK-LABEL: 'test_vXf64'
-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: 
%V256_01 = shufflevector <4 x double> %src256, <4 x double> undef, <2 x i32> 

-; CHECK-NEXT:  Cost Model: Found an estimated cost of 2 for instruction: 
%V256_23 = shufflevector <4 x double> %src256, <4 x double> undef, <2 x i32> 

-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: 
%V512_01 = shufflevector <8 x double> %src512, <8 x double> undef, <2 x i32> 

-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: 
%V512_23 = shufflevector <8 x double> %src512, <8 x double> undef, <2 x i32> 

-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: 
%V512_45 = shufflevector <8 x double> %src512, <8 x double> undef, <2 x i32> 

-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: 
%V512_67 = shufflevector <8 x double> %src512, <8 x double> undef, <2 x i32> 

-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: 
%V512_0123 = shufflevector <8 x double> %src512, <8 x double> undef, <4 x i32> 

-; CHECK-NEXT:  Cost Model: Found an estimated cost of 4 for instruction: 
%V512_2345 = shufflevector <8 x double> %src512, <8 x double> undef, <4 x i32> 

-; CHECK-NEXT:  Cost Model: Found an 

[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -218,6 +219,104 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+static std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) { // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  // Fallback: use the base class implementation.
+  auto fallback_impl = [&](const DebugNames::Entry ) {
+return ProcessEntry(entry, [&](DWARFDIE die) {
+  return GetFullyQualifiedTypeImpl(context, die, callback);
+});
+  };
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+auto parent_chain = getParentChain(entry, parent_names.size() + 1);
+
+if (!parent_chain) {
+  if (!fallback_impl(entry))
+return;
+  continue;
+}
+
+if (SameParentChain(parent_names, *parent_chain) &&

felipepiovezan wrote:

I'll add something at the top of loop

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


[Lldb-commits] [lldb] dad50fe - Add extra printing to TestWatchpointCount.py to debug CI fail

2024-01-31 Thread Jason Molenda via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T10:02:22-08:00
New Revision: dad50fefa24e717927a4d3315ae70fe507d624e0

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

LOG: Add extra printing to TestWatchpointCount.py to debug CI fail

The way the locals are laid out on the stack on x86-64 Debian is
resulting in a test failure with the new large watchpoint support.
Collecting more logging before I revert/debug it.

Added: 


Modified: 
lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py

Removed: 




diff  --git 
a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py 
b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
index 8d7f37aecb25f..be0618bfb4b11 100644
--- a/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
+++ b/lldb/test/API/commands/watchpoints/watchpoint_count/TestWatchpointCount.py
@@ -29,6 +29,12 @@ def test_watchpoint_count(self):
 second_watch = second_var.Watch(True, False, True, error)
 if not error.Success():
 self.fail("Failed to make watchpoint for x2: %s" % 
(error.GetCString()))
+# LWP_TODO: Adding temporary prints to debug a test
+# failure on the x86-64 Debian bot.
+self.runCmd("p ")
+self.runCmd("p ")
+self.runCmd("watchpoint list")
+
 process.Continue()
 
 stop_reason = thread.GetStopReason()
@@ -39,6 +45,11 @@ def test_watchpoint_count(self):
 self.assertEqual(stop_reason_descr, "watchpoint 1")
 
 process.Continue()
+# LWP_TODO: Adding temporary prints to debug a test
+# failure on the x86-64 Debian bot.
+self.runCmd("frame select 0")
+self.runCmd("disassemble")
+
 stop_reason = thread.GetStopReason()
 self.assertStopReason(
 stop_reason, lldb.eStopReasonWatchpoint, "watchpoint for x2 not 
hit"



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


[Lldb-commits] [lldb] [lldb][DWARFIndex] Use IDX_parent to implement GetFullyQualifiedType query (PR #79932)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits


@@ -218,6 +219,104 @@ void DebugNamesDWARFIndex::GetCompleteObjCClass(
   m_fallback.GetCompleteObjCClass(class_name, must_be_implementation, 
callback);
 }
 
+namespace {
+using Entry = llvm::DWARFDebugNames::Entry;
+
+/// If `entry` and all of its parents have an `IDX_parent`, use that 
information
+/// to build and return a list of at most `max_parents` parent Entries.
+/// `entry` itself is not included in the list.
+/// If any parent does not have an `IDX_parent`, or the Entry data is 
corrupted,
+/// nullopt is returned.
+static std::optional>
+getParentChain(Entry entry, uint32_t max_parents) {
+  llvm::SmallVector parent_entries;
+
+  do {
+if (!entry.hasParentInformation())
+  return std::nullopt;
+
+llvm::Expected> parent = entry.getParentDIEEntry();
+if (!parent) { // Bad data.
+  consumeError(parent.takeError());
+  return std::nullopt;
+}
+
+// Last parent in the chain
+if (!parent->has_value())
+  break;
+
+parent_entries.push_back(**parent);
+entry = **parent;
+  } while (parent_entries.size() < max_parents);
+
+  return parent_entries;
+}
+} // namespace
+
+void DebugNamesDWARFIndex::GetFullyQualifiedType(
+const DWARFDeclContext ,
+llvm::function_ref callback) {
+  if (context.GetSize() == 0)
+return;
+
+  // Fallback: use the base class implementation.
+  auto fallback_impl = [&](const DebugNames::Entry ) {
+return ProcessEntry(entry, [&](DWARFDIE die) {
+  return GetFullyQualifiedTypeImpl(context, die, callback);
+});
+  };
+
+  llvm::StringRef leaf_name = context[0].name;
+  llvm::SmallVector parent_names;
+  for (auto idx : llvm::seq(1, context.GetSize()))
+parent_names.emplace_back(context[idx].name);
+
+  for (const DebugNames::Entry  :
+   m_debug_names_up->equal_range(leaf_name)) {
+if (!isType(entry.tag()))
+  continue;
+
+// Grab at most one extra parent, subsequent parents are not necessary to
+// test equality.
+auto parent_chain = getParentChain(entry, parent_names.size() + 1);
+
+if (!parent_chain) {
+  if (!fallback_impl(entry))
+return;
+  continue;
+}
+
+if (SameParentChain(parent_names, *parent_chain) &&
+!ProcessEntry(entry, callback))
+  return;

felipepiovezan wrote:

If that's ok, I propose we leave it as is because of the guidelines and because 
I can imagine this method growing in the future to include more code after the 
referenced line.

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


[Lldb-commits] [compiler-rt] [libcxx] [libcxxabi] [lldb] [libc] [llvm] [flang] [clang] [lld] [clang-tools-extra] [libunwind] [PowerPC] Combine sub within setcc back to sext (PR #66978)

2024-01-31 Thread Qiu Chaofan via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add support for large watchpoints in lldb (PR #79962)

2024-01-31 Thread Jason Molenda via lldb-commits

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


[Lldb-commits] [lldb] 57c66b3 - [lldb] Add support for large watchpoints in lldb (#79962)

2024-01-31 Thread via lldb-commits

Author: Jason Molenda
Date: 2024-01-31T09:40:50-08:00
New Revision: 57c66b35a885b571f9897d75d18f1d974c29e533

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

LOG: [lldb] Add support for large watchpoints in lldb (#79962)

This patch is the next piece of work in my Large Watchpoint proposal,
https://discourse.llvm.org/t/rfc-large-watchpoint-support-in-lldb/72116

This patch breaks a user's watchpoint into one or more
WatchpointResources which reflect what the hardware registers can cover.
This means we can watch objects larger than 8 bytes, and we can watched
unaligned address ranges. On a typical 64-bit target with 4 watchpoint
registers you can watch 32 bytes of memory if the start address is
doubleword aligned.

Additionally, if the remote stub implements AArch64 MASK style
watchpoints (e.g. debugserver on Darwin), we can watch any power-of-2
size region of memory up to 2GB, aligned to that same size.

I updated the Watchpoint constructor and CommandObjectWatchpoint to
create a CompilerType of Array when the size of the watched
region is greater than pointer-size and we don't have a variable type to
use. For pointer-size and smaller, we can display the watched granule as
an integer value; for larger-than-pointer-size we will display as an
array of bytes.

I have `watchpoint list` now print the WatchpointResources used to
implement the watchpoint.

I added a WatchpointAlgorithm class which has a top-level static method
that takes an enum flag mask WatchpointHardwareFeature and a user
address and size, and returns a vector of WatchpointResources covering
the request. It does not take into account the number of watchpoint
registers the target has, or the number still available for use. Right
now there is only one algorithm, which monitors power-of-2 regions of
memory. For up to pointer-size, this is what Intel hardware supports.
AArch64 Byte Address Select watchpoints can watch any number of
contiguous bytes in a pointer-size memory granule, that is not currently
supported so if you ask to watch bytes 3-5, the algorithm will watch the
entire doubleword (8 bytes). The newly default "modify" style means we
will silently ignore modifications to bytes outside the watched range.

I've temporarily skipped TestLargeWatchpoint.py for all targets. It was
only run on Darwin when using the in-tree debugserver, which was a proxy
for "debugserver supports MASK watchpoints". I'll be adding the
aforementioned feature flag from the stub and enabling full mask
watchpoints when a debugserver with that feature is enabled, and
re-enable this test.

I added a new TestUnalignedLargeWatchpoint.py which only has one test
but it's a great one, watching a 22-byte range that is unaligned and
requires four 8-byte watchpoints to cover.

I also added a unit test, WatchpointAlgorithmsTests, which has a number
of simple tests against WatchpointAlgorithms::PowerOf2Watchpoints. I
think there's interesting possible different approaches to how we cover
these; I note in the unit test that a user requesting a watch on address
0x12e0 of 120 bytes will be covered by two watchpoints today, a
128-bytes at 0x1280 and at 0x1300. But it could be done with a 16-byte
watchpoint at 0x12e0 and a 128-byte at 0x1300, which would have fewer
false positives/private stops. As we try refining this one, it's helpful
to have a collection of tests to make sure things don't regress.

I tested this on arm64 macOS, (genuine) x86_64 macOS, and AArch64
Ubuntu. I have not modifed the Windows process plugins yet, I might try
that as a standalone patch, I'd be making the change blind, but the
necessary changes (see ProcessGDBRemote::EnableWatchpoint) are pretty
small so it might be obvious enough that I can change it and see what
the Windows CI thinks.

There isn't yet a packet (or a qSupported feature query) for the gdb
remote serial protocol stub to communicate its watchpoint capabilities
to lldb. I'll be doing that in a patch right after this is landed,
having debugserver advertise its capability of AArch64 MASK watchpoints,
and have ProcessGDBRemote add eWatchpointHardwareArmMASK to
WatchpointAlgorithms so we can watch larger than 32-byte requests on
Darwin.

I haven't yet tackled WatchpointResource *sharing* by multiple
Watchpoints. This is all part of the goal, especially when we may be
watching a larger memory range than the user requested, if they then add
another watchpoint next to their first request, it may be covered by the
same WatchpointResource (hardware watchpoint register). Also one "read"
watchpoint and one "write" watchpoint on the same memory granule need to
be handled, making the WatchpointResource cover all requests.

As WatchpointResources aren't shared among multiple Watchpoints yet,
there's no handling of running the conditions/commands/etc on multiple
Watchpoints when their shared WatchpointResource is 

[Lldb-commits] [compiler-rt] [libcxx] [libcxxabi] [lldb] [libc] [llvm] [flang] [clang] [lld] [clang-tools-extra] [libunwind] [PowerPC] Combine sub within setcc back to sext (PR #66978)

2024-01-31 Thread Qiu Chaofan via lldb-commits


@@ -14428,15 +14431,52 @@ SDValue PPCTargetLowering::combineSetCC(SDNode *N,
 // x != 0-y --> x+y != 0
 if (RHS.getOpcode() == ISD::SUB && isNullConstant(RHS.getOperand(0)) &&
 RHS.hasOneUse()) {
-  SDLoc DL(N);
-  SelectionDAG  = DCI.DAG;
-  EVT VT = N->getValueType(0);
-  EVT OpVT = LHS.getValueType();
   SDValue Add = DAG.getNode(ISD::ADD, DL, OpVT, LHS, RHS.getOperand(1));
   return DAG.getSetCC(DL, VT, Add, DAG.getConstant(0, DL, OpVT), CC);
 }
   }
 
+  if (CC == ISD::SETULT && isa(RHS)) {
+uint64_t RHSVal = cast(RHS)->getZExtValue();
+if (LHS.getOpcode() == ISD::ADD && isa(LHS.getOperand(1))) 
{
+  uint64_t Addend = 
cast(LHS.getOperand(1))->getZExtValue();
+  if (OpVT == MVT::i64) {
+uint64_t ShiftVal = ~Addend + 1;

ecnelises wrote:

negating an unsigned variable is UB?

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


[Lldb-commits] [compiler-rt] [libcxx] [mlir] [lldb] [libc] [flang] [llvm] [clang] [lld] [clang-tools-extra] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits` (PR #79978)

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/H-G-Hristov updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/5] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 

[Lldb-commits] [libc] [clang] [lld] [libcxx] [llvm] [flang] [compiler-rt] [lldb] [clang-tools-extra] [mlir] [libc++][memory] P2652R2: Disallow Specialization of `allocator_traits` (PR #79978)

2024-01-31 Thread Hristo Hristov via lldb-commits

https://github.com/Zingam updated 
https://github.com/llvm/llvm-project/pull/79978

>From c2b9a249689b2b6928d50aeea4717fc9dfe87162 Mon Sep 17 00:00:00 2001
From: Zingam 
Date: Sat, 27 Jan 2024 13:54:21 +0200
Subject: [PATCH 1/4] [libc++][memory] P2652R2 - Disallow Specialization of
 `allocator_traits`

Implements P2652R2 :
- https://eel.is/c++draft/allocator.requirements.general
- https://eel.is/c++draft/memory.syn
- https://eel.is/c++draft/allocator.traits.general
- https://eel.is/c++draft/allocator.traits.members
- https://eel.is/c++draft/diff.cpp20.concepts
- https://eel.is/c++draft/diff.cpp20.utilities
---
 libcxx/docs/FeatureTestMacroTable.rst |  2 +-
 libcxx/docs/ReleaseNotes/19.rst   |  6 +-
 libcxx/docs/Status/Cxx23Papers.csv|  2 +-
 libcxx/docs/Status/Cxx2cIssues.csv|  2 +-
 libcxx/include/CMakeLists.txt |  1 +
 libcxx/include/__format/buffer.h  |  1 +
 libcxx/include/__memory/allocate_at_least.h   | 15 ++--
 libcxx/include/__memory/allocation_result.h   | 45 
 libcxx/include/__memory/allocator.h   |  1 +
 libcxx/include/__memory/allocator_traits.h| 13 
 libcxx/include/__split_buffer |  1 +
 libcxx/include/libcxx.imp |  1 +
 libcxx/include/memory | 12 ++--
 libcxx/include/module.modulemap.in|  1 +
 libcxx/include/string | 17 +++--
 libcxx/include/vector |  1 +
 libcxx/include/version|  4 +-
 libcxx/modules/std/memory.inc |  2 +
 .../memory.version.compile.pass.cpp   | 10 +--
 .../version.version.compile.pass.cpp  | 10 +--
 .../allocate_at_least.pass.cpp|  6 +-
 .../allocate_at_least.pass.cpp| 70 +++
 .../generate_feature_test_macro_components.py |  4 +-
 23 files changed, 189 insertions(+), 38 deletions(-)
 create mode 100644 libcxx/include/__memory/allocation_result.h
 create mode 100644 
libcxx/test/std/utilities/memory/allocator.traits/allocator.traits.members/allocate_at_least.pass.cpp

diff --git a/libcxx/docs/FeatureTestMacroTable.rst 
b/libcxx/docs/FeatureTestMacroTable.rst
index d0d057e6bbaf0..a5c6fa22cec06 100644
--- a/libcxx/docs/FeatureTestMacroTable.rst
+++ b/libcxx/docs/FeatureTestMacroTable.rst
@@ -304,7 +304,7 @@ Status
 -
 ``__cpp_lib_adaptor_iterator_pair_constructor`` ``202106L``
 --- -
-``__cpp_lib_allocate_at_least`` ``202106L``
+``__cpp_lib_allocate_at_least`` ``202302L``
 --- -
 ``__cpp_lib_associative_heterogeneous_erasure`` *unimplemented*
 --- -
diff --git a/libcxx/docs/ReleaseNotes/19.rst b/libcxx/docs/ReleaseNotes/19.rst
index e96abc72c1648..dee9ebc8b8c33 100644
--- a/libcxx/docs/ReleaseNotes/19.rst
+++ b/libcxx/docs/ReleaseNotes/19.rst
@@ -37,12 +37,16 @@ What's New in Libc++ 19.0.0?
 
 Implemented Papers
 --
+
 - P2637R3 - Member ``visit``
+- P2652R2 - Disallow User Specialization of ``allocator_traits``
 
 
 Improvements and New Features
 -
-TODO
+
+- The ``_LIBCPP_ENABLE_CXX23_USER_SPECIALIZATION_OF_ALLOCATOR_TRAITS`` macro 
has been added to re-enable user specialization
+  of `allocator_traits`, which was disabled by `P2652R2 
`_.
 
 
 Deprecations and Removals
diff --git a/libcxx/docs/Status/Cxx23Papers.csv 
b/libcxx/docs/Status/Cxx23Papers.csv
index ebab3ef735b61..eb415ed8c031f 100644
--- a/libcxx/docs/Status/Cxx23Papers.csv
+++ b/libcxx/docs/Status/Cxx23Papers.csv
@@ -115,7 +115,7 @@
 "`P2679R2 `__","LWG", "Fixing 
``std::start_lifetime_as`` for arrays","February 2023","","",""
 "`P2674R1 `__","LWG", "A trait for implicit 
lifetime types","February 2023","","",""
 "`P2655R3 `__","LWG", "``common_reference_t`` of 
``reference_wrapper`` Should Be a Reference Type","February 2023","","",""
-"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","","",""
+"`P2652R2 `__","LWG", "Disallow User Specialization 
of ``allocator_traits``","February 2023","|Complete|","19.0",""
 "`P2787R1 `__","LWG", "``pmr::generator`` - Promise 
Types are not Values","February 2023","","",""
 "`P2614R2 `__","LWG", "Deprecate 
``numeric_limits::has_denorm``","February 2023","|Complete|","18.0",""
 "`P2588R3 `__","LWG", "``barrier``’s phase 
completion guarantees","February 2023","","",""

[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Michael Buch via lldb-commits

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

>From a899377f8d0e0b28f8d87c8ea1770bd233c6616f Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Wed, 31 Jan 2024 15:51:03 +
Subject: [PATCH] [lldb][TypeSynthetic] Make
 SyntheticChildrenFrontend::Update() return an enum

---
 .../lldb/DataFormatters/TypeSynthetic.h   | 25 +++---
 .../lldb/DataFormatters/VectorIterator.h  |  2 +-
 .../Core/ValueObjectSyntheticFilter.cpp   |  5 +-
 lldb/source/DataFormatters/TypeSynthetic.cpp  |  9 ++-
 lldb/source/DataFormatters/VectorType.cpp |  4 +-
 .../Language/CPlusPlus/BlockPointer.cpp   |  2 +-
 .../Plugins/Language/CPlusPlus/Coroutines.cpp | 16 ++--
 .../Plugins/Language/CPlusPlus/Coroutines.h   |  2 +-
 .../Language/CPlusPlus/GenericBitset.cpp  |  8 +-
 .../Language/CPlusPlus/GenericOptional.cpp|  8 +-
 .../Plugins/Language/CPlusPlus/LibCxx.cpp | 63 ---
 .../Plugins/Language/CPlusPlus/LibCxx.h   |  8 +-
 .../Language/CPlusPlus/LibCxxAtomic.cpp   |  7 +-
 .../CPlusPlus/LibCxxInitializerList.cpp   | 10 +--
 .../Plugins/Language/CPlusPlus/LibCxxList.cpp | 32 
 .../Plugins/Language/CPlusPlus/LibCxxMap.cpp  |  9 ++-
 .../Language/CPlusPlus/LibCxxQueue.cpp|  8 +-
 .../CPlusPlus/LibCxxRangesRefView.cpp | 10 +--
 .../Plugins/Language/CPlusPlus/LibCxxSpan.cpp |  9 ++-
 .../Language/CPlusPlus/LibCxxTuple.cpp|  8 +-
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp | 20 ++---
 .../Language/CPlusPlus/LibCxxVariant.cpp  | 12 +--
 .../Language/CPlusPlus/LibCxxVector.cpp   | 28 ---
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  | 47 ++-
 .../Language/CPlusPlus/LibStdcppTuple.cpp |  9 ++-
 .../CPlusPlus/LibStdcppUniquePointer.cpp  |  9 ++-
 lldb/source/Plugins/Language/ObjC/Cocoa.cpp   |  2 +-
 lldb/source/Plugins/Language/ObjC/NSArray.cpp | 43 +-
 .../Plugins/Language/ObjC/NSDictionary.cpp| 80 ++-
 lldb/source/Plugins/Language/ObjC/NSError.cpp | 12 +--
 .../Plugins/Language/ObjC/NSException.cpp |  8 +-
 .../Plugins/Language/ObjC/NSIndexPath.cpp | 14 ++--
 lldb/source/Plugins/Language/ObjC/NSSet.cpp   | 45 ++-
 33 files changed, 303 insertions(+), 271 deletions(-)

diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 41be9b7efda8f..7379a7ff06b44 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState { Invalid, Valid };
+
+  /// This function is assumed to always succeed and if it fails, the front-end
+  /// should know to deal with it in the correct way (most probably, by 
refusing
+  /// to return any children). The return value of \ref Update should actually
+  /// be interpreted as "ValueObjectSyntheticFilter cache is good/bad". If this
+  /// function returns \ref CacheState::Valid, \ref ValueObjectSyntheticFilter
+  /// is allowed to use the children it fetched previously and cached.
+  /// Otherwise, \ref ValueObjectSyntheticFilter must throw away its cache, and
+  /// query again for children.
+  virtual CacheState Update() = 0;
 
   // if this function returns false, then CalculateNumChildren() MUST return 0
   // since UI frontends might validly decide not to inquire for children given
@@ -116,7 +119,7 @@ class SyntheticValueProviderFrontEnd : public 
SyntheticChildrenFrontEnd {
 return UINT32_MAX;
   }
 
-  bool Update() override { return false; }
+  CacheState Update() override { return CacheState::Invalid; }
 
   bool MightHaveChildren() override { return false; }
 
@@ -328,7 +331,7 @@ class TypeFilterImpl : public SyntheticChildren {
   filter->GetExpressionPathAtIndex(idx), true);
 }
 
-bool Update() override { return false; }
+CacheState Update() override { return CacheState::Invalid; }
 
 bool MightHaveChildren() override { return filter->GetCount() > 0; }
 
@@ -427,7 +430,7 @@ class ScriptedSyntheticChildren : public SyntheticChildren {
 
 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
 
-bool Update() override;
+CacheState Update() override;
 
 bool MightHaveChildren() override;
 
diff --git a/lldb/include/lldb/DataFormatters/VectorIterator.h 

[Lldb-commits] [lldb] 08c0eb1 - [lldb][DataFormatter][NFC] Use GetFirstValueOfLibCXXCompressedPair throughout formatters (#80133)

2024-01-31 Thread via lldb-commits

Author: Michael Buch
Date: 2024-01-31T17:18:13Z
New Revision: 08c0eb183a9ca2983d20f5a5f366df44f199d287

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

LOG: [lldb][DataFormatter][NFC] Use GetFirstValueOfLibCXXCompressedPair 
throughout formatters (#80133)

This avoids duplicating the logic to get the first
element of a libc++ `__compressed_pair`. This will
be useful in supporting upcoming changes to the layout
of `__compressed_pair`.

Drive-by changes:
* Renamed `m_item` to `size_node` for readability;
  `m_item` suggests it's a member variable, which it
  is not.

Added: 


Modified: 
lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
index 092a4120376b7..d3ee63a35e107 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp
@@ -213,30 +213,20 @@ size_t 
lldb_private::formatters::LibcxxStdMapSyntheticFrontEnd::
 CalculateNumChildren() {
   if (m_count != UINT32_MAX)
 return m_count;
+
   if (m_tree == nullptr)
 return 0;
-  ValueObjectSP m_item(m_tree->GetChildMemberWithName("__pair3_"));
-  if (!m_item)
+
+  ValueObjectSP size_node(m_tree->GetChildMemberWithName("__pair3_"));
+  if (!size_node)
 return 0;
 
-  switch (m_item->GetCompilerType().GetNumDirectBaseClasses()) {
-  case 1:
-// Assume a pre llvm r300140 __compressed_pair implementation:
-m_item = m_item->GetChildMemberWithName("__first_");
-break;
-  case 2: {
-// Assume a post llvm r300140 __compressed_pair implementation:
-ValueObjectSP first_elem_parent = m_item->GetChildAtIndex(0);
-m_item = first_elem_parent->GetChildMemberWithName("__value_");
-break;
-  }
-  default:
-return false;
-  }
+  size_node = GetFirstValueOfLibCXXCompressedPair(*size_node);
 
-  if (!m_item)
+  if (!size_node)
 return 0;
-  m_count = m_item->GetValueAsUnsigned(0);
+
+  m_count = size_node->GetValueAsUnsigned(0);
   return m_count;
 }
 

diff  --git a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
index ff7043bdf97ff..1a85d37ebf0cc 100644
--- a/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
+++ b/lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp
@@ -116,25 +116,10 @@ lldb::ValueObjectSP lldb_private::formatters::
 if (!p1_sp)
   return nullptr;
 
-ValueObjectSP first_sp = nullptr;
-switch (p1_sp->GetCompilerType().GetNumDirectBaseClasses()) {
-case 1:
-  // Assume a pre llvm r300140 __compressed_pair implementation:
-  first_sp = p1_sp->GetChildMemberWithName("__first_");
-  break;
-case 2: {
-  // Assume a post llvm r300140 __compressed_pair implementation:
-  ValueObjectSP first_elem_parent_sp =
-p1_sp->GetChildAtIndex(0);
-  first_sp = p1_sp->GetChildMemberWithName("__value_");
-  break;
-}
-default:
-  return nullptr;
-}
-
+ValueObjectSP first_sp = GetFirstValueOfLibCXXCompressedPair(*p1_sp);
 if (!first_sp)
   return nullptr;
+
 m_element_type = first_sp->GetCompilerType();
 m_element_type = m_element_type.GetTypeTemplateArgument(0);
 m_element_type = m_element_type.GetPointeeType();
@@ -218,37 +203,30 @@ bool 
lldb_private::formatters::LibcxxStdUnorderedMapSyntheticFrontEnd::
 return false;
 
   ValueObjectSP p2_sp = table_sp->GetChildMemberWithName("__p2_");
-  ValueObjectSP num_elements_sp = nullptr;
-  llvm::SmallVector next_path;
-  switch (p2_sp->GetCompilerType().GetNumDirectBaseClasses()) {
-  case 1:
-// Assume a pre llvm r300140 __compressed_pair implementation:
-num_elements_sp = p2_sp->GetChildMemberWithName("__first_");
-next_path.append({"__p1_", "__first_", "__next_"});
-break;
-  case 2: {
-// Assume a post llvm r300140 __compressed_pair implementation:
-ValueObjectSP first_elem_parent = p2_sp->GetChildAtIndex(0);
-num_elements_sp = first_elem_parent->GetChildMemberWithName("__value_");
-next_path.append({"__p1_", "__value_", "__next_"});
-break;
-  }
-  default:
+  if (!p2_sp)
 return false;
-  }
 
+  ValueObjectSP num_elements_sp = GetFirstValueOfLibCXXCompressedPair(*p2_sp);
   if (!num_elements_sp)
 return false;
 
-  m_tree = table_sp->GetChildAtNamePath(next_path).get();
+  ValueObjectSP p1_sp = table_sp->GetChildMemberWithName("__p1_");
+  if (!p1_sp)
+return false;
+
+  

[Lldb-commits] [lldb] [lldb][DataFormatter][NFC] Use GetFirstValueOfLibCXXCompressedPair throughout formatters (PR #80133)

2024-01-31 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)


Changes

This patch changes the return value of `SyntheticChildrenFrontend::Update` to a 
scoped enum that aims to describe what the return value means.

---

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


33 Files Affected:

- (modified) lldb/include/lldb/DataFormatters/TypeSynthetic.h (+14-11) 
- (modified) lldb/include/lldb/DataFormatters/VectorIterator.h (+1-1) 
- (modified) lldb/source/Core/ValueObjectSyntheticFilter.cpp (+3-2) 
- (modified) lldb/source/DataFormatters/TypeSynthetic.cpp (+6-3) 
- (modified) lldb/source/DataFormatters/VectorType.cpp (+2-2) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/BlockPointer.cpp (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.cpp (+8-8) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/Coroutines.h (+1-1) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericBitset.cpp (+4-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/GenericOptional.cpp (+4-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.cpp (+33-30) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxx.h (+4-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxAtomic.cpp (+4-3) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxInitializerList.cpp 
(+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxList.cpp (+16-16) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxMap.cpp (+5-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp (+4-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxRangesRefView.cpp 
(+5-5) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxSpan.cpp (+5-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp (+4-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxUnorderedMap.cpp 
(+8-8) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp (+6-6) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibCxxVector.cpp (+16-14) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp (+25-22) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp (+5-4) 
- (modified) lldb/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp 
(+5-4) 
- (modified) lldb/source/Plugins/Language/ObjC/Cocoa.cpp (+1-1) 
- (modified) lldb/source/Plugins/Language/ObjC/NSArray.cpp (+22-21) 
- (modified) lldb/source/Plugins/Language/ObjC/NSDictionary.cpp (+43-37) 
- (modified) lldb/source/Plugins/Language/ObjC/NSError.cpp (+6-6) 
- (modified) lldb/source/Plugins/Language/ObjC/NSException.cpp (+5-3) 
- (modified) lldb/source/Plugins/Language/ObjC/NSIndexPath.cpp (+7-7) 
- (modified) lldb/source/Plugins/Language/ObjC/NSSet.cpp (+24-21) 


``diff
diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 41be9b7efda8f..407177bbd303e 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState : short { Invalid, Valid };
+
+  /// This function is assumed to always succeed and if it fails, the front-end
+  /// should know to deal with it in the correct way (most probably, by 
refusing
+  /// to return any children). The return value of \ref Update should actually
+  /// be interpreted as "ValueObjectSyntheticFilter cache is good/bad". If this
+  /// function returns \ref CacheState::Valid, \ref ValueObjectSyntheticFilter
+  /// is allowed to use the children it fetched previously and cached.
+  /// Otherwise, \ref ValueObjectSyntheticFilter must throw away its cache, and
+  /// query again for children.
+  virtual CacheState Update() = 0;
 
   // if this function returns false, then CalculateNumChildren() MUST return 0
   // since UI frontends might validly decide not to inquire for children given
@@ -116,7 +119,7 @@ class SyntheticValueProviderFrontEnd : public 
SyntheticChildrenFrontEnd {
 return UINT32_MAX;
   }
 
-  bool Update() override { return false; }
+  CacheState Update() override { return CacheState::Invalid; }
 
   bool MightHaveChildren() override { return false; }
 
@@ -328,7 +331,7 @@ class TypeFilterImpl : public 

[Lldb-commits] [lldb] [lldb][TypeSynthetic][NFC] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Michael Buch via lldb-commits

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


[Lldb-commits] [lldb] [lldb][TypeSynthetic] Make SyntheticChildrenFrontend::Update() return an enum (PR #80167)

2024-01-31 Thread Michael Buch via lldb-commits

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

This patch changes the return value of `SyntheticChildrenFrontend::Update` to a 
scoped enum that aims to describe what the return value means.

>From 921a20776ee76d8e6b0e8f50705f3728643e08b3 Mon Sep 17 00:00:00 2001
From: Michael Buch 
Date: Wed, 31 Jan 2024 15:51:03 +
Subject: [PATCH] [lldb][TypeSynthetic] Make
 SyntheticChildrenFrontend::Update() return an enum

---
 .../lldb/DataFormatters/TypeSynthetic.h   | 25 +++---
 .../lldb/DataFormatters/VectorIterator.h  |  2 +-
 .../Core/ValueObjectSyntheticFilter.cpp   |  5 +-
 lldb/source/DataFormatters/TypeSynthetic.cpp  |  9 ++-
 lldb/source/DataFormatters/VectorType.cpp |  4 +-
 .../Language/CPlusPlus/BlockPointer.cpp   |  2 +-
 .../Plugins/Language/CPlusPlus/Coroutines.cpp | 16 ++--
 .../Plugins/Language/CPlusPlus/Coroutines.h   |  2 +-
 .../Language/CPlusPlus/GenericBitset.cpp  |  8 +-
 .../Language/CPlusPlus/GenericOptional.cpp|  8 +-
 .../Plugins/Language/CPlusPlus/LibCxx.cpp | 63 ---
 .../Plugins/Language/CPlusPlus/LibCxx.h   |  8 +-
 .../Language/CPlusPlus/LibCxxAtomic.cpp   |  7 +-
 .../CPlusPlus/LibCxxInitializerList.cpp   | 10 +--
 .../Plugins/Language/CPlusPlus/LibCxxList.cpp | 32 
 .../Plugins/Language/CPlusPlus/LibCxxMap.cpp  |  9 ++-
 .../Language/CPlusPlus/LibCxxQueue.cpp|  8 +-
 .../CPlusPlus/LibCxxRangesRefView.cpp | 10 +--
 .../Plugins/Language/CPlusPlus/LibCxxSpan.cpp |  9 ++-
 .../Language/CPlusPlus/LibCxxTuple.cpp|  8 +-
 .../Language/CPlusPlus/LibCxxUnorderedMap.cpp | 16 ++--
 .../Language/CPlusPlus/LibCxxVariant.cpp  | 12 +--
 .../Language/CPlusPlus/LibCxxVector.cpp   | 30 +++
 .../Plugins/Language/CPlusPlus/LibStdcpp.cpp  | 47 ++-
 .../Language/CPlusPlus/LibStdcppTuple.cpp |  9 ++-
 .../CPlusPlus/LibStdcppUniquePointer.cpp  |  9 ++-
 lldb/source/Plugins/Language/ObjC/Cocoa.cpp   |  2 +-
 lldb/source/Plugins/Language/ObjC/NSArray.cpp | 43 +-
 .../Plugins/Language/ObjC/NSDictionary.cpp| 80 ++-
 lldb/source/Plugins/Language/ObjC/NSError.cpp | 12 +--
 .../Plugins/Language/ObjC/NSException.cpp |  8 +-
 .../Plugins/Language/ObjC/NSIndexPath.cpp | 14 ++--
 lldb/source/Plugins/Language/ObjC/NSSet.cpp   | 45 ++-
 33 files changed, 302 insertions(+), 270 deletions(-)

diff --git a/lldb/include/lldb/DataFormatters/TypeSynthetic.h 
b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
index 41be9b7efda8f..407177bbd303e 100644
--- a/lldb/include/lldb/DataFormatters/TypeSynthetic.h
+++ b/lldb/include/lldb/DataFormatters/TypeSynthetic.h
@@ -49,14 +49,17 @@ class SyntheticChildrenFrontEnd {
 
   virtual size_t GetIndexOfChildWithName(ConstString name) = 0;
 
-  // this function is assumed to always succeed and it if fails, the front-end
-  // should know to deal with it in the correct way (most probably, by refusing
-  // to return any children) the return value of Update() should actually be
-  // interpreted as "ValueObjectSyntheticFilter cache is good/bad" if =true,
-  // ValueObjectSyntheticFilter is allowed to use the children it fetched
-  // previously and cached if =false, ValueObjectSyntheticFilter must throw
-  // away its cache, and query again for children
-  virtual bool Update() = 0;
+  enum class CacheState : short { Invalid, Valid };
+
+  /// This function is assumed to always succeed and if it fails, the front-end
+  /// should know to deal with it in the correct way (most probably, by 
refusing
+  /// to return any children). The return value of \ref Update should actually
+  /// be interpreted as "ValueObjectSyntheticFilter cache is good/bad". If this
+  /// function returns \ref CacheState::Valid, \ref ValueObjectSyntheticFilter
+  /// is allowed to use the children it fetched previously and cached.
+  /// Otherwise, \ref ValueObjectSyntheticFilter must throw away its cache, and
+  /// query again for children.
+  virtual CacheState Update() = 0;
 
   // if this function returns false, then CalculateNumChildren() MUST return 0
   // since UI frontends might validly decide not to inquire for children given
@@ -116,7 +119,7 @@ class SyntheticValueProviderFrontEnd : public 
SyntheticChildrenFrontEnd {
 return UINT32_MAX;
   }
 
-  bool Update() override { return false; }
+  CacheState Update() override { return CacheState::Invalid; }
 
   bool MightHaveChildren() override { return false; }
 
@@ -328,7 +331,7 @@ class TypeFilterImpl : public SyntheticChildren {
   filter->GetExpressionPathAtIndex(idx), true);
 }
 
-bool Update() override { return false; }
+CacheState Update() override { return CacheState::Invalid; }
 
 bool MightHaveChildren() override { return filter->GetCount() > 0; }
 
@@ -427,7 +430,7 @@ class ScriptedSyntheticChildren : public SyntheticChildren {
 
 lldb::ValueObjectSP GetChildAtIndex(size_t idx) override;
 
-bool Update() 

[Lldb-commits] [flang] [compiler-rt] [clang] [llvm] [mlir] [clang-tools-extra] [lldb] [libc] [libcxx] [AArch64] add intrinsic to generate a bfi instruction (PR #79672)

2024-01-31 Thread David Green via lldb-commits

davemgreen wrote:

I see. The issue is that the opposite is often true as well - if we add a 
target specific intrinsic for this then, whilst we get a single instruction 
being emitted, we don't see all the other optimizations that the compiler can 
and should be performing.

Things like constant folding, combining into other instructions, known-bits 
analysis or any form of vectorization will all be blocked by the intrinsic. It 
can take quite some work to add all those features in (if they are possible), 
and without them can potentially lead to worse results. Plus more things to 
maintain.

BFI isn't a trivial instructions to match as it involves certain masks and 
shifts. There might certainly be advantages to having an intrinsic. I would 
like to try and see what the problems would be with generated code using normal 
operations first though, if we can. If there are optimizations we can make 
based on the existing code then that would help in all cases (c, mlir, rust, 
etc), not just frontends that are producing the intrinsics.

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


[Lldb-commits] [lldb] [lldb][DataFormatter][NFC] Use GetFirstValueOfLibCXXCompressedPair throughout formatters (PR #80133)

2024-01-31 Thread Felipe de Azevedo Piovezan via lldb-commits

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

Nice removal of duplicated code!

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


  1   2   >