[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-22 Thread Philip Pfaffe via Phabricator via lldb-commits
pfaffe updated this revision to Diff 477099.
pfaffe marked 2 inline comments as done.
pfaffe added a comment.

Override new functions in DWOs.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137247

Files:
  lldb/include/lldb/Expression/DWARFExpression.h
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Expression/DWARFExpressionList.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/unittests/Expression/DWARFExpressionTest.cpp

Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -9,9 +9,11 @@
 #include "lldb/Expression/DWARFExpression.h"
 #include "Plugins/Platform/Linux/PlatformLinux.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/dwarf.h"
 #include "lldb/Host/HostInfo.h"
@@ -514,3 +516,242 @@
   ASSERT_EQ(result.GetValueType(), Value::ValueType::LoadAddress);
   ASSERT_EQ(result.GetScalar().UInt(), 0x5678u);
 }
+
+class CustomSymbolFileDWARF : public SymbolFileDWARF {
+  static char ID;
+
+public:
+  using SymbolFileDWARF::SymbolFileDWARF;
+
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+
+  static llvm::StringRef GetPluginNameStatic() { return "custom_dwarf"; }
+
+  static llvm::StringRef GetPluginDescriptionStatic() {
+return "Symbol file reader with expression extensions.";
+  }
+
+  static void Initialize() {
+PluginManager::RegisterPlugin(GetPluginNameStatic(),
+  GetPluginDescriptionStatic(), CreateInstance,
+  SymbolFileDWARF::DebuggerInitialize);
+  }
+
+  static void Terminate() { PluginManager::UnregisterPlugin(CreateInstance); }
+
+  static lldb_private::SymbolFile *
+  CreateInstance(lldb::ObjectFileSP objfile_sp) {
+return new CustomSymbolFileDWARF(std::move(objfile_sp),
+ /*dwo_section_list*/ nullptr);
+  }
+
+  lldb::offset_t
+  GetVendorDWARFOpcodeSize(const lldb_private::DataExtractor &data,
+   const lldb::offset_t data_offset,
+   const uint8_t op) const final {
+auto offset = data_offset;
+if (op != DW_OP_WASM_location) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// DW_OP_WASM_location WASM_GLOBAL:0x03 index:u32
+// Called with "arguments" 0x03 and 0x04
+// Location type:
+if (data.GetU8(&offset) != /* global */ 0x03) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// Index
+if (data.GetU32(&offset) != 0x04) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// Report the skipped distance:
+return offset - data_offset;
+  }
+
+  bool
+  ParseVendorDWARFOpcode(uint8_t op, const lldb_private::DataExtractor &opcodes,
+ lldb::offset_t &offset,
+ std::vector &stack) const final {
+if (op != DW_OP_WASM_location) {
+  return false;
+}
+
+// DW_OP_WASM_location WASM_GLOBAL:0x03 index:u32
+// Called with "arguments" 0x03 and  0x04
+// Location type:
+if (opcodes.GetU8(&offset) != /* global */ 0x03) {
+  return false;
+}
+
+// Index:
+if (opcodes.GetU32(&offset) != 0x04) {
+  return false;
+}
+
+// Return some value:
+stack.push_back({GetScalar(32, 42, false)});
+return true;
+  }
+};
+
+char CustomSymbolFileDWARF::ID;
+
+static auto testExpressionVendorExtensions(lldb::ModuleSP module_sp,
+   DWARFUnit &dwarf_unit) {
+  // Test that expression extensions can be evaluated, for example
+  // DW_OP_WASM_location which is not currently handled by DWARFExpression:
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_WASM_location, 0x03, // WASM_GLOBAL:0x03
+ 0x04, 0x00, 0x00,  // index:u32
+ 0x00, DW_OP_stack_value},
+module_sp, &dwarf_unit),
+   llvm::HasValue(GetScalar(32, 42, false)));
+
+  // Test that searches for opcodes work in the presence of extensions:
+  uint8_t expr[] = {DW_OP_WASM_location,   0x03, 0x04, 0x00, 0x00, 0x00,
+DW_OP_form_tls_address};
+  DataExtractor extractor(expr, sizeof(expr), lldb::eByteOrderLittle,
+ 

[Lldb-commits] [PATCH] D138407: [LLDB] Add LoongArch register definitions and operations

2022-11-22 Thread Lu Weining via Phabricator via lldb-commits
SixWeining added inline comments.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:27
+// NT_PRSTATUS and NT_FPREGSET definition
+#include 
+

[[ https://llvm.org/docs/CodingStandards.html#include-style | Should be sorted 
lexicographically by the full path ]]. So put it before `sys/uio.h`. 



Comment at: 
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp:138
+size_t RegisterInfoPOSIX_loongarch64::GetRegisterSetCount() const {
+  return k_num_register_sets - 1;
+}

Why `-  1`?



Comment at: lldb/source/Plugins/Process/Utility/RegisterInfos_loongarch64.h:35
+  {
\
+loongarch_dwarf::dwarf_##reg, loongarch_dwarf::dwarf_##reg, generic_kind,  
\
+LLDB_INVALID_REGNUM, reg##_loongarch   
\

unnecessary indent?



Comment at: lldb/source/Plugins/Process/Utility/RegisterInfos_loongarch64.h:56
+
+#define DEFINE_FPR64(reg, generic_kind)
\
+  {
\

Not allow accessing FPR registers through ABI names?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138407

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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Use plugin.object-file.pe-coff.abi as minidump process abi when OS is Windows.

2022-11-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added a comment.
This revision is now accepted and ready to land.

Cool, great.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

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


[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-22 Thread Pavel Labath via Phabricator via lldb-commits
labath accepted this revision.
labath added inline comments.
This revision is now accepted and ready to land.



Comment at: lldb/source/Expression/DWARFExpression.cpp:41-44
+#include "llvm/Support/Casting.h"
 
 #include "Plugins/SymbolFile/DWARF/DWARFUnit.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h"

I think these are not needed anymore.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137247

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


[Lldb-commits] [PATCH] D138259: Add the ability to see when a type in incomplete.

2022-11-22 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

In D138259#3941859 , @clayborg wrote:

> In D138259#3941465 , @labath wrote:
>
>> In D138259#3941431 , @clayborg 
>> wrote:
>>
>>> "a type should be complete but isn't and you are losing information that 
>>> should have been available for you to debug".
>>
>> I agree, but there are still two (or more) ways to communicate that 
>> information.
>>
>> 1. "this type is complete" + "actually, I'm just missing the debug info and 
>> pretending it's complete"
>> 2. "this type is incomplete" + "it is incomplete because I am missing its 
>> debug info"
>>
>> My question is which method would be more useful to the user.
>
> Gotcha. We could change "bool SBType::IsTypeComplete()" to return false, and 
> then add a new:
>
>   bool SBType::ShouldBeComplete();
>
> That would return true if IsTypeComplete() returned false because it was 
> forcefully completed.

That is the expected behavior, but we wouldn't need to implement it that way. 
We could still implement it by calling the "is forcefully completed" metadata 
function, and so it wouldn't force the completion of the type. So a `true` 
return value would mean that the type has been forcefully completed, while a 
return value of `false` would mean that the type is complete (not just 
pretend-complete) **or** the completion of the type hasn't been attempted yet.

Note that I'm not saying that this is how it needs to be implemented. However, 
I think its worth thinking about this, given that we're adding a new public 
interface and all. I think it comes down to the question of which situation 
would be more/less confusing to the (SB) user

- querying a member/base class of an object and finding that it's incomplete 
(even though that is not possible in regular c++)
- querying a member/base class of an object and finding that it's empty (even 
though the truth is that we just don't know what it contains.)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138259

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


[Lldb-commits] [lldb] c08d3b0 - [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-22 Thread Philip Pfaffe via lldb-commits

Author: Philip Pfaffe
Date: 2022-11-22T14:38:07Z
New Revision: c08d3b08f6d71e974537de226c68d4c94c396a46

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

LOG: [lldb] Allow plugins to extend DWARF expression parsing for vendor 
extensions

Parsing DWARF expressions currently does not support DW_OPs that are vendor
extensions. With this change expression parsing calls into SymbolFileDWARF for
unknown opcodes, which is the semantically "closest" plugin that we have right
now. Plugins can then extend SymbolFileDWARF to add support for vendor
extensions.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D137247

Added: 


Modified: 
lldb/include/lldb/Expression/DWARFExpression.h
lldb/source/Expression/DWARFExpression.cpp
lldb/source/Expression/DWARFExpressionList.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
lldb/unittests/Expression/DWARFExpressionTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Expression/DWARFExpression.h 
b/lldb/include/lldb/Expression/DWARFExpression.h
index 49e51d51f211c..aea41926d848d 100644
--- a/lldb/include/lldb/Expression/DWARFExpression.h
+++ b/lldb/include/lldb/Expression/DWARFExpression.h
@@ -75,14 +75,15 @@ class DWARFExpression {
   lldb::addr_t GetLocation_DW_OP_addr(const DWARFUnit *dwarf_cu,
   uint32_t op_addr_idx, bool &error) const;
 
-  bool Update_DW_OP_addr(lldb::addr_t file_addr);
+  bool Update_DW_OP_addr(const DWARFUnit *dwarf_cu, lldb::addr_t file_addr);
 
   void UpdateValue(uint64_t const_value, lldb::offset_t const_value_byte_size,
uint8_t addr_byte_size);
 
-  bool ContainsThreadLocalStorage() const;
+  bool ContainsThreadLocalStorage(const DWARFUnit *dwarf_cu) const;
 
   bool LinkThreadLocalStorage(
+  const DWARFUnit *dwarf_cu,
   std::function const
   &link_address_callback);
 

diff  --git a/lldb/source/Expression/DWARFExpression.cpp 
b/lldb/source/Expression/DWARFExpression.cpp
index 3c36587f63115..9e7df2d3b82ef 100644
--- a/lldb/source/Expression/DWARFExpression.cpp
+++ b/lldb/source/Expression/DWARFExpression.cpp
@@ -131,7 +131,7 @@ static bool ReadRegisterValueAsScalar(RegisterContext 
*reg_ctx,
 /// are made on the state of \p data after this call.
 static offset_t GetOpcodeDataSize(const DataExtractor &data,
   const lldb::offset_t data_offset,
-  const uint8_t op) {
+  const uint8_t op, const DWARFUnit *dwarf_cu) 
{
   lldb::offset_t offset = data_offset;
   switch (op) {
   case DW_OP_addr:
@@ -333,9 +333,12 @@ static offset_t GetOpcodeDataSize(const DataExtractor 
&data,
   }
 
   default:
-break;
+if (!dwarf_cu) {
+  return LLDB_INVALID_OFFSET;
+}
+return dwarf_cu->GetSymbolFileDWARF().GetVendorDWARFOpcodeSize(
+data, data_offset, op);
   }
-  return LLDB_INVALID_OFFSET;
 }
 
 lldb::addr_t DWARFExpression::GetLocation_DW_OP_addr(const DWARFUnit *dwarf_cu,
@@ -364,7 +367,8 @@ lldb::addr_t DWARFExpression::GetLocation_DW_OP_addr(const 
DWARFUnit *dwarf_cu,
   }
   ++curr_op_addr_idx;
 } else {
-  const offset_t op_arg_size = GetOpcodeDataSize(m_data, offset, op);
+  const offset_t op_arg_size =
+  GetOpcodeDataSize(m_data, offset, op, dwarf_cu);
   if (op_arg_size == LLDB_INVALID_OFFSET) {
 error = true;
 break;
@@ -375,7 +379,8 @@ lldb::addr_t DWARFExpression::GetLocation_DW_OP_addr(const 
DWARFUnit *dwarf_cu,
   return LLDB_INVALID_ADDRESS;
 }
 
-bool DWARFExpression::Update_DW_OP_addr(lldb::addr_t file_addr) {
+bool DWARFExpression::Update_DW_OP_addr(const DWARFUnit *dwarf_cu,
+lldb::addr_t file_addr) {
   lldb::offset_t offset = 0;
   while (m_data.ValidOffset(offset)) {
 const uint8_t op = m_data.GetU8(&offset);
@@ -402,7 +407,8 @@ bool DWARFExpression::Update_DW_OP_addr(lldb::addr_t 
file_addr) {
   m_data.SetData(encoder.GetDataBuffer());
   return true;
 } else {
-  const offset_t op_arg_size = GetOpcodeDataSize(m_data, offset, op);
+  const offset_t op_arg_size =
+  GetOpcodeDataSize(m_data, offset, op, dwarf_cu);
   if (op_arg_size == LLDB_INVALID_OFFSET)
 break;
   offset += op_arg_size;
@@ -411,14 +417,16 @@ bool DWARFExpression::Update_DW_OP_addr(lldb::addr_t 
file_addr) {
   return false;
 }
 
-bool DWARFExpression::ContainsThreadLocalStorage() const {
+bool DWARFExpression::ContainsThreadLocalStorage(
+const DWARFUnit *dwarf_cu) const {

[Lldb-commits] [PATCH] D137247: [lldb] Allow plugins to extend DWARF expression parsing for vendor extensions

2022-11-22 Thread Philip Pfaffe via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc08d3b08f6d7: [lldb] Allow plugins to extend DWARF 
expression parsing for vendor extensions (authored by pfaffe).

Changed prior to commit:
  https://reviews.llvm.org/D137247?vs=477099&id=477175#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137247

Files:
  lldb/include/lldb/Expression/DWARFExpression.h
  lldb/source/Expression/DWARFExpression.cpp
  lldb/source/Expression/DWARFExpressionList.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp
  lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h
  lldb/unittests/Expression/DWARFExpressionTest.cpp

Index: lldb/unittests/Expression/DWARFExpressionTest.cpp
===
--- lldb/unittests/Expression/DWARFExpressionTest.cpp
+++ lldb/unittests/Expression/DWARFExpressionTest.cpp
@@ -9,9 +9,11 @@
 #include "lldb/Expression/DWARFExpression.h"
 #include "Plugins/Platform/Linux/PlatformLinux.h"
 #include "Plugins/SymbolFile/DWARF/DWARFDebugInfo.h"
+#include "Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h"
 #include "Plugins/TypeSystem/Clang/TypeSystemClang.h"
 #include "TestingSupport/Symbol/YAMLModuleTester.h"
 #include "lldb/Core/Debugger.h"
+#include "lldb/Core/PluginManager.h"
 #include "lldb/Core/Value.h"
 #include "lldb/Core/dwarf.h"
 #include "lldb/Host/HostInfo.h"
@@ -514,3 +516,242 @@
   ASSERT_EQ(result.GetValueType(), Value::ValueType::LoadAddress);
   ASSERT_EQ(result.GetScalar().UInt(), 0x5678u);
 }
+
+class CustomSymbolFileDWARF : public SymbolFileDWARF {
+  static char ID;
+
+public:
+  using SymbolFileDWARF::SymbolFileDWARF;
+
+  bool isA(const void *ClassID) const override {
+return ClassID == &ID || SymbolFile::isA(ClassID);
+  }
+  static bool classof(const SymbolFile *obj) { return obj->isA(&ID); }
+
+  static llvm::StringRef GetPluginNameStatic() { return "custom_dwarf"; }
+
+  static llvm::StringRef GetPluginDescriptionStatic() {
+return "Symbol file reader with expression extensions.";
+  }
+
+  static void Initialize() {
+PluginManager::RegisterPlugin(GetPluginNameStatic(),
+  GetPluginDescriptionStatic(), CreateInstance,
+  SymbolFileDWARF::DebuggerInitialize);
+  }
+
+  static void Terminate() { PluginManager::UnregisterPlugin(CreateInstance); }
+
+  static lldb_private::SymbolFile *
+  CreateInstance(lldb::ObjectFileSP objfile_sp) {
+return new CustomSymbolFileDWARF(std::move(objfile_sp),
+ /*dwo_section_list*/ nullptr);
+  }
+
+  lldb::offset_t
+  GetVendorDWARFOpcodeSize(const lldb_private::DataExtractor &data,
+   const lldb::offset_t data_offset,
+   const uint8_t op) const final {
+auto offset = data_offset;
+if (op != DW_OP_WASM_location) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// DW_OP_WASM_location WASM_GLOBAL:0x03 index:u32
+// Called with "arguments" 0x03 and 0x04
+// Location type:
+if (data.GetU8(&offset) != /* global */ 0x03) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// Index
+if (data.GetU32(&offset) != 0x04) {
+  return LLDB_INVALID_OFFSET;
+}
+
+// Report the skipped distance:
+return offset - data_offset;
+  }
+
+  bool
+  ParseVendorDWARFOpcode(uint8_t op, const lldb_private::DataExtractor &opcodes,
+ lldb::offset_t &offset,
+ std::vector &stack) const final {
+if (op != DW_OP_WASM_location) {
+  return false;
+}
+
+// DW_OP_WASM_location WASM_GLOBAL:0x03 index:u32
+// Called with "arguments" 0x03 and  0x04
+// Location type:
+if (opcodes.GetU8(&offset) != /* global */ 0x03) {
+  return false;
+}
+
+// Index:
+if (opcodes.GetU32(&offset) != 0x04) {
+  return false;
+}
+
+// Return some value:
+stack.push_back({GetScalar(32, 42, false)});
+return true;
+  }
+};
+
+char CustomSymbolFileDWARF::ID;
+
+static auto testExpressionVendorExtensions(lldb::ModuleSP module_sp,
+   DWARFUnit &dwarf_unit) {
+  // Test that expression extensions can be evaluated, for example
+  // DW_OP_WASM_location which is not currently handled by DWARFExpression:
+  EXPECT_THAT_EXPECTED(Evaluate({DW_OP_WASM_location, 0x03, // WASM_GLOBAL:0x03
+ 0x04, 0x00, 0x00,  // index:u32
+ 0x00, DW_OP_stack_value},
+module_sp, &dwarf_unit),
+   llvm::HasValue(GetScalar(32, 42, false)));
+
+  // Test that searches for opcodes work in the presence of extensions:
+  uint8_t expr[] = {DW_OP_WASM_location,   

[Lldb-commits] [lldb] 8effceb - [lldb] rm include/lldb/Host/posix/Fcntl.h

2022-11-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-11-22T16:13:29+01:00
New Revision: 8effceb570d924675cd4b15e6ca25311598797d1

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

LOG: [lldb] rm include/lldb/Host/posix/Fcntl.h

File is unused.

Added: 


Modified: 


Removed: 
lldb/include/lldb/Host/posix/Fcntl.h



diff  --git a/lldb/include/lldb/Host/posix/Fcntl.h 
b/lldb/include/lldb/Host/posix/Fcntl.h
deleted file mode 100644
index 31cc293dd37a6..0
--- a/lldb/include/lldb/Host/posix/Fcntl.h
+++ /dev/null
@@ -1,24 +0,0 @@
-//===-- Fcntl.h -*- C++ 
-*-===//
-//
-// Part of the LLVM Project, under the Apache License v2.0 with LLVM 
Exceptions.
-// See https://llvm.org/LICENSE.txt for license information.
-// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
-//
-//===--===//
-
-// This file defines fcntl functions & structures
-
-#ifndef liblldb_Host_posix_Fcntl_h_
-#define liblldb_Host_posix_Fcntl_h_
-
-#ifdef __ANDROID__
-#include 
-#endif
-
-#include 
-
-#if defined(__ANDROID_API__) && __ANDROID_API__ < 21
-#define F_DUPFD_CLOEXEC (F_LINUX_SPECIFIC_BASE + 6)
-#endif
-
-#endif // liblldb_Host_posix_Fcntl_h_



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


[Lldb-commits] [lldb] 60d690b - Add include guards for PlatformQemuUser.h

2022-11-22 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-11-22T16:13:29+01:00
New Revision: 60d690b3a956a727ecf2c3dc1d00a74d667a0f5f

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

LOG: Add include guards for PlatformQemuUser.h

Added: 


Modified: 
lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h

Removed: 




diff  --git a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h 
b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
index a29b5bcdedc74..596cf75b591f2 100644
--- a/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
+++ b/lldb/source/Plugins/Platform/QemuUser/PlatformQemuUser.h
@@ -6,6 +6,9 @@
 //
 
//===--===//
 
+#ifndef LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H
+#define LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H
+
 #include "lldb/Host/Host.h"
 #include "lldb/Host/HostInfo.h"
 #include "lldb/Target/Platform.h"
@@ -74,3 +77,5 @@ class PlatformQemuUser : public Platform {
 };
 
 } // namespace lldb_private
+
+#endif // LLDB_SOURCE_PLUGINS_PLATFORM_QEMUUSER_PLATFORMQEMUUSER_H



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


[Lldb-commits] [PATCH] D138407: [LLDB] Add LoongArch register definitions and operations

2022-11-22 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett added inline comments.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:194
+
+  uint8_t *dst = const_cast(data_sp->GetBytes());
+  ::memcpy(dst, GetGPRBuffer(), GetGPRSize());

I'm not sure const cast is needed.



Comment at: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_loongarch64.cpp:221
+
+  uint8_t *src = const_cast(data_sp->GetBytes());
+  if (src == nullptr) {

Possibly not needed const cast.



Comment at: 
lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_loongarch64.h:32
+
+  virtual size_t GetGPRSize();
+

Some of these can be override I'm pretty sure.

If you don't want to check manually I think there is some "possible override" 
warning in gcc at least.

(and they don't need to be virtual, unless there's some derived class of this 
that I've missed)



Comment at: 
lldb/source/Plugins/Process/Utility/RegisterContextPOSIX_loongarch64.h:60
+  virtual bool WriteGPR() = 0;
+  virtual bool WriteFPR() = 0;
+};

This doesn't look right, I'd expect `bool ... () override;` here.



Comment at: 
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_loongarch64.cpp:138
+size_t RegisterInfoPOSIX_loongarch64::GetRegisterSetCount() const {
+  return k_num_register_sets - 1;
+}

SixWeining wrote:
> Why `-  1`?
I had the same thought. From the few others I looked at, it seems that it's 
count not the last index. So if you've got N sets it should return N.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138407

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


[Lldb-commits] [lldb] 531ed6d - [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2022-11-22T10:19:58-08:00
New Revision: 531ed6d5aa65f41c6dfe2e74905d5c6c88fc95a7

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

LOG: [LTO][COFF] Use bitcode file names in lto native object file names.

Currently the lto native object files have names like main.exe.lto.1.obj. In
PDB, those names are used as names for each compiland. Microsoft’s tool
SizeBench uses those names to present to users the size of each object files.
So, names like main.exe.lto.1.obj is not user friendly.

This patch makes the lto native object file names more readable by using
the bitcode file names as part of the file names. For example, if the input
bitcode file has path like "path/to/foo.obj", its corresponding lto native
object file path would be "path/to/main.exe.lto.foo.obj". Since the lto native
object file name only bothers PDB, this patch only changes the lld-linker's
behavior.

Reviewed By: tejohnson, MaskRay, #lld-macho

Differential Revision: https://reviews.llvm.org/D137217

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
lld/COFF/LTO.cpp
lld/COFF/LTO.h
lld/ELF/LTO.cpp
lld/MachO/LTO.cpp
lld/test/COFF/lto-obj-path.ll
lld/test/COFF/pdb-thinlto.ll
lld/test/COFF/thinlto.ll
lld/wasm/LTO.cpp
lldb/source/Core/DataFileCache.cpp
llvm/include/llvm/Support/Caching.h
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/Support/Caching.cpp
llvm/tools/llvm-lto/llvm-lto.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index d0cab0ceb4d3c..77b0c5b15da7d 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1110,7 +1110,7 @@ static void runThinLTOBackend(
   if (!lto::initImportList(*M, *CombinedIndex, ImportList))
 return;
 
-  auto AddStream = [&](size_t Task) {
+  auto AddStream = [&](size_t Task, const Twine &ModuleName) {
 return std::make_unique(std::move(OS),
   CGOpts.ObjectFilenameForDebug);
   };

diff  --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 500f5fdcecae2..5e0c0f92e6f53 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -843,7 +843,9 @@ Error linkBitcodeFiles(SmallVectorImpl 
&InputFiles,
   // Run the LTO job to compile the bitcode.
   size_t MaxTasks = LTOBackend->getMaxTasks();
   SmallVector Files(MaxTasks);
-  auto AddStream = [&](size_t Task) -> std::unique_ptr {
+  auto AddStream =
+  [&](size_t Task,
+  const Twine &ModuleName) -> std::unique_ptr {
 int FD = -1;
 auto &TempFile = Files[Task];
 StringRef Extension = (Triple.isNVPTX()) ? "s" : "o";

diff  --git a/lld/COFF/LTO.cpp b/lld/COFF/LTO.cpp
index a4b7c44a7e73b..197afabdc22b0 100644
--- a/lld/COFF/LTO.cpp
+++ b/lld/COFF/LTO.cpp
@@ -171,16 +171,18 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
   // specified, configure LTO to use it as the cache directory.
   FileCache cache;
   if (!config->ltoCache.empty())
-cache =
-check(localCache("ThinLTO", "Thin", config->ltoCache,
- [&](size_t task, std::unique_ptr mb) {
-   files[task] = std::move(mb);
- }));
+cache = check(localCache("ThinLTO", "Thin", config->ltoCache,
+ [&](size_t task, const Twine &moduleName,
+ std::unique_ptr mb) {
+   files[task].first = moduleName.str();
+   files[task].second = std::move(mb);
+ }));
 
   checkError(ltoObj->run(
-  [&](size_t task) {
+  [&](size_t task, const Twine &moduleName) {
+buf[task].first = moduleName.str();
 return std::make_unique(
-std::make_unique(buf[task]));
+std::make_unique(buf[task].second));
   },
   cache));
 
@@ -197,7 +199,7 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
   // distributed environment.
   if (config->thinLTOIndexOnly) {
 if (!config->ltoObjPath.empty())
-  saveBuffer(buf[0], config->ltoObjPath);
+  saveBuffer(buf[0].second, config->ltoObjPath);
 if (indexFile)
   indexFile->close();
 return {};
@@ -208,28 +210,40 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
 
   std::vector ret;
   for (unsigned i = 0; i != maxTasks; ++i) {
-// Assign unique n

[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Zequan Wu via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG531ed6d5aa65: [LTO][COFF] Use bitcode file names in lto 
native object file names. (authored by zequanwu).

Changed prior to commit:
  https://reviews.llvm.org/D137217?vs=477014&id=477246#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

Files:
  clang/lib/CodeGen/BackendUtil.cpp
  clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
  lld/COFF/LTO.cpp
  lld/COFF/LTO.h
  lld/ELF/LTO.cpp
  lld/MachO/LTO.cpp
  lld/test/COFF/lto-obj-path.ll
  lld/test/COFF/pdb-thinlto.ll
  lld/test/COFF/thinlto.ll
  lld/wasm/LTO.cpp
  lldb/source/Core/DataFileCache.cpp
  llvm/include/llvm/Support/Caching.h
  llvm/lib/Debuginfod/Debuginfod.cpp
  llvm/lib/LTO/LTO.cpp
  llvm/lib/LTO/LTOBackend.cpp
  llvm/lib/LTO/LTOCodeGenerator.cpp
  llvm/lib/Support/Caching.cpp
  llvm/tools/llvm-lto/llvm-lto.cpp
  llvm/tools/llvm-lto2/llvm-lto2.cpp

Index: llvm/tools/llvm-lto2/llvm-lto2.cpp
===
--- llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -411,7 +411,9 @@
   if (HasErrors)
 return 1;
 
-  auto AddStream = [&](size_t Task) -> std::unique_ptr {
+  auto AddStream =
+  [&](size_t Task,
+  const Twine &ModuleName) -> std::unique_ptr {
 std::string Path = OutputFilename + "." + utostr(Task);
 
 std::error_code EC;
@@ -420,8 +422,9 @@
 return std::make_unique(std::move(S), Path);
   };
 
-  auto AddBuffer = [&](size_t Task, std::unique_ptr MB) {
-*AddStream(Task)->OS << MB->getBuffer();
+  auto AddBuffer = [&](size_t Task, const Twine &ModuleName,
+   std::unique_ptr MB) {
+*AddStream(Task, ModuleName)->OS << MB->getBuffer();
   };
 
   FileCache Cache;
Index: llvm/tools/llvm-lto/llvm-lto.cpp
===
--- llvm/tools/llvm-lto/llvm-lto.cpp
+++ llvm/tools/llvm-lto/llvm-lto.cpp
@@ -317,11 +317,11 @@
   if (!CurrentActivity.empty())
 OS << ' ' << CurrentActivity;
   OS << ": ";
-  
+
   DiagnosticPrinterRawOStream DP(OS);
   DI.print(DP);
   OS << '\n';
-  
+
   if (DI.getSeverity() == DS_Error)
 exit(1);
   return true;
@@ -1099,7 +1099,9 @@
 error("writing merged module failed.");
 }
 
-auto AddStream = [&](size_t Task) -> std::unique_ptr {
+auto AddStream =
+[&](size_t Task,
+const Twine &ModuleName) -> std::unique_ptr {
   std::string PartFilename = OutputFilename;
   if (Parallelism != 1)
 PartFilename += "." + utostr(Task);
Index: llvm/lib/Support/Caching.cpp
===
--- llvm/lib/Support/Caching.cpp
+++ llvm/lib/Support/Caching.cpp
@@ -26,9 +26,9 @@
 
 using namespace llvm;
 
-Expected llvm::localCache(Twine CacheNameRef,
- Twine TempFilePrefixRef,
- Twine CacheDirectoryPathRef,
+Expected llvm::localCache(const Twine &CacheNameRef,
+ const Twine &TempFilePrefixRef,
+ const Twine &CacheDirectoryPathRef,
  AddBufferFn AddBuffer) {
 
   // Create local copies which are safely captured-by-copy in lambdas
@@ -37,7 +37,8 @@
   TempFilePrefixRef.toVector(TempFilePrefix);
   CacheDirectoryPathRef.toVector(CacheDirectoryPath);
 
-  return [=](unsigned Task, StringRef Key) -> Expected {
+  return [=](unsigned Task, StringRef Key,
+ const Twine &ModuleName) -> Expected {
 // This choice of file name allows the cache to be pruned (see pruneCache()
 // in include/llvm/Support/CachePruning.h).
 SmallString<64> EntryPath;
@@ -54,7 +55,7 @@
 /*RequiresNullTerminator=*/false);
   sys::fs::closeFile(*FDOrErr);
   if (MBOrErr) {
-AddBuffer(Task, std::move(*MBOrErr));
+AddBuffer(Task, ModuleName, std::move(*MBOrErr));
 return AddStreamFn();
   }
   EC = MBOrErr.getError();
@@ -77,14 +78,15 @@
 struct CacheStream : CachedFileStream {
   AddBufferFn AddBuffer;
   sys::fs::TempFile TempFile;
+  std::string ModuleName;
   unsigned Task;
 
   CacheStream(std::unique_ptr OS, AddBufferFn AddBuffer,
   sys::fs::TempFile TempFile, std::string EntryPath,
-  unsigned Task)
+  std::string ModuleName, unsigned Task)
   : CachedFileStream(std::move(OS), std::move(EntryPath)),
 AddBuffer(std::move(AddBuffer)), TempFile(std::move(TempFile)),
-Task(Task) {}
+ModuleName(ModuleName), Task(Task) {}
 
   ~CacheStream() {
 // TODO: Manually commit rather than using non-trivial destructor,
@@ -133,11 +135,12 @@
 

[Lldb-commits] [lldb] 24993e7 - [LLDB][Minidump] Merge executable module's architecture into target's architecture.

2022-11-22 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2022-11-22T10:23:11-08:00
New Revision: 24993e749ccd0b8f701f5d8cecaaa49cc205aaa2

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

LOG: [LLDB][Minidump] Merge executable module's architecture into target's 
architecture.

This allows minidump process ABI to match the PE/COFF file ABI.

Reviewed By: labath

Differential Revision: https://reviews.llvm.org/D137873

Added: 


Modified: 
lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
lldb/test/Shell/Minidump/Windows/find-module.test
lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml

Removed: 




diff  --git a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp 
b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
index 5c56f039e6780..872203930d0b8 100644
--- a/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ b/lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -290,7 +290,8 @@ Status ProcessMinidump::DoLoadCore() {
   SetUnixSignals(UnixSignals::Create(GetArchitecture()));
 
   ReadModuleList();
-
+  if (ModuleSP module = GetTarget().GetExecutableModule())
+GetTarget().MergeArchitecture(module->GetArchitecture());
   llvm::Optional pid = m_minidump_parser->GetPid();
   if (!pid) {
 Debugger::ReportWarning("unable to retrieve process ID from minidump file, 
"

diff  --git a/lldb/test/Shell/Minidump/Windows/find-module.test 
b/lldb/test/Shell/Minidump/Windows/find-module.test
index c07a1f24fef32..7ac2f74f8039b 100644
--- a/lldb/test/Shell/Minidump/Windows/find-module.test
+++ b/lldb/test/Shell/Minidump/Windows/find-module.test
@@ -4,7 +4,25 @@ use it when opening minidumps.
 RUN: yaml2obj %S/Inputs/find-module.exe.yaml -o %T/find-module.exe
 RUN: yaml2obj %S/Inputs/find-module.dmp.yaml -o %T/find-module.dmp
 RUN: %lldb -O "settings set target.exec-search-paths %T" \
-RUN:   -c %T/find-module.dmp -o "image dump objfile" -o exit | FileCheck %s
+RUN:   -c %T/find-module.dmp -o "image dump objfile" -o "target list" -o exit \
+RUN:   | FileCheck --check-prefix=DEFAULT %s
 
-CHECK-LABEL: image dump objfile
-CHECK: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+RUN: %lldb -O "settings set plugin.object-file.pe-coff.abi msvc" \
+RUN:   -O "settings set target.exec-search-paths %T" -c %T/find-module.dmp \
+RUN:   -o "target list" -o exit | FileCheck --check-prefix=MSVC %s
+
+RUN: %lldb -O "settings set plugin.object-file.pe-coff.abi gnu" \
+RUN:   -O "settings set target.exec-search-paths %T" -c %T/find-module.dmp \
+RUN:   -o "target list" -o exit | FileCheck --check-prefix=GNU %s
+
+DEFAULT-LABEL: image dump objfile
+DEFAULT: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+
+DEFAULT-LABEL: target list
+DEFAULT: arch=i386-pc-windows-{{msvc|gnu}}
+
+MSVC-LABEL: target list
+MSVC: arch=i386-pc-windows-msvc
+
+GNU-LABEL: target list
+GNU: arch=i386-pc-windows-gnu

diff  --git 
a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml 
b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
index 6075c33bb88ab..8981c84e43c6f 100644
--- 
a/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
+++ 
b/lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
@@ -50,7 +50,7 @@ Streams:
 ...
 
 --- !COFF
-OptionalHeader:  
+OptionalHeader:
   AddressOfEntryPoint: 0
   ImageBase:   720896
   SectionAlignment: 4096
@@ -67,13 +67,13 @@ OptionalHeader:
   SizeOfStackCommit: 4096
   SizeOfHeapReserve: 1048576
   SizeOfHeapCommit: 4096
-  Debug:   
+  Debug:
 RelativeVirtualAddress: 8192
 Size:28
-header:  
-  Machine: IMAGE_FILE_MACHINE_AMD64
+header:
+  Machine: IMAGE_FILE_MACHINE_I386
   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, 
IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
-sections:
+sections:
   - Name:.text
 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, 
IMAGE_SCN_MEM_READ ]
 VirtualAddress:  4096



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


[Lldb-commits] [PATCH] D137873: [LLDB][Minidump] Merge executable module's architecture into target's architecture.

2022-11-22 Thread Zequan Wu via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG24993e749ccd: [LLDB][Minidump] Merge executable 
module's architecture into target's… (authored by zequanwu).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137873

Files:
  lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
  lldb/test/Shell/Minidump/Windows/find-module.test
  lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml


Index: 
lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
===
--- lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
+++ lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
@@ -50,7 +50,7 @@
 ...
 
 --- !COFF
-OptionalHeader:  
+OptionalHeader:
   AddressOfEntryPoint: 0
   ImageBase:   720896
   SectionAlignment: 4096
@@ -67,13 +67,13 @@
   SizeOfStackCommit: 4096
   SizeOfHeapReserve: 1048576
   SizeOfHeapCommit: 4096
-  Debug:   
+  Debug:
 RelativeVirtualAddress: 8192
 Size:28
-header:  
-  Machine: IMAGE_FILE_MACHINE_AMD64
+header:
+  Machine: IMAGE_FILE_MACHINE_I386
   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, 
IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
-sections:
+sections:
   - Name:.text
 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, 
IMAGE_SCN_MEM_READ ]
 VirtualAddress:  4096
Index: lldb/test/Shell/Minidump/Windows/find-module.test
===
--- lldb/test/Shell/Minidump/Windows/find-module.test
+++ lldb/test/Shell/Minidump/Windows/find-module.test
@@ -4,7 +4,25 @@
 RUN: yaml2obj %S/Inputs/find-module.exe.yaml -o %T/find-module.exe
 RUN: yaml2obj %S/Inputs/find-module.dmp.yaml -o %T/find-module.dmp
 RUN: %lldb -O "settings set target.exec-search-paths %T" \
-RUN:   -c %T/find-module.dmp -o "image dump objfile" -o exit | FileCheck %s
+RUN:   -c %T/find-module.dmp -o "image dump objfile" -o "target list" -o exit \
+RUN:   | FileCheck --check-prefix=DEFAULT %s
 
-CHECK-LABEL: image dump objfile
-CHECK: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+RUN: %lldb -O "settings set plugin.object-file.pe-coff.abi msvc" \
+RUN:   -O "settings set target.exec-search-paths %T" -c %T/find-module.dmp \
+RUN:   -o "target list" -o exit | FileCheck --check-prefix=MSVC %s
+
+RUN: %lldb -O "settings set plugin.object-file.pe-coff.abi gnu" \
+RUN:   -O "settings set target.exec-search-paths %T" -c %T/find-module.dmp \
+RUN:   -o "target list" -o exit | FileCheck --check-prefix=GNU %s
+
+DEFAULT-LABEL: image dump objfile
+DEFAULT: ObjectFilePECOFF, file = '{{.*}}find-module.exe', arch = i386
+
+DEFAULT-LABEL: target list
+DEFAULT: arch=i386-pc-windows-{{msvc|gnu}}
+
+MSVC-LABEL: target list
+MSVC: arch=i386-pc-windows-msvc
+
+GNU-LABEL: target list
+GNU: arch=i386-pc-windows-gnu
Index: lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
===
--- lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
+++ lldb/source/Plugins/Process/minidump/ProcessMinidump.cpp
@@ -290,7 +290,8 @@
   SetUnixSignals(UnixSignals::Create(GetArchitecture()));
 
   ReadModuleList();
-
+  if (ModuleSP module = GetTarget().GetExecutableModule())
+GetTarget().MergeArchitecture(module->GetArchitecture());
   llvm::Optional pid = m_minidump_parser->GetPid();
   if (!pid) {
 Debugger::ReportWarning("unable to retrieve process ID from minidump file, 
"


Index: lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
===
--- lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
+++ lldb/test/Shell/SymbolFile/Breakpad/unwind-via-stack-win-no-memory-info.yaml
@@ -50,7 +50,7 @@
 ...
 
 --- !COFF
-OptionalHeader:  
+OptionalHeader:
   AddressOfEntryPoint: 0
   ImageBase:   720896
   SectionAlignment: 4096
@@ -67,13 +67,13 @@
   SizeOfStackCommit: 4096
   SizeOfHeapReserve: 1048576
   SizeOfHeapCommit: 4096
-  Debug:   
+  Debug:
 RelativeVirtualAddress: 8192
 Size:28
-header:  
-  Machine: IMAGE_FILE_MACHINE_AMD64
+header:
+  Machine: IMAGE_FILE_MACHINE_I386
   Characteristics: [ IMAGE_FILE_EXECUTABLE_IMAGE, IMAGE_FILE_LARGE_ADDRESS_AWARE, IMAGE_FILE_DLL ]
-sections:
+sections:
   - Name:.text
 Characteristics: [ IMAGE_SCN_CNT_CODE, IMAGE_SCN_MEM_EXECUTE, IMAGE_SCN_MEM_READ ]
 VirtualAddress:  4096
Index: lldb/test/Shell/Minidump/Windows/find-module.test
===
--- lldb/test/Shell/Minidump/Windows/find-module.test
+++ lldb/test/Shell/Minidump/Windows/find-module.test
@@ -4,7

[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Nico Weber via Phabricator via lldb-commits
thakis added a comment.

This doesn't build:
http://45.33.8.238/win/70474/step_4.txt
http://45.33.8.238/linux/92146/step_4.txt

Please take a look and revert for now if it takes a while to fix.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [lldb] eef5405 - Revert "[LTO][COFF] Use bitcode file names in lto native object file names."

2022-11-22 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2022-11-22T10:55:05-08:00
New Revision: eef5405f74ae208e3e2eb7daacecac923d7338f2

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

LOG: Revert "[LTO][COFF] Use bitcode file names in lto native object file 
names."

This reverts commit 531ed6d5aa65f41c6dfe2e74905d5c6c88fc95a7.

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
lld/COFF/LTO.cpp
lld/COFF/LTO.h
lld/ELF/LTO.cpp
lld/MachO/LTO.cpp
lld/test/COFF/lto-obj-path.ll
lld/test/COFF/pdb-thinlto.ll
lld/test/COFF/thinlto.ll
lld/wasm/LTO.cpp
lldb/source/Core/DataFileCache.cpp
llvm/include/llvm/Support/Caching.h
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/Support/Caching.cpp
llvm/tools/llvm-lto/llvm-lto.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index 77b0c5b15da7..d0cab0ceb4d3 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1110,7 +1110,7 @@ static void runThinLTOBackend(
   if (!lto::initImportList(*M, *CombinedIndex, ImportList))
 return;
 
-  auto AddStream = [&](size_t Task, const Twine &ModuleName) {
+  auto AddStream = [&](size_t Task) {
 return std::make_unique(std::move(OS),
   CGOpts.ObjectFilenameForDebug);
   };

diff  --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 5e0c0f92e6f5..500f5fdcecae 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -843,9 +843,7 @@ Error linkBitcodeFiles(SmallVectorImpl 
&InputFiles,
   // Run the LTO job to compile the bitcode.
   size_t MaxTasks = LTOBackend->getMaxTasks();
   SmallVector Files(MaxTasks);
-  auto AddStream =
-  [&](size_t Task,
-  const Twine &ModuleName) -> std::unique_ptr {
+  auto AddStream = [&](size_t Task) -> std::unique_ptr {
 int FD = -1;
 auto &TempFile = Files[Task];
 StringRef Extension = (Triple.isNVPTX()) ? "s" : "o";

diff  --git a/lld/COFF/LTO.cpp b/lld/COFF/LTO.cpp
index 197afabdc22b..a4b7c44a7e73 100644
--- a/lld/COFF/LTO.cpp
+++ b/lld/COFF/LTO.cpp
@@ -171,18 +171,16 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
   // specified, configure LTO to use it as the cache directory.
   FileCache cache;
   if (!config->ltoCache.empty())
-cache = check(localCache("ThinLTO", "Thin", config->ltoCache,
- [&](size_t task, const Twine &moduleName,
- std::unique_ptr mb) {
-   files[task].first = moduleName.str();
-   files[task].second = std::move(mb);
- }));
+cache =
+check(localCache("ThinLTO", "Thin", config->ltoCache,
+ [&](size_t task, std::unique_ptr mb) {
+   files[task] = std::move(mb);
+ }));
 
   checkError(ltoObj->run(
-  [&](size_t task, const Twine &moduleName) {
-buf[task].first = moduleName.str();
+  [&](size_t task) {
 return std::make_unique(
-std::make_unique(buf[task].second));
+std::make_unique(buf[task]));
   },
   cache));
 
@@ -199,7 +197,7 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
   // distributed environment.
   if (config->thinLTOIndexOnly) {
 if (!config->ltoObjPath.empty())
-  saveBuffer(buf[0].second, config->ltoObjPath);
+  saveBuffer(buf[0], config->ltoObjPath);
 if (indexFile)
   indexFile->close();
 return {};
@@ -210,40 +208,28 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
 
   std::vector ret;
   for (unsigned i = 0; i != maxTasks; ++i) {
-StringRef bitcodeFilePath;
+// Assign unique names to LTO objects. This ensures they have unique names
+// in the PDB if one is produced. The names should look like:
+// - foo.exe.lto.obj
+// - foo.exe.lto.1.obj
+// - ...
+StringRef ltoObjName =
+saver().save(Twine(config->outputFile) + ".lto" +
+ (i == 0 ? Twine("") : Twine('.') + Twine(i)) + ".obj");
+
 // Get the native object contents either from the cache or from memory.  Do
 // not use the cached MemoryBuffer directly, or the PDB will not be
 // deterministic.
 StringRef objBuf;
-if (files[i].second) {
-  objBuf = files[i].second->getBuffer();
-  bitcodeFilePath = files[i].first;
-  

[Lldb-commits] [lldb] 387620a - Reland "[LTO][COFF] Use bitcode file names in lto native object file names."

2022-11-22 Thread Zequan Wu via lldb-commits

Author: Zequan Wu
Date: 2022-11-22T11:26:18-08:00
New Revision: 387620aa8cea33174b6c1fb80c1af713fee732ac

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

LOG: Reland "[LTO][COFF] Use bitcode file names in lto native object file 
names."

This reverts commit eef5405f74ae208e3e2eb7daacecac923d7338f2.

Added: 


Modified: 
clang/lib/CodeGen/BackendUtil.cpp
clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
lld/COFF/LTO.cpp
lld/COFF/LTO.h
lld/ELF/LTO.cpp
lld/MachO/LTO.cpp
lld/test/COFF/lto-obj-path.ll
lld/test/COFF/pdb-thinlto.ll
lld/test/COFF/thinlto.ll
lld/wasm/LTO.cpp
lldb/source/Core/DataFileCache.cpp
llvm/include/llvm/Support/Caching.h
llvm/lib/Debuginfod/Debuginfod.cpp
llvm/lib/LTO/LTO.cpp
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/LTO/LTOCodeGenerator.cpp
llvm/lib/Support/Caching.cpp
llvm/tools/llvm-lto/llvm-lto.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp

Removed: 




diff  --git a/clang/lib/CodeGen/BackendUtil.cpp 
b/clang/lib/CodeGen/BackendUtil.cpp
index d0cab0ceb4d3c..77b0c5b15da7d 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -1110,7 +1110,7 @@ static void runThinLTOBackend(
   if (!lto::initImportList(*M, *CombinedIndex, ImportList))
 return;
 
-  auto AddStream = [&](size_t Task) {
+  auto AddStream = [&](size_t Task, const Twine &ModuleName) {
 return std::make_unique(std::move(OS),
   CGOpts.ObjectFilenameForDebug);
   };

diff  --git a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp 
b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
index 500f5fdcecae2..5e0c0f92e6f53 100644
--- a/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
+++ b/clang/tools/clang-linker-wrapper/ClangLinkerWrapper.cpp
@@ -843,7 +843,9 @@ Error linkBitcodeFiles(SmallVectorImpl 
&InputFiles,
   // Run the LTO job to compile the bitcode.
   size_t MaxTasks = LTOBackend->getMaxTasks();
   SmallVector Files(MaxTasks);
-  auto AddStream = [&](size_t Task) -> std::unique_ptr {
+  auto AddStream =
+  [&](size_t Task,
+  const Twine &ModuleName) -> std::unique_ptr {
 int FD = -1;
 auto &TempFile = Files[Task];
 StringRef Extension = (Triple.isNVPTX()) ? "s" : "o";

diff  --git a/lld/COFF/LTO.cpp b/lld/COFF/LTO.cpp
index a4b7c44a7e73b..7dcd7a2aefb4a 100644
--- a/lld/COFF/LTO.cpp
+++ b/lld/COFF/LTO.cpp
@@ -165,22 +165,25 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
   unsigned maxTasks = ltoObj->getMaxTasks();
   buf.resize(maxTasks);
   files.resize(maxTasks);
+  file_names.resize(maxTasks);
 
   // The /lldltocache option specifies the path to a directory in which to 
cache
   // native object files for ThinLTO incremental builds. If a path was
   // specified, configure LTO to use it as the cache directory.
   FileCache cache;
   if (!config->ltoCache.empty())
-cache =
-check(localCache("ThinLTO", "Thin", config->ltoCache,
- [&](size_t task, std::unique_ptr mb) {
-   files[task] = std::move(mb);
- }));
+cache = check(localCache("ThinLTO", "Thin", config->ltoCache,
+ [&](size_t task, const Twine &moduleName,
+ std::unique_ptr mb) {
+   files[task] = std::move(mb);
+   file_names[task] = moduleName.str();
+ }));
 
   checkError(ltoObj->run(
-  [&](size_t task) {
+  [&](size_t task, const Twine &moduleName) {
+buf[task].first = moduleName.str();
 return std::make_unique(
-std::make_unique(buf[task]));
+std::make_unique(buf[task].second));
   },
   cache));
 
@@ -197,7 +200,7 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
   // distributed environment.
   if (config->thinLTOIndexOnly) {
 if (!config->ltoObjPath.empty())
-  saveBuffer(buf[0], config->ltoObjPath);
+  saveBuffer(buf[0].second, config->ltoObjPath);
 if (indexFile)
   indexFile->close();
 return {};
@@ -208,28 +211,40 @@ std::vector 
BitcodeCompiler::compile(COFFLinkerContext &ctx) {
 
   std::vector ret;
   for (unsigned i = 0; i != maxTasks; ++i) {
-// Assign unique names to LTO objects. This ensures they have unique names
-// in the PDB if one is produced. The names should look like:
-// - foo.exe.lto.obj
-// - foo.exe.lto.1.obj
-// - ...
-StringRef ltoObjName =
-saver().save(Twine(config->outputFile) + ".lto" +
- (i == 0 ? Twine("") : Twine('.') + Twine(i)) + ".obj");
-
+StringRef bitcodeFilePath;
 // Get the native object con

[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

Relanded here 
 to match 
api changes at https://reviews.llvm.org/D135590


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D138259: Add the ability to see when a type in incomplete.

2022-11-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg added a comment.

In D138259#3943739 , @labath wrote:

> In D138259#3941859 , @clayborg 
> wrote:
>
>> In D138259#3941465 , @labath wrote:
>>
>>> In D138259#3941431 , @clayborg 
>>> wrote:
>>>
 "a type should be complete but isn't and you are losing information that 
 should have been available for you to debug".
>>>
>>> I agree, but there are still two (or more) ways to communicate that 
>>> information.
>>>
>>> 1. "this type is complete" + "actually, I'm just missing the debug info and 
>>> pretending it's complete"
>>> 2. "this type is incomplete" + "it is incomplete because I am missing its 
>>> debug info"
>>>
>>> My question is which method would be more useful to the user.
>>
>> Gotcha. We could change "bool SBType::IsTypeComplete()" to return false, and 
>> then add a new:
>>
>>   bool SBType::ShouldBeComplete();
>>
>> That would return true if IsTypeComplete() returned false because it was 
>> forcefully completed.
>
> That is the expected behavior, but we wouldn't need to implement it that way. 
> We could still implement it by calling the "is forcefully completed" metadata 
> function, and so it wouldn't force the completion of the type. So a `true` 
> return value would mean that the type has been forcefully completed, while a 
> return value of `false` would mean that the type is complete (not just 
> pretend-complete) **or** the completion of the type hasn't been attempted yet.

The current SBType::IsTypeComplete() will complete the type in order to figure 
out if it is actually complete. So although we can shortcut this for forcefully 
completed types, it wouldn't work for other types.

> Note that I'm not saying that this is how it needs to be implemented. 
> However, I think its worth thinking about this, given that we're adding a new 
> public interface and all. I think it comes down to the question of which 
> situation would be more/less confusing to the (SB) user
>
> - querying a member/base class of an object and finding that it's incomplete 
> (even though that is not possible in regular c++)
> - querying a member/base class of an object and finding that it's empty (even 
> though the truth is that we just don't know what it contains.)

Why don't I remove this API change from this patch to allow the patch to get 
into open source and we can revisit if we need to since we don't have any 
clients for this right now. But I do think it is a good idea to change the 
SBTType::IsTypeComplete() to return false for forcefully completed types, so I 
will make that change and test it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138259

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


[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Mike Hommey via Phabricator via lldb-commits
glandium added a comment.

This broke the gold plugin:

  [task 2022-11-22T21:03:29.486Z] 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1108:19: 
error: no matching function for call to 'localCache'
  [task 2022-11-22T21:03:29.486Z] Cache = check(localCache("ThinLTO", 
"Thin", options::cache_dir, AddBuffer));
  [task 2022-11-22T21:03:29.487Z]   ^~
  [task 2022-11-22T21:03:29.487Z] 
/builds/worker/fetches/llvm-project/llvm/include/llvm/Support/Caching.h:72:21: 
note: candidate function not viable: no known conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1102:20)' 
to 'llvm::AddBufferFn' (aka 'function)>') for 4th argument
  [task 2022-11-22T21:03:29.487Z] Expected localCache(
  [task 2022-11-22T21:03:29.488Z] ^
  [task 2022-11-22T21:03:29.488Z] 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1110:18: 
error: no viable conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'llvm::AddStreamFn' (aka 
'function> (unsigned int, const 
llvm::Twine &)>')
  [task 2022-11-22T21:03:29.488Z]   check(Lto->run(AddStream, Cache));
  [task 2022-11-22T21:03:29.488Z]  ^
  [task 2022-11-22T21:03:29.488Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:421:7:
 note: candidate constructor not viable: no known conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
  [task 2022-11-22T21:03:29.488Z]   function(nullptr_t) noexcept
  [task 2022-11-22T21:03:29.488Z]   ^
  [task 2022-11-22T21:03:29.489Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:432:7:
 note: candidate constructor not viable: no known conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'const std::function>> (unsigned int, const llvm::Twine 
&)> &' for 1st argument
  [task 2022-11-22T21:03:29.489Z]   function(const function& __x);
  [task 2022-11-22T21:03:29.489Z]   ^
  [task 2022-11-22T21:03:29.489Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:441:7:
 note: candidate constructor not viable: no known conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'std::function>> (unsigned int, const llvm::Twine 
&)> &&' for 1st argument
  [task 2022-11-22T21:03:29.489Z]   function(function&& __x) noexcept : 
_Function_base()
  [task 2022-11-22T21:03:29.489Z]   ^
  [task 2022-11-22T21:03:29.489Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:465:2:
 note: candidate template ignored: substitution failure [with _Functor = 
(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20), 
$1 = void]: no type named 'type' in 'std::result_of<(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) 
&(unsigned int, const llvm::Twine &)>'
  [task 2022-11-22T21:03:29.489Z] function(_Functor);
  [task 2022-11-22T21:03:29.489Z] ^
  [task 2022-11-22T21:03:29.489Z] 
/builds/worker/fetches/llvm-project/llvm/include/llvm/LTO/LTO.h:278:25: note: 
passing argument to parameter 'AddStream' here
  [task 2022-11-22T21:03:29.489Z]   Error run(AddStreamFn AddStream, FileCache 
Cache = nullptr);
  [task 2022-11-22T21:03:29.489Z] ^
  [task 2022-11-22T21:03:29.489Z] 2 errors generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

In D137217#3944952 , @glandium wrote:

> This broke the gold plugin:
>
>   [task 2022-11-22T21:03:29.486Z] 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1108:19: 
> error: no matching function for call to 'localCache'
>   [task 2022-11-22T21:03:29.486Z] Cache = check(localCache("ThinLTO", 
> "Thin", options::cache_dir, AddBuffer));
>   [task 2022-11-22T21:03:29.487Z]   ^~
>   [task 2022-11-22T21:03:29.487Z] 
> /builds/worker/fetches/llvm-project/llvm/include/llvm/Support/Caching.h:72:21:
>  note: candidate function not viable: no known conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1102:20)' 
> to 'llvm::AddBufferFn' (aka 'function &, std::unique_ptr)>') for 4th argument
>   [task 2022-11-22T21:03:29.487Z] Expected localCache(
>   [task 2022-11-22T21:03:29.488Z] ^
>   [task 2022-11-22T21:03:29.488Z] 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1110:18: 
> error: no viable conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'llvm::AddStreamFn' (aka 
> 'function> (unsigned int, const 
> llvm::Twine &)>')
>   [task 2022-11-22T21:03:29.488Z]   check(Lto->run(AddStream, Cache));
>   [task 2022-11-22T21:03:29.488Z]  ^
>   [task 2022-11-22T21:03:29.488Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:421:7:
>  note: candidate constructor not viable: no known conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
>   [task 2022-11-22T21:03:29.488Z]   function(nullptr_t) noexcept
>   [task 2022-11-22T21:03:29.488Z]   ^
>   [task 2022-11-22T21:03:29.489Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:432:7:
>  note: candidate constructor not viable: no known conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'const 
> std::function std::default_delete>> (unsigned int, const 
> llvm::Twine &)> &' for 1st argument
>   [task 2022-11-22T21:03:29.489Z]   function(const function& __x);
>   [task 2022-11-22T21:03:29.489Z]   ^
>   [task 2022-11-22T21:03:29.489Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:441:7:
>  note: candidate constructor not viable: no known conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'std::function std::default_delete>> (unsigned int, const 
> llvm::Twine &)> &&' for 1st argument
>   [task 2022-11-22T21:03:29.489Z]   function(function&& __x) noexcept : 
> _Function_base()
>   [task 2022-11-22T21:03:29.489Z]   ^
>   [task 2022-11-22T21:03:29.489Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:465:2:
>  note: candidate template ignored: substitution failure [with _Functor = 
> (lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20), 
> $1 = void]: no type named 'type' in 'std::result_of<(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) 
> &(unsigned int, const llvm::Twine &)>'
>   [task 2022-11-22T21:03:29.489Z] function(_Functor);
>   [task 2022-11-22T21:03:29.489Z] ^
>   [task 2022-11-22T21:03:29.489Z] 
> /builds/worker/fetches/llvm-project/llvm/include/llvm/LTO/LTO.h:278:25: note: 
> passing argument to parameter 'AddStream' here
>   [task 2022-11-22T21:03:29.489Z]   Error run(AddStreamFn AddStream, 
> FileCache Cache = nullptr);
>   [task 2022-11-22T21:03:29.489Z] ^
>   [task 2022-11-22T21:03:29.489Z] 2 errors generated.

Thanks for noticing. I have fixed at 
https://reviews.llvm.org/rG10a43c4641c20e0a50edc0ff99915c837a507cc1. 
Unfortunately, this patch is reverted right before that fix pushed. I relanded 
this at https://reviews.llvm.org/rG84be92d26fcb1ddad533c0c614a79a81c59f795d.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D135798: Add runToBinaryEntry option for lldb-vscode

2022-11-22 Thread jeffrey tan via Phabricator via lldb-commits
This revision was not accepted when it landed; it landed in state "Needs 
Review".
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf0c16f89124f: Add runToBinaryEntry option for lldb-vscode 
(authored by yinghuitan).

Changed prior to commit:
  https://reviews.llvm.org/D135798?vs=468593&id=477290#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135798

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
  lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
  lldb/tools/lldb-vscode/VSCode.cpp
  lldb/tools/lldb-vscode/VSCode.h
  lldb/tools/lldb-vscode/lldb-vscode.cpp
  lldb/tools/lldb-vscode/package.json

Index: lldb/tools/lldb-vscode/package.json
===
--- lldb/tools/lldb-vscode/package.json
+++ lldb/tools/lldb-vscode/package.json
@@ -157,6 +157,11 @@
 "description": "Automatically stop after launch.",
 "default": false
 			},
+			"runToBinaryEntry": {
+"type": "boolean",
+"description": "run to program entry one-shot breakpoint during launch to ensure dependency modules are loaded.",
+"default": false
+			},
 			"disableASLR": {
 "type": "boolean",
 "description": "Enable or disable Address space layout randomization if the debugger supports it.",
Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -1610,6 +1610,68 @@
  error.GetCString());
 }
 
+lldb::SBError RunToBinaryEntry() {
+  lldb::SBError error;
+  if (!g_vsc.run_to_binary_entry)
+return error;
+
+  if (g_vsc.stop_at_entry) {
+g_vsc.SendOutput(OutputType::Console,
+ "RunToBinaryEntry is ignored due to StopOnEntry\n");
+return error;
+  }
+
+  lldb::SBTarget target = g_vsc.debugger.GetSelectedTarget();
+  if (!target.IsValid())
+return error;
+  lldb::SBFileSpec exe_file = target.GetExecutable();
+  if (!exe_file.IsValid())
+return error;
+  lldb::SBModule exe_module = target.FindModule(exe_file);
+  if (!exe_module.IsValid()) {
+g_vsc.SendOutput(OutputType::Console,
+ "RunToBinaryEntry failed: invalid executable module\n");
+return error;
+  }
+
+  lldb::SBAddress entry_point = exe_module.GetObjectFileEntryPointAddress();
+  if (!entry_point.IsValid()) {
+g_vsc.SendOutput(OutputType::Console,
+ "RunToBinaryEntry failed: can't find entry point\n");
+return error;
+  }
+  lldb::SBBreakpoint entry_breakpoint =
+  target.BreakpointCreateBySBAddress(entry_point);
+  if (!entry_breakpoint.IsValid() || entry_breakpoint.GetNumLocations() == 0) {
+g_vsc.SendOutput(OutputType::Console,
+ "RunToBinaryEntry failed: can't resolve the entry point breakpoint\n");
+return error;
+  }
+
+  uint32_t old_stop_id = target.GetProcess().GetStopID();
+  entry_breakpoint.SetOneShot(true);
+  error = target.GetProcess().Continue();
+  if (error.Fail())
+return error;
+
+  const uint64_t timeout_seconds = 600;
+  error = g_vsc.WaitForProcessToStop(timeout_seconds, old_stop_id);
+  if (error.Fail())
+return error;
+
+  // Successfully got a process stop; we still need to check if the stop is what
+  // we expected.
+  if (entry_breakpoint.GetHitCount() == 0)
+g_vsc.SendOutput(OutputType::Telemetry,
+ "RunToBinaryEntry failed: process stopped not at the "
+ "binary's entry point\n");
+  else
+g_vsc.SendOutput(OutputType::Telemetry,
+ "RunToBinaryEntry success: Process stopped successfully "
+ "at the binary's entry point\n");
+  return error;
+}
+
 // "LaunchRequest": {
 //   "allOf": [ { "$ref": "#/definitions/Request" }, {
 // "type": "object",
@@ -1659,6 +1721,7 @@
   std::vector postRunCommands =
   GetStrings(arguments, "postRunCommands");
   g_vsc.stop_at_entry = GetBoolean(arguments, "stopOnEntry", false);
+  g_vsc.run_to_binary_entry = GetBoolean(arguments, "runToBinaryEntry", false);
   const llvm::StringRef debuggerRoot = GetString(arguments, "debuggerRoot");
   const uint64_t timeout_seconds = GetUnsigned(arguments, "timeout", 30);
 
@@ -1741,6 +1804,9 @@
 error = g_vsc.WaitForProcessToStop(timeout_seconds);
   }
 
+  if (error.Success())
+error = RunToBinaryEntry();
+
   if (error.Fail()) {
 response["success"] = llvm::json::Value(false);
 EmplaceSafeString(response, "message", std::string(error.GetCString()));
Index: lldb/tools/lldb-vscode/VSCode.h
===
--- lldb/tools/lldb-vscode/VSCode.h
+++ lldb/tools/lldb-vs

[Lldb-commits] [lldb] f0c16f8 - Add runToBinaryEntry option for lldb-vscode

2022-11-22 Thread Jeffrey Tan via lldb-commits

Author: Jeffrey Tan
Date: 2022-11-22T13:52:45-08:00
New Revision: f0c16f89124f2dc0630162ff9ea23934f5b2b75b

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

LOG: Add runToBinaryEntry option for lldb-vscode

This patch adds a new runToBinaryEntry option which sets a one-shot breakpoint
at program entry. This option is useful for synchronizing module loading with
dynamic loader to measure debugger startup performance:  when program entry
one-short breakpoint hits most of the dependency modules should have been
loaded so this provides a good sample point for debugger startup time.

More explicitly for lldb-vscode, when this option is enabled, "Initialized" DAP
event is synchronously sent after most dependency modules are loaded.

Differential Revision: https://reviews.llvm.org/D135798

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
lldb/tools/lldb-vscode/VSCode.cpp
lldb/tools/lldb-vscode/VSCode.h
lldb/tools/lldb-vscode/lldb-vscode.cpp
lldb/tools/lldb-vscode/package.json

Removed: 




diff  --git 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
index a91f3b2b8feff..99baad59dc12d 100644
--- 
a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -286,7 +286,7 @@ def launch(self, program=None, args=None, cwd=None, 
env=None,
stopCommands=None, exitCommands=None, terminateCommands=None,
sourcePath=None, debuggerRoot=None, sourceInitFile=False, 
launchCommands=None,
sourceMap=None, disconnectAutomatically=True, 
runInTerminal=False,
-   expectFailure=False, postRunCommands=None):
+   expectFailure=False, postRunCommands=None, 
runToBinaryEntry=False):
 '''Sending launch request to vscode
 '''
 
@@ -323,7 +323,8 @@ def cleanup():
 sourceMap=sourceMap,
 runInTerminal=runInTerminal,
 expectFailure=expectFailure,
-postRunCommands=postRunCommands)
+postRunCommands=postRunCommands,
+runToBinaryEntry=runToBinaryEntry)
 
 if expectFailure:
 return response
@@ -346,7 +347,7 @@ def build_and_launch(self, program, args=None, cwd=None, 
env=None,
  terminateCommands=None, sourcePath=None,
  debuggerRoot=None, sourceInitFile=False, 
runInTerminal=False,
  disconnectAutomatically=True, postRunCommands=None,
- lldbVSCodeEnv=None):
+ lldbVSCodeEnv=None, runToBinaryEntry=False):
 '''Build the default Makefile target, create the VSCode debug adaptor,
and launch the process.
 '''
@@ -359,4 +360,5 @@ def build_and_launch(self, program, args=None, cwd=None, 
env=None,
 terminateCommands, sourcePath, debuggerRoot, 
sourceInitFile,
 runInTerminal=runInTerminal,
 disconnectAutomatically=disconnectAutomatically,
-postRunCommands=postRunCommands)
+postRunCommands=postRunCommands,
+runToBinaryEntry=runToBinaryEntry)

diff  --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py 
b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
index c2de4ad5c7d9a..f5f9ae30bbd46 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/vscode.py
@@ -650,7 +650,7 @@ def request_launch(self, program, args=None, cwd=None, 
env=None,
terminateCommands=None ,sourcePath=None,
debuggerRoot=None, launchCommands=None, sourceMap=None,
runInTerminal=False, expectFailure=False,
-   postRunCommands=None):
+   postRunCommands=None, runToBinaryEntry=False):
 args_dict = {
 'program': program
 }
@@ -662,6 +662,8 @@ def request_launch(self, program, args=None, cwd=None, 
env=None,
 args_dict['env'] = env
 if stopOnEntry:
 args_dict['stopOnEntry'] = stopOnEntry
+if runToBinaryEntry:
+args_dict['runToBinaryEntry'] = runToBinaryEntry
 if disableASLR:
 args_dict['disableASLR'] = disableASLR
 if disableSTDIO:

diff  --git a/lldb/test/API/tools/lldb-vscode/launch/TestVSCode

[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Mike Hommey via Phabricator via lldb-commits
glandium added a comment.

Still broken:

  task 2022-11-22T22:09:00.912Z] /usr/lib/llvm-11/bin/clang++ 
--sysroot=/builds/worker/fetches/sysroot -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE 
-D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
-Itools/gold -I/builds/worker/fetches/llvm-project/llvm/tools/gold -Iinclude 
-I/builds/worker/fetches/llvm-project/llvm/include -fPIC 
-fvisibility-inlines-hidden -Werror=date-time 
-Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
-Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
-Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
-Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
-Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
-Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
-ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC  -fno-exceptions 
-fno-rtti -std=c++17 -MD -MT 
tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o -MF 
tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o.d -o 
tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o -c 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp
  [task 2022-11-22T22:09:00.912Z] 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp::18: 
error: no viable conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'llvm::AddStreamFn' (aka 
'function> (unsigned int, const 
llvm::Twine &)>')
  [task 2022-11-22T22:09:00.912Z]   check(Lto->run(AddStream, Cache));
  [task 2022-11-22T22:09:00.912Z]  ^
  [task 2022-11-22T22:09:00.912Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:421:7:
 note: candidate constructor not viable: no known conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
  [task 2022-11-22T22:09:00.912Z]   function(nullptr_t) noexcept
  [task 2022-11-22T22:09:00.912Z]   ^
  [task 2022-11-22T22:09:00.912Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:432:7:
 note: candidate constructor not viable: no known conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'const std::function>> (unsigned int, const llvm::Twine 
&)> &' for 1st argument
  [task 2022-11-22T22:09:00.912Z]   function(const function& __x);
  [task 2022-11-22T22:09:00.912Z]   ^
  [task 2022-11-22T22:09:00.912Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:441:7:
 note: candidate constructor not viable: no known conversion from '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
to 'std::function>> (unsigned int, const llvm::Twine 
&)> &&' for 1st argument
  [task 2022-11-22T22:09:00.912Z]   function(function&& __x) noexcept : 
_Function_base()
  [task 2022-11-22T22:09:00.913Z]   ^
  [task 2022-11-22T22:09:00.913Z] 
/builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:465:2:
 note: candidate template ignored: substitution failure [with _Functor = 
(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20), 
$1 = void]: no type named 'type' in 'std::result_of<(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) 
&(unsigned int, const llvm::Twine &)>'
  [task 2022-11-22T22:09:00.913Z] function(_Functor);
  [task 2022-11-22T22:09:00.913Z] ^
  [task 2022-11-22T22:09:00.913Z] 
/builds/worker/fetches/llvm-project/llvm/include/llvm/LTO/LTO.h:278:25: note: 
passing argument to parameter 'AddStream' here
  [task 2022-11-22T22:09:00.913Z]   Error run(AddStreamFn AddStream, FileCache 
Cache = nullptr);
  [task 2022-11-22T22:09:00.913Z] ^
  [task 2022-11-22T22:09:00.913Z] 1 error generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D138259: Add the ability to see when a type in incomplete.

2022-11-22 Thread Greg Clayton via Phabricator via lldb-commits
clayborg updated this revision to Diff 477314.
clayborg added a comment.

Remove SBType::IsTypeForcefullyCompleted() for now. Change 
SBType::IsTypeComplete() to return false for forcefully completed types. I did 
this only in the public API, not internally since we have the 
CompilerType::IsForcefullyCompleted() available and internal code can deal with 
this special case if needed.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138259

Files:
  lldb/include/lldb/Symbol/CompilerType.h
  lldb/include/lldb/Symbol/TypeSystem.h
  lldb/source/API/SBType.cpp
  lldb/source/Core/ValueObject.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  lldb/source/Symbol/CompilerType.cpp
  lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py
  lldb/unittests/Symbol/TestTypeSystemClang.cpp

Index: lldb/unittests/Symbol/TestTypeSystemClang.cpp
===
--- lldb/unittests/Symbol/TestTypeSystemClang.cpp
+++ lldb/unittests/Symbol/TestTypeSystemClang.cpp
@@ -394,7 +394,7 @@
 
   RecordDecl *empty_base_decl = TypeSystemClang::GetAsRecordDecl(empty_base);
   EXPECT_NE(nullptr, empty_base_decl);
-  EXPECT_FALSE(TypeSystemClang::RecordHasFields(empty_base_decl));
+  EXPECT_FALSE(m_ast->RecordHasFields(empty_base_decl));
 
   // Test that a record with direct fields returns true
   CompilerType non_empty_base = m_ast->CreateRecordType(
@@ -408,7 +408,7 @@
   TypeSystemClang::GetAsRecordDecl(non_empty_base);
   EXPECT_NE(nullptr, non_empty_base_decl);
   EXPECT_NE(nullptr, non_empty_base_field_decl);
-  EXPECT_TRUE(TypeSystemClang::RecordHasFields(non_empty_base_decl));
+  EXPECT_TRUE(m_ast->RecordHasFields(non_empty_base_decl));
 
   std::vector> bases;
 
@@ -429,10 +429,9 @@
   m_ast->GetAsCXXRecordDecl(empty_derived.GetOpaqueQualType());
   RecordDecl *empty_derived_non_empty_base_decl =
   TypeSystemClang::GetAsRecordDecl(empty_derived);
-  EXPECT_EQ(1u, TypeSystemClang::GetNumBaseClasses(
+  EXPECT_EQ(1u, m_ast->GetNumBaseClasses(
 empty_derived_non_empty_base_cxx_decl, false));
-  EXPECT_TRUE(
-  TypeSystemClang::RecordHasFields(empty_derived_non_empty_base_decl));
+  EXPECT_TRUE(m_ast->RecordHasFields(empty_derived_non_empty_base_decl));
 
   // Test that a record with no direct fields, but fields in a virtual base
   // returns true
@@ -452,10 +451,10 @@
   m_ast->GetAsCXXRecordDecl(empty_derived2.GetOpaqueQualType());
   RecordDecl *empty_derived_non_empty_vbase_decl =
   TypeSystemClang::GetAsRecordDecl(empty_derived2);
-  EXPECT_EQ(1u, TypeSystemClang::GetNumBaseClasses(
+  EXPECT_EQ(1u, m_ast->GetNumBaseClasses(
 empty_derived_non_empty_vbase_cxx_decl, false));
   EXPECT_TRUE(
-  TypeSystemClang::RecordHasFields(empty_derived_non_empty_vbase_decl));
+  m_ast->RecordHasFields(empty_derived_non_empty_vbase_decl));
 }
 
 TEST_F(TestTypeSystemClang, TemplateArguments) {
@@ -969,4 +968,3 @@
   ModuleSP module = t.GetExeModule();
   EXPECT_EQ(module.get(), nullptr);
 }
-
Index: lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py
===
--- lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py
+++ lldb/test/API/functionalities/limit-debug-info/TestLimitDebugInfo.py
@@ -16,10 +16,12 @@
 type_ = exe.FindFirstType(name)
 self.trace("type_: %s"%type_)
 self.assertTrue(type_)
+self.assertTrue(type_.IsTypeComplete())
 base = type_.GetDirectBaseClassAtIndex(0).GetType()
 self.trace("base:%s"%base)
 self.assertTrue(base)
 self.assertEquals(base.GetNumberOfFields(), 0)
+self.assertFalse(base.IsTypeComplete())
 
 def _check_debug_info_is_limited(self, target):
 # Without other shared libraries we should only see the member declared
@@ -28,6 +30,100 @@
 self._check_type(target, "InheritsFromOne")
 self._check_type(target, "InheritsFromTwo")
 
+def _check_incomplete_frame_variable_output(self):
+# Check that the display of the "frame variable" output identifies the
+# incomplete types. Currently the expression parser will find the real
+# definition for a type when running an expression for any forcefully
+# completed types, but "frame variable" won't. I hope to fix this with
+# a follow up patch, but if we don't find the actual definition we
+# should clearly show this to the user by showing which types were
+# incomplete. So this will test verifies the expected output for such
+# types. We also need to verify the standard "frame variable" output
+# which will inline all of the members on one line, versus the full
+# output from "frame variable --raw" and a few other opti

[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Zequan Wu via Phabricator via lldb-commits
zequanwu added a comment.

In D137217#3945136 , @glandium wrote:

> Still broken:
>
>   task 2022-11-22T22:09:00.912Z] /usr/lib/llvm-11/bin/clang++ 
> --sysroot=/builds/worker/fetches/sysroot -DGTEST_HAS_RTTI=0 -D_GNU_SOURCE 
> -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS 
> -Itools/gold -I/builds/worker/fetches/llvm-project/llvm/tools/gold -Iinclude 
> -I/builds/worker/fetches/llvm-project/llvm/include -fPIC 
> -fvisibility-inlines-hidden -Werror=date-time 
> -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter 
> -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic 
> -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough 
> -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor 
> -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion 
> -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color 
> -ffunction-sections -fdata-sections -O3 -DNDEBUG -fPIC  -fno-exceptions 
> -fno-rtti -std=c++17 -MD -MT 
> tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o -MF 
> tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o.d -o 
> tools/gold/CMakeFiles/LLVMgold.dir/gold-plugin.cpp.o -c 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp
>   [task 2022-11-22T22:09:00.912Z] 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp::18: 
> error: no viable conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'llvm::AddStreamFn' (aka 
> 'function> (unsigned int, const 
> llvm::Twine &)>')
>   [task 2022-11-22T22:09:00.912Z]   check(Lto->run(AddStream, Cache));
>   [task 2022-11-22T22:09:00.912Z]  ^
>   [task 2022-11-22T22:09:00.912Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:421:7:
>  note: candidate constructor not viable: no known conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'std::nullptr_t' (aka 'nullptr_t') for 1st argument
>   [task 2022-11-22T22:09:00.912Z]   function(nullptr_t) noexcept
>   [task 2022-11-22T22:09:00.912Z]   ^
>   [task 2022-11-22T22:09:00.912Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:432:7:
>  note: candidate constructor not viable: no known conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'const 
> std::function std::default_delete>> (unsigned int, const 
> llvm::Twine &)> &' for 1st argument
>   [task 2022-11-22T22:09:00.912Z]   function(const function& __x);
>   [task 2022-11-22T22:09:00.912Z]   ^
>   [task 2022-11-22T22:09:00.912Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:441:7:
>  note: candidate constructor not viable: no known conversion from '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20)' 
> to 'std::function std::default_delete>> (unsigned int, const 
> llvm::Twine &)> &&' for 1st argument
>   [task 2022-11-22T22:09:00.912Z]   function(function&& __x) noexcept : 
> _Function_base()
>   [task 2022-11-22T22:09:00.913Z]   ^
>   [task 2022-11-22T22:09:00.913Z] 
> /builds/worker/fetches/sysroot/usr/lib/gcc/x86_64-linux-gnu/7.5.0/../../../../include/c++/7.5.0/bits/std_function.h:465:2:
>  note: candidate template ignored: substitution failure [with _Functor = 
> (lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20), 
> $1 = void]: no type named 'type' in 'std::result_of<(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1094:20) 
> &(unsigned int, const llvm::Twine &)>'
>   [task 2022-11-22T22:09:00.913Z] function(_Functor);
>   [task 2022-11-22T22:09:00.913Z] ^
>   [task 2022-11-22T22:09:00.913Z] 
> /builds/worker/fetches/llvm-project/llvm/include/llvm/LTO/LTO.h:278:25: note: 
> passing argument to parameter 'AddStream' here
>   [task 2022-11-22T22:09:00.913Z]   Error run(AddStreamFn AddStream, 
> FileCache Cache = nullptr);
>   [task 2022-11-22T22:09:00.913Z] ^
>   [task 2022-11-22T22:09:00.913Z] 1 error generated.

Oh, sorry, I missed another place. Hope this 
 will fix 
it.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Mike Hommey via Phabricator via lldb-commits
glandium added a comment.

Almost there, but not quite:

  [task 2022-11-22T23:55:36.341Z] 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1106:6: 
error: no matching function for call to object of type '(lambda at 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1095:7)'
  [task 2022-11-22T23:55:36.341Z] *AddStream(Task)->OS << MB->getBuffer();
  [task 2022-11-22T23:55:36.341Z]  ^
  [task 2022-11-22T23:55:36.341Z] 
/builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1095:7: 
note: candidate function not viable: requires 2 arguments, but 1 was provided
  [task 2022-11-22T23:55:36.341Z]   [&](size_t Task,
  [task 2022-11-22T23:55:36.341Z]   ^
  [task 2022-11-22T23:55:36.341Z] 1 error generated.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D137217: [LTO][COFF] Use bitcode file names in lto native object file names.

2022-11-22 Thread Fangrui Song via Phabricator via lldb-commits
MaskRay added a comment.

In D137217#3945366 , @glandium wrote:

> Almost there, but not quite:
>
>   [task 2022-11-22T23:55:36.341Z] 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1106:6: 
> error: no matching function for call to object of type '(lambda at 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1095:7)'
>   [task 2022-11-22T23:55:36.341Z] *AddStream(Task)->OS << MB->getBuffer();
>   [task 2022-11-22T23:55:36.341Z]  ^
>   [task 2022-11-22T23:55:36.341Z] 
> /builds/worker/fetches/llvm-project/llvm/tools/gold/gold-plugin.cpp:1095:7: 
> note: candidate function not viable: requires 2 arguments, but 1 was provided
>   [task 2022-11-22T23:55:36.341Z]   [&](size_t Task,
>   [task 2022-11-22T23:55:36.341Z]   ^
>   [task 2022-11-22T23:55:36.341Z] 1 error generated.

`ninja LLVMgold.so` works for me now. I think @zequanwu fixed this in 
10a43c4641c20e0a50edc0ff99915c837a507cc1 
/5d140dc2c0f3068fae7127b85df861c420848078
 
/d23b63ceccfe526c3a9b17d35032b3666e6816a1
 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137217

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


[Lldb-commits] [PATCH] D138536: Fix TestVSCode_launch.py test failure

2022-11-22 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan created this revision.
yinghuitan added reviewers: clayborg, GeorgeHuyubo, kusmour.
Herald added a project: All.
yinghuitan requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

We changed the output to telemetry category but the test code did not change. 
This patch fixes the test failure.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138536

Files:
  lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
  lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py


Index: lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -89,8 +89,8 @@
 self.build_and_launch(program, runToBinaryEntry=True)
 self.set_function_breakpoints(['main'])
 stopped_events = self.continue_to_next_stop()
-console_output = self.get_console()
-self.assertIn("Process stopped successfully at the binary's entry 
point", console_output)
+telemetry = self.get_telemetry()
+self.assertIn("Process stopped successfully at the binary's entry 
point", telemetry)
 
 for stopped_event in stopped_events:
 if 'body' in stopped_event:
Index: 
lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -188,6 +188,9 @@
 def get_console(self, timeout=0.0):
 return self.vscode.get_output('console', timeout=timeout)
 
+def get_telemetry(self, timeout=0.0):
+return self.vscode.get_output('telemetry', timeout=timeout)
+
 def collect_console(self, duration):
 return self.vscode.collect_output('console', duration=duration)
 


Index: lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
===
--- lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
+++ lldb/test/API/tools/lldb-vscode/launch/TestVSCode_launch.py
@@ -89,8 +89,8 @@
 self.build_and_launch(program, runToBinaryEntry=True)
 self.set_function_breakpoints(['main'])
 stopped_events = self.continue_to_next_stop()
-console_output = self.get_console()
-self.assertIn("Process stopped successfully at the binary's entry point", console_output)
+telemetry = self.get_telemetry()
+self.assertIn("Process stopped successfully at the binary's entry point", telemetry)
 
 for stopped_event in stopped_events:
 if 'body' in stopped_event:
Index: lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
===
--- lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
+++ lldb/packages/Python/lldbsuite/test/tools/lldb-vscode/lldbvscode_testcase.py
@@ -188,6 +188,9 @@
 def get_console(self, timeout=0.0):
 return self.vscode.get_output('console', timeout=timeout)
 
+def get_telemetry(self, timeout=0.0):
+return self.vscode.get_output('telemetry', timeout=timeout)
+
 def collect_console(self, duration):
 return self.vscode.collect_output('console', duration=duration)
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D135798: Add runToBinaryEntry option for lldb-vscode

2022-11-22 Thread jeffrey tan via Phabricator via lldb-commits
yinghuitan added a comment.

The test failure is fixed in https://reviews.llvm.org/D138536


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D135798

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


[Lldb-commits] [PATCH] D138539: Use std::nullopt_t instead of NoneType (NFC)

2022-11-22 Thread Kazu Hirata via Phabricator via lldb-commits
kazu created this revision.
Herald added subscribers: Moerafaat, zero9178, bzcheeseman, ayermolo, sdasgup3, 
carlosgalvezp, wenzhicui, wrengr, cota, teijeong, rdzhabarov, tatianashp, 
msifontes, jurahul, Kayjukh, grosul1, Joonsoo, liufengdb, aartbik, mgester, 
arpith-jacob, antiagainst, shauheen, rriddle, mehdi_amini, kadircet, arphaman, 
hiraditya.
Herald added a reviewer: rriddle.
Herald added a reviewer: rafauler.
Herald added a reviewer: Amir.
Herald added a reviewer: maksfb.
Herald added a reviewer: NoQ.
Herald added a reviewer: njames93.
Herald added a project: All.
kazu requested review of this revision.
Herald added subscribers: cfe-commits, llvm-commits, lldb-commits, yota9, 
stephenneuendorffer, nicolasvasilache.
Herald added projects: clang, LLDB, MLIR, LLVM, clang-tools-extra.

This patch replaces those occurrences of NoneType that would trigger
an error if the definition of NoneType were missing in None.h.

To keep this patch focused, I am deliberately not replacing None with
std::nullopt in this patch or updating comments.  They will be
addressed in subsequent patches.

This is part of an effort to migrate from llvm::Optional to
std::optional:

https://discourse.llvm.org/t/deprecating-llvm-optional-x-hasvalue-getvalue-getvalueor/63716


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D138539

Files:
  bolt/lib/Profile/DataAggregator.cpp
  bolt/lib/Profile/YAMLProfileWriter.cpp
  clang-tools-extra/clang-tidy/utils/RenamerClangTidyCheck.cpp
  clang-tools-extra/clangd/support/ThreadsafeFS.h
  clang/include/clang/Analysis/Analyses/PostOrderCFGView.h
  clang/include/clang/Basic/DirectoryEntry.h
  clang/include/clang/Basic/FileEntry.h
  clang/include/clang/Sema/Template.h
  clang/lib/AST/ExprConstant.cpp
  clang/lib/Tooling/Transformer/Parsing.cpp
  lldb/include/lldb/Utility/Timeout.h
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.cpp
  lldb/source/Plugins/TypeSystem/Clang/TypeSystemClang.h
  llvm/include/llvm/ADT/ArrayRef.h
  llvm/include/llvm/ADT/Optional.h
  llvm/include/llvm/ADT/StringMapEntry.h
  llvm/include/llvm/ADT/StringSet.h
  llvm/include/llvm/FuzzMutate/OpDescriptor.h
  llvm/include/llvm/Support/SMLoc.h
  llvm/lib/CodeGen/MIRParser/MILexer.cpp
  llvm/lib/Support/Optional.cpp
  mlir/include/mlir/IR/OpDefinition.h
  mlir/include/mlir/IR/OperationSupport.h
  mlir/include/mlir/Support/Timing.h
  mlir/lib/Support/Timing.cpp

Index: mlir/lib/Support/Timing.cpp
===
--- mlir/lib/Support/Timing.cpp
+++ mlir/lib/Support/Timing.cpp
@@ -50,7 +50,7 @@
   llvm::sys::SmartRWMutex identifierMutex;
 
   /// A thread local cache of identifiers to reduce lock contention.
-  ThreadLocalCache *>>
+  ThreadLocalCache *>>
   localIdentifierCache;
 
   TimingManagerImpl() : identifiers(identifierAllocator) {}
Index: mlir/include/mlir/Support/Timing.h
===
--- mlir/include/mlir/Support/Timing.h
+++ mlir/include/mlir/Support/Timing.h
@@ -43,7 +43,7 @@
 /// This is a POD type with pointer size, so it should be passed around by
 /// value. The underlying data is owned by the `TimingManager`.
 class TimingIdentifier {
-  using EntryType = llvm::StringMapEntry;
+  using EntryType = llvm::StringMapEntry;
 
 public:
   TimingIdentifier(const TimingIdentifier &) = default;
Index: mlir/include/mlir/IR/OperationSupport.h
===
--- mlir/include/mlir/IR/OperationSupport.h
+++ mlir/include/mlir/IR/OperationSupport.h
@@ -490,7 +490,7 @@
   using size_type = size_t;
 
   NamedAttrList() : dictionarySorted({}, true) {}
-  NamedAttrList(llvm::NoneType none) : NamedAttrList() {}
+  NamedAttrList(std::nullopt_t none) : NamedAttrList() {}
   NamedAttrList(ArrayRef attributes);
   NamedAttrList(DictionaryAttr attributes);
   NamedAttrList(const_iterator inStart, const_iterator inEnd);
@@ -759,7 +759,7 @@
 class OpPrintingFlags {
 public:
   OpPrintingFlags();
-  OpPrintingFlags(llvm::NoneType) : OpPrintingFlags() {}
+  OpPrintingFlags(std::nullopt_t) : OpPrintingFlags() {}
 
   /// Enables the elision of large elements attributes by printing a lexically
   /// valid but otherwise meaningless form instead of the element data. The
Index: mlir/include/mlir/IR/OpDefinition.h
===
--- mlir/include/mlir/IR/OpDefinition.h
+++ mlir/include/mlir/IR/OpDefinition.h
@@ -41,7 +41,7 @@
   OptionalParseResult(ParseResult result) : impl(result) {}
   OptionalParseResult(const InFlightDiagnostic &)
   : OptionalParseResult(failure()) {}
-  OptionalParseResult(llvm::NoneType) : impl(llvm::None) {}
+  OptionalParseResult(std::nullopt_t) : impl(llvm::None) {}
 
   /// Returns true if we contain a valid ParseResult value.
   bool has_value() const { return impl.has_value(); }
Index: llvm/lib/Support/Optional.cpp
==