[Lldb-commits] [lldb] Add armv7a and armv8a ArchSpecs (PR #106433)

2024-08-28 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google created 
https://github.com/llvm/llvm-project/pull/106433

armv7a and armv8a are common names for the application subarch for arm.

These names in particular are used in ChromeOS, Android, and a few other known 
applications. In ChromeOS, we encountered a bug where armv7a arch was not 
recognised and segfaulted when starting an executable on an arm32 device.

Google Issue Tracker:
https://issuetracker.google.com/361414339

>From 6df22d9cde077a9ec2dfcdd18e2c4456c080259b Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 27 Aug 2024 20:59:30 +
Subject: [PATCH] Add armv7a and armv8a ArchSpecs

armv7a and armv8a are common names for the application subarch for
arm.

These names in particular are used in ChromeOS, Android, and a few
other known applications. In ChromeOS, we encountered a bug where
armv7a arch was not recognised and segfaulted when starting an
executable on an arm32 device.

Google Issue Tracker:
https://issuetracker.google.com/361414339
---
 lldb/include/lldb/Utility/ArchSpec.h | 2 ++
 lldb/source/Utility/ArchSpec.cpp | 4 
 2 files changed, 6 insertions(+)

diff --git a/lldb/include/lldb/Utility/ArchSpec.h 
b/lldb/include/lldb/Utility/ArchSpec.h
index 50830b889b9115..5990f984b09e2d 100644
--- a/lldb/include/lldb/Utility/ArchSpec.h
+++ b/lldb/include/lldb/Utility/ArchSpec.h
@@ -123,6 +123,7 @@ class ArchSpec {
 eCore_arm_armv6,
 eCore_arm_armv6m,
 eCore_arm_armv7,
+eCore_arm_armv7a,
 eCore_arm_armv7l,
 eCore_arm_armv7f,
 eCore_arm_armv7s,
@@ -145,6 +146,7 @@ class ArchSpec {
 eCore_thumbv7em,
 eCore_arm_arm64,
 eCore_arm_armv8,
+eCore_arm_armv8a,
 eCore_arm_armv8l,
 eCore_arm_arm64e,
 eCore_arm_arm64_32,
diff --git a/lldb/source/Utility/ArchSpec.cpp b/lldb/source/Utility/ArchSpec.cpp
index 4fd1a800023ce3..85bb85044ec156 100644
--- a/lldb/source/Utility/ArchSpec.cpp
+++ b/lldb/source/Utility/ArchSpec.cpp
@@ -60,6 +60,8 @@ static const CoreDefinition g_core_definitions[] = {
  "armv6m"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7,
  "armv7"},
+{eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7a,
+ "armv7a"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7l,
  "armv7l"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv7f,
@@ -102,6 +104,8 @@ static const CoreDefinition g_core_definitions[] = {
  ArchSpec::eCore_arm_arm64, "arm64"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
  ArchSpec::eCore_arm_armv8, "armv8"},
+{eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,
+ ArchSpec::eCore_arm_armv8a, "armv8a"},
 {eByteOrderLittle, 4, 2, 4, llvm::Triple::arm, ArchSpec::eCore_arm_armv8l,
  "armv8l"},
 {eByteOrderLittle, 8, 4, 4, llvm::Triple::aarch64,

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


[Lldb-commits] [lldb] [lldb] Add armv7a and armv8a ArchSpecs (PR #106433)

2024-08-29 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

Thanks for the review and merge!

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


[Lldb-commits] [lldb] [llvm] [libcxx] [flang] [libc] [clang-tools-extra] [clang] [compiler-rt] [libunwind] [libunwind] Replace process_vm_readv with SYS_rt_sigprocmask (PR #74791)

2024-01-04 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/74791

>From 9d4665cf1ddda98129af2f6ff575989cec49af6d Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Fri, 8 Dec 2023 00:09:59 +
Subject: [PATCH 01/13] [libunwind] Replace process_vm_readv with pipe

process_vm_readv is generally considered dangerous from a syscall
perspective, and is frequently blanket banned in seccomp filters such as
those in Chromium and ChromiumOS. We can get the same behaviour during
the invalid PC address case with pipes and write/read.

Testing to ensure that process_vm_readv does not appear, I ran the
output of check-unwind on an ARM64 device under strace. Previously,
bad_unwind_info in particular would use process_vm_readv, but with this
commit, it now uses pipe2:

```
strace test/Output/bad_unwind_info.pass.cpp.dir/t.tmp.exe \
  |& grep process_vm_readv
strace test/Output/bad_unwind_info.pass.cpp.dir/t.tmp.exe \
  |& grep pipe2
```
---
 libunwind/src/UnwindCursor.hpp | 50 --
 1 file changed, 29 insertions(+), 21 deletions(-)

diff --git a/libunwind/src/UnwindCursor.hpp b/libunwind/src/UnwindCursor.hpp
index 647a5a9c9d92d9..5e4e376220daa0 100644
--- a/libunwind/src/UnwindCursor.hpp
+++ b/libunwind/src/UnwindCursor.hpp
@@ -33,6 +33,7 @@
 #if defined(_LIBUNWIND_TARGET_LINUX) &&
\
 (defined(_LIBUNWIND_TARGET_AARCH64) || defined(_LIBUNWIND_TARGET_RISCV) || 
\
  defined(_LIBUNWIND_TARGET_S390X))
+#include 
 #include 
 #include 
 #include 
@@ -2700,19 +2701,18 @@ bool UnwindCursor::setInfoForSigReturn(Registers_arm64 &) {
   // [1] 
https://github.com/torvalds/linux/blob/master/arch/arm64/kernel/vdso/sigreturn.S
   const pint_t pc = static_cast(this->getReg(UNW_REG_IP));
   // The PC might contain an invalid address if the unwind info is bad, so
-  // directly accessing it could cause a segfault. Use process_vm_readv to read
-  // the memory safely instead. process_vm_readv was added in Linux 3.2, and
-  // AArch64 supported was added in Linux 3.7, so the syscall is guaranteed to
-  // be present. Unfortunately, there are Linux AArch64 environments where the
-  // libc wrapper for the syscall might not be present (e.g. Android 5), so 
call
-  // the syscall directly instead.
+  // directly accessing it could cause a segfault. Use pipe/write/read to read
+  // the memory safely instead.
+  int pipefd[2];
+  if (pipe2(pipefd, O_CLOEXEC | O_NONBLOCK) == -1)
+return false;
   uint32_t instructions[2];
-  struct iovec local_iov = {&instructions, sizeof instructions};
-  struct iovec remote_iov = {reinterpret_cast(pc), sizeof 
instructions};
-  long bytesRead =
-  syscall(SYS_process_vm_readv, getpid(), &local_iov, 1, &remote_iov, 1, 
0);
+  const auto bufferSize = sizeof instructions;
+  if (write(pipefd[1], reinterpret_cast(pc), bufferSize) != bufferSize)
+return false;
+  const auto bytesRead = read(pipefd[0], instructions, bufferSize);
   // Look for instructions: mov x8, #0x8b; svc #0x0
-  if (bytesRead != sizeof instructions || instructions[0] != 0xd2801168 ||
+  if (bytesRead != bufferSize || instructions[0] != 0xd2801168 ||
   instructions[1] != 0xd401)
 return false;
 
@@ -2762,17 +2762,20 @@ int UnwindCursor::stepThroughSigReturn(Registers_arm64 &) {
 template 
 bool UnwindCursor::setInfoForSigReturn(Registers_riscv &) {
   const pint_t pc = static_cast(getReg(UNW_REG_IP));
+  int pipefd[2];
+  if (pipe2(pipefd, O_CLOEXEC | O_NONBLOCK) == -1)
+return false;
   uint32_t instructions[2];
-  struct iovec local_iov = {&instructions, sizeof instructions};
-  struct iovec remote_iov = {reinterpret_cast(pc), sizeof 
instructions};
-  long bytesRead =
-  syscall(SYS_process_vm_readv, getpid(), &local_iov, 1, &remote_iov, 1, 
0);
+  const auto bufferSize = sizeof instructions;
+  if (write(pipefd[1], reinterpret_cast(pc), bufferSize) != bufferSize)
+return false;
+  const auto bytesRead = read(pipefd[0], instructions, bufferSize);
   // Look for the two instructions used in the sigreturn trampoline
   // __vdso_rt_sigreturn:
   //
   // 0x08b00893 li a7,0x8b
   // 0x0073 ecall
-  if (bytesRead != sizeof instructions || instructions[0] != 0x08b00893 ||
+  if (bytesRead != bufferSize || instructions[0] != 0x08b00893 ||
   instructions[1] != 0x0073)
 return false;
 
@@ -2822,13 +2825,18 @@ bool UnwindCursor::setInfoForSigReturn(Registers_s390x &) {
   // onto the stack.
   const pint_t pc = static_cast(this->getReg(UNW_REG_IP));
   // The PC might contain an invalid address if the unwind info is bad, so
-  // directly accessing it could cause a segfault. Use process_vm_readv to
+  // directly accessing it could cause a segfault. Use pipe/write/read to
   // read the memory safely instead.
   uint16_t inst;
-  struct iovec local_iov = {&inst, sizeof inst};
-  struct iovec remote_iov = {reinterpret_cast(pc), sizeof inst};
-  long bytesRead = process_vm_readv(

[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-11 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google created 
https://github.com/llvm/llvm-project/pull/126810

For some operating systems, terminfo is a separate package and library from 
ncurses. Both are still requirements for curses support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Fixes #101368

>From e2343766f65acd684adc375373f08452ce071670 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 1 Oct 2024 18:41:28 +
Subject: [PATCH] [lldb] Add terminfo dependency for ncurses support

For some operating systems, terminfo is a separate package
and library from ncurses. Both are still requirements for curses
support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Fixes #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214bf54b..df4980cc5e0d1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,15 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
+# NOTE: terminfo and curses libraries are required separately, as
+# some systems do not bundle them together.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
+  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +19,10 @@ else()
 REQUIRED_VARS
   CURSES_INCLUDE_DIRS
   CURSES_LIBRARIES
+  TINFO_LIBRARIES
   PANEL_LIBRARIES)
-  if(CURSES_FOUND AND PANEL_LIBRARIES)
-mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES 
PANEL_LIBRARIES)
   endif()
 endif()
 

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-11 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/126810

>From ddd3febff5b77cc7b2101996d49729added00f2b Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 1 Oct 2024 18:41:28 +
Subject: [PATCH] [lldb] Add terminfo dependency for ncurses support

For some operating systems (e.g. chromiumos), terminfo is a separate
package and library from ncurses. Both are still requirements for curses
support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Without this fix, LLDB cannot be built on these systems.

Fixes #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214bf54b..df4980cc5e0d1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,15 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
+# NOTE: terminfo and curses libraries are required separately, as
+# some systems do not bundle them together.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
+  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +19,10 @@ else()
 REQUIRED_VARS
   CURSES_INCLUDE_DIRS
   CURSES_LIBRARIES
+  TINFO_LIBRARIES
   PANEL_LIBRARIES)
-  if(CURSES_FOUND AND PANEL_LIBRARIES)
-mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES 
PANEL_LIBRARIES)
   endif()
 endif()
 

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-11 Thread Jordan R AW via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-11 Thread Jordan R AW via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-12 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

> This isn't using TINFO_LIBRARIES anywhere. Presumably you'll need to add it 
> to LLDB_CURSES_LIBS like the original spack patch.

Hmm. This patch does seem to work locally, so it's not _required_. I would have 
thought the logic is entirely in the `find_package` invocation, and the 
variables are just for the `if` check. But no issue adding it to the 
`LLDB_CURSES_LIBS`, will do that now!

---

I understand the issue in point two--this patch may unnecessarily require a 
separate tinfo library even when the headers and objects are available via 
ncurses. But could you explain more on your recommended solutions, particularly 
on why we would need to set an optional variable? 

If we're going to require a CMAKE flag anyways to show a warning, why not just 
guard it on a `LLDB_USE_SEPARATE_TERMINFO=ON` flag and not worry about 
autodetection? It's already breaking with a link time error, surely that's a 
louder signal than a configure-time warning.

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-12 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

Thanks, this does clear it up! Yeah I'd rather have it work out of the bod.

I'll see what I can do for doing the autodetection ergonomically, and get back 
to you. If not, I'll add a flag.

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits


@@ -2,23 +2,54 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+include(CMakePushCheckState)
+
+function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+  cmake_reset_check_state()
+  set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")

ajordanr-google wrote:

This function is primarily here so that we don't have scope leak on modifying 
`CMAKE_REQUIRED_LIBRARIES` (which we want to restrict to only our given curses 
`.so`, and no other).

I'm not super sure how scope guarding works with how these `Find*` modules 
work, but I wanted to be sure that we don't actually modify 
CMAKE_REQUIRED_LIBRARIES outside of any other scope.

Not sure if that makes too much sense, but we _could_ move it out if you're 
okay with other libraries providing `acs_map`, not just the found 
`libcurses.so`.

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits


@@ -11,6 +11,9 @@ set(LLDB_LIBEDIT_LIBS)
 
 if (LLDB_ENABLE_CURSES)
   list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+  if(NOT CURSES_HAS_TINFO)
+list(APPEND LLDB_CURSES_LIBS ${TINFO_LIBRARIES})
+  endif()

ajordanr-google wrote:

I think that should be fine. Will test, and upload!

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/126810

>From ddd3febff5b77cc7b2101996d49729added00f2b Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 1 Oct 2024 18:41:28 +
Subject: [PATCH 1/3] [lldb] Add terminfo dependency for ncurses support

For some operating systems (e.g. chromiumos), terminfo is a separate
package and library from ncurses. Both are still requirements for curses
support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Without this fix, LLDB cannot be built on these systems.

Fixes #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214bf54b..df4980cc5e0d1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,15 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
+# NOTE: terminfo and curses libraries are required separately, as
+# some systems do not bundle them together.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
+  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +19,10 @@ else()
 REQUIRED_VARS
   CURSES_INCLUDE_DIRS
   CURSES_LIBRARIES
+  TINFO_LIBRARIES
   PANEL_LIBRARIES)
-  if(CURSES_FOUND AND PANEL_LIBRARIES)
-mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES 
PANEL_LIBRARIES)
   endif()
 endif()
 

>From 41ad79112bc2242a1cb10ae688353863155d9038 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 18:22:09 +
Subject: [PATCH 2/3] fixup! [lldb] Add terminfo dependency for ncurses support

---
 lldb/source/Core/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da489..6c7a50056f751 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
 set(LLDB_LIBEDIT_LIBS)
 
 if (LLDB_ENABLE_CURSES)
-  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES} 
${TINFO_LIBRARIES})
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_CURSES_LIBS gpm)
   endif()

>From 9ffc89356cc635ac31f11c66dcb6f32cd73380fc Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 19:29:23 +
Subject: [PATCH 3/3] fixup! fixup! [lldb] Add terminfo dependency for ncurses
 support

---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 41 +
 lldb/cmake/modules/FindTerminfo.cmake   | 21 +++
 lldb/source/Core/CMakeLists.txt |  5 ++-
 3 files changed, 59 insertions(+), 8 deletions(-)
 create mode 100644 lldb/cmake/modules/FindTerminfo.cmake

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index df4980cc5e0d1..646113155343d 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -3,26 +3,53 @@
 # ---
 #
 # Find the curses, terminfo, and panel library as a whole.
-# NOTE: terminfo and curses libraries are required separately, as
-# some systems do not bundle them together.
+
+include(CMakePushCheckState)
+
+function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+  cmake_reset_check_state()
+  set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
+  # acs_map is one of many symbols that are part of tinfo but could
+  # be bundled in curses.
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+endfunction()
 
 if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
-  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
+  
+  # Sometimes the curs

[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/126810

>From ddd3febff5b77cc7b2101996d49729added00f2b Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 1 Oct 2024 18:41:28 +
Subject: [PATCH 1/5] [lldb] Add terminfo dependency for ncurses support

For some operating systems (e.g. chromiumos), terminfo is a separate
package and library from ncurses. Both are still requirements for curses
support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Without this fix, LLDB cannot be built on these systems.

Fixes #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214bf54b..df4980cc5e0d1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,15 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
+# NOTE: terminfo and curses libraries are required separately, as
+# some systems do not bundle them together.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
+  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +19,10 @@ else()
 REQUIRED_VARS
   CURSES_INCLUDE_DIRS
   CURSES_LIBRARIES
+  TINFO_LIBRARIES
   PANEL_LIBRARIES)
-  if(CURSES_FOUND AND PANEL_LIBRARIES)
-mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES 
PANEL_LIBRARIES)
   endif()
 endif()
 

>From 41ad79112bc2242a1cb10ae688353863155d9038 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 18:22:09 +
Subject: [PATCH 2/5] fixup! [lldb] Add terminfo dependency for ncurses support

---
 lldb/source/Core/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da489..6c7a50056f751 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
 set(LLDB_LIBEDIT_LIBS)
 
 if (LLDB_ENABLE_CURSES)
-  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES} 
${TINFO_LIBRARIES})
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_CURSES_LIBS gpm)
   endif()

>From 9ffc89356cc635ac31f11c66dcb6f32cd73380fc Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 19:29:23 +
Subject: [PATCH 3/5] fixup! fixup! [lldb] Add terminfo dependency for ncurses
 support

---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 41 +
 lldb/cmake/modules/FindTerminfo.cmake   | 21 +++
 lldb/source/Core/CMakeLists.txt |  5 ++-
 3 files changed, 59 insertions(+), 8 deletions(-)
 create mode 100644 lldb/cmake/modules/FindTerminfo.cmake

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index df4980cc5e0d1..646113155343d 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -3,26 +3,53 @@
 # ---
 #
 # Find the curses, terminfo, and panel library as a whole.
-# NOTE: terminfo and curses libraries are required separately, as
-# some systems do not bundle them together.
+
+include(CMakePushCheckState)
+
+function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+  cmake_reset_check_state()
+  set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
+  # acs_map is one of many symbols that are part of tinfo but could
+  # be bundled in curses.
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+endfunction()
 
 if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
-  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
+  
+  # Sometimes the curs

[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/126810

>From ddd3febff5b77cc7b2101996d49729added00f2b Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 1 Oct 2024 18:41:28 +
Subject: [PATCH 1/4] [lldb] Add terminfo dependency for ncurses support

For some operating systems (e.g. chromiumos), terminfo is a separate
package and library from ncurses. Both are still requirements for curses
support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Without this fix, LLDB cannot be built on these systems.

Fixes #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214bf54b..df4980cc5e0d1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,15 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
+# NOTE: terminfo and curses libraries are required separately, as
+# some systems do not bundle them together.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
+  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +19,10 @@ else()
 REQUIRED_VARS
   CURSES_INCLUDE_DIRS
   CURSES_LIBRARIES
+  TINFO_LIBRARIES
   PANEL_LIBRARIES)
-  if(CURSES_FOUND AND PANEL_LIBRARIES)
-mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES 
PANEL_LIBRARIES)
   endif()
 endif()
 

>From 41ad79112bc2242a1cb10ae688353863155d9038 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 18:22:09 +
Subject: [PATCH 2/4] fixup! [lldb] Add terminfo dependency for ncurses support

---
 lldb/source/Core/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da489..6c7a50056f751 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
 set(LLDB_LIBEDIT_LIBS)
 
 if (LLDB_ENABLE_CURSES)
-  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES} 
${TINFO_LIBRARIES})
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_CURSES_LIBS gpm)
   endif()

>From 9ffc89356cc635ac31f11c66dcb6f32cd73380fc Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 19:29:23 +
Subject: [PATCH 3/4] fixup! fixup! [lldb] Add terminfo dependency for ncurses
 support

---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 41 +
 lldb/cmake/modules/FindTerminfo.cmake   | 21 +++
 lldb/source/Core/CMakeLists.txt |  5 ++-
 3 files changed, 59 insertions(+), 8 deletions(-)
 create mode 100644 lldb/cmake/modules/FindTerminfo.cmake

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index df4980cc5e0d1..646113155343d 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -3,26 +3,53 @@
 # ---
 #
 # Find the curses, terminfo, and panel library as a whole.
-# NOTE: terminfo and curses libraries are required separately, as
-# some systems do not bundle them together.
+
+include(CMakePushCheckState)
+
+function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+  cmake_reset_check_state()
+  set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
+  # acs_map is one of many symbols that are part of tinfo but could
+  # be bundled in curses.
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+endfunction()
 
 if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
-  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
+  
+  # Sometimes the curs

[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

Tested with a system that has bundled terminfo in curses and one without 
locally!

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-12 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/126810

>From ddd3febff5b77cc7b2101996d49729added00f2b Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 1 Oct 2024 18:41:28 +
Subject: [PATCH 1/2] [lldb] Add terminfo dependency for ncurses support

For some operating systems (e.g. chromiumos), terminfo is a separate
package and library from ncurses. Both are still requirements for curses
support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Without this fix, LLDB cannot be built on these systems.

Fixes #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214bf54b..df4980cc5e0d1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,15 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
+# NOTE: terminfo and curses libraries are required separately, as
+# some systems do not bundle them together.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
+  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +19,10 @@ else()
 REQUIRED_VARS
   CURSES_INCLUDE_DIRS
   CURSES_LIBRARIES
+  TINFO_LIBRARIES
   PANEL_LIBRARIES)
-  if(CURSES_FOUND AND PANEL_LIBRARIES)
-mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES 
PANEL_LIBRARIES)
   endif()
 endif()
 

>From 41ad79112bc2242a1cb10ae688353863155d9038 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 18:22:09 +
Subject: [PATCH 2/2] fixup! [lldb] Add terminfo dependency for ncurses support

---
 lldb/source/Core/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da489..6c7a50056f751 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
 set(LLDB_LIBEDIT_LIBS)
 
 if (LLDB_ENABLE_CURSES)
-  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES} 
${TINFO_LIBRARIES})
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_CURSES_LIBS gpm)
   endif()

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/126810

>From ddd3febff5b77cc7b2101996d49729added00f2b Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Tue, 1 Oct 2024 18:41:28 +
Subject: [PATCH 1/6] [lldb] Add terminfo dependency for ncurses support

For some operating systems (e.g. chromiumos), terminfo is a separate
package and library from ncurses. Both are still requirements for curses
support in lldb, individually.

This is a rebase of this original spack commit:
https://github.com/spack/spack/commit/9ea261265010eacd250691a8361f661d0576f25c

Without this fix, LLDB cannot be built on these systems.

Fixes #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 12 
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index aaadf214bf54b..df4980cc5e0d1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -2,12 +2,15 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
+# NOTE: terminfo and curses libraries are required separately, as
+# some systems do not bundle them together.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
+  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
   find_package_handle_standard_args(CursesAndPanel
@@ -16,9 +19,10 @@ else()
 REQUIRED_VARS
   CURSES_INCLUDE_DIRS
   CURSES_LIBRARIES
+  TINFO_LIBRARIES
   PANEL_LIBRARIES)
-  if(CURSES_FOUND AND PANEL_LIBRARIES)
-mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES PANEL_LIBRARIES)
+  if(CURSES_FOUND AND TINFO_LIBRARIES AND PANEL_LIBRARIES)
+mark_as_advanced(CURSES_INCLUDE_DIRS CURSES_LIBRARIES TINFO_LIBRARIES 
PANEL_LIBRARIES)
   endif()
 endif()
 

>From 41ad79112bc2242a1cb10ae688353863155d9038 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 18:22:09 +
Subject: [PATCH 2/6] fixup! [lldb] Add terminfo dependency for ncurses support

---
 lldb/source/Core/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da489..6c7a50056f751 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -10,7 +10,7 @@ set(LLDB_CURSES_LIBS)
 set(LLDB_LIBEDIT_LIBS)
 
 if (LLDB_ENABLE_CURSES)
-  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES})
+  list(APPEND LLDB_CURSES_LIBS ${PANEL_LIBRARIES} ${CURSES_LIBRARIES} 
${TINFO_LIBRARIES})
   if (LLVM_BUILD_STATIC)
 list(APPEND LLDB_CURSES_LIBS gpm)
   endif()

>From 9ffc89356cc635ac31f11c66dcb6f32cd73380fc Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 12 Feb 2025 19:29:23 +
Subject: [PATCH 3/6] fixup! fixup! [lldb] Add terminfo dependency for ncurses
 support

---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 41 +
 lldb/cmake/modules/FindTerminfo.cmake   | 21 +++
 lldb/source/Core/CMakeLists.txt |  5 ++-
 3 files changed, 59 insertions(+), 8 deletions(-)
 create mode 100644 lldb/cmake/modules/FindTerminfo.cmake

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index df4980cc5e0d1..646113155343d 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -3,26 +3,53 @@
 # ---
 #
 # Find the curses, terminfo, and panel library as a whole.
-# NOTE: terminfo and curses libraries are required separately, as
-# some systems do not bundle them together.
+
+include(CMakePushCheckState)
+
+function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+  cmake_reset_check_state()
+  set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
+  # acs_map is one of many symbols that are part of tinfo but could
+  # be bundled in curses.
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+endfunction()
 
 if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
-  find_package(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
+  
+  # Sometimes the curs

[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-14 Thread Jordan R AW via lldb-commits


@@ -2,23 +2,54 @@
 # FindCursesAndPanel
 # ---
 #
-# Find the curses and panel library as a whole.
+# Find the curses, terminfo, and panel library as a whole.
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+include(CMakePushCheckState)
+
+function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+  cmake_reset_check_state()
+  set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
+  # acs_map is one of many symbols that are part of tinfo but could
+  # be bundled in curses.
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+endfunction()
+
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
   find_library(PANEL_LIBRARIES NAMES panel DOC "The curses panel library" 
QUIET)
   include(FindPackageHandleStandardArgs)
+  
+  # Sometimes the curses libraries define their own terminfo symbols,
+  # other times they're extern and are defined by a separate terminfo library.
+  # Auto-detect which.
+  lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
+  if(CURSES_FOUND AND PANEL_LIBRARIES)
+if (NOT CURSES_HAS_TINFO)

ajordanr-google wrote:

As above, I'm going to keep `lldb_check_curses_tinfo()`, but I should indeed 
move this into the `if`. Thanks!

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google created 
https://github.com/llvm/llvm-project/pull/128245

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES after 
it is found through `find_package`. However, by introducing a check for 
TINFO_LIBRARIES, we break systems which pass all of CURSES_INCLUDE_DIRS, 
CURSES_LIBRARIES, and PANEL_LIBRARIES individually without passing 
TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES at all.

This commit preemptively attempts to fix issues encountered on systems that 
manually pass CURSES_LIBRARIES which already contain the necessary terminfo 
symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd to begin 
with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368

>From ff5884d252b8359bcec41024f9dc9e3c7bbe3fc2 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 19 Feb 2025 19:24:40 +
Subject: [PATCH] [lldb] Fix manual CURSES_LIBRARIES tinfo finding

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES
after it is found through `find_package`. However, by introducing a
check for TINFO_LIBRARIES, we break systems which pass all of
CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually
without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES
at all.

This commit preemptively attempts to fix issues encountered
on systems that manually pass CURSES_LIBRARIES which already
contain the necessary terminfo symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd
to begin with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 75ebaa35d7ea1..315810c87b67b 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,15 +6,24 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
 endfunction()
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  if(NOT HAS_TERMINFO_SYMBOLS)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if (NOT CURSES_HAS_TINFO)
+  message(WARNING "CURSES_LIBRARIES was provided manually but is missing 
terminfo symbols")
+endif()
+mark_as_advanced(CURSES_HAS_TINFO)
+  endif()
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
@@ -25,7 +34,9 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
 if (NOT CURSES_HAS_TINFO)
   message(STATUS "curses library missing terminfo symbols, looking for 
tinfo separately")
   find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-21 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

Turns out `set(CURSES_LIBRARIES "${CURSES_LIBRARIES } ${TINFO_LIBRARIES}")` 
definitely does NOT work. I think there's some string quoting which gives:

```
ninja -v -j96 -l999 distribution libclang.so


   
ninja: error: '/usr/lib/libform.so /usr/lib/libtinfo.so', needed by 
'lib64/liblldb.so.20.0.0git', missing and no known rule to make it
 * ERROR: sys-devel/llvm-::chromiumos failed (compile phase):
 ```
Both `libform.so` and `libtinfo.so` exist at those locations, but obviously the 
joint path with a space does not.

Using `list(APPEND *_LIBRARIES ${...})` is pretty common elsewhere throughout 
llvm-project, so I think this is normal. (e.g. 
mlir/cmake/modules/FindLevelZero.cmake, 
libunwind/cmake/Modules/HandleLibunwindFlags.cmake, etc.). Also `LINK_LIBS` in 
`add_lldb_library` is a list, so it should work out.

Everything else I think have working in a new patch. Will upload now.

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits


@@ -6,15 +6,24 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)

ajordanr-google wrote:

Both options work, but indeed, I chose `check_symbol_exists` as the cmake 
documentation prefers it.

I'm fine with using `CMAKE_REQUIRED_INCLUDES` instead; I think that makes sense.

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/128245

>From ff5884d252b8359bcec41024f9dc9e3c7bbe3fc2 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 19 Feb 2025 19:24:40 +
Subject: [PATCH 1/4] [lldb] Fix manual CURSES_LIBRARIES tinfo finding

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES
after it is found through `find_package`. However, by introducing a
check for TINFO_LIBRARIES, we break systems which pass all of
CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually
without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES
at all.

This commit preemptively attempts to fix issues encountered
on systems that manually pass CURSES_LIBRARIES which already
contain the necessary terminfo symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd
to begin with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 75ebaa35d7ea1..315810c87b67b 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,15 +6,24 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
 endfunction()
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  if(NOT HAS_TERMINFO_SYMBOLS)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if (NOT CURSES_HAS_TINFO)
+  message(WARNING "CURSES_LIBRARIES was provided manually but is missing 
terminfo symbols")
+endif()
+mark_as_advanced(CURSES_HAS_TINFO)
+  endif()
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
@@ -25,7 +34,9 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
 if (NOT CURSES_HAS_TINFO)
   message(STATUS "curses library missing terminfo symbols, looking for 
tinfo separately")
   find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)

>From b25240267657f4d5c66125eac6fe74856b73b15a Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Fri, 21 Feb 2025 23:39:01 +
Subject: [PATCH 2/4] fixup! [lldb] Fix manual CURSES_LIBRARIES tinfo finding

---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 315810c87b67b..9033813009977 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,12 +6,13 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
+  set(CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS}")
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
 endfunction()
 
 if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
@@ -34,7 +35,7 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
 "${CURSES_LIBRARIES}"
 CURSES_HAS_TINFO)
 if (NOT CURSES_HAS_TINFO)

>From 0f16f66afc4e822824e0bf19d889ff3415701df1 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Wh

[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/128245

>From ff5884d252b8359bcec41024f9dc9e3c7bbe3fc2 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 19 Feb 2025 19:24:40 +
Subject: [PATCH 1/3] [lldb] Fix manual CURSES_LIBRARIES tinfo finding

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES
after it is found through `find_package`. However, by introducing a
check for TINFO_LIBRARIES, we break systems which pass all of
CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually
without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES
at all.

This commit preemptively attempts to fix issues encountered
on systems that manually pass CURSES_LIBRARIES which already
contain the necessary terminfo symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd
to begin with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 75ebaa35d7ea1..315810c87b67b 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,15 +6,24 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
 endfunction()
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  if(NOT HAS_TERMINFO_SYMBOLS)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if (NOT CURSES_HAS_TINFO)
+  message(WARNING "CURSES_LIBRARIES was provided manually but is missing 
terminfo symbols")
+endif()
+mark_as_advanced(CURSES_HAS_TINFO)
+  endif()
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
@@ -25,7 +34,9 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
 if (NOT CURSES_HAS_TINFO)
   message(STATUS "curses library missing terminfo symbols, looking for 
tinfo separately")
   find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)

>From b25240267657f4d5c66125eac6fe74856b73b15a Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Fri, 21 Feb 2025 23:39:01 +
Subject: [PATCH 2/3] fixup! [lldb] Fix manual CURSES_LIBRARIES tinfo finding

---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 315810c87b67b..9033813009977 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,12 +6,13 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
+  set(CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS}")
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
 endfunction()
 
 if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
@@ -34,7 +35,7 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
 "${CURSES_LIBRARIES}"
 CURSES_HAS_TINFO)
 if (NOT CURSES_HAS_TINFO)

>From 0f16f66afc4e822824e0bf19d889ff3415701df1 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Wh

[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

Rebasing to fix merge conflict...

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/128245

>From f0d81ca9124f0e4b0a60f2752c56c4166052813a Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 19 Feb 2025 19:24:40 +
Subject: [PATCH] [lldb] Fix manual CURSES_LIBRARIES tinfo finding

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES
after it is found through `find_package`. However, by introducing a
check for TINFO_LIBRARIES, we break systems which pass all of
CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually
without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES
at all.

This commit preemptively attempts to fix issues encountered
on systems that manually pass CURSES_LIBRARIES which already
contain the necessary terminfo symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd
to begin with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 75ebaa35d7ea1..8628059f91ba1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,15 +6,25 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
+  set(CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS}")
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
   check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
 endfunction()
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  if(NOT HAS_TERMINFO_SYMBOLS)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if(NOT CURSES_HAS_TINFO)
+  message(WARNING "CURSES_LIBRARIES was provided manually but is missing 
terminfo symbols")
+endif()
+mark_as_advanced(CURSES_HAS_TINFO)
+  endif()
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
@@ -25,8 +35,10 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
-if (NOT CURSES_HAS_TINFO)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if(NOT CURSES_HAS_TINFO)
   message(STATUS "curses library missing terminfo symbols, looking for 
tinfo separately")
   find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   list(APPEND CURSES_LIBRARIES "${TINFO_LIBRARIES}")

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/128245

>From f0d81ca9124f0e4b0a60f2752c56c4166052813a Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 19 Feb 2025 19:24:40 +
Subject: [PATCH] [lldb] Fix manual CURSES_LIBRARIES tinfo finding

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES
after it is found through `find_package`. However, by introducing a
check for TINFO_LIBRARIES, we break systems which pass all of
CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually
without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES
at all.

This commit preemptively attempts to fix issues encountered
on systems that manually pass CURSES_LIBRARIES which already
contain the necessary terminfo symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd
to begin with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 75ebaa35d7ea1..8628059f91ba1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,15 +6,25 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
+  set(CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS}")
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
   check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
 endfunction()
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  if(NOT HAS_TERMINFO_SYMBOLS)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if(NOT CURSES_HAS_TINFO)
+  message(WARNING "CURSES_LIBRARIES was provided manually but is missing 
terminfo symbols")
+endif()
+mark_as_advanced(CURSES_HAS_TINFO)
+  endif()
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
@@ -25,8 +35,10 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
-if (NOT CURSES_HAS_TINFO)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if(NOT CURSES_HAS_TINFO)
   message(STATUS "curses library missing terminfo symbols, looking for 
tinfo separately")
   find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   list(APPEND CURSES_LIBRARIES "${TINFO_LIBRARIES}")

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/128245

>From f0d81ca9124f0e4b0a60f2752c56c4166052813a Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 19 Feb 2025 19:24:40 +
Subject: [PATCH] [lldb] Fix manual CURSES_LIBRARIES tinfo finding

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES
after it is found through `find_package`. However, by introducing a
check for TINFO_LIBRARIES, we break systems which pass all of
CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually
without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES
at all.

This commit preemptively attempts to fix issues encountered
on systems that manually pass CURSES_LIBRARIES which already
contain the necessary terminfo symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd
to begin with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 20 
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 75ebaa35d7ea1..8628059f91ba1 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,15 +6,25 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
+  set(CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS}")
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
   check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
 endfunction()
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  if(NOT HAS_TERMINFO_SYMBOLS)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if(NOT CURSES_HAS_TINFO)
+  message(WARNING "CURSES_LIBRARIES was provided manually but is missing 
terminfo symbols")
+endif()
+mark_as_advanced(CURSES_HAS_TINFO)
+  endif()
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
@@ -25,8 +35,10 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
-if (NOT CURSES_HAS_TINFO)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if(NOT CURSES_HAS_TINFO)
   message(STATUS "curses library missing terminfo symbols, looking for 
tinfo separately")
   find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)
   list(APPEND CURSES_LIBRARIES "${TINFO_LIBRARIES}")

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


[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits

https://github.com/ajordanr-google updated 
https://github.com/llvm/llvm-project/pull/128245

>From ff5884d252b8359bcec41024f9dc9e3c7bbe3fc2 Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Wed, 19 Feb 2025 19:24:40 +
Subject: [PATCH 1/2] [lldb] Fix manual CURSES_LIBRARIES tinfo finding

At present, we automatically detect terminfo symbols in CURSES_LIBRARIES
after it is found through `find_package`. However, by introducing a
check for TINFO_LIBRARIES, we break systems which pass all of
CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES individually
without passing TINFO_LIBRARIES. We'd rather not expose TINFO_LIBRARIES
at all.

This commit preemptively attempts to fix issues encountered
on systems that manually pass CURSES_LIBRARIES which already
contain the necessary terminfo symbols (e.g. 'acs_map').

Additionally, let's not make CURSES_LIBRARIES a list. That was odd
to begin with.

See this breakage in Google Fuchsia:
https://issues.fuchsia.dev/397455029

References Issue #101368
---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 75ebaa35d7ea1..315810c87b67b 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,15 +6,24 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
 endfunction()
 
-if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND TINFO_LIBRARIES AND 
PANEL_LIBRARIES)
+if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
+  if(NOT HAS_TERMINFO_SYMBOLS)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
+if (NOT CURSES_HAS_TINFO)
+  message(WARNING "CURSES_LIBRARIES was provided manually but is missing 
terminfo symbols")
+endif()
+mark_as_advanced(CURSES_HAS_TINFO)
+  endif()
   set(CURSESANDPANEL_FOUND TRUE)
 else()
   find_package(Curses QUIET)
@@ -25,7 +34,9 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_LIBRARIES}" CURSES_HAS_TINFO)
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+"${CURSES_LIBRARIES}"
+CURSES_HAS_TINFO)
 if (NOT CURSES_HAS_TINFO)
   message(STATUS "curses library missing terminfo symbols, looking for 
tinfo separately")
   find_library(TINFO_LIBRARIES NAMES tinfo DOC "The curses tinfo library" 
QUIET)

>From b25240267657f4d5c66125eac6fe74856b73b15a Mon Sep 17 00:00:00 2001
From: Jordan R Abrahams-Whitehead 
Date: Fri, 21 Feb 2025 23:39:01 +
Subject: [PATCH 2/2] fixup! [lldb] Fix manual CURSES_LIBRARIES tinfo finding

---
 lldb/cmake/modules/FindCursesAndPanel.cmake | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lldb/cmake/modules/FindCursesAndPanel.cmake 
b/lldb/cmake/modules/FindCursesAndPanel.cmake
index 315810c87b67b..9033813009977 100644
--- a/lldb/cmake/modules/FindCursesAndPanel.cmake
+++ b/lldb/cmake/modules/FindCursesAndPanel.cmake
@@ -6,12 +6,13 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_INCLUDE_DIRS CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
+  set(CMAKE_REQUIRED_INCLUDES "${CURSES_INCLUDE_DIRS}")
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
 endfunction()
 
 if(CURSES_INCLUDE_DIRS AND CURSES_LIBRARIES AND PANEL_LIBRARIES)
@@ -34,7 +35,7 @@ else()
 # Sometimes the curses libraries define their own terminfo symbols,
 # other times they're extern and are defined by a separate terminfo 
library.
 # Auto-detect which.
-lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}/curses.h"
+lldb_check_curses_tinfo("${CURSES_INCLUDE_DIRS}"
 "${CURSES_LIBRARIES}"
 CURSES_HAS_TINFO)
 if (NOT CURSES_HAS_TINFO)

___
lldb-commits mailing list
lldb-commits@lists.llvm.

[Lldb-commits] [lldb] [lldb] Fix manual CURSES_LIBRARIES tinfo finding (PR #128245)

2025-02-21 Thread Jordan R AW via lldb-commits


@@ -6,15 +6,24 @@
 
 include(CMakePushCheckState)
 
-function(lldb_check_curses_tinfo CURSES_LIBRARIES CURSES_HAS_TINFO)
+function(lldb_check_curses_tinfo CURSES_HEADER CURSES_LIBRARIES 
CURSES_HAS_TINFO)
   cmake_reset_check_state()
   set(CMAKE_REQUIRED_LIBRARIES "${CURSES_LIBRARIES}")
   # acs_map is one of many symbols that are part of tinfo but could
   # be bundled in curses.
-  check_symbol_exists(acs_map "curses.h" CURSES_HAS_TINFO)
+  check_symbol_exists(acs_map "${CURSES_HEADER}" CURSES_HAS_TINFO)

ajordanr-google wrote:

Patched using @mystermath's suggestion, tested in 3 different configurations:

1. With acs_map defined in libcurses.so
1. with acs_map defined in libtinfo.so
1. With -DCURSES_LIBRARIES specified, and acs_map defined in libcurses.so

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-18 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

This apparently broke a downstream edge case with fuschia: 
https://issues.fuchsia.dev/397455029, where they set all but the 
`TINFO_LIBRARIES` variable.

I have given them a downstream fix, but wondering if I can rework the patch so 
that this isn't an issue. I don't think we need to revert, given this only 
happens with edge-case defines and it's easily fixed downstream by setting 
`TINFO_LIBRARIES = CURSES_LIBRARIES`.

I'm thinking we could make it easier for folks who hit similar errors by doing 
one of the following:

1. Checking that when `CURSES_LIBRARIES`, see if it has the symbols. If not, 
then check if `TINFO_LIBRARIES` is set. Error out if not.
2. Don't check for the existence of `TINFO_LIBRARIES` at all, assume 
`CURSES_LIBRARIES` is set "correctly" for their use case.

I don't really have a preference here.

I also notice with this commit that we're changing `CURSES_LIBRARIES` to be a 
path to a list of paths. Not sure if anyone depends on that fact? Do we care?

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-19 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

> Okay, I think I understand what's going on with fuchsia: they manually set 
> CURSES_INCLUDE_DIRS, CURSES_LIBRARIES, and PANEL_LIBRARIES. On line 17 we go 
> into the else-case because TINFO_LIBRARIES is not set.

That's correct!

> So next we check if the provided CURSES_LIBRARIES has our symbol...

I believe they don't even get this far. They apparently have an issue with 
find_package/find_library lookup mechanism, and that fails. So it breaks then 
without even trying to check for the symbol.

> (As an aside, while I'm reading this: why is this checking TINFO_LIBRARIES 
> and not HAS_TERMINFO_SYMBOLS, that's what this package sets. I don't think we 
> should be mentioning TINFO_LIBRARIES at all, unless we know someone is 
> setting that manually?)

Mostly this variable was derived from the spack commit which uses it. That's 
the only place I know it exists. Technically now fuchsia is using it too, after 
they implemented the fix (which also logically makes some sense, 
`TINFO_LIBRARIES` in their case IS `CURSES_LIBRARIES`.

---

If we were to hide TINFO_LIBRARIES entirely in the conditional, we must check 
`CURSES_LIBRARIES` to see if what's passed has the necessary terminfo symbols 
(or just tell people it needs to be there). I'm fine with that. We shouldn't 
_need_ to check `HAS_TERMINFO_SYMBOLS` if they're providing this all directly.

---

Cool cool, will do about the `CURSES_LIBRARIES` update.

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-28 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

/cherry-pick 8d017e6c0178f2628b246c18b2a634909815e54f 
eec242aa97c8d153574923f8237754ca3fa6f0a6

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-28 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

/cherry-pick 8fff0c181f26a5e8b2344c061ebf2559118b1160 
bb6a273d9ab9ee90dbb957e541f4d810fffb22ee

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-02-28 Thread Jordan R AW via lldb-commits

ajordanr-google wrote:

We haven't had any issues since on our end. I'll check with Fuchsia again to be 
sure, then will try to backport.

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


[Lldb-commits] [lldb] [lldb] Add terminfo dependency for ncurses support (PR #126810)

2025-03-01 Thread Jordan R AW via lldb-commits

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