[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64

2023-04-19 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta created this revision.
Herald added subscribers: ctetreau, omjavaid, kristof.beyls, tschuett.
Herald added a project: All.
manojgupta requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Use correct internal sve functions for arm64.
Otherwise, when cross-compling lld for AArch64 there are build
errors like:
NativeRegisterContextLinux_arm64.cpp:936:11:

  error: use of undeclared identifier 'sve_vl_valid

NativeRegisterContextLinux_arm64.cpp:63:28:

  error: variable has incomplete type 'struct user_sve_header'


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148752

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp


Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -61,7 +61,7 @@
   case llvm::Triple::aarch64: {
 // Configure register sets supported by this AArch64 target.
 // Read SVE header to check for SVE support.
-struct user_sve_header sve_header;
+struct sve::user_sve_header sve_header;
 struct iovec ioVec;
 ioVec.iov_base = &sve_header;
 ioVec.iov_len = sizeof(sve_header);
@@ -380,7 +380,7 @@
   if (GetRegisterInfo().IsSVERegVG(reg)) {
 uint64_t vg_value = reg_value.GetAsUInt64();
 
-if (sve_vl_valid(vg_value * 8)) {
+if (sve::vl_valid(vg_value * 8)) {
   if (m_sve_header_is_valid && vg_value == GetSVERegVG())
 return error;
 
@@ -566,7 +566,7 @@
   if (contains_sve_reg_data) {
 // We have SVE register data first write SVE header.
 ::memcpy(GetSVEHeader(), src, GetSVEHeaderSize());
-if (!sve_vl_valid(m_sve_header.vl)) {
+if (!sve::vl_valid(m_sve_header.vl)) {
   m_sve_header_is_valid = false;
   error.SetErrorStringWithFormat("NativeRegisterContextLinux_arm64::%s "
  "Invalid SVE header in data_sp",
@@ -934,7 +934,7 @@
   // On every stop we configure SVE vector length by calling
   // ConfigureVectorLength regardless of current SVEState of this thread.
   uint32_t vq = RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVE;
-  if (sve_vl_valid(m_sve_header.vl))
+  if (sve::vl_valid(m_sve_header.vl))
 vq = sve::vq_from_vl(m_sve_header.vl);
 
   GetRegisterInfo().ConfigureVectorLength(vq);


Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -61,7 +61,7 @@
   case llvm::Triple::aarch64: {
 // Configure register sets supported by this AArch64 target.
 // Read SVE header to check for SVE support.
-struct user_sve_header sve_header;
+struct sve::user_sve_header sve_header;
 struct iovec ioVec;
 ioVec.iov_base = &sve_header;
 ioVec.iov_len = sizeof(sve_header);
@@ -380,7 +380,7 @@
   if (GetRegisterInfo().IsSVERegVG(reg)) {
 uint64_t vg_value = reg_value.GetAsUInt64();
 
-if (sve_vl_valid(vg_value * 8)) {
+if (sve::vl_valid(vg_value * 8)) {
   if (m_sve_header_is_valid && vg_value == GetSVERegVG())
 return error;
 
@@ -566,7 +566,7 @@
   if (contains_sve_reg_data) {
 // We have SVE register data first write SVE header.
 ::memcpy(GetSVEHeader(), src, GetSVEHeaderSize());
-if (!sve_vl_valid(m_sve_header.vl)) {
+if (!sve::vl_valid(m_sve_header.vl)) {
   m_sve_header_is_valid = false;
   error.SetErrorStringWithFormat("NativeRegisterContextLinux_arm64::%s "
  "Invalid SVE header in data_sp",
@@ -934,7 +934,7 @@
   // On every stop we configure SVE vector length by calling
   // ConfigureVectorLength regardless of current SVEState of this thread.
   uint32_t vq = RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVE;
-  if (sve_vl_valid(m_sve_header.vl))
+  if (sve::vl_valid(m_sve_header.vl))
 vq = sve::vq_from_vl(m_sve_header.vl);
 
   GetRegisterInfo().ConfigureVectorLength(vq);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64

2023-04-20 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta added a comment.

I am building on ChromeOS. We only have headers from linux kernel 4.14 
available in our build system (The actual running kernel could be a higher 
version).
But given these functions/struct definitions (sve::) are already available 
and used, why are they not used consistently?

e.g. 
https://source.chromium.org/chromium/external/github.com/llvm/llvm-project/+/main:lldb/source/Plugins/Process/elf-core/RegisterContextPOSIXCore_arm64.cpp;l=99
already uses sve::vl_valid and there are uses of sve::user_sve_header as well.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148752/new/

https://reviews.llvm.org/D148752

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


[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64

2023-04-21 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta added a comment.

Are there any objecttions? This patch is only making a consistent use of 
pre-existing and already in-use APIs/struct defintions.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148752/new/

https://reviews.llvm.org/D148752

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


[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64

2023-04-27 Thread Manoj Gupta via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGbe5f35e24f4c: lldb: Fix usage of sve functions on arm64 
(authored by manojgupta).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148752/new/

https://reviews.llvm.org/D148752

Files:
  lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp


Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -61,7 +61,7 @@
   case llvm::Triple::aarch64: {
 // Configure register sets supported by this AArch64 target.
 // Read SVE header to check for SVE support.
-struct user_sve_header sve_header;
+struct sve::user_sve_header sve_header;
 struct iovec ioVec;
 ioVec.iov_base = &sve_header;
 ioVec.iov_len = sizeof(sve_header);
@@ -380,7 +380,7 @@
   if (GetRegisterInfo().IsSVERegVG(reg)) {
 uint64_t vg_value = reg_value.GetAsUInt64();
 
-if (sve_vl_valid(vg_value * 8)) {
+if (sve::vl_valid(vg_value * 8)) {
   if (m_sve_header_is_valid && vg_value == GetSVERegVG())
 return error;
 
@@ -566,7 +566,7 @@
   if (contains_sve_reg_data) {
 // We have SVE register data first write SVE header.
 ::memcpy(GetSVEHeader(), src, GetSVEHeaderSize());
-if (!sve_vl_valid(m_sve_header.vl)) {
+if (!sve::vl_valid(m_sve_header.vl)) {
   m_sve_header_is_valid = false;
   error.SetErrorStringWithFormat("NativeRegisterContextLinux_arm64::%s "
  "Invalid SVE header in data_sp",
@@ -934,7 +934,7 @@
   // On every stop we configure SVE vector length by calling
   // ConfigureVectorLength regardless of current SVEState of this thread.
   uint32_t vq = RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVE;
-  if (sve_vl_valid(m_sve_header.vl))
+  if (sve::vl_valid(m_sve_header.vl))
 vq = sve::vq_from_vl(m_sve_header.vl);
 
   GetRegisterInfo().ConfigureVectorLength(vq);


Index: lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
===
--- lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -61,7 +61,7 @@
   case llvm::Triple::aarch64: {
 // Configure register sets supported by this AArch64 target.
 // Read SVE header to check for SVE support.
-struct user_sve_header sve_header;
+struct sve::user_sve_header sve_header;
 struct iovec ioVec;
 ioVec.iov_base = &sve_header;
 ioVec.iov_len = sizeof(sve_header);
@@ -380,7 +380,7 @@
   if (GetRegisterInfo().IsSVERegVG(reg)) {
 uint64_t vg_value = reg_value.GetAsUInt64();
 
-if (sve_vl_valid(vg_value * 8)) {
+if (sve::vl_valid(vg_value * 8)) {
   if (m_sve_header_is_valid && vg_value == GetSVERegVG())
 return error;
 
@@ -566,7 +566,7 @@
   if (contains_sve_reg_data) {
 // We have SVE register data first write SVE header.
 ::memcpy(GetSVEHeader(), src, GetSVEHeaderSize());
-if (!sve_vl_valid(m_sve_header.vl)) {
+if (!sve::vl_valid(m_sve_header.vl)) {
   m_sve_header_is_valid = false;
   error.SetErrorStringWithFormat("NativeRegisterContextLinux_arm64::%s "
  "Invalid SVE header in data_sp",
@@ -934,7 +934,7 @@
   // On every stop we configure SVE vector length by calling
   // ConfigureVectorLength regardless of current SVEState of this thread.
   uint32_t vq = RegisterInfoPOSIX_arm64::eVectorQuadwordAArch64SVE;
-  if (sve_vl_valid(m_sve_header.vl))
+  if (sve::vl_valid(m_sve_header.vl))
 vq = sve::vq_from_vl(m_sve_header.vl);
 
   GetRegisterInfo().ConfigureVectorLength(vq);
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D148752: lldb: Fix usage of sve functions on arm64

2023-04-27 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta added a comment.

Thanks, regarding sve from Linux headers, LLVM currently supports building with 
GCC  7.1 or clang 5.0 and both were released in 2017. SVE support in Linux 
kernel believe  was added in Linux kernel 4.19 timeframe iso maybe late 2018. 
If SVE needs to be built from recent headers as a pre-requisite, then the Linux 
headers version requirement must also be added to llvm docs at 
https://llvm.org/docs/GettingStarted.html.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148752/new/

https://reviews.llvm.org/D148752

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


[Lldb-commits] [PATCH] D108053: [lldb] skip host build for lldb_tblgen with LLDB_TABLEGEN_EXE set

2021-08-13 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta created this revision.
manojgupta added reviewers: JDevlieghere, mstorsjo.
Herald added a subscriber: mgorny.
manojgupta requested review of this revision.
Herald added a project: LLDB.

When cross compiling lldb-server, do not create a host build
for building lldb-tblgeb when LLDB_TABLEGEN_EXE is already
provided. This avoids an expensive and time-consuming build step
if lldb-tblgen was already built previously for host.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D108053

Files:
  lldb/CMakeLists.txt


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -64,7 +64,7 @@
   list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen)
 endif()
 
-if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE)
+if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE AND NOT LLDB_TABLEGEN_EXE)
   set(LLVM_USE_HOST_TOOLS ON)
   include(CrossCompile)
   if (NOT NATIVE_LLVM_DIR OR NOT NATIVE_Clang_DIR)


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -64,7 +64,7 @@
   list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen)
 endif()
 
-if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE)
+if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE AND NOT LLDB_TABLEGEN_EXE)
   set(LLVM_USE_HOST_TOOLS ON)
   include(CrossCompile)
   if (NOT NATIVE_LLVM_DIR OR NOT NATIVE_Clang_DIR)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D108053: [lldb] skip host build for lldb_tblgen with LLDB_TABLEGEN_EXE set

2021-08-13 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta added a comment.

This is a local patch we have been carrying in Chrome OS.
What we do to cross compile lldb-server:

1. Create host build to build tools like llvm-tblgen, clang-tblgen, lldb-tblgen
2. Cross compile llvm and clang libraries using the just build *tblgen.
3. Cross compile lldb by setting the path to pre-cross compiled libraries and 
*tblgen binaries from step 1.

Without this patch, cross compiling lldb-server start yet another host build 
just to build lldb-tblgen which we want to avoid.
Also see 
https://chromium-review.googlesource.com/c/chromiumos/overlays/chromiumos-overlay/+/2851114/12/dev-util/lldb-server/lldb-server-12.0_pre416183.ebuild


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108053/new/

https://reviews.llvm.org/D108053

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


[Lldb-commits] [PATCH] D108053: [lldb] skip host build for lldb_tblgen with LLDB_TABLEGEN_EXE set

2021-08-13 Thread Manoj Gupta via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1f7b25ea76a9: [lldb] skip host build for lldb_tblgen with 
LLDB_TABLEGEN_EXE set (authored by manojgupta).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D108053/new/

https://reviews.llvm.org/D108053

Files:
  lldb/CMakeLists.txt


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -64,7 +64,7 @@
   list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen)
 endif()
 
-if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE)
+if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE AND NOT LLDB_TABLEGEN_EXE)
   set(LLVM_USE_HOST_TOOLS ON)
   include(CrossCompile)
   if (NOT NATIVE_LLVM_DIR OR NOT NATIVE_Clang_DIR)


Index: lldb/CMakeLists.txt
===
--- lldb/CMakeLists.txt
+++ lldb/CMakeLists.txt
@@ -64,7 +64,7 @@
   list(APPEND LLVM_COMMON_DEPENDS intrinsics_gen)
 endif()
 
-if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE)
+if(CMAKE_CROSSCOMPILING AND LLDB_BUILT_STANDALONE AND NOT LLDB_TABLEGEN_EXE)
   set(LLVM_USE_HOST_TOOLS ON)
   include(CrossCompile)
   if (NOT NATIVE_LLVM_DIR OR NOT NATIVE_Clang_DIR)
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-12 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta added a comment.

Hi,

I see another crash with this change when building gdb.

Reduced test case:
struct type *a(type *, type *, long, long);
enum b {};
static int empty_array(type *, int c) { type *d = a(__null, d, c, c - 1); }
long e;
b f() { empty_array(0, e); }

Repros with:
clang -cc1 -triple x86_64-linux-gnu -emit-obj -disable-free -mrelocation-model 
pic -pic-level 2 -pic-is-pie -mthread-model posix -mframe-pointer=all  
-mconstructor-aliases -munwind-tables  -dwarf-column-info  
-debug-info-kind=limited -dwarf-version=4 -debugger-tuning=gdb  -O2  -x c++

Chromium bug: https://bugs.chromium.org/p/chromium/issues/detail?id=1060788


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-20 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta added a comment.

Still causing a crash using a previously supplied test 
https://bugs.chromium.org/p/chromium/issues/detail?id=1061533#c7. Any reason 
this was not tested with a previous repro?


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



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


[Lldb-commits] [PATCH] D73534: [DebugInfo] Enable the debug entry values feature by default

2020-03-23 Thread Manoj Gupta via Phabricator via lldb-commits
manojgupta added a comment.

Thanks for the quick fix, verified that the crash is fixed on trunk.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73534/new/

https://reviews.llvm.org/D73534



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