[Lldb-commits] [libcxx] [llvm] [clang-tools-extra] [flang] [lldb] [lld] [clang] [compiler-rt] [libunwind] [AMDGPU] - Add constant folding for s_quadmask (PR #72381)

2023-11-17 Thread Matt Arsenault via lldb-commits


@@ -50,13 +49,10 @@ define i64 @test_quadmask_constant_i64() {
 ; GFX11-LABEL: test_quadmask_constant_i64:
 ; GFX11:   ; %bb.0: ; %entry
 ; GFX11-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; GFX11-NEXT:s_mov_b32 s0, 0x85fe3a92
-; GFX11-NEXT:s_mov_b32 s1, 0x67de48fc
-; GFX11-NEXT:s_quadmask_b64 s[0:1], s[0:1]
-; GFX11-NEXT:v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
+; GFX11-NEXT:v_dual_mov_b32 v0, 0xe3e6 :: v_dual_mov_b32 v1, 0
 ; GFX11-NEXT:s_setpc_b64 s[30:31]
 entry:
-  %qm = call i64 @llvm.amdgcn.s.quadmask.i64(i64 u0x67DE48FC85FE3A92)
+  %qm = call i64 @llvm.amdgcn.s.quadmask.i64(i64 u0x67D000FC85F00A90)

arsenm wrote:

Test some additional values, especially 0, -1, undef and poison 

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


[Lldb-commits] [libcxxabi] [libcxx] [lld] [clang-tools-extra] [lldb] [compiler-rt] [mlir] [libunwind] [clang] [libc] [llvm] [flang] [lldb][test] Add the ability to extract the variable value out of th

2023-11-17 Thread via lldb-commits

https://github.com/santhoshe447 created 
https://github.com/llvm/llvm-project/pull/72631

When it comes to test infrastructure the test (TestDAP_variables.py: 
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries) will 
fail if the variable has a summary along with value.

I just tried to add a summary to a variable before we set a value to the 
variable using below expression from “request_setVariable” function.
RunLLDBCommands(llvm::StringRef(), {std::string("type summary add 
--summary-string "{sample summary}" (const char **) argv")});

As value has nonnumeric characters where we are trying to convert into integer, 
python is throwing an error. We did not see this issue in upstream as we are 
not adding summary explicitly, by default we are getting empty summary & value 
for all children’s of argv parameter (even after auto summary).

The test is failing with below error:
ERROR: test_scopes_variables_setVariable_evaluate_with_descriptive_summaries 
(TestDAP_variables.TestDAP_variables)
Traceback (most recent call last):
File 
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
 line 372, in 
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries
enableAutoVariableSummaries=True
File 
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
 line 266, in do_test_scopes_variables_setVariable_evaluate
argv = self.get_local_as_int("argv")
File 
"//llvm/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py",
 line 199, in get_local_as_int
return int(value, 16)
ValueError: invalid literal for int() with base 16: '0x1234 sample 
summary'
Config=x86_64-//llvm/llvm-build/bin/clang

>From 960351c9abf51f42d92604ac6297aa5b76ddfba5 Mon Sep 17 00:00:00 2001
From: Santhosh Kumar Ellendula 
Date: Fri, 17 Nov 2023 15:09:10 +0530
Subject: [PATCH] [lldb][test] Add the ability to extract the variable value
 out of the summary.

---
 .../Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py   | 3 +++
 1 file changed, 3 insertions(+)

diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 9d79872b029a334..0cf9d4fde49488f 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -195,6 +195,9 @@ def collect_console(self, duration):
 
 def get_local_as_int(self, name, threadId=None):
 value = self.dap_server.get_local_variable_value(name, 
threadId=threadId)
+# 'value' may have the variable value and summary.
+# Extract the variable value since summary can have nonnumeric 
characters.
+value = value.split(" ")[0]
 if value.startswith("0x"):
 return int(value, 16)
 elif value.startswith("0"):

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


[Lldb-commits] [libcxxabi] [libcxx] [lld] [clang-tools-extra] [lldb] [compiler-rt] [mlir] [libunwind] [clang] [libc] [llvm] [flang] [lldb][test] Add the ability to extract the variable value out of th

2023-11-17 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: None (santhoshe447)


Changes

When it comes to test infrastructure the test (TestDAP_variables.py: 
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries) will 
fail if the variable has a summary along with value.

I just tried to add a summary to a variable before we set a value to the 
variable using below expression from “request_setVariable” function.
RunLLDBCommands(llvm::StringRef(), {std::string("type summary add 
--summary-string "{sample summary}" (const char **) argv")});

As value has nonnumeric characters where we are trying to convert into integer, 
python is throwing an error. We did not see this issue in upstream as we are 
not adding summary explicitly, by default we are getting empty summary & 
value for all children’s of argv parameter (even after auto summary).

The test is failing with below error:
ERROR: test_scopes_variables_setVariable_evaluate_with_descriptive_summaries 
(TestDAP_variables.TestDAP_variables)
Traceback (most recent call last):
File 
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
 line 372, in 
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries
enableAutoVariableSummaries=True
File 
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
 line 266, in do_test_scopes_variables_setVariable_evaluate
argv = self.get_local_as_int("argv")
File 
"//llvm/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py",
 line 199, in get_local_as_int
return int(value, 16)
ValueError: invalid literal for int() with base 16: '0x1234 sample 
summary'
Config=x86_64-//llvm/llvm-build/bin/clang

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


1 Files Affected:

- (modified) 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (+3) 


``diff
diff --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 9d79872b029a334..0cf9d4fde49488f 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -195,6 +195,9 @@ def collect_console(self, duration):
 
 def get_local_as_int(self, name, threadId=None):
 value = self.dap_server.get_local_variable_value(name, 
threadId=threadId)
+# 'value' may have the variable value and summary.
+# Extract the variable value since summary can have nonnumeric 
characters.
+value = value.split(" ")[0]
 if value.startswith("0x"):
 return int(value, 16)
 elif value.startswith("0"):

``




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


[Lldb-commits] [compiler-rt] [lldb] [clang-tools-extra] [llvm] [libc] [libcxx] [clang] [libcxxabi] [libunwind] [lld] [flang] [mlir] [lldb][test] Add the ability to extract the variable value out of th

2023-11-17 Thread via lldb-commits

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


[Lldb-commits] [lldb] [lldb] enable wasm source debugging (PR #72634)

2023-11-17 Thread Xu Jun via lldb-commits

https://github.com/xujuntwt95329 created 
https://github.com/llvm/llvm-project/pull/72634

Rebase https://reviews.llvm.org/D78978 on latest code base, with less 
modification to LLDB core part:

I treat wasm locals, globals and operand stack values as virtual registers, and 
implement a wasmRegisterContext to handle this. 

2 high bits in the reg_num are used as a tag to distinguish wasm values

>From b9f6f4c03b6f72f44f9270a7de377deab3e0d8f6 Mon Sep 17 00:00:00 2001
From: Xu Jun <693788...@qq.com>
Date: Fri, 17 Nov 2023 16:07:09 +0800
Subject: [PATCH] [lldb] enable wasm source debugging

---
 lldb/source/Expression/DWARFExpression.cpp|  42 +++
 lldb/source/Plugins/Process/CMakeLists.txt|   1 +
 .../Process/gdb-remote/ProcessGDBRemote.cpp   |   7 +-
 .../Process/gdb-remote/ProcessGDBRemote.h |   2 +
 .../Plugins/Process/wasm/CMakeLists.txt   |  15 +
 .../Plugins/Process/wasm/ProcessWasm.cpp  | 261 ++
 .../source/Plugins/Process/wasm/ProcessWasm.h | 132 +
 .../Plugins/Process/wasm/ThreadWasm.cpp   |  57 
 lldb/source/Plugins/Process/wasm/ThreadWasm.h |  47 
 .../Plugins/Process/wasm/UnwindWasm.cpp   |  79 ++
 lldb/source/Plugins/Process/wasm/UnwindWasm.h |  58 
 .../Process/wasm/wasmRegisterContext.cpp  | 103 +++
 .../Process/wasm/wasmRegisterContext.h|  70 +
 lldb/source/Target/Platform.cpp   |   8 +
 14 files changed, 881 insertions(+), 1 deletion(-)
 create mode 100644 lldb/source/Plugins/Process/wasm/CMakeLists.txt
 create mode 100644 lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
 create mode 100644 lldb/source/Plugins/Process/wasm/ProcessWasm.h
 create mode 100644 lldb/source/Plugins/Process/wasm/ThreadWasm.cpp
 create mode 100644 lldb/source/Plugins/Process/wasm/ThreadWasm.h
 create mode 100644 lldb/source/Plugins/Process/wasm/UnwindWasm.cpp
 create mode 100644 lldb/source/Plugins/Process/wasm/UnwindWasm.h
 create mode 100644 lldb/source/Plugins/Process/wasm/wasmRegisterContext.cpp
 create mode 100644 lldb/source/Plugins/Process/wasm/wasmRegisterContext.h

diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index fe4928d4f43a434..1693e390c2e9203 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -346,6 +346,17 @@ static offset_t GetOpcodeDataSize(const DataExtractor 
&data,
 return (offset - data_offset) + subexpr_len;
   }
 
+  case DW_OP_WASM_location: {
+uint8_t wasm_op = data.GetU8(&offset);
+if (wasm_op == 3) {
+  data.GetU32(&offset);
+}
+else {
+  data.GetULEB128(&offset);
+}
+return offset - data_offset;
+  }
+
   default:
 if (!dwarf_cu) {
   return LLDB_INVALID_OFFSET;
@@ -2595,6 +2606,37 @@ bool DWARFExpression::Evaluate(
   break;
 }
 
+case DW_OP_WASM_location: {
+  uint8_t wasm_op = opcodes.GetU8(&offset);
+  uint32_t index;
+
+  /* LLDB doesn't have an address space to represents WebAssembly Locals,
+   * GLobals and operand stacks.
+   * We encode these elements into virtual registers: 
+   *   | tag: 2 bits | index: 30 bits |
+   *   where tag is:
+   *0: Not a WebAssembly location
+   *1: Local
+   *2: Global
+   *3: Operand stack value 
+   */
+  if (wasm_op == 3) {
+index = opcodes.GetU32(&offset);
+wasm_op = 1;
+  } else {
+index = opcodes.GetULEB128(&offset);
+  }
+
+  reg_num = (((wasm_op + 1) & 0x03) << 30) | (index & 0x3fff);
+
+  if (ReadRegisterValueAsScalar(reg_ctx, reg_kind, reg_num, error_ptr, 
tmp))
+stack.push_back(tmp);
+  else
+return false;
+
+  break;
+}
+
 default:
   if (dwarf_cu) {
 if (dwarf_cu->GetSymbolFileDWARF().ParseVendorDWARFOpcode(
diff --git a/lldb/source/Plugins/Process/CMakeLists.txt 
b/lldb/source/Plugins/Process/CMakeLists.txt
index a51d0f7afd17591..be109a303e86691 100644
--- a/lldb/source/Plugins/Process/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/CMakeLists.txt
@@ -19,3 +19,4 @@ add_subdirectory(elf-core)
 add_subdirectory(mach-core)
 add_subdirectory(minidump)
 add_subdirectory(FreeBSDKernel)
+add_subdirectory(wasm)
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index e653ef5d8ac54e4..f82c85ffbe20ffb 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1627,6 +1627,11 @@ void ProcessGDBRemote::ParseExpeditedRegisters(
   }
 }
 
+std::shared_ptr
+ProcessGDBRemote::CreateThread(lldb::tid_t tid) {
+  return std::make_shared(*this, tid);
+}
+
 ThreadSP ProcessGDBRemote::SetThreadStopInfo(
 lldb::tid_t tid, ExpeditedRegisterMap &expedited_register_map,
 uint8_t signo, const std::string &thread_name, const std::string &reason,
@@ -1651,7 +1656,7 @@ T

[Lldb-commits] [lldb] [lldb] enable wasm source debugging (PR #72634)

2023-11-17 Thread Xu Jun via lldb-commits

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


[Lldb-commits] [lldb] [lldb] enable wasm source debugging (PR #72634)

2023-11-17 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Xu Jun (xujuntwt95329)


Changes

Rebase https://reviews.llvm.org/D78978 on latest code base, with less 
modification to LLDB core part:

I treat wasm locals, globals and operand stack values as virtual registers, and 
implement a wasmRegisterContext to handle this. 

2 high bits in the reg_num are used as a tag to distinguish wasm values

---

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


14 Files Affected:

- (modified) lldb/source/Expression/DWARFExpression.cpp (+42) 
- (modified) lldb/source/Plugins/Process/CMakeLists.txt (+1) 
- (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp (+6-1) 
- (modified) lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h (+2) 
- (added) lldb/source/Plugins/Process/wasm/CMakeLists.txt (+15) 
- (added) lldb/source/Plugins/Process/wasm/ProcessWasm.cpp (+261) 
- (added) lldb/source/Plugins/Process/wasm/ProcessWasm.h (+132) 
- (added) lldb/source/Plugins/Process/wasm/ThreadWasm.cpp (+57) 
- (added) lldb/source/Plugins/Process/wasm/ThreadWasm.h (+47) 
- (added) lldb/source/Plugins/Process/wasm/UnwindWasm.cpp (+79) 
- (added) lldb/source/Plugins/Process/wasm/UnwindWasm.h (+58) 
- (added) lldb/source/Plugins/Process/wasm/wasmRegisterContext.cpp (+103) 
- (added) lldb/source/Plugins/Process/wasm/wasmRegisterContext.h (+70) 
- (modified) lldb/source/Target/Platform.cpp (+8) 


``diff
diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index fe4928d4f43a434..1693e390c2e9203 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -346,6 +346,17 @@ static offset_t GetOpcodeDataSize(const DataExtractor 
&data,
 return (offset - data_offset) + subexpr_len;
   }
 
+  case DW_OP_WASM_location: {
+uint8_t wasm_op = data.GetU8(&offset);
+if (wasm_op == 3) {
+  data.GetU32(&offset);
+}
+else {
+  data.GetULEB128(&offset);
+}
+return offset - data_offset;
+  }
+
   default:
 if (!dwarf_cu) {
   return LLDB_INVALID_OFFSET;
@@ -2595,6 +2606,37 @@ bool DWARFExpression::Evaluate(
   break;
 }
 
+case DW_OP_WASM_location: {
+  uint8_t wasm_op = opcodes.GetU8(&offset);
+  uint32_t index;
+
+  /* LLDB doesn't have an address space to represents WebAssembly Locals,
+   * GLobals and operand stacks.
+   * We encode these elements into virtual registers: 
+   *   | tag: 2 bits | index: 30 bits |
+   *   where tag is:
+   *0: Not a WebAssembly location
+   *1: Local
+   *2: Global
+   *3: Operand stack value 
+   */
+  if (wasm_op == 3) {
+index = opcodes.GetU32(&offset);
+wasm_op = 1;
+  } else {
+index = opcodes.GetULEB128(&offset);
+  }
+
+  reg_num = (((wasm_op + 1) & 0x03) << 30) | (index & 0x3fff);
+
+  if (ReadRegisterValueAsScalar(reg_ctx, reg_kind, reg_num, error_ptr, 
tmp))
+stack.push_back(tmp);
+  else
+return false;
+
+  break;
+}
+
 default:
   if (dwarf_cu) {
 if (dwarf_cu->GetSymbolFileDWARF().ParseVendorDWARFOpcode(
diff --git a/lldb/source/Plugins/Process/CMakeLists.txt 
b/lldb/source/Plugins/Process/CMakeLists.txt
index a51d0f7afd17591..be109a303e86691 100644
--- a/lldb/source/Plugins/Process/CMakeLists.txt
+++ b/lldb/source/Plugins/Process/CMakeLists.txt
@@ -19,3 +19,4 @@ add_subdirectory(elf-core)
 add_subdirectory(mach-core)
 add_subdirectory(minidump)
 add_subdirectory(FreeBSDKernel)
+add_subdirectory(wasm)
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index e653ef5d8ac54e4..f82c85ffbe20ffb 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1627,6 +1627,11 @@ void ProcessGDBRemote::ParseExpeditedRegisters(
   }
 }
 
+std::shared_ptr
+ProcessGDBRemote::CreateThread(lldb::tid_t tid) {
+  return std::make_shared(*this, tid);
+}
+
 ThreadSP ProcessGDBRemote::SetThreadStopInfo(
 lldb::tid_t tid, ExpeditedRegisterMap &expedited_register_map,
 uint8_t signo, const std::string &thread_name, const std::string &reason,
@@ -1651,7 +1656,7 @@ ThreadSP ProcessGDBRemote::SetThreadStopInfo(
 
 if (!thread_sp) {
   // Create the thread if we need to
-  thread_sp = std::make_shared(*this, tid);
+  thread_sp = CreateThread(tid);
   m_thread_list_real.AddThread(thread_sp);
 }
   }
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h 
b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
index f3787e7169047e2..7c2300c979eec5e 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -353,6 +353,8 @@ class ProcessGDBRemot

[Lldb-commits] [lldb] [lldb] enable wasm source debugging (PR #72634)

2023-11-17 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 915f6c3d6a4377e2672a95c656374d71df62e95a 
b9f6f4c03b6f72f44f9270a7de377deab3e0d8f6 -- 
lldb/source/Plugins/Process/wasm/ProcessWasm.cpp 
lldb/source/Plugins/Process/wasm/ProcessWasm.h 
lldb/source/Plugins/Process/wasm/ThreadWasm.cpp 
lldb/source/Plugins/Process/wasm/ThreadWasm.h 
lldb/source/Plugins/Process/wasm/UnwindWasm.cpp 
lldb/source/Plugins/Process/wasm/UnwindWasm.h 
lldb/source/Plugins/Process/wasm/wasmRegisterContext.cpp 
lldb/source/Plugins/Process/wasm/wasmRegisterContext.h 
lldb/source/Expression/DWARFExpression.cpp 
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp 
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h 
lldb/source/Target/Platform.cpp
``





View the diff from clang-format here.


``diff
diff --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 1693e390c2..8e8ea610b8 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -350,8 +350,7 @@ static offset_t GetOpcodeDataSize(const DataExtractor &data,
 uint8_t wasm_op = data.GetU8(&offset);
 if (wasm_op == 3) {
   data.GetU32(&offset);
-}
-else {
+} else {
   data.GetULEB128(&offset);
 }
 return offset - data_offset;
@@ -2612,13 +2611,13 @@ bool DWARFExpression::Evaluate(
 
   /* LLDB doesn't have an address space to represents WebAssembly Locals,
* GLobals and operand stacks.
-   * We encode these elements into virtual registers: 
+   * We encode these elements into virtual registers:
*   | tag: 2 bits | index: 30 bits |
*   where tag is:
*0: Not a WebAssembly location
*1: Local
*2: Global
-   *3: Operand stack value 
+   *3: Operand stack value
*/
   if (wasm_op == 3) {
 index = opcodes.GetU32(&offset);
diff --git a/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp 
b/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
index a2c6a33f83..698c8668e5 100644
--- a/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
+++ b/lldb/source/Plugins/Process/wasm/ProcessWasm.cpp
@@ -73,7 +73,7 @@ lldb::ProcessSP ProcessWasm::CreateInstance(lldb::TargetSP 
target_sp,
 }
 
 bool ProcessWasm::CanDebug(lldb::TargetSP target_sp,
-bool plugin_specified_by_name) {
+   bool plugin_specified_by_name) {
   if (plugin_specified_by_name)
 return true;
 
@@ -109,7 +109,7 @@ size_t ProcessWasm::ReadMemory(lldb::addr_t vm_addr, void 
*buf, size_t size,
 }
 
 size_t ProcessWasm::WasmReadMemory(uint32_t wasm_module_id, lldb::addr_t addr,
- void *buf, size_t buffer_size) {
+   void *buf, size_t buffer_size) {
   char packet[64];
   int packet_len =
   ::snprintf(packet, sizeof(packet), "qWasmMem:%d;%" PRIx64 ";%" PRIx64,
@@ -118,7 +118,8 @@ size_t ProcessWasm::WasmReadMemory(uint32_t wasm_module_id, 
lldb::addr_t addr,
   assert(packet_len + 1 < (int)sizeof(packet));
   UNUSED_IF_ASSERT_DISABLED(packet_len);
   StringExtractorGDBRemote response;
-  if (m_gdb_comm.SendPacketAndWaitForResponse(packet, response, 
GetInterruptTimeout()) ==
+  if (m_gdb_comm.SendPacketAndWaitForResponse(packet, response,
+  GetInterruptTimeout()) ==
   GDBRemoteCommunication::PacketResult::Success) {
 if (response.IsNormalResponse()) {
   return response.GetHexBytes(llvm::MutableArrayRef(
@@ -130,7 +131,7 @@ size_t ProcessWasm::WasmReadMemory(uint32_t wasm_module_id, 
lldb::addr_t addr,
 }
 
 size_t ProcessWasm::WasmReadData(uint32_t wasm_module_id, lldb::addr_t addr,
-   void *buf, size_t buffer_size) {
+ void *buf, size_t buffer_size) {
   char packet[64];
   int packet_len =
   ::snprintf(packet, sizeof(packet), "qWasmData:%d;%" PRIx64 ";%" PRIx64,
@@ -139,7 +140,8 @@ size_t ProcessWasm::WasmReadData(uint32_t wasm_module_id, 
lldb::addr_t addr,
   assert(packet_len + 1 < (int)sizeof(packet));
   UNUSED_IF_ASSERT_DISABLED(packet_len);
   StringExtractorGDBRemote response;
-  if (m_gdb_comm.SendPacketAndWaitForResponse(packet, response, 
GetInterruptTimeout()) ==
+  if (m_gdb_comm.SendPacketAndWaitForResponse(packet, response,
+  GetInterruptTimeout()) ==
   GDBRemoteCommunication::PacketResult::Success) {
 if (response.IsNormalResponse()) {
   return response.GetHexBytes(llvm::MutableArrayRef(
diff --git a/lldb/source/Plugins/Process/wasm/ProcessWasm.h 
b/lldb/source/Plugins/Process/wasm/ProcessWasm.h
index 4ef784ae9a..79338b175f 100644
--- a/lldb/source/Plugins/Process/wasm/ProcessWasm.h
+++ b/lldb/source/

[Lldb-commits] [libunwind] [clang-tools-extra] [clang] [llvm] [lldb] [libcxx] [compiler-rt] [flang] [lld] [AMDGPU] - Add constant folding for s_quadmask (PR #72381)

2023-11-17 Thread Jessica Del via lldb-commits

https://github.com/OutOfCache updated 
https://github.com/llvm/llvm-project/pull/72381

>From 00d0f99207242befc8022031ccd8faf573cbf014 Mon Sep 17 00:00:00 2001
From: Jessica Del 
Date: Tue, 14 Nov 2023 22:17:26 +0100
Subject: [PATCH 1/4] [AMDGPU] - Add constant folding for s_quadmask

If the input is a constant we can constant fold the `s_quadmask`
intrinsic.
---
 llvm/lib/Analysis/ConstantFolding.cpp| 14 ++
 llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll | 12 
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/Analysis/ConstantFolding.cpp 
b/llvm/lib/Analysis/ConstantFolding.cpp
index 966a65ac26b8017..40b5938fcda0c2a 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1533,6 +1533,7 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, 
const Function *F) {
   case Intrinsic::amdgcn_perm:
   case Intrinsic::amdgcn_wave_reduce_umin:
   case Intrinsic::amdgcn_wave_reduce_umax:
+  case Intrinsic::amdgcn_s_quadmask:
   case Intrinsic::arm_mve_vctp8:
   case Intrinsic::arm_mve_vctp16:
   case Intrinsic::arm_mve_vctp32:
@@ -2422,6 +2423,19 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
 
   return ConstantFP::get(Ty->getContext(), Val);
 }
+
+case Intrinsic::amdgcn_s_quadmask: {
+  uint64_t Val = Op->getZExtValue();
+  uint64_t QuadMask = 0;
+  for (unsigned i = 0; i < Op->getBitWidth() / 4; ++i, Val >>= 4) {
+if (!(Val & 0xF))
+  continue;
+
+QuadMask |= (1 << i);
+  }
+  return ConstantInt::get(Ty, QuadMask);
+}
+
 default:
   return nullptr;
 }
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll 
b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll
index 65443a6efa789d9..0f500c0999ad9a8 100644
--- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll
@@ -9,11 +9,10 @@ define i32 @test_quadmask_constant_i32() {
 ; GFX11-LABEL: test_quadmask_constant_i32:
 ; GFX11:   ; %bb.0: ; %entry
 ; GFX11-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; GFX11-NEXT:s_quadmask_b32 s0, 0x85fe3a92
-; GFX11-NEXT:v_mov_b32_e32 v0, s0
+; GFX11-NEXT:v_mov_b32_e32 v0, 0xcb
 ; GFX11-NEXT:s_setpc_b64 s[30:31]
 entry:
-  %qm = call i32 @llvm.amdgcn.s.quadmask.i32(i32 u0x85FE3A92)
+  %qm = call i32 @llvm.amdgcn.s.quadmask.i32(i32 u0x85003092)
   ret i32 %qm
 }
 
@@ -50,13 +49,10 @@ define i64 @test_quadmask_constant_i64() {
 ; GFX11-LABEL: test_quadmask_constant_i64:
 ; GFX11:   ; %bb.0: ; %entry
 ; GFX11-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; GFX11-NEXT:s_mov_b32 s0, 0x85fe3a92
-; GFX11-NEXT:s_mov_b32 s1, 0x67de48fc
-; GFX11-NEXT:s_quadmask_b64 s[0:1], s[0:1]
-; GFX11-NEXT:v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
+; GFX11-NEXT:v_dual_mov_b32 v0, 0xe3e6 :: v_dual_mov_b32 v1, 0
 ; GFX11-NEXT:s_setpc_b64 s[30:31]
 entry:
-  %qm = call i64 @llvm.amdgcn.s.quadmask.i64(i64 u0x67DE48FC85FE3A92)
+  %qm = call i64 @llvm.amdgcn.s.quadmask.i64(i64 u0x67D000FC85F00A90)
   ret i64 %qm
 }
 

>From 144c4dc164ec137e518cfd647c116373e7a61b8f Mon Sep 17 00:00:00 2001
From: Jessica Del 
Date: Wed, 15 Nov 2023 15:59:56 +0100
Subject: [PATCH 2/4] fixup! [AMDGPU] - Add constant folding for s_quadmask

---
 llvm/lib/Analysis/ConstantFolding.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Analysis/ConstantFolding.cpp 
b/llvm/lib/Analysis/ConstantFolding.cpp
index 40b5938fcda0c2a..39bbb04fbcf26cc 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -2427,11 +2427,11 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
 case Intrinsic::amdgcn_s_quadmask: {
   uint64_t Val = Op->getZExtValue();
   uint64_t QuadMask = 0;
-  for (unsigned i = 0; i < Op->getBitWidth() / 4; ++i, Val >>= 4) {
+  for (unsigned I = 0; I < Op->getBitWidth() / 4; ++I, Val >>= 4) {
 if (!(Val & 0xF))
   continue;
 
-QuadMask |= (1 << i);
+QuadMask |= (1 << I);
   }
   return ConstantInt::get(Ty, QuadMask);
 }

>From 65bb0b1164ff9b7491589cb88decb1d135504c1b Mon Sep 17 00:00:00 2001
From: Jessica Del 
Date: Thu, 16 Nov 2023 11:22:52 +0100
Subject: [PATCH 3/4] fixup! Merge branch 'main' into quadmask-folding

---
 llvm/lib/Analysis/ConstantFolding.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Analysis/ConstantFolding.cpp 
b/llvm/lib/Analysis/ConstantFolding.cpp
index 64d088ea7a46404..2771a3d574f7799 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -2425,7 +2425,6 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
   return ConstantFP::get(Ty->getContext(), Val);
 }
 
-
 case Intrinsic::amdgcn_s_quadmask: {
   uint64_t Val = Op->getZExtValue();
   uint64_t QuadMask = 0;
@@ -2436,6 +2435,7 @@ static Constant

[Lldb-commits] [lld] [libunwind] [libcxx] [compiler-rt] [llvm] [flang] [clang-tools-extra] [lldb] [clang] [AMDGPU] - Add constant folding for s_quadmask (PR #72381)

2023-11-17 Thread Jessica Del via lldb-commits

https://github.com/OutOfCache updated 
https://github.com/llvm/llvm-project/pull/72381

>From 00d0f99207242befc8022031ccd8faf573cbf014 Mon Sep 17 00:00:00 2001
From: Jessica Del 
Date: Tue, 14 Nov 2023 22:17:26 +0100
Subject: [PATCH 1/5] [AMDGPU] - Add constant folding for s_quadmask

If the input is a constant we can constant fold the `s_quadmask`
intrinsic.
---
 llvm/lib/Analysis/ConstantFolding.cpp| 14 ++
 llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll | 12 
 2 files changed, 18 insertions(+), 8 deletions(-)

diff --git a/llvm/lib/Analysis/ConstantFolding.cpp 
b/llvm/lib/Analysis/ConstantFolding.cpp
index 966a65ac26b8017..40b5938fcda0c2a 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -1533,6 +1533,7 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, 
const Function *F) {
   case Intrinsic::amdgcn_perm:
   case Intrinsic::amdgcn_wave_reduce_umin:
   case Intrinsic::amdgcn_wave_reduce_umax:
+  case Intrinsic::amdgcn_s_quadmask:
   case Intrinsic::arm_mve_vctp8:
   case Intrinsic::arm_mve_vctp16:
   case Intrinsic::arm_mve_vctp32:
@@ -2422,6 +2423,19 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
 
   return ConstantFP::get(Ty->getContext(), Val);
 }
+
+case Intrinsic::amdgcn_s_quadmask: {
+  uint64_t Val = Op->getZExtValue();
+  uint64_t QuadMask = 0;
+  for (unsigned i = 0; i < Op->getBitWidth() / 4; ++i, Val >>= 4) {
+if (!(Val & 0xF))
+  continue;
+
+QuadMask |= (1 << i);
+  }
+  return ConstantInt::get(Ty, QuadMask);
+}
+
 default:
   return nullptr;
 }
diff --git a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll 
b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll
index 65443a6efa789d9..0f500c0999ad9a8 100644
--- a/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll
+++ b/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.quadmask.ll
@@ -9,11 +9,10 @@ define i32 @test_quadmask_constant_i32() {
 ; GFX11-LABEL: test_quadmask_constant_i32:
 ; GFX11:   ; %bb.0: ; %entry
 ; GFX11-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; GFX11-NEXT:s_quadmask_b32 s0, 0x85fe3a92
-; GFX11-NEXT:v_mov_b32_e32 v0, s0
+; GFX11-NEXT:v_mov_b32_e32 v0, 0xcb
 ; GFX11-NEXT:s_setpc_b64 s[30:31]
 entry:
-  %qm = call i32 @llvm.amdgcn.s.quadmask.i32(i32 u0x85FE3A92)
+  %qm = call i32 @llvm.amdgcn.s.quadmask.i32(i32 u0x85003092)
   ret i32 %qm
 }
 
@@ -50,13 +49,10 @@ define i64 @test_quadmask_constant_i64() {
 ; GFX11-LABEL: test_quadmask_constant_i64:
 ; GFX11:   ; %bb.0: ; %entry
 ; GFX11-NEXT:s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
-; GFX11-NEXT:s_mov_b32 s0, 0x85fe3a92
-; GFX11-NEXT:s_mov_b32 s1, 0x67de48fc
-; GFX11-NEXT:s_quadmask_b64 s[0:1], s[0:1]
-; GFX11-NEXT:v_dual_mov_b32 v0, s0 :: v_dual_mov_b32 v1, s1
+; GFX11-NEXT:v_dual_mov_b32 v0, 0xe3e6 :: v_dual_mov_b32 v1, 0
 ; GFX11-NEXT:s_setpc_b64 s[30:31]
 entry:
-  %qm = call i64 @llvm.amdgcn.s.quadmask.i64(i64 u0x67DE48FC85FE3A92)
+  %qm = call i64 @llvm.amdgcn.s.quadmask.i64(i64 u0x67D000FC85F00A90)
   ret i64 %qm
 }
 

>From 144c4dc164ec137e518cfd647c116373e7a61b8f Mon Sep 17 00:00:00 2001
From: Jessica Del 
Date: Wed, 15 Nov 2023 15:59:56 +0100
Subject: [PATCH 2/5] fixup! [AMDGPU] - Add constant folding for s_quadmask

---
 llvm/lib/Analysis/ConstantFolding.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/llvm/lib/Analysis/ConstantFolding.cpp 
b/llvm/lib/Analysis/ConstantFolding.cpp
index 40b5938fcda0c2a..39bbb04fbcf26cc 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -2427,11 +2427,11 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
 case Intrinsic::amdgcn_s_quadmask: {
   uint64_t Val = Op->getZExtValue();
   uint64_t QuadMask = 0;
-  for (unsigned i = 0; i < Op->getBitWidth() / 4; ++i, Val >>= 4) {
+  for (unsigned I = 0; I < Op->getBitWidth() / 4; ++I, Val >>= 4) {
 if (!(Val & 0xF))
   continue;
 
-QuadMask |= (1 << i);
+QuadMask |= (1 << I);
   }
   return ConstantInt::get(Ty, QuadMask);
 }

>From 65bb0b1164ff9b7491589cb88decb1d135504c1b Mon Sep 17 00:00:00 2001
From: Jessica Del 
Date: Thu, 16 Nov 2023 11:22:52 +0100
Subject: [PATCH 3/5] fixup! Merge branch 'main' into quadmask-folding

---
 llvm/lib/Analysis/ConstantFolding.cpp | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/llvm/lib/Analysis/ConstantFolding.cpp 
b/llvm/lib/Analysis/ConstantFolding.cpp
index 64d088ea7a46404..2771a3d574f7799 100644
--- a/llvm/lib/Analysis/ConstantFolding.cpp
+++ b/llvm/lib/Analysis/ConstantFolding.cpp
@@ -2425,7 +2425,6 @@ static Constant *ConstantFoldScalarCall1(StringRef Name,
   return ConstantFP::get(Ty->getContext(), Val);
 }
 
-
 case Intrinsic::amdgcn_s_quadmask: {
   uint64_t Val = Op->getZExtValue();
   uint64_t QuadMask = 0;
@@ -2436,6 +2435,7 @@ static Constant

[Lldb-commits] [lldb] 5f64b94 - Clarify error messages on corefiles that no plugin handles (#72559)

2023-11-17 Thread via lldb-commits

Author: Jason Molenda
Date: 2023-11-16T13:58:07-08:00
New Revision: 5f64b940761002efcff04c40d6e882167d05197c

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

LOG: Clarify error messages on corefiles that no plugin handles (#72559)

These error messages are written in a way that makes sense to an lldb
developer, but not to an end user who asks lldb to run on a compressed
corefile or whatever. Simplfy the messages.

Added: 


Modified: 
lldb/source/Commands/CommandObjectTarget.cpp
lldb/source/Core/IOHandlerCursesGUI.cpp
lldb/test/API/commands/target/basic/TestTargetCommand.py

Removed: 




diff  --git a/lldb/source/Commands/CommandObjectTarget.cpp 
b/lldb/source/Commands/CommandObjectTarget.cpp
index 8f052d0a7b837e2..58785cde3ec7c63 100644
--- a/lldb/source/Commands/CommandObjectTarget.cpp
+++ b/lldb/source/Commands/CommandObjectTarget.cpp
@@ -436,8 +436,7 @@ class CommandObjectTargetCreate : public 
CommandObjectParsed {
   error = process_sp->LoadCore();
 
   if (error.Fail()) {
-result.AppendError(
-error.AsCString("can't find plug-in for core file"));
+result.AppendError(error.AsCString("unknown core file format"));
 return;
   } else {
 result.AppendMessageWithFormatv(
@@ -447,9 +446,8 @@ class CommandObjectTargetCreate : public 
CommandObjectParsed {
 on_error.release();
   }
 } else {
-  result.AppendErrorWithFormatv(
-  "Unable to find process plug-in for core file '{0}'\n",
-  core_file.GetPath());
+  result.AppendErrorWithFormatv("Unknown core file format '{0}'\n",
+core_file.GetPath());
 }
   } else {
 result.AppendMessageWithFormat(

diff  --git a/lldb/source/Core/IOHandlerCursesGUI.cpp 
b/lldb/source/Core/IOHandlerCursesGUI.cpp
index 22b8cc3582eae78..abf0b6b801f37fc 100644
--- a/lldb/source/Core/IOHandlerCursesGUI.cpp
+++ b/lldb/source/Core/IOHandlerCursesGUI.cpp
@@ -3178,13 +3178,13 @@ class TargetCreateFormDelegate : public FormDelegate {
 m_debugger.GetListener(), llvm::StringRef(), &core_file_spec, false));
 
 if (!process_sp) {
-  SetError("Unable to find process plug-in for core file!");
+  SetError("Unknown core file format!");
   return;
 }
 
 Status status = process_sp->LoadCore();
 if (status.Fail()) {
-  SetError("Can't find plug-in for core file!");
+  SetError("Unknown core file format!");
   return;
 }
   }

diff  --git a/lldb/test/API/commands/target/basic/TestTargetCommand.py 
b/lldb/test/API/commands/target/basic/TestTargetCommand.py
index 96e7fe86ac5aee5..cb7a5f33f6643e8 100644
--- a/lldb/test/API/commands/target/basic/TestTargetCommand.py
+++ b/lldb/test/API/commands/target/basic/TestTargetCommand.py
@@ -447,7 +447,7 @@ def test_target_create_invalid_core_file(self):
 self.expect(
 "target create -c '" + invalid_core_path + "'",
 error=True,
-substrs=["Unable to find process plug-in for core file '"],
+substrs=["Unknown core file format '"],
 )
 
 # Write only files don't seem to be supported on Windows.



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


[Lldb-commits] [lldb] 4639610 - [lldb] Add interface to check if UserExpression::Parse() is cacheable (#66826)

2023-11-17 Thread via lldb-commits

Author: Augusto Noronha
Date: 2023-11-16T14:20:14-08:00
New Revision: 46396108deb24564159c441c6e6ebfac26714d7b

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

LOG: [lldb] Add interface to check if UserExpression::Parse() is cacheable 
(#66826)

When setting conditional breakpoints, we currently assume that a call to
UserExpression::Parse() can be cached and resued multiple times. This
may not be true for every user expression. Add a new method so
subclasses of UserExpression can customize if they are parseable or not.

Added: 


Modified: 
lldb/include/lldb/Expression/UserExpression.h
lldb/source/Breakpoint/BreakpointLocation.cpp

Removed: 




diff  --git a/lldb/include/lldb/Expression/UserExpression.h 
b/lldb/include/lldb/Expression/UserExpression.h
index df7a76664f6d5b6..b6cfeec7e899330 100644
--- a/lldb/include/lldb/Expression/UserExpression.h
+++ b/lldb/include/lldb/Expression/UserExpression.h
@@ -192,6 +192,14 @@ class UserExpression : public Expression {
   /// expression.  Text() should contain the definition of this function.
   const char *FunctionName() override { return "$__lldb_expr"; }
 
+  /// Returns whether the call to Parse on this user expression is cacheable.
+  /// This function exists to provide an escape hatch for supporting languages
+  /// where parsing an expression in the exact same context is unsafe. For
+  /// example, languages where generic functions aren't monomorphized, but
+  /// implement some other mechanism to represent generic values, may be unsafe
+  /// to cache, as the concrete type substitution may be 
diff erent in every
+  /// expression evaluation.
+  virtual bool IsParseCacheable() { return true; }
   /// Return the language that should be used when parsing.  To use the
   /// default, return eLanguageTypeUnknown.
   lldb::LanguageType Language() const override { return m_language; }

diff  --git a/lldb/source/Breakpoint/BreakpointLocation.cpp 
b/lldb/source/Breakpoint/BreakpointLocation.cpp
index 27dc7458dc26f70..931e1ad4b2d9339 100644
--- a/lldb/source/Breakpoint/BreakpointLocation.cpp
+++ b/lldb/source/Breakpoint/BreakpointLocation.cpp
@@ -250,6 +250,7 @@ bool BreakpointLocation::ConditionSaysStop(ExecutionContext 
&exe_ctx,
   DiagnosticManager diagnostics;
 
   if (condition_hash != m_condition_hash || !m_user_expression_sp ||
+  !m_user_expression_sp->IsParseCacheable() ||
   !m_user_expression_sp->MatchesContext(exe_ctx)) {
 LanguageType language = eLanguageTypeUnknown;
 // See if we can figure out the language from the frame, otherwise use the



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


[Lldb-commits] [lld] [libunwind] [libcxxabi] [libcxx] [compiler-rt] [llvm] [flang] [mlir] [clang-tools-extra] [lldb] [clang] [Passes] Disable code sinking in InstCombine early on. (PR #72567)

2023-11-17 Thread Florian Hahn via lldb-commits

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


[Lldb-commits] [lld] [mlir] [llvm] [clang-tools-extra] [flang] [compiler-rt] [libc] [libcxx] [lldb] [clang] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Fabian Mora via lldb-commits


@@ -61,6 +63,7 @@ registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) 
{
   registerLLVMDialectTranslation(registry);
   registerNVVMDialectTranslation(registry);
   registerROCDLDialectTranslation(registry);
+  registerSPIRVDialectTranslation(registry);

fabianmcg wrote:

The call to `registry.insert();` is needed so that 
`mlir-translate` can parse the code containing the SPIR-V target attribute, 
nothing more; there's no translation happening from SPIR-V to LLVM. If the call 
is not added, then `mlir-translate` throws an error because `SPIR-V` never gets 
registered.

The question is, should an empty translation to LLVM should be added to mirror 
all other * to LLVM translation code structure, or is inlining the call ok? I 
definitely prefer the second option -one less target.

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


[Lldb-commits] [compiler-rt] [llvm] [lld] [clang-tools-extra] [libcxx] [clang] [flang] [lldb] [libunwind] [AMDGPU] - Add constant folding for s_quadmask (PR #72381)

2023-11-17 Thread Jessica Del via lldb-commits

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


[Lldb-commits] [libc] [llvm] [lld] [clang-tools-extra] [libcxx] [clang] [flang] [lldb] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-17 Thread Erich Keane via lldb-commits

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


[Lldb-commits] [mlir] [libunwind] [clang-tools-extra] [lld] [lldb] [compiler-rt] [libcxxabi] [clang] [llvm] [libc] [flang] [libcxx] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Shahid Iqbal via lldb-commits

https://github.com/shahidiqbal13 created 
https://github.com/llvm/llvm-project/pull/72654

This issue is raised by @DrTodd13

The code in include/llvm/Analysis/DOTGraphTraitsPass.h will exceed most normal 
file system's maximum filename length of 255 if, e.g., the function's name is 
that length.

>From b6bfb18e25c111baf6c95a0a4a1c3d667bb25b6d Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Thu, 16 Nov 2023 11:26:43 -0500
Subject: [PATCH 1/2] TESTING infra

---
 clang/NOTES.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/NOTES.txt b/clang/NOTES.txt
index f06ea8c70cd3409..c83dda52a1fc21e 100644
--- a/clang/NOTES.txt
+++ b/clang/NOTES.txt
@@ -4,6 +4,8 @@
 
 //===-===//
 
+//TESTING git infra//
+
 To time GCC preprocessing speed without output, use:
"time gcc -MM file"
 This is similar to -Eonly.

>From 7662d4f177d32c3159c1c48b11ce3884e4ea78c8 Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Fri, 17 Nov 2023 09:26:31 -0500
Subject: [PATCH 2/2] PR#72453 : Exceeding maximum file name length

---
 llvm/include/llvm/Analysis/DOTGraphTraitsPass.h | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h 
b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index 07c08bc1cc3bcb6..f78d8ff52ee3932 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -17,6 +17,8 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/GraphWriter.h"
 
+#define MAX_FILENAME_LEN 255
+
 namespace llvm {
 
 /// Default traits class for extracting a graph from an analysis pass.
@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple,
GraphName + " for '" + F.getName() + "' function");
   else
@@ -280,7 +282,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public 
ModulePass {
 raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
 std::string Title = DOTGraphTraits::getGraphName(Graph);
 
-if (!EC)
+if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
   WriteGraph(File, Graph, IsSimple, Title);
 else
   errs() << "  error opening file for writing!";
@@ -310,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
   std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple, Title);
   else
 errs() << "  error opening file for writing!";

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


[Lldb-commits] [mlir] [libunwind] [clang-tools-extra] [lld] [lldb] [compiler-rt] [libcxxabi] [clang] [llvm] [libc] [flang] [libcxx] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-llvm-analysis

Author: Shahid Iqbal (shahidiqbal13)


Changes

This issue is raised by @DrTodd13

The code in include/llvm/Analysis/DOTGraphTraitsPass.h will exceed most normal 
file system's maximum filename length of 255 if, e.g., the function's name is 
that length.

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


2 Files Affected:

- (modified) clang/NOTES.txt (+2) 
- (modified) llvm/include/llvm/Analysis/DOTGraphTraitsPass.h (+5-3) 


``diff
diff --git a/clang/NOTES.txt b/clang/NOTES.txt
index f06ea8c70cd3409..c83dda52a1fc21e 100644
--- a/clang/NOTES.txt
+++ b/clang/NOTES.txt
@@ -4,6 +4,8 @@
 
 //===-===//
 
+//TESTING git infra//
+
 To time GCC preprocessing speed without output, use:
"time gcc -MM file"
 This is similar to -Eonly.
diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h 
b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index 07c08bc1cc3bcb6..f78d8ff52ee3932 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -17,6 +17,8 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/GraphWriter.h"
 
+#define MAX_FILENAME_LEN 255
+
 namespace llvm {
 
 /// Default traits class for extracting a graph from an analysis pass.
@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple,
GraphName + " for '" + F.getName() + "' function");
   else
@@ -280,7 +282,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public 
ModulePass {
 raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
 std::string Title = DOTGraphTraits::getGraphName(Graph);
 
-if (!EC)
+if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
   WriteGraph(File, Graph, IsSimple, Title);
 else
   errs() << "  error opening file for writing!";
@@ -310,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
   std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple, Title);
   else
 errs() << "  error opening file for writing!";

``




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


[Lldb-commits] [mlir] [libunwind] [clang-tools-extra] [lld] [lldb] [compiler-rt] [libcxxabi] [clang] [llvm] [libc] [flang] [libcxx] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread via lldb-commits

github-actions[bot] wrote:




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



You can test this locally with the following command:


``bash
git-clang-format --diff 44af5924b1cbbb395e7e71250a5445053c4ec4a3 
7662d4f177d32c3159c1c48b11ce3884e4ea78c8 -- 
llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
``





View the diff from clang-format here.


``diff
diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h 
b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index f78d8ff52e..f7ab6df3b4 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -96,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
 
-  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN))
 WriteGraph(File, Graph, IsSimple,
GraphName + " for '" + F.getName() + "' function");
   else
@@ -282,7 +282,7 @@ public:
 raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
 std::string Title = DOTGraphTraits::getGraphName(Graph);
 
-if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
+if (!EC && (Filename.length() <= MAX_FILENAME_LEN))
   WriteGraph(File, Graph, IsSimple, Title);
 else
   errs() << "  error opening file for writing!";
@@ -312,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
   std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
-  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN))
 WriteGraph(File, Graph, IsSimple, Title);
   else
 errs() << "  error opening file for writing!";

``




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


[Lldb-commits] [mlir] [libunwind] [clang-tools-extra] [lld] [lldb] [compiler-rt] [libcxxabi] [clang] [llvm] [libc] [flang] [libcxx] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Shahid Iqbal via lldb-commits

https://github.com/shahidiqbal13 updated 
https://github.com/llvm/llvm-project/pull/72654

>From b6bfb18e25c111baf6c95a0a4a1c3d667bb25b6d Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Thu, 16 Nov 2023 11:26:43 -0500
Subject: [PATCH 1/3] TESTING infra

---
 clang/NOTES.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/NOTES.txt b/clang/NOTES.txt
index f06ea8c70cd3409..c83dda52a1fc21e 100644
--- a/clang/NOTES.txt
+++ b/clang/NOTES.txt
@@ -4,6 +4,8 @@
 
 //===-===//
 
+//TESTING git infra//
+
 To time GCC preprocessing speed without output, use:
"time gcc -MM file"
 This is similar to -Eonly.

>From 7662d4f177d32c3159c1c48b11ce3884e4ea78c8 Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Fri, 17 Nov 2023 09:26:31 -0500
Subject: [PATCH 2/3] PR#72453 : Exceeding maximum file name length

---
 llvm/include/llvm/Analysis/DOTGraphTraitsPass.h | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h 
b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index 07c08bc1cc3bcb6..f78d8ff52ee3932 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -17,6 +17,8 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/GraphWriter.h"
 
+#define MAX_FILENAME_LEN 255
+
 namespace llvm {
 
 /// Default traits class for extracting a graph from an analysis pass.
@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple,
GraphName + " for '" + F.getName() + "' function");
   else
@@ -280,7 +282,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public 
ModulePass {
 raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
 std::string Title = DOTGraphTraits::getGraphName(Graph);
 
-if (!EC)
+if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
   WriteGraph(File, Graph, IsSimple, Title);
 else
   errs() << "  error opening file for writing!";
@@ -310,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
   std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple, Title);
   else
 errs() << "  error opening file for writing!";

>From d3d33e5bfe907b761ecb9065fe45b698c3ce0672 Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Fri, 17 Nov 2023 09:48:43 -0500
Subject: [PATCH 3/3] Reverted the earlier test text

---
 clang/NOTES.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/clang/NOTES.txt b/clang/NOTES.txt
index c83dda52a1fc21e..f06ea8c70cd3409 100644
--- a/clang/NOTES.txt
+++ b/clang/NOTES.txt
@@ -4,8 +4,6 @@
 
 //===-===//
 
-//TESTING git infra//
-
 To time GCC preprocessing speed without output, use:
"time gcc -MM file"
 This is similar to -Eonly.

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


[Lldb-commits] [flang] [compiler-rt] [lldb] [lld] [libcxx] [llvm] [mlir] [libcxxabi] [clang] [libunwind] [libc] [clang-tools-extra] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Shahid Iqbal via lldb-commits

https://github.com/shahidiqbal13 updated 
https://github.com/llvm/llvm-project/pull/72654

>From b6bfb18e25c111baf6c95a0a4a1c3d667bb25b6d Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Thu, 16 Nov 2023 11:26:43 -0500
Subject: [PATCH 1/4] TESTING infra

---
 clang/NOTES.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/clang/NOTES.txt b/clang/NOTES.txt
index f06ea8c70cd3409..c83dda52a1fc21e 100644
--- a/clang/NOTES.txt
+++ b/clang/NOTES.txt
@@ -4,6 +4,8 @@
 
 //===-===//
 
+//TESTING git infra//
+
 To time GCC preprocessing speed without output, use:
"time gcc -MM file"
 This is similar to -Eonly.

>From 7662d4f177d32c3159c1c48b11ce3884e4ea78c8 Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Fri, 17 Nov 2023 09:26:31 -0500
Subject: [PATCH 2/4] PR#72453 : Exceeding maximum file name length

---
 llvm/include/llvm/Analysis/DOTGraphTraitsPass.h | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h 
b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index 07c08bc1cc3bcb6..f78d8ff52ee3932 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -17,6 +17,8 @@
 #include "llvm/Support/FileSystem.h"
 #include "llvm/Support/GraphWriter.h"
 
+#define MAX_FILENAME_LEN 255
+
 namespace llvm {
 
 /// Default traits class for extracting a graph from an analysis pass.
@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple,
GraphName + " for '" + F.getName() + "' function");
   else
@@ -280,7 +282,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public 
ModulePass {
 raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
 std::string Title = DOTGraphTraits::getGraphName(Graph);
 
-if (!EC)
+if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
   WriteGraph(File, Graph, IsSimple, Title);
 else
   errs() << "  error opening file for writing!";
@@ -310,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
   std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
 WriteGraph(File, Graph, IsSimple, Title);
   else
 errs() << "  error opening file for writing!";

>From d3d33e5bfe907b761ecb9065fe45b698c3ce0672 Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Fri, 17 Nov 2023 09:48:43 -0500
Subject: [PATCH 3/4] Reverted the earlier test text

---
 clang/NOTES.txt | 2 --
 1 file changed, 2 deletions(-)

diff --git a/clang/NOTES.txt b/clang/NOTES.txt
index c83dda52a1fc21e..f06ea8c70cd3409 100644
--- a/clang/NOTES.txt
+++ b/clang/NOTES.txt
@@ -4,8 +4,6 @@
 
 //===-===//
 
-//TESTING git infra//
-
 To time GCC preprocessing speed without output, use:
"time gcc -MM file"
 This is similar to -Eonly.

>From 41c19e2ceee80cce8a60d0fd869958a0783ddb7f Mon Sep 17 00:00:00 2001
From: Shahid Iqbal 
Date: Fri, 17 Nov 2023 10:06:52 -0500
Subject: [PATCH 4/4] Code refactoring

---
 llvm/include/llvm/Analysis/DOTGraphTraitsPass.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h 
b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
index f78d8ff52ee3932..f7ab6df3b4dd819 100644
--- a/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
+++ b/llvm/include/llvm/Analysis/DOTGraphTraitsPass.h
@@ -96,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
 
-  if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN))
 WriteGraph(File, Graph, IsSimple,
GraphName + " for '" + F.getName() + "' function");
   else
@@ -282,7 +282,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public 
ModulePass {
 raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
 std::string Title = DOTGraphTraits::getGraphName(Graph);
 
-if (!EC && (Filename.length() <= MAX_FILENAME_LEN ))
+if (!EC && (Filename.length() <= MAX_FILENAME_LEN))
   WriteGraph(File, Graph, IsSimple, Title);
 else
   errs() << "  error opening file for writing!";
@@ -312,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
   std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
-  if (!EC && (Filename.length() 

[Lldb-commits] [flang] [compiler-rt] [lldb] [lld] [libcxx] [llvm] [mlir] [libcxxabi] [clang] [libunwind] [libc] [clang-tools-extra] [lldb][test] Add the ability to extract the variable value out of th

2023-11-17 Thread Walter Erquinigo via lldb-commits

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

Thank you!

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


[Lldb-commits] [lldb] 06effaf - [lldb][test] Add the ability to extract the variable value out of the summary. (#72631)

2023-11-17 Thread via lldb-commits

Author: santhoshe447
Date: 2023-11-17T10:15:23-05:00
New Revision: 06effaf43e9669c55ee4a1e2254166b5e7dc5b29

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

LOG: [lldb][test] Add the ability to extract the variable value out of the 
summary. (#72631)

Fix for https://github.com/llvm/llvm-project/issues/71897
When it comes to test infrastructure the test (TestDAP_variables.py:
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries)
will fail if the variable has a summary along with value.

I just tried to add a summary to a variable before we set a value to the
variable using below expression from “request_setVariable” function.
RunLLDBCommands(llvm::StringRef(), {std::string("type summary add
--summary-string "{sample summary}" (const char **) argv")});

As value has nonnumeric characters where we are trying to convert into
integer, python is throwing an error. We did not see this issue in
upstream as we are not adding summary explicitly, by default we are
getting empty summary & value for all children’s of argv parameter (even
after auto summary).

The test is failing with below error:
ERROR:
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries
(TestDAP_variables.TestDAP_variables)
Traceback (most recent call last):
File
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
line 372, in
test_scopes_variables_setVariable_evaluate_with_descriptive_summaries
enableAutoVariableSummaries=True
File
"/llvm/llvm-project/lldb/test/API/tools/lldb-dap/variables/TestDAP_variables.py",
line 266, in do_test_scopes_variables_setVariable_evaluate
argv = self.get_local_as_int("argv")
File
"//llvm/llvm-project/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py",
line 199, in get_local_as_int
return int(value, 16)
ValueError: invalid literal for int() with base 16: '0x1234
sample summary'
Config=x86_64-//llvm/llvm-build/bin/clang

Co-authored-by: Santhosh Kumar Ellendula 

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 9d79872b029a334..0cf9d4fde49488f 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -195,6 +195,9 @@ def collect_console(self, duration):
 
 def get_local_as_int(self, name, threadId=None):
 value = self.dap_server.get_local_variable_value(name, 
threadId=threadId)
+# 'value' may have the variable value and summary.
+# Extract the variable value since summary can have nonnumeric 
characters.
+value = value.split(" ")[0]
 if value.startswith("0x"):
 return int(value, 16)
 elif value.startswith("0"):



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


[Lldb-commits] [llvm] [libcxxabi] [libcxx] [clang-tools-extra] [lldb] [mlir] [libc] [clang] [lld] [flang] [compiler-rt] [libunwind] [lldb][test] Add the ability to extract the variable value out of th

2023-11-17 Thread Walter Erquinigo via lldb-commits

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


[Lldb-commits] [llvm] [clang] [lldb] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits

https://github.com/erichkeane updated 
https://github.com/llvm/llvm-project/pull/72661

>From 01fc81b37ad744a265f712b26fd6c3a85430c719 Mon Sep 17 00:00:00 2001
From: erichkeane 
Date: Fri, 17 Nov 2023 06:29:35 -0800
Subject: [PATCH 1/2] [OpenACC] Implement initial parsing for
 Construct/Directive Names

As the first real parsing effort for the OpenACC implementation effort,
this implements the parsing for construct/directive names. This does not
do any semantic analysis, nor any parsing for the parens for afew of the
constructs, nor any of the clauses.  Those will come in a future patch.

For the time being, we warn when we hit a point that we don't implement
the parsing for either of these situations.
---
 .../clang/Basic/DiagnosticParseKinds.td   |  25 +-
 clang/include/clang/Basic/OpenACCKinds.h  |  72 ++
 clang/include/clang/Parse/Parser.h|   6 +-
 .../clang/Parse/RAIIObjectsForParser.h|  19 ++
 clang/lib/Parse/ParseDecl.cpp |   2 +-
 clang/lib/Parse/ParseDeclCXX.cpp  |   2 +-
 clang/lib/Parse/ParseOpenACC.cpp  | 232 +-
 clang/lib/Parse/Parser.cpp|   7 +-
 clang/test/ParserOpenACC/parse-constructs.c   | 148 +++
 clang/test/ParserOpenACC/unimplemented.c  |   6 +-
 clang/test/ParserOpenACC/unimplemented.cpp|   6 +-
 11 files changed, 504 insertions(+), 21 deletions(-)
 create mode 100644 clang/include/clang/Basic/OpenACCKinds.h
 create mode 100644 clang/test/ParserOpenACC/parse-constructs.c

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index c3d06053caa5eea..54ae536e9cf7935 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1343,13 +1343,30 @@ def err_openclcxx_virtual_function : Error<
   "virtual functions are not supported in C++ for OpenCL">;
 
 // OpenACC Support.
-def warn_pragma_acc_ignored : Warning<
-  "unexpected '#pragma acc ...' in program">, InGroup, 
DefaultIgnore;
-def err_acc_unexpected_directive : Error<
-  "unexpected OpenACC directive %select{|'#pragma acc %1'}0">;
+def warn_pragma_acc_ignored
+: Warning<"unexpected '#pragma acc ...' in program">,
+  InGroup,
+  DefaultIgnore;
+def err_acc_unexpected_directive
+: Error<"unexpected OpenACC directive %select{|'#pragma acc %1'}0">;
 def warn_pragma_acc_unimplemented
 : Warning<"OpenACC directives not yet implemented, pragma ignored">,
   InGroup;
+def warn_pragma_acc_unimplemented_construct_parens
+: Warning<
+  "OpenACC %select{'cache' 'var-list'|'wait-argument'|'routine-name'}0 
"
+  "parsing not yet implemented">,
+  InGroup;
+def warn_pragma_acc_unimplemented_clause_parsing
+: Warning<"OpenACC clause parsing not yet implemented">,
+  InGroup;
+def err_acc_invalid_directive
+: Error<"invalid OpenACC directive '%select{%1|%1 %2}0'">;
+def err_acc_invalid_atomic_clause
+: Error<"invalid OpenACC 'atomic-clause' '%0'; expected 'read', 'write', "
+"'update', or 'capture'">;
+def err_acc_invalid_open_paren
+: Error<"expected clause-list or newline in pragma directive">;
 
 // OpenMP support.
 def warn_pragma_omp_ignored : Warning<
diff --git a/clang/include/clang/Basic/OpenACCKinds.h 
b/clang/include/clang/Basic/OpenACCKinds.h
new file mode 100644
index 000..8a901d96bec5207
--- /dev/null
+++ b/clang/include/clang/Basic/OpenACCKinds.h
@@ -0,0 +1,72 @@
+//===--- OpenACCKinds.h - OpenACC Enums -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Defines some OpenACC-specific enums and functions.
+///
+//===--===//
+
+#ifndef LLVM_CLANG_BASIC_OPENACCKINDS_H
+#define LLVM_CLANG_BASIC_OPENACCKINDS_H
+
+namespace clang {
+// Represents the Construct/Directive kind of a pragma directive. Note the
+// OpenACC standard is inconsistent between calling these Construct vs
+// Directive, but we're calling it a Directive to be consistent with OpenMP.
+enum class OpenACCDirectiveKind {
+  // Compute Constructs.
+  Parallel,
+  Serial,
+  Kernels,
+
+  // Data Environment. "enter data" and "exit data" are also referred to in the
+  // Executable Directives section, but just as a back reference to the Data
+  // Environment.
+  Data,
+  EnterData,
+  ExitData,
+  HostData,
+
+  // Misc.
+  Loop,
+  Cache,
+
+  // Combined Constructs.
+  ParallelLoop,
+  SerialLoop,
+  KernelsLoop,
+
+  // Atomic Construct.  The OpenACC standard considers these as a single
+  // construct, however the atomic-clause (read, write, update, capture) are
+  // im

[Lldb-commits] [llvm] [clang] [lldb] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits


@@ -3531,7 +3535,7 @@ class Parser : public CodeCompletionHandler {
   /// Placeholder for now, should just ignore the directives after emitting a
   /// diagnostic. Eventually will be split into a few functions to parse
   /// different situations.
-  DeclGroupPtrTy ParseOpenACCDirective();
+  DeclGroupPtrTy ParseOpenACCDirectiveDecl();

erichkeane wrote:

Done.

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


[Lldb-commits] [llvm] [clang] [lldb] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Alexey Bataev via lldb-commits


@@ -10,18 +10,240 @@
 //
 
//===--===//
 
+#include "clang/Basic/OpenACCKinds.h"
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Parse/Parser.h"
+#include "clang/Parse/RAIIObjectsForParser.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
 
 using namespace clang;
+using namespace llvm;
+
+namespace {
+// An enum that contains the extended 'partial' parsed variants. This type
+// should never escape the initial parse functionality, but is useful for
+// simplifying the implementation.
+enum class OpenACCDirectiveKindEx {
+  Invalid = static_cast(OpenACCDirectiveKind::Invalid),
+  // 'enter data' and 'exit data'
+  Enter,
+  Exit,
+  // 'atomic read', 'atomic write', 'atomic update', and 'atomic capture'.
+  Atomic,
+};
+
+// Translate single-token string representations to the OpenACC Directive Kind.
+// This doesn't completely comprehend 'Compound Constructs' (as it just
+// identifies the first token), and doesn't fully handle 'enter data', 'exit
+// data', nor any of the 'atomic' variants, just the first token of each.  So
+// this should only be used by `ParseOpenACCDirectiveKind`.
+OpenACCDirectiveKindEx GetOpenACCDirectiveKind(StringRef Name) {
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(Name)
+  .Case("parallel", OpenACCDirectiveKind::Parallel)
+  .Case("serial", OpenACCDirectiveKind::Serial)
+  .Case("kernels", OpenACCDirectiveKind::Kernels)
+  .Case("data", OpenACCDirectiveKind::Data)
+  .Case("host_data", OpenACCDirectiveKind::HostData)
+  .Case("loop", OpenACCDirectiveKind::Loop)
+  .Case("cache", OpenACCDirectiveKind::Cache)
+  .Case("declare", OpenACCDirectiveKind::Declare)
+  .Case("init", OpenACCDirectiveKind::Init)
+  .Case("shutdown", OpenACCDirectiveKind::Shutdown)
+  .Case("set", OpenACCDirectiveKind::Shutdown)
+  .Case("update", OpenACCDirectiveKind::Update)
+  .Case("wait", OpenACCDirectiveKind::Wait)
+  .Case("routine", OpenACCDirectiveKind::Routine)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind != OpenACCDirectiveKind::Invalid)
+return static_cast(DirKind);
+
+  return llvm::StringSwitch(Name)
+  .Case("enter", OpenACCDirectiveKindEx::Enter)
+  .Case("exit", OpenACCDirectiveKindEx::Exit)
+  .Case("atomic", OpenACCDirectiveKindEx::Atomic)
+  .Default(OpenACCDirectiveKindEx::Invalid);
+}
+
+// "enter data" and "exit data" are permitted as their own constructs. Handle
+// these, knowing the previous token is either 'enter' or 'exit'. The current
+// token should be the one after the "enter" or "exit".
+OpenACCDirectiveKind
+ParseOpenACCEnterExitDataDirective(Parser &P, Token FirstTok,
+   StringRef FirstTokSpelling,
+   OpenACCDirectiveKindEx ExtDirKind) {
+  Token SecondTok = P.getCurToken();
+  std::string SecondTokSpelling = P.getPreprocessor().getSpelling(SecondTok);
+
+  if (SecondTokSpelling != "data") {
+P.Diag(FirstTok, diag::err_acc_invalid_directive)
+<< 1 << FirstTokSpelling << SecondTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  }
+
+  P.ConsumeToken();
+  return ExtDirKind == OpenACCDirectiveKindEx::Enter
+ ? OpenACCDirectiveKind::EnterData
+ : OpenACCDirectiveKind::ExitData;
+}
+
+OpenACCDirectiveKind ParseOpenACCAtomicDirective(Parser &P) {
+  Token AtomicClauseToken = P.getCurToken();
+  std::string AtomicClauseSpelling =
+  P.getPreprocessor().getSpelling(AtomicClauseToken);
+
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(AtomicClauseSpelling)
+  .Case("read", OpenACCDirectiveKind::AtomicRead)
+  .Case("write", OpenACCDirectiveKind::AtomicWrite)
+  .Case("update", OpenACCDirectiveKind::AtomicUpdate)
+  .Case("capture", OpenACCDirectiveKind::AtomicCapture)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind == OpenACCDirectiveKind::Invalid)
+P.Diag(AtomicClauseToken, diag::err_acc_invalid_atomic_clause)
+<< AtomicClauseSpelling;
+
+  P.ConsumeToken();
+  return DirKind;
+}
+
+// Parse and consume the tokens for OpenACC Directive/Construct kinds.
+OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
+  Token FirstTok = P.getCurToken();
+  P.ConsumeToken();
+  std::string FirstTokSpelling = P.getPreprocessor().getSpelling(FirstTok);
+
+  OpenACCDirectiveKindEx ExDirKind = GetOpenACCDirectiveKind(FirstTokSpelling);
+
+  Token SecondTok = P.getCurToken();
+  // Go through the Extended kinds to see if we can convert this to the
+  // non-Extended kinds, and handle invalid.
+  switch (ExDirKind) {
+  case OpenACCDirectiveKindEx::Invalid:
+P.Diag(FirstTok, diag::err_acc_invalid_directive) << 0 << FirstTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  case OpenACCDirectiveKindEx::Enter:

[Lldb-commits] [lldb] Add --copyExecutable and --ignoreNegativeCache to dsymForUUID invoke (PR #72579)

2023-11-17 Thread Jonas Devlieghere via lldb-commits

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


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


[Lldb-commits] [clang] [lldb] [llvm] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits


@@ -10,18 +10,240 @@
 //
 
//===--===//
 
+#include "clang/Basic/OpenACCKinds.h"
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Parse/Parser.h"
+#include "clang/Parse/RAIIObjectsForParser.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
 
 using namespace clang;
+using namespace llvm;
+
+namespace {
+// An enum that contains the extended 'partial' parsed variants. This type
+// should never escape the initial parse functionality, but is useful for
+// simplifying the implementation.
+enum class OpenACCDirectiveKindEx {
+  Invalid = static_cast(OpenACCDirectiveKind::Invalid),
+  // 'enter data' and 'exit data'
+  Enter,
+  Exit,
+  // 'atomic read', 'atomic write', 'atomic update', and 'atomic capture'.
+  Atomic,
+};
+
+// Translate single-token string representations to the OpenACC Directive Kind.
+// This doesn't completely comprehend 'Compound Constructs' (as it just
+// identifies the first token), and doesn't fully handle 'enter data', 'exit
+// data', nor any of the 'atomic' variants, just the first token of each.  So
+// this should only be used by `ParseOpenACCDirectiveKind`.
+OpenACCDirectiveKindEx GetOpenACCDirectiveKind(StringRef Name) {
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(Name)
+  .Case("parallel", OpenACCDirectiveKind::Parallel)
+  .Case("serial", OpenACCDirectiveKind::Serial)
+  .Case("kernels", OpenACCDirectiveKind::Kernels)
+  .Case("data", OpenACCDirectiveKind::Data)
+  .Case("host_data", OpenACCDirectiveKind::HostData)
+  .Case("loop", OpenACCDirectiveKind::Loop)
+  .Case("cache", OpenACCDirectiveKind::Cache)
+  .Case("declare", OpenACCDirectiveKind::Declare)
+  .Case("init", OpenACCDirectiveKind::Init)
+  .Case("shutdown", OpenACCDirectiveKind::Shutdown)
+  .Case("set", OpenACCDirectiveKind::Shutdown)
+  .Case("update", OpenACCDirectiveKind::Update)
+  .Case("wait", OpenACCDirectiveKind::Wait)
+  .Case("routine", OpenACCDirectiveKind::Routine)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind != OpenACCDirectiveKind::Invalid)
+return static_cast(DirKind);
+
+  return llvm::StringSwitch(Name)
+  .Case("enter", OpenACCDirectiveKindEx::Enter)
+  .Case("exit", OpenACCDirectiveKindEx::Exit)
+  .Case("atomic", OpenACCDirectiveKindEx::Atomic)
+  .Default(OpenACCDirectiveKindEx::Invalid);
+}
+
+// "enter data" and "exit data" are permitted as their own constructs. Handle
+// these, knowing the previous token is either 'enter' or 'exit'. The current
+// token should be the one after the "enter" or "exit".
+OpenACCDirectiveKind
+ParseOpenACCEnterExitDataDirective(Parser &P, Token FirstTok,
+   StringRef FirstTokSpelling,
+   OpenACCDirectiveKindEx ExtDirKind) {
+  Token SecondTok = P.getCurToken();
+  std::string SecondTokSpelling = P.getPreprocessor().getSpelling(SecondTok);
+
+  if (SecondTokSpelling != "data") {
+P.Diag(FirstTok, diag::err_acc_invalid_directive)
+<< 1 << FirstTokSpelling << SecondTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  }
+
+  P.ConsumeToken();
+  return ExtDirKind == OpenACCDirectiveKindEx::Enter
+ ? OpenACCDirectiveKind::EnterData
+ : OpenACCDirectiveKind::ExitData;
+}
+
+OpenACCDirectiveKind ParseOpenACCAtomicDirective(Parser &P) {
+  Token AtomicClauseToken = P.getCurToken();
+  std::string AtomicClauseSpelling =
+  P.getPreprocessor().getSpelling(AtomicClauseToken);
+
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(AtomicClauseSpelling)
+  .Case("read", OpenACCDirectiveKind::AtomicRead)
+  .Case("write", OpenACCDirectiveKind::AtomicWrite)
+  .Case("update", OpenACCDirectiveKind::AtomicUpdate)
+  .Case("capture", OpenACCDirectiveKind::AtomicCapture)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind == OpenACCDirectiveKind::Invalid)
+P.Diag(AtomicClauseToken, diag::err_acc_invalid_atomic_clause)
+<< AtomicClauseSpelling;
+
+  P.ConsumeToken();
+  return DirKind;
+}
+
+// Parse and consume the tokens for OpenACC Directive/Construct kinds.
+OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
+  Token FirstTok = P.getCurToken();
+  P.ConsumeToken();
+  std::string FirstTokSpelling = P.getPreprocessor().getSpelling(FirstTok);
+
+  OpenACCDirectiveKindEx ExDirKind = GetOpenACCDirectiveKind(FirstTokSpelling);
+
+  Token SecondTok = P.getCurToken();
+  // Go through the Extended kinds to see if we can convert this to the
+  // non-Extended kinds, and handle invalid.
+  switch (ExDirKind) {
+  case OpenACCDirectiveKindEx::Invalid:
+P.Diag(FirstTok, diag::err_acc_invalid_directive) << 0 << FirstTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  case OpenACCDirectiveKindEx::Enter:

[Lldb-commits] [lldb] [lldb] Remove unused Status::SetMachError (NFC) (PR #72668)

2023-11-17 Thread Jonas Devlieghere via lldb-commits

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

This function is never used, neither here nor downstream in the Swift fork. As 
far as I can tell, the same is true for the corresponding eErrorTypeMachKernel 
but as that's part of the SB API we cannot remove that.

>From b17285071edca2b1d74fb5138489deb21ab93ec9 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Fri, 17 Nov 2023 07:39:52 -0800
Subject: [PATCH] [lldb] Remove unused Status::SetMachError (NFC)

This function is never used, neither here nor downstream in the Swift
fork. As far as I can tell, the same is true for the corresponding
eErrorTypeMachKernel but as that's part of the SB API we cannot remove
that.
---
 lldb/include/lldb/Utility/Status.h | 9 -
 lldb/source/Utility/Status.cpp | 8 
 2 files changed, 17 deletions(-)

diff --git a/lldb/include/lldb/Utility/Status.h 
b/lldb/include/lldb/Utility/Status.h
index ac410552438e0c6..fa5768141fa45df 100644
--- a/lldb/include/lldb/Utility/Status.h
+++ b/lldb/include/lldb/Utility/Status.h
@@ -114,15 +114,6 @@ class Status {
   /// The error type enumeration value.
   lldb::ErrorType GetType() const;
 
-  /// Set accessor from a kern_return_t.
-  ///
-  /// Set accessor for the error value to \a err and the error type to \c
-  /// MachKernel.
-  ///
-  /// \param[in] err
-  /// A mach error code.
-  void SetMachError(uint32_t err);
-
   void SetExpressionError(lldb::ExpressionResults, const char *mssg);
 
   int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format,
diff --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index 4498961d83e7712..3bd00bb20da258c 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -180,14 +180,6 @@ ErrorType Status::GetType() const { return m_type; }
 // otherwise non-success result.
 bool Status::Fail() const { return m_code != 0; }
 
-// Set accessor for the error value to "err" and the type to
-// "eErrorTypeMachKernel"
-void Status::SetMachError(uint32_t err) {
-  m_code = err;
-  m_type = eErrorTypeMachKernel;
-  m_string.clear();
-}
-
 void Status::SetExpressionError(lldb::ExpressionResults result,
 const char *mssg) {
   m_code = result;

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


[Lldb-commits] [clang] [llvm] [lldb] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits


@@ -0,0 +1,72 @@
+//===--- OpenACCKinds.h - OpenACC Enums -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Defines some OpenACC-specific enums and functions.
+///
+//===--===//
+
+#ifndef LLVM_CLANG_BASIC_OPENACCKINDS_H
+#define LLVM_CLANG_BASIC_OPENACCKINDS_H
+
+namespace clang {
+// Represents the Construct/Directive kind of a pragma directive. Note the
+// OpenACC standard is inconsistent between calling these Construct vs
+// Directive, but we're calling it a Directive to be consistent with OpenMP.
+enum class OpenACCDirectiveKind {
+  // Compute Constructs.
+  Parallel,

erichkeane wrote:

To clarify: Are you asking me to split this patch up into 23 different ones 
here?  The first adding the infrastructure + parallel, followed by most of the 
22 that are just adding an entry here and to a string-switch?

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


[Lldb-commits] [lldb] [lldb] Remove unused Status::SetMachError (NFC) (PR #72668)

2023-11-17 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

This function is never used, neither here nor downstream in the Swift fork. As 
far as I can tell, the same is true for the corresponding eErrorTypeMachKernel 
but as that's part of the SB API we cannot remove that.

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


2 Files Affected:

- (modified) lldb/include/lldb/Utility/Status.h (-9) 
- (modified) lldb/source/Utility/Status.cpp (-8) 


``diff
diff --git a/lldb/include/lldb/Utility/Status.h 
b/lldb/include/lldb/Utility/Status.h
index ac410552438e0c6..fa5768141fa45df 100644
--- a/lldb/include/lldb/Utility/Status.h
+++ b/lldb/include/lldb/Utility/Status.h
@@ -114,15 +114,6 @@ class Status {
   /// The error type enumeration value.
   lldb::ErrorType GetType() const;
 
-  /// Set accessor from a kern_return_t.
-  ///
-  /// Set accessor for the error value to \a err and the error type to \c
-  /// MachKernel.
-  ///
-  /// \param[in] err
-  /// A mach error code.
-  void SetMachError(uint32_t err);
-
   void SetExpressionError(lldb::ExpressionResults, const char *mssg);
 
   int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format,
diff --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index 4498961d83e7712..3bd00bb20da258c 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -180,14 +180,6 @@ ErrorType Status::GetType() const { return m_type; }
 // otherwise non-success result.
 bool Status::Fail() const { return m_code != 0; }
 
-// Set accessor for the error value to "err" and the type to
-// "eErrorTypeMachKernel"
-void Status::SetMachError(uint32_t err) {
-  m_code = err;
-  m_type = eErrorTypeMachKernel;
-  m_string.clear();
-}
-
 void Status::SetExpressionError(lldb::ExpressionResults result,
 const char *mssg) {
   m_code = result;

``




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


[Lldb-commits] [libc] [clang-tools-extra] [libcxx] [clang] [lld] [lldb] [flang] [llvm] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-17 Thread Shilei Tian via lldb-commits

shiltian wrote:

We will want to have OpenACC label(s) such that people who are interested can 
be notified.

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


[Lldb-commits] [libc] [clang-tools-extra] [libcxx] [clang] [lld] [lldb] [flang] [llvm] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-17 Thread Erich Keane via lldb-commits

erichkeane wrote:

> We will want to have OpenACC label(s) such that people who are interested can 
> be notified.

Done, see the next patch in the set here: 
https://github.com/llvm/llvm-project/pull/72661

I'll start adding them and see if I can get @llvmbot  to teach me how to add it.

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


[Lldb-commits] [clang] [lldb] [llvm] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Alexey Bataev via lldb-commits


@@ -10,18 +10,240 @@
 //
 
//===--===//
 
+#include "clang/Basic/OpenACCKinds.h"
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Parse/Parser.h"
+#include "clang/Parse/RAIIObjectsForParser.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
 
 using namespace clang;
+using namespace llvm;
+
+namespace {
+// An enum that contains the extended 'partial' parsed variants. This type
+// should never escape the initial parse functionality, but is useful for
+// simplifying the implementation.
+enum class OpenACCDirectiveKindEx {
+  Invalid = static_cast(OpenACCDirectiveKind::Invalid),
+  // 'enter data' and 'exit data'
+  Enter,
+  Exit,
+  // 'atomic read', 'atomic write', 'atomic update', and 'atomic capture'.
+  Atomic,
+};
+
+// Translate single-token string representations to the OpenACC Directive Kind.
+// This doesn't completely comprehend 'Compound Constructs' (as it just
+// identifies the first token), and doesn't fully handle 'enter data', 'exit
+// data', nor any of the 'atomic' variants, just the first token of each.  So
+// this should only be used by `ParseOpenACCDirectiveKind`.
+OpenACCDirectiveKindEx GetOpenACCDirectiveKind(StringRef Name) {
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(Name)
+  .Case("parallel", OpenACCDirectiveKind::Parallel)
+  .Case("serial", OpenACCDirectiveKind::Serial)
+  .Case("kernels", OpenACCDirectiveKind::Kernels)
+  .Case("data", OpenACCDirectiveKind::Data)
+  .Case("host_data", OpenACCDirectiveKind::HostData)
+  .Case("loop", OpenACCDirectiveKind::Loop)
+  .Case("cache", OpenACCDirectiveKind::Cache)
+  .Case("declare", OpenACCDirectiveKind::Declare)
+  .Case("init", OpenACCDirectiveKind::Init)
+  .Case("shutdown", OpenACCDirectiveKind::Shutdown)
+  .Case("set", OpenACCDirectiveKind::Shutdown)
+  .Case("update", OpenACCDirectiveKind::Update)
+  .Case("wait", OpenACCDirectiveKind::Wait)
+  .Case("routine", OpenACCDirectiveKind::Routine)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind != OpenACCDirectiveKind::Invalid)
+return static_cast(DirKind);
+
+  return llvm::StringSwitch(Name)
+  .Case("enter", OpenACCDirectiveKindEx::Enter)
+  .Case("exit", OpenACCDirectiveKindEx::Exit)
+  .Case("atomic", OpenACCDirectiveKindEx::Atomic)
+  .Default(OpenACCDirectiveKindEx::Invalid);
+}
+
+// "enter data" and "exit data" are permitted as their own constructs. Handle
+// these, knowing the previous token is either 'enter' or 'exit'. The current
+// token should be the one after the "enter" or "exit".
+OpenACCDirectiveKind
+ParseOpenACCEnterExitDataDirective(Parser &P, Token FirstTok,
+   StringRef FirstTokSpelling,
+   OpenACCDirectiveKindEx ExtDirKind) {
+  Token SecondTok = P.getCurToken();
+  std::string SecondTokSpelling = P.getPreprocessor().getSpelling(SecondTok);
+
+  if (SecondTokSpelling != "data") {
+P.Diag(FirstTok, diag::err_acc_invalid_directive)
+<< 1 << FirstTokSpelling << SecondTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  }
+
+  P.ConsumeToken();
+  return ExtDirKind == OpenACCDirectiveKindEx::Enter
+ ? OpenACCDirectiveKind::EnterData
+ : OpenACCDirectiveKind::ExitData;
+}
+
+OpenACCDirectiveKind ParseOpenACCAtomicDirective(Parser &P) {
+  Token AtomicClauseToken = P.getCurToken();
+  std::string AtomicClauseSpelling =
+  P.getPreprocessor().getSpelling(AtomicClauseToken);
+
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(AtomicClauseSpelling)
+  .Case("read", OpenACCDirectiveKind::AtomicRead)
+  .Case("write", OpenACCDirectiveKind::AtomicWrite)
+  .Case("update", OpenACCDirectiveKind::AtomicUpdate)
+  .Case("capture", OpenACCDirectiveKind::AtomicCapture)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind == OpenACCDirectiveKind::Invalid)
+P.Diag(AtomicClauseToken, diag::err_acc_invalid_atomic_clause)
+<< AtomicClauseSpelling;
+
+  P.ConsumeToken();
+  return DirKind;
+}
+
+// Parse and consume the tokens for OpenACC Directive/Construct kinds.
+OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
+  Token FirstTok = P.getCurToken();
+  P.ConsumeToken();
+  std::string FirstTokSpelling = P.getPreprocessor().getSpelling(FirstTok);
+
+  OpenACCDirectiveKindEx ExDirKind = GetOpenACCDirectiveKind(FirstTokSpelling);
+
+  Token SecondTok = P.getCurToken();
+  // Go through the Extended kinds to see if we can convert this to the
+  // non-Extended kinds, and handle invalid.
+  switch (ExDirKind) {
+  case OpenACCDirectiveKindEx::Invalid:
+P.Diag(FirstTok, diag::err_acc_invalid_directive) << 0 << FirstTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  case OpenACCDirectiveKindEx::Enter:

[Lldb-commits] [clang] [lldb] [llvm] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits


@@ -10,18 +10,240 @@
 //
 
//===--===//
 
+#include "clang/Basic/OpenACCKinds.h"
 #include "clang/Parse/ParseDiagnostic.h"
 #include "clang/Parse/Parser.h"
+#include "clang/Parse/RAIIObjectsForParser.h"
+#include "llvm/ADT/StringRef.h"
+#include "llvm/ADT/StringSwitch.h"
 
 using namespace clang;
+using namespace llvm;
+
+namespace {
+// An enum that contains the extended 'partial' parsed variants. This type
+// should never escape the initial parse functionality, but is useful for
+// simplifying the implementation.
+enum class OpenACCDirectiveKindEx {
+  Invalid = static_cast(OpenACCDirectiveKind::Invalid),
+  // 'enter data' and 'exit data'
+  Enter,
+  Exit,
+  // 'atomic read', 'atomic write', 'atomic update', and 'atomic capture'.
+  Atomic,
+};
+
+// Translate single-token string representations to the OpenACC Directive Kind.
+// This doesn't completely comprehend 'Compound Constructs' (as it just
+// identifies the first token), and doesn't fully handle 'enter data', 'exit
+// data', nor any of the 'atomic' variants, just the first token of each.  So
+// this should only be used by `ParseOpenACCDirectiveKind`.
+OpenACCDirectiveKindEx GetOpenACCDirectiveKind(StringRef Name) {
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(Name)
+  .Case("parallel", OpenACCDirectiveKind::Parallel)
+  .Case("serial", OpenACCDirectiveKind::Serial)
+  .Case("kernels", OpenACCDirectiveKind::Kernels)
+  .Case("data", OpenACCDirectiveKind::Data)
+  .Case("host_data", OpenACCDirectiveKind::HostData)
+  .Case("loop", OpenACCDirectiveKind::Loop)
+  .Case("cache", OpenACCDirectiveKind::Cache)
+  .Case("declare", OpenACCDirectiveKind::Declare)
+  .Case("init", OpenACCDirectiveKind::Init)
+  .Case("shutdown", OpenACCDirectiveKind::Shutdown)
+  .Case("set", OpenACCDirectiveKind::Shutdown)
+  .Case("update", OpenACCDirectiveKind::Update)
+  .Case("wait", OpenACCDirectiveKind::Wait)
+  .Case("routine", OpenACCDirectiveKind::Routine)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind != OpenACCDirectiveKind::Invalid)
+return static_cast(DirKind);
+
+  return llvm::StringSwitch(Name)
+  .Case("enter", OpenACCDirectiveKindEx::Enter)
+  .Case("exit", OpenACCDirectiveKindEx::Exit)
+  .Case("atomic", OpenACCDirectiveKindEx::Atomic)
+  .Default(OpenACCDirectiveKindEx::Invalid);
+}
+
+// "enter data" and "exit data" are permitted as their own constructs. Handle
+// these, knowing the previous token is either 'enter' or 'exit'. The current
+// token should be the one after the "enter" or "exit".
+OpenACCDirectiveKind
+ParseOpenACCEnterExitDataDirective(Parser &P, Token FirstTok,
+   StringRef FirstTokSpelling,
+   OpenACCDirectiveKindEx ExtDirKind) {
+  Token SecondTok = P.getCurToken();
+  std::string SecondTokSpelling = P.getPreprocessor().getSpelling(SecondTok);
+
+  if (SecondTokSpelling != "data") {
+P.Diag(FirstTok, diag::err_acc_invalid_directive)
+<< 1 << FirstTokSpelling << SecondTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  }
+
+  P.ConsumeToken();
+  return ExtDirKind == OpenACCDirectiveKindEx::Enter
+ ? OpenACCDirectiveKind::EnterData
+ : OpenACCDirectiveKind::ExitData;
+}
+
+OpenACCDirectiveKind ParseOpenACCAtomicDirective(Parser &P) {
+  Token AtomicClauseToken = P.getCurToken();
+  std::string AtomicClauseSpelling =
+  P.getPreprocessor().getSpelling(AtomicClauseToken);
+
+  OpenACCDirectiveKind DirKind =
+  llvm::StringSwitch(AtomicClauseSpelling)
+  .Case("read", OpenACCDirectiveKind::AtomicRead)
+  .Case("write", OpenACCDirectiveKind::AtomicWrite)
+  .Case("update", OpenACCDirectiveKind::AtomicUpdate)
+  .Case("capture", OpenACCDirectiveKind::AtomicCapture)
+  .Default(OpenACCDirectiveKind::Invalid);
+
+  if (DirKind == OpenACCDirectiveKind::Invalid)
+P.Diag(AtomicClauseToken, diag::err_acc_invalid_atomic_clause)
+<< AtomicClauseSpelling;
+
+  P.ConsumeToken();
+  return DirKind;
+}
+
+// Parse and consume the tokens for OpenACC Directive/Construct kinds.
+OpenACCDirectiveKind ParseOpenACCDirectiveKind(Parser &P) {
+  Token FirstTok = P.getCurToken();
+  P.ConsumeToken();
+  std::string FirstTokSpelling = P.getPreprocessor().getSpelling(FirstTok);
+
+  OpenACCDirectiveKindEx ExDirKind = GetOpenACCDirectiveKind(FirstTokSpelling);
+
+  Token SecondTok = P.getCurToken();
+  // Go through the Extended kinds to see if we can convert this to the
+  // non-Extended kinds, and handle invalid.
+  switch (ExDirKind) {
+  case OpenACCDirectiveKindEx::Invalid:
+P.Diag(FirstTok, diag::err_acc_invalid_directive) << 0 << FirstTokSpelling;
+return OpenACCDirectiveKind::Invalid;
+  case OpenACCDirectiveKindEx::Enter:

[Lldb-commits] [lldb] [lldb] Pass important options to dsymForUUID (PR #72669)

2023-11-17 Thread Jonas Devlieghere via lldb-commits

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

On macOS, we usually use the DebugSymbols framework to find dSYMs, but we have 
a few places (including crashlog.py) that calls out directly to dsymForUUID. 
Currently, this invocation is missing two important options:

  * `--ignoreNegativeCache`: Poor network connectivity or lack of VPN can lead 
to a negative cache hit. Avoiding those issues is worth the penalty of skipping 
these caches.
  * `--copyExecutable`: Ensure we copy the executable as it might not be 
available at its original location.

rdar://118480731

>From 0dd237e1d5dc7d9d40fe7be743d8e1a30c15 Mon Sep 17 00:00:00 2001
From: Jonas Devlieghere 
Date: Fri, 17 Nov 2023 07:45:43 -0800
Subject: [PATCH] [lldb] Pass important options to dsymForUUID

On macOS, we usually use the DebugSymbols framework to find dSYMs, but
we have a few places (including crashlog.py) that calls out directly to
dsymForUUID. Currently, this invocation is missing two important options:

  * `--ignoreNegativeCache`: Poor network connectivity or lack of VPN
can lead to a negative cache hit. Avoiding those issues is worth the
penalty of skipping these caches.
  * `--copyExecutable`: Ensure we copy the executable as it might not be
available at its original location.

rdar://118480731
---
 lldb/examples/python/crashlog.py | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index cb8008419404c23..9e4f94264037aea 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -356,7 +356,11 @@ def locate_module_and_debug_symbols(self):
 # Keep track of unresolved source paths.
 unavailable_source_paths = set()
 if os.path.exists(self.dsymForUUIDBinary):
-dsym_for_uuid_command = "%s %s" % (self.dsymForUUIDBinary, 
uuid_str)
+dsym_for_uuid_command = (
+"{} --copyExecutable --ignoreNegativeCache {}".format(
+self.dsymForUUIDBinary, uuid_str
+)
+)
 s = subprocess.check_output(dsym_for_uuid_command, shell=True)
 if s:
 try:

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


[Lldb-commits] [lldb] [lldb] Pass important options to dsymForUUID (PR #72669)

2023-11-17 Thread via lldb-commits

llvmbot wrote:




@llvm/pr-subscribers-lldb

Author: Jonas Devlieghere (JDevlieghere)


Changes

On macOS, we usually use the DebugSymbols framework to find dSYMs, but we have 
a few places (including crashlog.py) that calls out directly to dsymForUUID. 
Currently, this invocation is missing two important options:

  * `--ignoreNegativeCache`: Poor network connectivity or lack of VPN can lead 
to a negative cache hit. Avoiding those issues is worth the penalty of skipping 
these caches.
  * `--copyExecutable`: Ensure we copy the executable as it might not be 
available at its original location.

rdar://118480731

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


1 Files Affected:

- (modified) lldb/examples/python/crashlog.py (+5-1) 


``diff
diff --git a/lldb/examples/python/crashlog.py b/lldb/examples/python/crashlog.py
index cb8008419404c23..9e4f94264037aea 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -356,7 +356,11 @@ def locate_module_and_debug_symbols(self):
 # Keep track of unresolved source paths.
 unavailable_source_paths = set()
 if os.path.exists(self.dsymForUUIDBinary):
-dsym_for_uuid_command = "%s %s" % (self.dsymForUUIDBinary, 
uuid_str)
+dsym_for_uuid_command = (
+"{} --copyExecutable --ignoreNegativeCache {}".format(
+self.dsymForUUIDBinary, uuid_str
+)
+)
 s = subprocess.check_output(dsym_for_uuid_command, shell=True)
 if s:
 try:

``




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


[Lldb-commits] [lldb] [lldb] Pass important options to dsymForUUID (PR #72669)

2023-11-17 Thread Med Ismail Bennani via lldb-commits

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

LGTM! Thanks!

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


[Lldb-commits] [lldb] [clang] [llvm] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Alexey Bataev via lldb-commits


@@ -0,0 +1,72 @@
+//===--- OpenACCKinds.h - OpenACC Enums -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Defines some OpenACC-specific enums and functions.
+///
+//===--===//
+
+#ifndef LLVM_CLANG_BASIC_OPENACCKINDS_H
+#define LLVM_CLANG_BASIC_OPENACCKINDS_H
+
+namespace clang {
+// Represents the Construct/Directive kind of a pragma directive. Note the
+// OpenACC standard is inconsistent between calling these Construct vs
+// Directive, but we're calling it a Directive to be consistent with OpenMP.
+enum class OpenACCDirectiveKind {
+  // Compute Constructs.
+  Parallel,

alexey-bataev wrote:

No, not neccesary. The first patch, that lands main infrastructure, better to 
have a small parsing functionality, the future patch(es) may include parsing of 
other stuff, if it small enough

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


[Lldb-commits] [lldb] [lldb] Pass important options to dsymForUUID (PR #72669)

2023-11-17 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] ec6a34e - [lldb] Pass important options to dsymForUUID (#72669)

2023-11-17 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2023-11-17T08:00:07-08:00
New Revision: ec6a34e2a781fcfc6fe1d30e7cd358fb779157cf

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

LOG: [lldb] Pass important options to dsymForUUID (#72669)

On macOS, we usually use the DebugSymbols framework to find dSYMs, but
we have a few places (including crashlog.py) that calls out directly to
dsymForUUID. Currently, this invocation is missing two important
options:

* `--ignoreNegativeCache`: Poor network connectivity or lack of VPN can
lead to a negative cache hit. Avoiding those issues is worth the penalty
of skipping these caches.
* `--copyExecutable`: Ensure we copy the executable as it might not be
available at its original location.

rdar://118480731

Added: 


Modified: 
lldb/examples/python/crashlog.py

Removed: 




diff  --git a/lldb/examples/python/crashlog.py 
b/lldb/examples/python/crashlog.py
index cb8008419404c23..9e4f94264037aea 100755
--- a/lldb/examples/python/crashlog.py
+++ b/lldb/examples/python/crashlog.py
@@ -356,7 +356,11 @@ def locate_module_and_debug_symbols(self):
 # Keep track of unresolved source paths.
 unavailable_source_paths = set()
 if os.path.exists(self.dsymForUUIDBinary):
-dsym_for_uuid_command = "%s %s" % (self.dsymForUUIDBinary, 
uuid_str)
+dsym_for_uuid_command = (
+"{} --copyExecutable --ignoreNegativeCache {}".format(
+self.dsymForUUIDBinary, uuid_str
+)
+)
 s = subprocess.check_output(dsym_for_uuid_command, shell=True)
 if s:
 try:



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


[Lldb-commits] [clang] [clang-tools-extra] [libcxx] [flang] [lldb] [llvm] [libc] [lld] [OpenACC] Initial commits to support OpenACC (PR #70234)

2023-11-17 Thread Shilei Tian via lldb-commits

shiltian wrote:

You might also want to update the team "pr-subscribers-openacc" because 
currently it only reflects Flang.

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


[Lldb-commits] [flang] [libc] [libunwind] [libcxx] [clang-tools-extra] [libcxxabi] [lld] [llvm] [lldb] [clang] [compiler-rt] [mlir] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Todd A. Anderson via lldb-commits

https://github.com/DrTodd13 requested changes to this pull request.

I don't think these changes as they are solve the problem.

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


[Lldb-commits] [clang] [libunwind] [lldb] [lld] [flang] [compiler-rt] [clang-tools-extra] [llvm] [libc] [libcxx] [mlir] [libcxxabi] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Todd A. Anderson via lldb-commits


@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);

DrTodd13 wrote:

If Filename is too long, then EC here will already contain an error code.

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


[Lldb-commits] [libunwind] [libcxxabi] [clang] [mlir] [compiler-rt] [clang-tools-extra] [libcxx] [flang] [lldb] [llvm] [libc] [lld] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Todd A. Anderson via lldb-commits

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


[Lldb-commits] [mlir] [llvm] [libunwind] [libcxx] [libcxxabi] [libc] [clang] [lldb] [compiler-rt] [lld] [clang-tools-extra] [flang] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Todd A. Anderson via lldb-commits


@@ -310,7 +312,7 @@ void WriteDOTGraphToFile(Function &F, GraphT &&Graph,
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
   std::string Title = GraphName + " for '" + F.getName().str() + "' function";
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN))

DrTodd13 wrote:

Same issue as above.

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


[Lldb-commits] [llvm] [clang-tools-extra] [libcxx] [flang] [clang] [libc] [mlir] [lldb] [compiler-rt] [libunwind] [lld] [libcxxabi] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Todd A. Anderson via lldb-commits


@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
   std::string GraphName = DOTGraphTraits::getGraphName(Graph);
 
-  if (!EC)
+  if (!EC && (Filename.length() <= MAX_FILENAME_LEN))

DrTodd13 wrote:

Not sure this does anything since if filename is too long then an error code EC 
will already be set.

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


[Lldb-commits] [clang] [libc] [libcxxabi] [mlir] [llvm] [compiler-rt] [lldb] [flang] [lld] [libcxx] [clang-tools-extra] [libunwind] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Todd A. Anderson via lldb-commits


@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);

DrTodd13 wrote:

I needed to work around this bug when I found it so in my local version I did a 
(Name.str() + "." + F.getName().str()).substr(0,250) + ".dot".  In this way, I 
just truncate the lengthy filename to 250 characters before adding the ".dot".  
However, this approach has the problem that two functions who names differ only 
past the 250 character mark will try to write to the same file.  I don't know 
what the right solution is here and that's why I posted it for discussion. 

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


[Lldb-commits] [compiler-rt] [mlir] [libc] [libcxxabi] [clang-tools-extra] [libunwind] [libcxx] [clang] [lld] [lldb] [flang] [llvm] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Todd A. Anderson via lldb-commits


@@ -280,7 +282,7 @@ class DOTGraphTraitsModulePrinterWrapperPass : public 
ModulePass {
 raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);
 std::string Title = DOTGraphTraits::getGraphName(Graph);
 
-if (!EC)
+if (!EC && (Filename.length() <= MAX_FILENAME_LEN))

DrTodd13 wrote:

Same issue as above.

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


[Lldb-commits] [lldb] [clang] [llvm] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits


@@ -0,0 +1,72 @@
+//===--- OpenACCKinds.h - OpenACC Enums -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Defines some OpenACC-specific enums and functions.
+///
+//===--===//
+
+#ifndef LLVM_CLANG_BASIC_OPENACCKINDS_H
+#define LLVM_CLANG_BASIC_OPENACCKINDS_H
+
+namespace clang {
+// Represents the Construct/Directive kind of a pragma directive. Note the
+// OpenACC standard is inconsistent between calling these Construct vs
+// Directive, but we're calling it a Directive to be consistent with OpenMP.
+enum class OpenACCDirectiveKind {
+  // Compute Constructs.
+  Parallel,

erichkeane wrote:

Alright then, I'll do that.

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


[Lldb-commits] [clang] [libc] [libcxxabi] [mlir] [llvm] [compiler-rt] [lldb] [flang] [lld] [libcxx] [clang-tools-extra] [libunwind] PR#72453 : Exceeding maximum file name length (PR #72654)

2023-11-17 Thread Shahid Iqbal via lldb-commits


@@ -94,7 +96,7 @@ void printGraphForFunction(Function &F, GraphT Graph, 
StringRef Name,
   raw_fd_ostream File(Filename, EC, sys::fs::OF_TextWithCRLF);

shahidiqbal13 wrote:

@DrTodd13 ,
Will change the fix later , need to think

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


[Lldb-commits] [lldb] [llvm] [clang] [OpenACC] Implement initial parsing for Construct/Directive Names (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits

https://github.com/erichkeane updated 
https://github.com/llvm/llvm-project/pull/72661

>From 01fc81b37ad744a265f712b26fd6c3a85430c719 Mon Sep 17 00:00:00 2001
From: erichkeane 
Date: Fri, 17 Nov 2023 06:29:35 -0800
Subject: [PATCH 1/3] [OpenACC] Implement initial parsing for
 Construct/Directive Names

As the first real parsing effort for the OpenACC implementation effort,
this implements the parsing for construct/directive names. This does not
do any semantic analysis, nor any parsing for the parens for afew of the
constructs, nor any of the clauses.  Those will come in a future patch.

For the time being, we warn when we hit a point that we don't implement
the parsing for either of these situations.
---
 .../clang/Basic/DiagnosticParseKinds.td   |  25 +-
 clang/include/clang/Basic/OpenACCKinds.h  |  72 ++
 clang/include/clang/Parse/Parser.h|   6 +-
 .../clang/Parse/RAIIObjectsForParser.h|  19 ++
 clang/lib/Parse/ParseDecl.cpp |   2 +-
 clang/lib/Parse/ParseDeclCXX.cpp  |   2 +-
 clang/lib/Parse/ParseOpenACC.cpp  | 232 +-
 clang/lib/Parse/Parser.cpp|   7 +-
 clang/test/ParserOpenACC/parse-constructs.c   | 148 +++
 clang/test/ParserOpenACC/unimplemented.c  |   6 +-
 clang/test/ParserOpenACC/unimplemented.cpp|   6 +-
 11 files changed, 504 insertions(+), 21 deletions(-)
 create mode 100644 clang/include/clang/Basic/OpenACCKinds.h
 create mode 100644 clang/test/ParserOpenACC/parse-constructs.c

diff --git a/clang/include/clang/Basic/DiagnosticParseKinds.td 
b/clang/include/clang/Basic/DiagnosticParseKinds.td
index c3d06053caa5eea..54ae536e9cf7935 100644
--- a/clang/include/clang/Basic/DiagnosticParseKinds.td
+++ b/clang/include/clang/Basic/DiagnosticParseKinds.td
@@ -1343,13 +1343,30 @@ def err_openclcxx_virtual_function : Error<
   "virtual functions are not supported in C++ for OpenCL">;
 
 // OpenACC Support.
-def warn_pragma_acc_ignored : Warning<
-  "unexpected '#pragma acc ...' in program">, InGroup, 
DefaultIgnore;
-def err_acc_unexpected_directive : Error<
-  "unexpected OpenACC directive %select{|'#pragma acc %1'}0">;
+def warn_pragma_acc_ignored
+: Warning<"unexpected '#pragma acc ...' in program">,
+  InGroup,
+  DefaultIgnore;
+def err_acc_unexpected_directive
+: Error<"unexpected OpenACC directive %select{|'#pragma acc %1'}0">;
 def warn_pragma_acc_unimplemented
 : Warning<"OpenACC directives not yet implemented, pragma ignored">,
   InGroup;
+def warn_pragma_acc_unimplemented_construct_parens
+: Warning<
+  "OpenACC %select{'cache' 'var-list'|'wait-argument'|'routine-name'}0 
"
+  "parsing not yet implemented">,
+  InGroup;
+def warn_pragma_acc_unimplemented_clause_parsing
+: Warning<"OpenACC clause parsing not yet implemented">,
+  InGroup;
+def err_acc_invalid_directive
+: Error<"invalid OpenACC directive '%select{%1|%1 %2}0'">;
+def err_acc_invalid_atomic_clause
+: Error<"invalid OpenACC 'atomic-clause' '%0'; expected 'read', 'write', "
+"'update', or 'capture'">;
+def err_acc_invalid_open_paren
+: Error<"expected clause-list or newline in pragma directive">;
 
 // OpenMP support.
 def warn_pragma_omp_ignored : Warning<
diff --git a/clang/include/clang/Basic/OpenACCKinds.h 
b/clang/include/clang/Basic/OpenACCKinds.h
new file mode 100644
index 000..8a901d96bec5207
--- /dev/null
+++ b/clang/include/clang/Basic/OpenACCKinds.h
@@ -0,0 +1,72 @@
+//===--- OpenACCKinds.h - OpenACC Enums -*- C++ 
-*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+///
+/// \file
+/// Defines some OpenACC-specific enums and functions.
+///
+//===--===//
+
+#ifndef LLVM_CLANG_BASIC_OPENACCKINDS_H
+#define LLVM_CLANG_BASIC_OPENACCKINDS_H
+
+namespace clang {
+// Represents the Construct/Directive kind of a pragma directive. Note the
+// OpenACC standard is inconsistent between calling these Construct vs
+// Directive, but we're calling it a Directive to be consistent with OpenMP.
+enum class OpenACCDirectiveKind {
+  // Compute Constructs.
+  Parallel,
+  Serial,
+  Kernels,
+
+  // Data Environment. "enter data" and "exit data" are also referred to in the
+  // Executable Directives section, but just as a back reference to the Data
+  // Environment.
+  Data,
+  EnterData,
+  ExitData,
+  HostData,
+
+  // Misc.
+  Loop,
+  Cache,
+
+  // Combined Constructs.
+  ParallelLoop,
+  SerialLoop,
+  KernelsLoop,
+
+  // Atomic Construct.  The OpenACC standard considers these as a single
+  // construct, however the atomic-clause (read, write, update, capture) are
+  // im

[Lldb-commits] [lldb] [llvm] [clang] [OpenACC] Implement initial parsing for `parallel` construct (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [clang] [OpenACC] Implement initial parsing for `parallel` construct (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits

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


[Lldb-commits] [lldb] [llvm] [clang] [OpenACC] Implement initial parsing for `parallel` construct (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits

erichkeane wrote:

@alexey-bataev : Patch reduced to just parallel as requested.

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


[Lldb-commits] [lldb] [llvm] [clang] [OpenACC] Implement initial parsing for `parallel` construct (PR #72661)

2023-11-17 Thread Alexey Bataev via lldb-commits

https://github.com/alexey-bataev approved this pull request.


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


[Lldb-commits] [lldb] [lldb] Remove unused Status::SetMachError (NFC) (PR #72668)

2023-11-17 Thread Alex Langford via lldb-commits

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

🚢 

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


[Lldb-commits] [lldb] e2fb816 - Add new API in SBTarget for loading core from SBFile (#71769)

2023-11-17 Thread via lldb-commits

Author: GeorgeHuyubo
Date: 2023-11-17T09:53:12-08:00
New Revision: e2fb816c4f0286ddf8b1030148a343d5efc14e01

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

LOG: Add new API in SBTarget for loading core from SBFile (#71769)

Add a new API in SBTarget to Load Core from a SBFile.
This will enable a target to load core from a file descriptor.
So that in coredumper, we don't need to write core file to disk, instead
we can pass the input file descriptor to lldb directly.


Test:
```
(lldb) script
Python Interactive Interpreter. To exit, type 'quit()', 'exit()' or Ctrl-D.
>>> file_object = open("/home/hyubo/210hda79ms32sr0h", "r")
>>> fd=file_object.fileno()
>>> file = lldb.SBFile(fd,'r', True)
>>> error = lldb.SBError()
>>> target = lldb.debugger.CreateTarget(None)
>>> target.LoadCore(file,error)
SBProcess: pid = 56415, state = stopped, threads = 1
```

Added: 


Modified: 
lldb/include/lldb/API/SBTarget.h
lldb/source/API/SBTarget.cpp
lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py

Removed: 




diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index 83087623088c5b4..8e44cd5513c5b20 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -184,6 +184,7 @@ class LLDB_API SBTarget {
 
   SBProcess LoadCore(const char *core_file);
   SBProcess LoadCore(const char *core_file, lldb::SBError &error);
+  SBProcess LoadCore(const SBFile &file, lldb::SBError &error);
 
   /// Launch a new process with sensible defaults.
   ///

diff  --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 2d029554492a05c..9632627e3cefc42 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -16,6 +16,7 @@
 #include "lldb/API/SBEnvironment.h"
 #include "lldb/API/SBEvent.h"
 #include "lldb/API/SBExpressionOptions.h"
+#include "lldb/API/SBFile.h"
 #include "lldb/API/SBFileSpec.h"
 #include "lldb/API/SBListener.h"
 #include "lldb/API/SBModule.h"
@@ -260,6 +261,31 @@ SBProcess SBTarget::LoadCore(const char *core_file, 
lldb::SBError &error) {
   return sb_process;
 }
 
+SBProcess SBTarget::LoadCore(const SBFile &file, lldb::SBError &error) {
+  LLDB_INSTRUMENT_VA(this, file, error);
+
+  SBProcess sb_process;
+  TargetSP target_sp(GetSP());
+  if (target_sp) {
+FileSP file_sp = file.GetFile();
+FileSpec filespec;
+file_sp->GetFileSpec(filespec);
+FileSystem::Instance().Resolve(filespec);
+ProcessSP process_sp(target_sp->CreateProcess(
+target_sp->GetDebugger().GetListener(), "", &filespec, false));
+if (process_sp) {
+  error.SetError(process_sp->LoadCore());
+  if (error.Success())
+sb_process.SetSP(process_sp);
+} else {
+  error.SetErrorString("Failed to create the process");
+}
+  } else {
+error.SetErrorString("SBTarget is invalid");
+  }
+  return sb_process;
+}
+
 SBProcess SBTarget::LaunchSimple(char const **argv, char const **envp,
  const char *working_directory) {
   LLDB_INSTRUMENT_VA(this, argv, envp, working_directory);

diff  --git 
a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py 
b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
index 58f104eb49de245..a6a8518f9397da3 100644
--- a/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
+++ b/lldb/test/API/functionalities/postmortem/elf-core/TestLinuxCore.py
@@ -53,6 +53,11 @@ def test_x86_64(self):
 """Test that lldb can read the process information from an x86_64 
linux core file."""
 self.do_test("linux-x86_64", self._x86_64_pid, self._x86_64_regions, 
"a.out")
 
+@skipIfLLVMTargetMissing("X86")
+def test_x86_64_fd(self):
+"""Test that lldb can read the process information from an x86_64 
linux core file."""
+self.do_test_fd("linux-x86_64", self._x86_64_pid, 
self._x86_64_regions, "a.out")
+
 @skipIfLLVMTargetMissing("SystemZ")
 def test_s390x(self):
 """Test that lldb can read the process information from an s390x linux 
core file."""
@@ -757,6 +762,19 @@ def do_test(self, filename, pid, region_count, 
thread_name):
 
 self.dbg.DeleteTarget(target)
 
+def do_test_fd(self, filename, pid, region_count, thread_name):
+file_object = open(filename + ".core", "r")
+fd = file_object.fileno()
+file = lldb.SBFile(fd, "r", True)
+target = self.dbg.CreateTarget(filename + ".out")
+error = lldb.SBError()
+process = target.LoadCore(file, error)
+
+self.check_all(process, pid, region_count, thread_name)
+
+self.dbg.DeleteTarget(target)
+
+
 
 def replace_path(binary, replace_from, replace_to):
 src = replace_from.encode()



__

[Lldb-commits] [lldb] Add new API in SBTarget for loading core from SBFile (PR #71769)

2023-11-17 Thread via lldb-commits

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


[Lldb-commits] [lldb] 94ce378 - [lldb] Remove unused Status::SetMachError (NFC) (#72668)

2023-11-17 Thread via lldb-commits

Author: Jonas Devlieghere
Date: 2023-11-17T10:17:48-08:00
New Revision: 94ce378ec051a120d640073b885fcd90f1cf10f8

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

LOG: [lldb] Remove unused Status::SetMachError (NFC) (#72668)

This function is never used, neither here nor downstream in the Swift
fork. As far as I can tell, the same is true for the corresponding
eErrorTypeMachKernel but as that's part of the SB API we cannot remove
that.

Added: 


Modified: 
lldb/include/lldb/Utility/Status.h
lldb/source/Utility/Status.cpp

Removed: 




diff  --git a/lldb/include/lldb/Utility/Status.h 
b/lldb/include/lldb/Utility/Status.h
index ac410552438e0c6..fa5768141fa45df 100644
--- a/lldb/include/lldb/Utility/Status.h
+++ b/lldb/include/lldb/Utility/Status.h
@@ -114,15 +114,6 @@ class Status {
   /// The error type enumeration value.
   lldb::ErrorType GetType() const;
 
-  /// Set accessor from a kern_return_t.
-  ///
-  /// Set accessor for the error value to \a err and the error type to \c
-  /// MachKernel.
-  ///
-  /// \param[in] err
-  /// A mach error code.
-  void SetMachError(uint32_t err);
-
   void SetExpressionError(lldb::ExpressionResults, const char *mssg);
 
   int SetExpressionErrorWithFormat(lldb::ExpressionResults, const char *format,

diff  --git a/lldb/source/Utility/Status.cpp b/lldb/source/Utility/Status.cpp
index 4498961d83e7712..3bd00bb20da258c 100644
--- a/lldb/source/Utility/Status.cpp
+++ b/lldb/source/Utility/Status.cpp
@@ -180,14 +180,6 @@ ErrorType Status::GetType() const { return m_type; }
 // otherwise non-success result.
 bool Status::Fail() const { return m_code != 0; }
 
-// Set accessor for the error value to "err" and the type to
-// "eErrorTypeMachKernel"
-void Status::SetMachError(uint32_t err) {
-  m_code = err;
-  m_type = eErrorTypeMachKernel;
-  m_string.clear();
-}
-
 void Status::SetExpressionError(lldb::ExpressionResults result,
 const char *mssg) {
   m_code = result;



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


[Lldb-commits] [lldb] [lldb] Remove unused Status::SetMachError (NFC) (PR #72668)

2023-11-17 Thread Jonas Devlieghere via lldb-commits

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


[Lldb-commits] [lldb] Add new API in SBTarget for loading core from SBFile (PR #71769)

2023-11-17 Thread Jonas Devlieghere via lldb-commits


@@ -260,6 +261,31 @@ SBProcess SBTarget::LoadCore(const char *core_file, 
lldb::SBError &error) {
   return sb_process;
 }
 
+SBProcess SBTarget::LoadCore(const SBFile &file, lldb::SBError &error) {
+  LLDB_INSTRUMENT_VA(this, file, error);
+
+  SBProcess sb_process;
+  TargetSP target_sp(GetSP());
+  if (target_sp) {
+FileSP file_sp = file.GetFile();
+FileSpec filespec;
+file_sp->GetFileSpec(filespec);
+FileSystem::Instance().Resolve(filespec);
+ProcessSP process_sp(target_sp->CreateProcess(
+target_sp->GetDebugger().GetListener(), "", &filespec, false));
+if (process_sp) {
+  error.SetError(process_sp->LoadCore());
+  if (error.Success())
+sb_process.SetSP(process_sp);
+} else {
+  error.SetErrorString("Failed to create the process");
+}
+  } else {
+error.SetErrorString("SBTarget is invalid");
+  }
+  return sb_process;
+}

JDevlieghere wrote:

This could be a lot simpler and easier to read with early returns, with the 
added advantage that the error message is closer to the condition it 
corresponds to. The function below is a good example of that.

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


[Lldb-commits] [lldb] Add new API in SBTarget for loading core from SBFile (PR #71769)

2023-11-17 Thread Greg Clayton via lldb-commits

clayborg wrote:

I am not sure how this actually works? We pass in a SBFile and then get the 
FileSpec from it and then somehow that allows us to open a file that doesn't 
actually exist on disk? Or does this work _because_ the `fd` we had is actually 
backed by some file on disk? In that case we didn't even need this new API as 
we could have extracted the file path from the descriptor and just passed that 
into LLDB.

The story is that linux allows a tool to get run when a core file is created 
and it gets a integer file descriptor for the core file that is used to access 
the core file. Prior to this fix we would write the file to disk and then load 
it into the debugger. Now we want to use the "fd" to load the core file, so our 
SBFile must be able to extract the actual backing file and then we will need to 
re-open this file in lldb???

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


[Lldb-commits] [llvm] [lldb] [clang] [OpenACC] Implement initial parsing for `parallel` construct (PR #72661)

2023-11-17 Thread Erich Keane via lldb-commits

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


[Lldb-commits] [lldb] Send an explicit interrupt to cancel an attach waitfor. (PR #72565)

2023-11-17 Thread Greg Clayton via lldb-commits

https://github.com/clayborg commented:

Looks good to me from a code perspective as long as this works.

It would be nice to add a test for Darwin only. Luckily this is easy to test to 
ensure it works.

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


[Lldb-commits] [lldb] Send an explicit interrupt to cancel an attach waitfor. (PR #72565)

2023-11-17 Thread Greg Clayton via lldb-commits

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


[Lldb-commits] [lldb] Send an explicit interrupt to cancel an attach waitfor. (PR #72565)

2023-11-17 Thread Greg Clayton via lldb-commits


@@ -799,7 +799,33 @@ DNBProcessAttachWait(RNBContext *ctx, const char 
*waitfor_process_name,
 break;
   }
 
-  ::usleep(waitfor_interval); // Sleep for WAITFOR_INTERVAL, then poll 
again
+  // Now we're going to wait a while before polling again.  But we also
+  // need to check whether we've gotten an event from the debugger  
+  // telling us to interrupt the wait.  So we'll use the wait for a 
possible
+  // next event to also be our short pause...
+  struct timespec short_timeout;
+  DNBTimer::OffsetTimeOfDay(&short_timeout, 0, waitfor_interval);
+  uint32_t event_mask = RNBContext::event_read_packet_available 
+  | RNBContext::event_read_thread_exiting;
+  nub_event_t set_events = ctx->Events().WaitForSetEvents(event_mask, 
+  &short_timeout);
+  if (set_events & RNBContext::event_read_packet_available) {
+// If we get any packet from the debugger while waiting on the async,
+// it has to be telling us to interrupt.  So always exit here.
+// Over here in DNB land we can see that there was a packet, but all
+// the methods to actually handle it are protected.  It's not worth
+// rearranging all that just to get which packet we were sent...
+DNBLogError("Interrupted by packet while waiting for '%s' to 
appear.\n",

clayborg wrote:

I agree that we are attaching and the only thing we can send a ^C, so no need 
for anything else here really.

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


[Lldb-commits] [libc] [clang-tools-extra] [mlir] [lldb] [libcxx] [llvm] [compiler-rt] [flang] [clang] [lld] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Fabian Mora via lldb-commits

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


[Lldb-commits] [flang] [mlir] [clang-tools-extra] [lld] [compiler-rt] [lldb] [llvm] [libc] [libcxx] [clang] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Fabian Mora via lldb-commits

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


[Lldb-commits] [lld] [llvm] [lldb] [clang-tools-extra] [libcxx] [libunwind] [mlir] [libc] [clang] [compiler-rt] [flang] [IRPGO][ValueProfile] Instrument virtual table address that could be used to do

2023-11-17 Thread Mingming Liu via lldb-commits


@@ -453,11 +471,94 @@ Error InstrProfSymtab::create(Module &M, bool InLTO) {
 if (Error E = addFuncWithName(F, getPGOFuncName(F, InLTO)))
   return E;
   }
+
+  SmallVector Types;
+  for (GlobalVariable &G : M.globals()) {
+if (!G.hasName())
+  continue;
+Types.clear();
+G.getMetadata(LLVMContext::MD_type, Types);
+if (!Types.empty()) {
+  MD5VTableMap.emplace_back(G.getGUID(), &G);
+}
+  }
   Sorted = false;
   finalizeSymtab();
   return Error::success();
 }
 
+/// \c NameStrings is a string composed of one of more possibly encoded
+/// sub-strings. The substrings are separated by 0 or more zero bytes. This
+/// method decodes the string and calls `NameCallback` for each substring.
+static Error
+readAndDecodeStrings(StringRef NameStrings,

minglotus-6 wrote:

Since InstrProfTest.cpp changes a lot, created a [nfc 
patch](https://github.com/llvm/llvm-project/pull/72611/files) to prepare for 
test coverage of a new type of value profiles.

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


[Lldb-commits] [compiler-rt] [mlir] [clang-tools-extra] [flang] [clang] [libc] [llvm] [libcxx] [lldb] [lld] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Sang Ik Lee via lldb-commits


@@ -0,0 +1,31 @@
+//===- SPIRVToLLVMIRTranslation.cpp - Translate SPIRV to LLVM IR 
--===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+//
+// This file implements a translation between the MLIR SPIRV dialect and
+// LLVM IR.
+//
+//===--===//
+
+#include "mlir/Target/LLVMIR/Dialect/SPIRV/SPIRVToLLVMIRTranslation.h"
+#include "mlir/Dialect/SPIRV/IR/SPIRVDialect.h"
+#include "mlir/IR/BuiltinAttributes.h"
+#include "mlir/IR/Operation.h"
+#include "mlir/Target/LLVMIR/ModuleTranslation.h"
+
+using namespace mlir;
+using namespace mlir::LLVM;
+
+void mlir::registerSPIRVDialectTranslation(DialectRegistry ®istry) {
+  registry.insert();

silee2 wrote:

There is no translation but dialect registration is still required as 
spirv.target_env is attached and appears in input.
Other option is to register SPIR-V dialect directly here: 
mlir/include/mlir/Target/LLVMIR/Dialect/All.h
@joker-eph Any thoughts? Or better option?





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


[Lldb-commits] [clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-17 Thread Paul Kirth via lldb-commits

ilovepi wrote:

Hi, we're seeing some breakages, similar to the above in our debugger tests 
with this patch.

A failing bot can be found here: 
https://luci-milo.appspot.com/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.x64-debug/b8764552260903625809/overview

You can find a fuller discussion in our bugtracker: 
https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=136182.

The problem in our test is that the `DW_AT_const_value`, no longer seems to be 
in the expected place, similar to @dyung's issue above. Is there an ETA on when 
your fix will land? If it won't be soon, would you mind reverting until you can 
address this issue?

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


[Lldb-commits] [clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-17 Thread Michael Buch via lldb-commits

Michael137 wrote:

> Hi, we're seeing some breakages, similar to the above in our debugger tests 
> with this patch.
> 
> A failing bot can be found here: 
> https://luci-milo.appspot.com/ui/p/fuchsia/builders/ci/clang_toolchain.ci.core.x64-debug/b8764552260903625809/overview
> 
> You can find a fuller discussion in our bugtracker: 
> https://bugs.fuchsia.dev/p/fuchsia/issues/detail?id=136182.
> 
> The problem in our test is that the `DW_AT_const_value`, no longer seems to 
> be in the expected place, similar to @dyung's issue above. Is there an ETA on 
> when your fix will land? If it won't be soon, would you mind reverting until 
> you can address this issue?

Sorry for not updating the thread. I'm about to open a PR for said change

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


[Lldb-commits] [clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-17 Thread Paul Kirth via lldb-commits

ilovepi wrote:

Fantastic!

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


[Lldb-commits] [clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-17 Thread Michael Buch via lldb-commits

Michael137 wrote:

> Fantastic!

@ilovepi To clarify the upcoming change, we are planning to attach the 
`DW_AT_const_value` to the definition, not the declaration like we used to. In 
case that's what your unit-test is expecting

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


[Lldb-commits] [clang] [lldb] Reland "[clang][DebugInfo] Emit global variable definitions for static data members with constant initializers" (PR #71780)

2023-11-17 Thread Paul Kirth via lldb-commits

ilovepi wrote:

I'm unclear on the specifics of the check, but it's probably something we can 
adjust if that is the long-term solution.

CC @petrhosek Since he was interested in getting this resolved soon.

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


[Lldb-commits] [clang] [lldb] [llvm] [BOLT][DWARF] Fix handling of DWARF5 DWP (PR #72729)

2023-11-17 Thread Alexander Yermolovich via lldb-commits

https://github.com/ayermolo created 
https://github.com/llvm/llvm-project/pull/72729

Fixed handling of DWP as input. Before BOLT crashed. Now it will write out
correct CU, and all the TUs. Potential future improvement is to scan all the TUs
used in this CU, and only include those.

>From 80adaca72cf869f8735d7a3684a8d64bc438e5b6 Mon Sep 17 00:00:00 2001
From: Amir Ayupov 
Date: Tue, 1 Jun 2021 11:37:41 -0700
Subject: [PATCH 1/3] Rebase: [Facebook] Add clang driver options to test debug
 info and BOLT

Summary:
This is an essential piece of infrastructure for us to be
continuously testing debug info with BOLT. We can't only make changes
to a test repo because we need to change debuginfo tests to call BOLT,
hence, this diff needs to sit in our opensource repo. But when upstreaming
to LLVM, this should be kept BOLT-only outside of LLVM. When upstreaming,
we need to git diff and check all folders that are being modified by our
commits and discard this one (and leave as an internal diff).

To test BOLT in debuginfo tests, configure it with -DLLVM_TEST_BOLT=ON.
Then run check-lldb and check-debuginfo.

Manual rebase conflict history:
https://phabricator.intern.facebook.com/D29205224
https://phabricator.intern.facebook.com/D29564078
https://phabricator.intern.facebook.com/D33289118
https://phabricator.intern.facebook.com/D34957174
https://phabricator.intern.facebook.com/D35317341

Test Plan:
tested locally
Configured with:
-DLLVM_ENABLE_PROJECTS="clang;lld;lldb;compiler-rt;bolt;debuginfo-tests"
-DLLVM_TEST_BOLT=ON
Ran test suite with:
ninja check-debuginfo
ninja check-lldb

Reviewers: maks, #llvm-bolt

Reviewed By: maks

Subscribers: ayermolo, phabricatorlinter

Differential Revision: https://phabricator.intern.facebook.com/D46256657

Tasks: T92898286
---
 clang/include/clang/Driver/Options.td  |  4 
 clang/lib/Driver/ToolChains/Gnu.cpp| 29 ++
 cross-project-tests/lit.cfg.py | 14 -
 cross-project-tests/lit.site.cfg.py.in |  4 
 lldb/test/API/lit.cfg.py   |  5 +
 lldb/test/API/lit.site.cfg.py.in   |  8 +++
 lldb/test/Shell/helper/toolchain.py|  5 +
 lldb/test/Shell/lit.site.cfg.py.in |  9 
 llvm/CMakeLists.txt|  4 
 9 files changed, 81 insertions(+), 1 deletion(-)

diff --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index 811550416110b3d..31ad86bc098ec63 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -5178,6 +5178,10 @@ def pg : Flag<["-"], "pg">, HelpText<"Enable mcount 
instrumentation">,
   MarshallingInfoFlag>;
 def pipe : Flag<["-", "--"], "pipe">,
   HelpText<"Use pipes between commands, when possible">;
+// Facebook T92898286
+def post_link_optimize : Flag<["--"], "post-link-optimize">,
+  HelpText<"Apply post-link optimizations using BOLT">;
+// End Facebook T92898286
 def prebind__all__twolevel__modules : Flag<["-"], 
"prebind_all_twolevel_modules">;
 def prebind : Flag<["-"], "prebind">;
 def preload : Flag<["-"], "preload">;
diff --git a/clang/lib/Driver/ToolChains/Gnu.cpp 
b/clang/lib/Driver/ToolChains/Gnu.cpp
index ba95ce9c5a28153..bf55d90f6dc704b 100644
--- a/clang/lib/Driver/ToolChains/Gnu.cpp
+++ b/clang/lib/Driver/ToolChains/Gnu.cpp
@@ -666,12 +666,41 @@ void tools::gnutools::Linker::ConstructJob(Compilation 
&C, const JobAction &JA,
 }
   }
 
+  // Facebook T92898286
+  if (Args.hasArg(options::OPT_post_link_optimize))
+CmdArgs.push_back("-q");
+  // End Facebook T92898286
+
   Args.AddAllArgs(CmdArgs, options::OPT_T);
 
   const char *Exec = Args.MakeArgString(ToolChain.GetLinkerPath());
   C.addCommand(std::make_unique(JA, *this,
  ResponseFileSupport::AtFileCurCP(),
  Exec, CmdArgs, Inputs, Output));
+  // Facebook T92898286
+  if (!Args.hasArg(options::OPT_post_link_optimize) || !Output.isFilename())
+return;
+
+  const char *MvExec = Args.MakeArgString(ToolChain.GetProgramPath("mv"));
+  ArgStringList MoveCmdArgs;
+  MoveCmdArgs.push_back(Output.getFilename());
+  const char *PreBoltBin =
+  Args.MakeArgString(Twine(Output.getFilename()) + ".pre-bolt");
+  MoveCmdArgs.push_back(PreBoltBin);
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ MvExec, MoveCmdArgs, std::nullopt));
+
+  ArgStringList BoltCmdArgs;
+  const char *BoltExec =
+  Args.MakeArgString(ToolChain.GetProgramPath("llvm-bolt"));
+  BoltCmdArgs.push_back(PreBoltBin);
+  BoltCmdArgs.push_back("-reorder-blocks=reverse");
+  BoltCmdArgs.push_back("-update-debug-sections");
+  BoltCmdArgs.push_back("-o");
+  BoltCmdArgs.push_back(Output.getFilename());
+  C.addCommand(std::make_unique(JA, *this, 
ResponseFileSupport::None(),
+ BoltExec, BoltCmdArgs, std::nullopt));
+  // End Facebook T92898286
 }
 
 void tools::gnutoo

[Lldb-commits] [llvm] [clang] [lldb] [BOLT][DWARF] Fix handling of DWARF5 DWP (PR #72729)

2023-11-17 Thread via lldb-commits

llvmbot wrote:



@llvm/pr-subscribers-clang-driver

@llvm/pr-subscribers-clang

Author: Alexander Yermolovich (ayermolo)


Changes

Fixed handling of DWP as input. Before BOLT crashed. Now it will write out
correct CU, and all the TUs. Potential future improvement is to scan all the TUs
used in this CU, and only include those.

---

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


25 Files Affected:

- (modified) bolt/include/bolt/Core/DIEBuilder.h (+2-1) 
- (modified) bolt/lib/Core/BinaryEmitter.cpp (+1) 
- (modified) bolt/lib/Core/DIEBuilder.cpp (+9-8) 
- (modified) bolt/lib/Rewrite/DWARFRewriter.cpp (+6-8) 
- (added) bolt/test/X86/Inputs/dwarf5-df-types-dup-helper.s (+504) 
- (added) bolt/test/X86/Inputs/dwarf5-df-types-dup-main.s (+498) 
- (added) bolt/test/X86/dwarf5-df-types-dup-dwp-input.test (+29) 
- (modified) clang/include/clang/Driver/Options.td (+4) 
- (modified) clang/lib/Driver/ToolChains/Gnu.cpp (+29) 
- (modified) cross-project-tests/lit.cfg.py (+13-1) 
- (modified) cross-project-tests/lit.site.cfg.py.in (+4) 
- (modified) lldb/test/API/lit.cfg.py (+5) 
- (modified) lldb/test/API/lit.site.cfg.py.in (+8) 
- (modified) lldb/test/Shell/helper/toolchain.py (+5) 
- (modified) lldb/test/Shell/lit.site.cfg.py.in (+9) 
- (modified) llvm/CMakeLists.txt (+4) 
- (modified) llvm/include/llvm/MC/MCFragment.h (+22) 
- (modified) llvm/include/llvm/MC/MCObjectStreamer.h (+2) 
- (modified) llvm/include/llvm/MC/MCStreamer.h (+6) 
- (modified) llvm/lib/MC/MCAssembler.cpp (+81-37) 
- (modified) llvm/lib/MC/MCFragment.cpp (+12) 
- (modified) llvm/lib/MC/MCObjectStreamer.cpp (+5) 
- (modified) llvm/lib/MC/MCStreamer.cpp (+2) 
- (modified) llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp (+24) 
- (added) llvm/test/MC/X86/directive-avoid_end_align.s (+208) 


``diff
diff --git a/bolt/include/bolt/Core/DIEBuilder.h 
b/bolt/include/bolt/Core/DIEBuilder.h
index fb86e59468b835a..1c5252142d4ebf5 100644
--- a/bolt/include/bolt/Core/DIEBuilder.h
+++ b/bolt/include/bolt/Core/DIEBuilder.h
@@ -273,7 +273,8 @@ class DIEBuilder {
   void buildCompileUnits(const std::vector &CUs);
   /// Preventing implicit conversions.
   template  void buildCompileUnits(T) = delete;
-  void buildBoth();
+  /// Builds DWO Unit. For DWARF5 this includes the type units.
+  void buildDWOUnit(DWARFUnit &U);
 
   /// Returns DWARFUnitInfo for DWARFUnit
   DWARFUnitInfo &getUnitInfoByDwarfUnit(const DWARFUnit &DwarfUnit) {
diff --git a/bolt/lib/Core/BinaryEmitter.cpp b/bolt/lib/Core/BinaryEmitter.cpp
index fb1bf530c1974aa..82fbd8c0f67b215 100644
--- a/bolt/lib/Core/BinaryEmitter.cpp
+++ b/bolt/lib/Core/BinaryEmitter.cpp
@@ -482,6 +482,7 @@ void BinaryEmitter::emitFunctionBody(BinaryFunction &BF, 
FunctionFragment &FF,
 // This assumes the second instruction in the macro-op pair will get
 // assigned to its own MCRelaxableFragment. Since all JCC instructions
 // are relaxable, we should be safe.
+Streamer.emitNeverAlignCodeAtEnd(/*Alignment to avoid=*/64, *BC.STI);
   }
 
   if (!EmitCodeOnly) {
diff --git a/bolt/lib/Core/DIEBuilder.cpp b/bolt/lib/Core/DIEBuilder.cpp
index 223ae714440d97d..6b33303ba553b72 100644
--- a/bolt/lib/Core/DIEBuilder.cpp
+++ b/bolt/lib/Core/DIEBuilder.cpp
@@ -193,12 +193,6 @@ void DIEBuilder::buildTypeUnits(const bool Init) {
   if (Init)
 BuilderState.reset(new State());
 
-  unsigned int CUNum = getCUNum(DwarfContext, IsDWO);
-  getState().CloneUnitCtxMap.resize(CUNum);
-  DWARFContext::unit_iterator_range CU4TURanges =
-  IsDWO ? DwarfContext->dwo_types_section_units()
-: DwarfContext->types_section_units();
-
   const DWARFUnitIndex &TUIndex = DwarfContext->getTUIndex();
   if (!TUIndex.getRows().empty()) {
 for (auto &Row : TUIndex.getRows()) {
@@ -208,6 +202,11 @@ void DIEBuilder::buildTypeUnits(const bool Init) {
true);
 }
   }
+  unsigned int CUNum = getCUNum(DwarfContext, IsDWO);
+  getState().CloneUnitCtxMap.resize(CUNum);
+  DWARFContext::unit_iterator_range CU4TURanges =
+  IsDWO ? DwarfContext->dwo_types_section_units()
+: DwarfContext->types_section_units();
 
   getState().Type = ProcessingType::DWARF4TUs;
   for (std::unique_ptr &DU : CU4TURanges)
@@ -278,11 +277,13 @@ void DIEBuilder::buildCompileUnits(const 
std::vector &CUs) {
 constructFromUnit(*DU);
 }
 
-void DIEBuilder::buildBoth() {
+void DIEBuilder::buildDWOUnit(DWARFUnit &U) {
   BuilderState.release();
   BuilderState = std::make_unique();
   buildTypeUnits(false);
-  buildCompileUnits(false);
+  getState().Type = ProcessingType::CUs;
+  registerUnit(U, false);
+  constructFromUnit(U);
 }
 
 DIE *DIEBuilder::constructDIEFast(DWARFDie &DDie, DWARFUnit &U,
diff --git a/bolt/lib/Rewrite/DWARFRewriter.cpp 
b/bolt/lib/Rewrite/DWARFRewriter.cpp
index 360b82f45bd7754..3bba61724b9e542 100644
--- a/bolt/lib/Rewrite/DWARFRewriter.cpp
+++ b/bolt/lib/Rewri

[Lldb-commits] [libc] [clang-tools-extra] [mlir] [compiler-rt] [lld] [libcxx] [clang] [flang] [lldb] [llvm] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Mehdi Amini via lldb-commits


@@ -61,6 +63,7 @@ registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) 
{
   registerLLVMDialectTranslation(registry);
   registerNVVMDialectTranslation(registry);
   registerROCDLDialectTranslation(registry);
+  registerSPIRVDialectTranslation(registry);

joker-eph wrote:

Which muir-translate test requires that? I don't find it by skimming the patch.

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


[Lldb-commits] [libc] [clang-tools-extra] [mlir] [compiler-rt] [lld] [libcxx] [clang] [flang] [lldb] [llvm] [MLIR] Enable GPU Dialect to SYCL runtime integration (PR #71430)

2023-11-17 Thread Mehdi Amini via lldb-commits

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