[Lldb-commits] [lldb] aaa9f40 - [lldb/test] Replace gnu-style-compression.cpp with a yaml file

2022-01-27 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-27T10:05:05+01:00
New Revision: aaa9f40e3fd2dd081e965d39f10649bcd8bf1d21

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

LOG: [lldb/test] Replace gnu-style-compression.cpp with a yaml file

In D117744, llvm removed writing support for this format, breaking the
test. We may eventually want to remove reading support as well, but for
now I have converted the test to a yaml file to maintain coverage.

Added: 
lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml

Modified: 


Removed: 
lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.cpp



diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.cpp 
b/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.cpp
deleted file mode 100644
index 9dc87303ba9fd..0
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-// REQUIRES: zlib
-
-// RUN: %clang %s -target x86_64-pc-linux -g -gsplit-dwarf -c -o %t \
-// RUN:   -Wa,--compress-debug-sections=zlib-gnu
-// RUN: %lldb %t -o "target var s a" -b | FileCheck %s
-
-// CHECK: (const short) s = 47
-// CHECK: (const A) a = (a = 42)
-
-struct A {
-  long a = 42;
-};
-extern constexpr short s = 47;
-extern constexpr A a{};

diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml 
b/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
new file mode 100644
index 0..d037cf474232e
--- /dev/null
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
@@ -0,0 +1,56 @@
+## NB: This is a yaml file because llvm gnu-style writing support in 14.0
+## (2022, D117744). In due time we may want to remove it from lldb as well.
+
+## Debug info generated from the following sources using clang-13
+## struct A {
+##  long a = 42;
+## };
+## extern constexpr short s = 47;
+## extern constexpr A a{};
+
+# REQUIRES: zlib
+
+# RUN: yaml2obj %s > %t
+# RUN: %lldb %t -o "target var s a" -b | FileCheck %s
+
+# CHECK: (const short) s = 47
+# CHECK: (const A) a = (a = 42)
+
+--- !ELF
+FileHeader:
+  Class:   ELFCLASS64
+  Data:ELFDATA2LSB
+  Type:ET_EXEC
+  Machine: EM_X86_64
+  Entry:   0x401000
+Sections:
+  - Name:.rodata
+Type:SHT_PROGBITS
+Flags:   [ SHF_ALLOC ]
+Address: 0x401000
+AddressAlign:0x8
+Offset:  0x1000
+Content: 2F002A00
+  - Name:.debug_info
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 
240008011A00C088361D3BC5B7B7
+  - Name:.debug_abbrev
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 01110010171B0EB44219B0420EB14207B3421700
+  - Name:.debug_line
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: 
710004006B00010101FB0E0D00010101010001012F686F6D652F706176656C6F2F6C6C6D6F6E6F2F6C6C64622F746573742F5368656C6C2F53796D626F6C46696C652F44574152462F7838362F676E752D7374796C652D636F6D7072657373696F6E2E63707100
+  - Name:.zdebug_str
+Type:SHT_PROGBITS
+Flags:   [ SHF_MERGE, SHF_STRINGS ]
+AddressAlign:0x1
+EntSize: 0x1
+Content: 
5A4C49420084789C75C9310E82401005502E04BF33B62686D6440A6B979DC826B3FC89332B727BB980ED7B585805F6FC8812AA48AD68062D3AFC1B04A97E504E08F1C0B4C8F1D35E13752C2AB83E2EF711DFF309B716D602AFB5F51EBB4A3FB3DA5BDC0BD761361BF2C6EE0781C8302C
+  - Name:.debug_addr
+Type:SHT_PROGBITS
+AddressAlign:0x1
+Content: '001048104000'
+...



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


[Lldb-commits] [lldb] 7afd052 - [lldb/DWARF] Make manual dwarf index deterministic

2022-01-27 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-27T10:05:05+01:00
New Revision: 7afd05211282c7516f0e9b3e7743b5dcc2605491

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

LOG: [lldb/DWARF] Make manual dwarf index deterministic

Currently, running the test suite with LLVM_ENABLE_EXPENSIVE_CHECKS=On
causes a couple of tests to fail. This happens because they expect a
certain order of variables (all of them happen to use the "target
variable" command, but other lookup functions should suffer from the
same issues), all of which have the same name. Sort algorithms often
preserve the order of equivalent elements (in this case the entries in
the NameToDIE map), but that not guaranteed, and
LLVM_ENABLE_EXPENSIVE_CHECKS stresses that by pre-shuffling all inputs
before sorting.

While this could easily be fixed by relaxing the test expectations,
having a deterministic output seems like a worthwhile goal,
particularly, as this could have bigger consequences than just a
different print order -- in some cases we just pick the first entry that
we find, whatever that is. Therefore this patch makes the sort
deterministic by introducing another sort key -- UniqueCString::Sort
gets a value comparator functor, which can be used to sort elements with
the same name -- in the DWARF case we use DIERef::operator<, which
roughly equals the order in which the entries appear in the debug info,
and matches the current "accidental" order.

Using a extra functor seemed preferable to using stable_sort, as the
latter allocates extra O(n) of temporary memory.

I observed no difference in debug info parsing speed with this patch
applied.

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

Added: 


Modified: 
lldb/include/lldb/Core/UniqueCStringMap.h
lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
lldb/unittests/Core/UniqueCStringMapTest.cpp

Removed: 




diff  --git a/lldb/include/lldb/Core/UniqueCStringMap.h 
b/lldb/include/lldb/Core/UniqueCStringMap.h
index e37027a0150a3..9c8b8081d374e 100644
--- a/lldb/include/lldb/Core/UniqueCStringMap.h
+++ b/lldb/include/lldb/Core/UniqueCStringMap.h
@@ -165,7 +165,21 @@ template  class UniqueCStringMap {
   //  my_map.Append (UniqueCStringMap::Entry(GetName(...), GetValue(...)));
   // }
   // my_map.Sort();
-  void Sort() { llvm::sort(m_map.begin(), m_map.end(), Compare()); }
+  void Sort() {
+Sort([](const T &, const T &) { return false; });
+  }
+
+  /// Sort contents of this map using the provided comparator to break ties for
+  /// entries with the same string value.
+  template  void Sort(TCompare tc) {
+Compare c;
+llvm::sort(m_map, [&](const Entry &lhs, const Entry &rhs) -> bool {
+  int result = c.ThreeWay(lhs.cstring, rhs.cstring);
+  if (result == 0)
+return tc(lhs.value, rhs.value);
+  return result < 0;
+});
+  }
 
   // Since we are using a vector to contain our items it will always double its
   // memory consumption as things are added to the vector, so if you intend to
@@ -205,13 +219,24 @@ template  class UniqueCStringMap {
   return operator()(lhs, rhs.cstring);
 }
 
+bool operator()(ConstString lhs, ConstString rhs) {
+  return ThreeWay(lhs, rhs) < 0;
+}
+
 // This is only for uniqueness, not lexicographical ordering, so we can
 // just compare pointers. *However*, comparing pointers from 
diff erent
 // allocations is UB, so we need compare their integral values instead.
-bool operator()(ConstString lhs, ConstString rhs) {
-  return uintptr_t(lhs.GetCString()) < uintptr_t(rhs.GetCString());
+int ThreeWay(ConstString lhs, ConstString rhs) {
+  auto lhsint = uintptr_t(lhs.GetCString());
+  auto rhsint = uintptr_t(rhs.GetCString());
+  if (lhsint < rhsint)
+return -1;
+  if (lhsint > rhsint)
+return 1;
+  return 0;
 }
   };
+
   collection m_map;
 };
 

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
index 33e2695f403a2..413920f33619e 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -21,7 +21,7 @@ using namespace lldb;
 using namespace lldb_private;
 
 void NameToDIE::Finalize() {
-  m_map.Sort();
+  m_map.Sort(std::less());
   m_map.SizeToFit();
 }
 

diff  --git a/lldb/unittests/Core/UniqueCStringMapTest.cpp 
b/lldb/unittests/Core/UniqueCStringMapTest.cpp
index 25bc28538e65f..aa1cdbadc958e 100644
--- a/lldb/unittests/Core/UniqueCStringMapTest.cpp
+++ b/lldb/unittests/Core/UniqueCStringMapTest.cpp
@@ -51,3 +51,18 @@ TEST(UniqueCStringMap, NoDefaultConstructor) {
   EXPECT_THAT(Map.GetValues(Bar, Values), 0);
   EXPECT_THAT(Values, testing::IsEmpty());
 }
+
+TEST(UniqueCStringMap, Va

[Lldb-commits] [lldb] 6730df4 - [lldb] Convert ProcessWindowsLog to the new API

2022-01-27 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-27T10:05:05+01:00
New Revision: 6730df4779cd2f6328fe8cb6dec1dced8cabe4c5

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

LOG: [lldb] Convert ProcessWindowsLog to the new API

Added: 


Modified: 
lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
lldb/source/Plugins/Process/Windows/Common/NativeProcessWindows.cpp

lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_WoW64.cpp

lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm.cpp

lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_arm64.cpp

lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_i386.cpp

lldb/source/Plugins/Process/Windows/Common/NativeRegisterContextWindows_x86_64.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessDebugger.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindows.cpp
lldb/source/Plugins/Process/Windows/Common/ProcessWindowsLog.h
lldb/source/Plugins/Process/Windows/Common/RegisterContextWindows.cpp

lldb/source/Plugins/Process/Windows/Common/x86/RegisterContextWindows_x86.cpp

Removed: 




diff  --git a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp 
b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
index 87c17d44c1869..a78ca2aabe134 100644
--- a/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
+++ b/lldb/source/Plugins/Process/Windows/Common/DebuggerThread.cpp
@@ -64,7 +64,7 @@ DebuggerThread::DebuggerThread(DebugDelegateSP debug_delegate)
 DebuggerThread::~DebuggerThread() { ::CloseHandle(m_debugging_ended_event); }
 
 Status DebuggerThread::DebugLaunch(const ProcessLaunchInfo &launch_info) {
-  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  Log *log = GetLog(WindowsLog::Process);
   LLDB_LOG(log, "launching '{0}'", launch_info.GetExecutableFile().GetPath());
 
   Status result;
@@ -83,7 +83,7 @@ Status DebuggerThread::DebugLaunch(const ProcessLaunchInfo 
&launch_info) {
 
 Status DebuggerThread::DebugAttach(lldb::pid_t pid,
const ProcessAttachInfo &attach_info) {
-  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  Log *log = GetLog(WindowsLog::Process);
   LLDB_LOG(log, "attaching to '{0}'", pid);
 
   Status result;
@@ -122,7 +122,7 @@ lldb::thread_result_t 
DebuggerThread::DebuggerThreadLaunchRoutine(
   // until after the thread routine has exited.
   std::shared_ptr this_ref(shared_from_this());
 
-  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  Log *log = GetLog(WindowsLog::Process);
   LLDB_LOG(log, "preparing to launch '{0}' on background thread.",
launch_info.GetExecutableFile().GetPath());
 
@@ -149,7 +149,7 @@ lldb::thread_result_t 
DebuggerThread::DebuggerThreadAttachRoutine(
   // until after the thread routine has exited.
   std::shared_ptr this_ref(shared_from_this());
 
-  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  Log *log = GetLog(WindowsLog::Process);
   LLDB_LOG(log, "preparing to attach to process '{0}' on background thread.",
pid);
 
@@ -172,7 +172,7 @@ Status DebuggerThread::StopDebugging(bool terminate) {
 
   lldb::pid_t pid = m_process.GetProcessId();
 
-  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS);
+  Log *log = GetLog(WindowsLog::Process);
   LLDB_LOG(log, "terminate = {0}, inferior={1}.", terminate, pid);
 
   // Set m_is_shutting_down to true if it was false.  Return if it was already
@@ -246,8 +246,7 @@ void DebuggerThread::ContinueAsyncException(ExceptionResult 
result) {
   if (!m_active_exception.get())
 return;
 
-  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_PROCESS |
-WINDOWS_LOG_EXCEPTION);
+  Log *log = GetLog(WindowsLog::Process | WindowsLog::Exception);
   LLDB_LOG(log, "broadcasting for inferior process {0}.",
m_process.GetProcessId());
 
@@ -265,7 +264,7 @@ void DebuggerThread::FreeProcessHandles() {
 }
 
 void DebuggerThread::DebugLoop() {
-  Log *log = ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_EVENT);
+  Log *log = GetLog(WindowsLog::Event);
   DEBUG_EVENT dbe = {};
   bool should_debug = true;
   LLDB_LOGV(log, "Entering WaitForDebugEvent loop");
@@ -346,8 +345,7 @@ void DebuggerThread::DebugLoop() {
 ExceptionResult
 DebuggerThread::HandleExceptionEvent(const EXCEPTION_DEBUG_INFO &info,
  DWORD thread_id) {
-  Log *log =
-  ProcessWindowsLog::GetLogIfAny(WINDOWS_LOG_EVENT | 
WINDOWS_LOG_EXCEPTION);
+  Log *log = GetLog(WindowsLog::Event | WindowsLog::Exception);
   if (m_is_shutting_down) {
 // A breakpoint that occurs while `m_pid_to_detach` is non-ze

[Lldb-commits] [PATCH] D118251: [lldb/DWARF] Make manual dwarf index deterministic

2022-01-27 Thread Pavel Labath via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG7afd05211282: [lldb/DWARF] Make manual dwarf index 
deterministic (authored by labath).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118251

Files:
  lldb/include/lldb/Core/UniqueCStringMap.h
  lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
  lldb/unittests/Core/UniqueCStringMapTest.cpp


Index: lldb/unittests/Core/UniqueCStringMapTest.cpp
===
--- lldb/unittests/Core/UniqueCStringMapTest.cpp
+++ lldb/unittests/Core/UniqueCStringMapTest.cpp
@@ -51,3 +51,18 @@
   EXPECT_THAT(Map.GetValues(Bar, Values), 0);
   EXPECT_THAT(Values, testing::IsEmpty());
 }
+
+TEST(UniqueCStringMap, ValueCompare) {
+  UniqueCStringMap Map;
+
+  ConstString Foo("foo");
+
+  Map.Append(Foo, 0);
+  Map.Append(Foo, 5);
+  Map.Append(Foo, -5);
+
+  Map.Sort(std::less());
+  std::vector Values;
+  EXPECT_THAT(Map.GetValues(Foo, Values), 3);
+  EXPECT_THAT(Values, testing::ElementsAre(-5, 0, 5));
+}
Index: lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -21,7 +21,7 @@
 using namespace lldb_private;
 
 void NameToDIE::Finalize() {
-  m_map.Sort();
+  m_map.Sort(std::less());
   m_map.SizeToFit();
 }
 
Index: lldb/include/lldb/Core/UniqueCStringMap.h
===
--- lldb/include/lldb/Core/UniqueCStringMap.h
+++ lldb/include/lldb/Core/UniqueCStringMap.h
@@ -165,7 +165,21 @@
   //  my_map.Append (UniqueCStringMap::Entry(GetName(...), GetValue(...)));
   // }
   // my_map.Sort();
-  void Sort() { llvm::sort(m_map.begin(), m_map.end(), Compare()); }
+  void Sort() {
+Sort([](const T &, const T &) { return false; });
+  }
+
+  /// Sort contents of this map using the provided comparator to break ties for
+  /// entries with the same string value.
+  template  void Sort(TCompare tc) {
+Compare c;
+llvm::sort(m_map, [&](const Entry &lhs, const Entry &rhs) -> bool {
+  int result = c.ThreeWay(lhs.cstring, rhs.cstring);
+  if (result == 0)
+return tc(lhs.value, rhs.value);
+  return result < 0;
+});
+  }
 
   // Since we are using a vector to contain our items it will always double its
   // memory consumption as things are added to the vector, so if you intend to
@@ -205,13 +219,24 @@
   return operator()(lhs, rhs.cstring);
 }
 
+bool operator()(ConstString lhs, ConstString rhs) {
+  return ThreeWay(lhs, rhs) < 0;
+}
+
 // This is only for uniqueness, not lexicographical ordering, so we can
 // just compare pointers. *However*, comparing pointers from different
 // allocations is UB, so we need compare their integral values instead.
-bool operator()(ConstString lhs, ConstString rhs) {
-  return uintptr_t(lhs.GetCString()) < uintptr_t(rhs.GetCString());
+int ThreeWay(ConstString lhs, ConstString rhs) {
+  auto lhsint = uintptr_t(lhs.GetCString());
+  auto rhsint = uintptr_t(rhs.GetCString());
+  if (lhsint < rhsint)
+return -1;
+  if (lhsint > rhsint)
+return 1;
+  return 0;
 }
   };
+
   collection m_map;
 };
 


Index: lldb/unittests/Core/UniqueCStringMapTest.cpp
===
--- lldb/unittests/Core/UniqueCStringMapTest.cpp
+++ lldb/unittests/Core/UniqueCStringMapTest.cpp
@@ -51,3 +51,18 @@
   EXPECT_THAT(Map.GetValues(Bar, Values), 0);
   EXPECT_THAT(Values, testing::IsEmpty());
 }
+
+TEST(UniqueCStringMap, ValueCompare) {
+  UniqueCStringMap Map;
+
+  ConstString Foo("foo");
+
+  Map.Append(Foo, 0);
+  Map.Append(Foo, 5);
+  Map.Append(Foo, -5);
+
+  Map.Sort(std::less());
+  std::vector Values;
+  EXPECT_THAT(Map.GetValues(Foo, Values), 3);
+  EXPECT_THAT(Values, testing::ElementsAre(-5, 0, 5));
+}
Index: lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/NameToDIE.cpp
@@ -21,7 +21,7 @@
 using namespace lldb_private;
 
 void NameToDIE::Finalize() {
-  m_map.Sort();
+  m_map.Sort(std::less());
   m_map.SizeToFit();
 }
 
Index: lldb/include/lldb/Core/UniqueCStringMap.h
===
--- lldb/include/lldb/Core/UniqueCStringMap.h
+++ lldb/include/lldb/Core/UniqueCStringMap.h
@@ -165,7 +165,21 @@
   //  my_map.Append (UniqueCStringMap::Entry(GetName(...), GetValue(...)));
   // }
   // my_map.Sort();
-  void Sort() { llvm::sort(m_map.begin(), m_map.end(), Compare()); }
+  void Sort() {
+Sort([](const T &, const T &) { return false; });
+  }
+
+  /// Sort contents of this 

[Lldb-commits] [lldb] 4cd8877 - [lldb/test] Fix gnu-style-compression.yaml

2022-01-27 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-27T10:23:21+01:00
New Revision: 4cd8877a3453d5ee4289348db45d89b8e249cf72

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

LOG: [lldb/test] Fix gnu-style-compression.yaml

In the rush to get the bot green, I did not realize I was building the
file with -gsplit-dwarf, and therefore the yaml ended up referring to a
file I did not check it.

This rebuilds the file without split dwarf.

Added: 


Modified: 
lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml

Removed: 




diff  --git a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml 
b/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
index d037cf474232..069753835474 100644
--- a/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
+++ b/lldb/test/Shell/SymbolFile/DWARF/x86/gnu-style-compression.yaml
@@ -31,26 +31,26 @@ Sections:
 AddressAlign:0x8
 Offset:  0x1000
 Content: 2F002A00
-  - Name:.debug_info
+  - Name:.zdebug_info
 Type:SHT_PROGBITS
 AddressAlign:0x1
-Content: 
240008011A00C088361D3BC5B7B7
+Content: 
5A4C49420077789C2B666060606100010E4610A9C820CA00012640CCE407248C81989197939941C0012CC16C01D2130024589998C280540848011F2733074C4124488E35116C28171B48493E480937505B04488A830100368605A7
   - Name:.debug_abbrev
 Type:SHT_PROGBITS
 AddressAlign:0x1
-Content: 01110010171B0EB44219B0420EB14207B3421700
+Content: 
011101250E1305030E10171B0E023400030E49133F193A0B3B0B02180326004913042400030E3E0B0B0B051301360B030E0B0B3A0B3B0B060D00030E49133A0B3B0B380B00
   - Name:.debug_line
 Type:SHT_PROGBITS
 AddressAlign:0x1
-Content: 
710004006B00010101FB0E0D00010101010001012F686F6D652F706176656C6F2F6C6C6D6F6E6F2F6C6C64622F746573742F5368656C6C2F53796D626F6C46696C652F44574152462F7838362F676E752D7374796C652D636F6D7072657373696F6E2E63707100
-  - Name:.zdebug_str
-Type:SHT_PROGBITS
-Flags:   [ SHF_MERGE, SHF_STRINGS ]
-AddressAlign:0x1
-EntSize: 0x1
-Content: 
5A4C49420084789C75C9310E82401005502E04BF33B62686D6440A6B979DC826B3FC89332B727BB980ED7B585805F6FC8812AA48AD68062D3AFC1B04A97E504E08F1C0B4C8F1D35E13752C2AB83E2EF711DFF309B716D602AFB5F51EBB4A3FB3DA5BDC0BD761361BF2C6EE0781C8302C
-  - Name:.debug_addr
-Type:SHT_PROGBITS
-AddressAlign:0x1
-Content: '001048104000'
+Content: 
3C0004003600010101FB0E0D00010101010001012F746D70676E752D7374796C652D636F6D7072657373696F6E2E63707100
+DWARF:
+  debug_str:
+- clang version 13.0.0
+- '/tmp/gnu-style-compression.cpp'
+- '/tmp/my_working_directory'
+- s
+- short
+- a
+- long int
+- A
 ...



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


[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-27 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/API/SBThread.cpp:1326-1334
+  if (!process.IsValid()) {
+error.SetErrorString("no process");
+return value;
+  }
+  SBTarget target = process.GetTarget();
+  if (!target.IsValid()) {
+error.SetErrorString("unable to get target");

It should be fine to chain these, relying on the fact that the SB methods on an 
empty object will return another empty object.


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

https://reviews.llvm.org/D118055

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


[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-27 Thread Michał Górny via Phabricator via lldb-commits
mgorny added inline comments.



Comment at: lldb/source/API/SBThread.cpp:1326-1334
+  if (!process.IsValid()) {
+error.SetErrorString("no process");
+return value;
+  }
+  SBTarget target = process.GetTarget();
+  if (!target.IsValid()) {
+error.SetErrorString("unable to get target");

labath wrote:
> It should be fine to chain these, relying on the fact that the SB methods on 
> an empty object will return another empty object.
I suppose I could avoid `process` and switch to getting byte order from target 
but tbh I think the explicit error message for lack of process is worth keeping 
the split.


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

https://reviews.llvm.org/D118055

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


[Lldb-commits] [lldb] 3053e14 - [lldb] [Platform] Support synthesizing siginfo_t

2022-01-27 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2022-01-27T13:33:47+01:00
New Revision: 3053e143bef273a2e65519cea15be8f7ce6cd854

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

LOG: [lldb] [Platform] Support synthesizing siginfo_t

Support synthesizing the siginfo_t type from the Platform plugin.
This type is going to be used by LLDB client to process the raw siginfo
data received from lldb-server without the necessity of relying
on target's debug info being present.

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

Added: 
lldb/unittests/Platform/PlatformSiginfoTest.cpp
lldb/unittests/Platform/tools/generate_siginfo.c

Modified: 
lldb/include/lldb/Target/Platform.h
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
lldb/source/Target/Platform.cpp
lldb/unittests/Platform/CMakeLists.txt

Removed: 




diff  --git a/lldb/include/lldb/Target/Platform.h 
b/lldb/include/lldb/Target/Platform.h
index d50badb1e687..4ef6c9d82b1a 100644
--- a/lldb/include/lldb/Target/Platform.h
+++ b/lldb/include/lldb/Target/Platform.h
@@ -863,6 +863,8 @@ class Platform : public PluginInterface {
 return nullptr;
   }
 
+  virtual CompilerType GetSiginfoType(const llvm::Triple &triple);
+
 protected:
   /// Create a list of ArchSpecs with the given OS and a architectures. The
   /// vendor field is left as an "unspecified unknown".

diff  --git a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp 
b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
index 754d06de7cb9..2bf0a44e4a3e 100644
--- a/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
+++ b/lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
@@ -183,3 +183,97 @@ MmapArgList PlatformFreeBSD::GetMmapArgumentList(const 
ArchSpec &arch,
 args.push_back(0);
   return args;
 }
+
+CompilerType PlatformFreeBSD::GetSiginfoType(const llvm::Triple &triple) {
+  if (!m_type_system_up)
+m_type_system_up.reset(new TypeSystemClang("siginfo", triple));
+  TypeSystemClang *ast = m_type_system_up.get();
+
+  // generic types
+  CompilerType int_type = ast->GetBasicType(eBasicTypeInt);
+  CompilerType uint_type = ast->GetBasicType(eBasicTypeUnsignedInt);
+  CompilerType long_type = ast->GetBasicType(eBasicTypeLong);
+  CompilerType voidp_type = ast->GetBasicType(eBasicTypeVoid).GetPointerType();
+
+  // platform-specific types
+  CompilerType &pid_type = int_type;
+  CompilerType &uid_type = uint_type;
+
+  CompilerType sigval_type = ast->CreateRecordType(
+  nullptr, OptionalClangModuleID(), lldb::eAccessPublic, "__lldb_sigval_t",
+  clang::TTK_Union, lldb::eLanguageTypeC);
+  ast->StartTagDeclarationDefinition(sigval_type);
+  ast->AddFieldToRecordType(sigval_type, "sival_int", int_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(sigval_type, "sival_ptr", voidp_type,
+lldb::eAccessPublic, 0);
+  ast->CompleteTagDeclarationDefinition(sigval_type);
+
+  // siginfo_t
+  CompilerType siginfo_type = ast->CreateRecordType(
+  nullptr, OptionalClangModuleID(), lldb::eAccessPublic, 
"__lldb_siginfo_t",
+  clang::TTK_Struct, lldb::eLanguageTypeC);
+  ast->StartTagDeclarationDefinition(siginfo_type);
+  ast->AddFieldToRecordType(siginfo_type, "si_signo", int_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(siginfo_type, "si_errno", int_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(siginfo_type, "si_code", int_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(siginfo_type, "si_pid", pid_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(siginfo_type, "si_uid", uid_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(siginfo_type, "si_status", int_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(siginfo_type, "si_addr", voidp_type,
+lldb::eAccessPublic, 0);
+  ast->AddFieldToRecordType(siginfo_type, "si_value", sigval_type,
+lldb::eAccessPublic, 0);
+
+  // union used to hold the signal data
+  CompilerType union_type = ast->CreateRecordType(
+  nullptr, OptionalClangModuleID(), lldb::eAccessPublic, "",
+  clang::TTK_Union, lldb::eLanguageTypeC);
+  ast->StartTagDeclarationDefinition(union_type);
+
+  ast->AddFieldToRecordType(
+  union_type, "_fault",
+  ast->C

[Lldb-commits] [lldb] 1a8f60f - [lldb] [gdb-remote] Support getting siginfo via API

2022-01-27 Thread Michał Górny via lldb-commits

Author: Michał Górny
Date: 2022-01-27T13:33:47+01:00
New Revision: 1a8f60f5f5b8638a3e8e7fb31ba7ae9e17a7ff2d

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

LOG: [lldb] [gdb-remote] Support getting siginfo via API

Add Thread::GetSiginfo() and SBThread::GetSiginfo() methods to retrieve
the siginfo value from server.

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

Added: 


Modified: 
lldb/bindings/interface/SBThread.i
lldb/include/lldb/API/SBPlatform.h
lldb/include/lldb/API/SBTarget.h
lldb/include/lldb/API/SBThread.h
lldb/include/lldb/API/SBType.h
lldb/include/lldb/Target/Thread.h
lldb/source/API/SBThread.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py

Removed: 




diff  --git a/lldb/bindings/interface/SBThread.i 
b/lldb/bindings/interface/SBThread.i
index d847d38f0d66..ba7f5b3fdf76 100644
--- a/lldb/bindings/interface/SBThread.i
+++ b/lldb/bindings/interface/SBThread.i
@@ -405,6 +405,12 @@ public:
 bool
 SafeToCallFunctions ();
 
+%feature("autodoc","
+Retruns a SBValue object representing the siginfo for the current signal.
+") GetSiginfo;
+lldb::SBValue
+GetSiginfo(SBError &error);
+
 STRING_EXTENSION(SBThread)
 
 #ifdef SWIGPYTHON

diff  --git a/lldb/include/lldb/API/SBPlatform.h 
b/lldb/include/lldb/API/SBPlatform.h
index dcc8a14ff0c1..4f5d04a24e95 100644
--- a/lldb/include/lldb/API/SBPlatform.h
+++ b/lldb/include/lldb/API/SBPlatform.h
@@ -172,6 +172,7 @@ class LLDB_API SBPlatform {
 protected:
   friend class SBDebugger;
   friend class SBTarget;
+  friend class SBThread;
 
   lldb::PlatformSP GetSP() const;
 

diff  --git a/lldb/include/lldb/API/SBTarget.h 
b/lldb/include/lldb/API/SBTarget.h
index abd9ebf07407..9e75b5e503a8 100644
--- a/lldb/include/lldb/API/SBTarget.h
+++ b/lldb/include/lldb/API/SBTarget.h
@@ -875,6 +875,7 @@ class LLDB_API SBTarget {
   friend class SBSection;
   friend class SBSourceManager;
   friend class SBSymbol;
+  friend class SBThread;
   friend class SBValue;
   friend class SBVariablesOptions;
 

diff  --git a/lldb/include/lldb/API/SBThread.h 
b/lldb/include/lldb/API/SBThread.h
index ac1b8407a220..76f794c25d9e 100644
--- a/lldb/include/lldb/API/SBThread.h
+++ b/lldb/include/lldb/API/SBThread.h
@@ -208,6 +208,8 @@ class LLDB_API SBThread {
 
   bool SafeToCallFunctions();
 
+  SBValue GetSiginfo(SBError &error);
+
 private:
   friend class SBBreakpoint;
   friend class SBBreakpointLocation;

diff  --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index 529b4d0eeffc..5885432d0624 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -225,6 +225,7 @@ class SBType {
   friend class SBFunction;
   friend class SBModule;
   friend class SBTarget;
+  friend class SBThread;
   friend class SBTypeEnumMember;
   friend class SBTypeEnumMemberList;
   friend class SBTypeNameSpecifier;

diff  --git a/lldb/include/lldb/Target/Thread.h 
b/lldb/include/lldb/Target/Thread.h
index 587b29eb4c66..f1d4e6c7ef01 100644
--- a/lldb/include/lldb/Target/Thread.h
+++ b/lldb/include/lldb/Target/Thread.h
@@ -22,6 +22,7 @@
 #include "lldb/Utility/CompletionRequest.h"
 #include "lldb/Utility/Event.h"
 #include "lldb/Utility/StructuredData.h"
+#include "lldb/Utility/UnimplementedError.h"
 #include "lldb/Utility/UserID.h"
 #include "lldb/lldb-private.h"
 
@@ -1184,6 +1185,11 @@ class Thread : public 
std::enable_shared_from_this,
 
   lldb::ThreadSP GetCurrentExceptionBacktrace();
 
+  virtual llvm::Expected>
+  GetSiginfo(size_t max_size) const {
+return llvm::make_error();
+  }
+
 protected:
   friend class ThreadPlan;
   friend class ThreadList;

diff  --git a/lldb/source/API/SBThread.cpp b/lldb/source/API/SBThread.cpp
index 46a6c2759140..dcc2a6ed3d18 100644
--- a/lldb/source/API/SBThread.cpp
+++ b/lldb/source/API/SBThread.cpp
@@ -1317,3 +1317,50 @@ lldb_private::Thread *SBThread::operator->() {
 lldb_private::Thread *SBThread::get() {
   return m_opaque_sp->GetThreadSP().get();
 }
+
+SBValue SBThread::GetSiginfo(SBError &error) {
+  LLDB_INSTRUMENT_VA(this, error);
+
+  SBValue value;
+  SBProcess process = GetProcess();
+  if (!process.IsValid()) {
+error.SetErrorString("no process");
+return value;
+  }
+  SBTarget target = process.GetTarget();
+  if (!target.IsValid()) {
+error.SetErrorString("unable to get target");
+return value;
+  }
+  SBPlatform platform = target.GetPlatform();
+  if (!platform.IsValid()) {
+error.SetError

[Lldb-commits] [PATCH] D117707: [lldb] [Platform] Support synthesizing siginfo_t

2022-01-27 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3053e143bef2: [lldb] [Platform] Support synthesizing 
siginfo_t (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D117707

Files:
  lldb/include/lldb/Target/Platform.h
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
  lldb/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
  lldb/source/Plugins/Platform/Linux/PlatformLinux.cpp
  lldb/source/Plugins/Platform/Linux/PlatformLinux.h
  lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.cpp
  lldb/source/Plugins/Platform/NetBSD/PlatformNetBSD.h
  lldb/source/Target/Platform.cpp
  lldb/unittests/Platform/CMakeLists.txt
  lldb/unittests/Platform/PlatformSiginfoTest.cpp
  lldb/unittests/Platform/tools/generate_siginfo.c

Index: lldb/unittests/Platform/tools/generate_siginfo.c
===
--- /dev/null
+++ lldb/unittests/Platform/tools/generate_siginfo.c
@@ -0,0 +1,112 @@
+//===-- generate_siginfo_linux.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
+//
+//===--===//
+
+#include 
+#include 
+#include 
+
+siginfo_t siginfo;
+
+#define P(member)  \
+  printf("   {\"%s\", %zd, %zd},\n", #member,   \
+ offsetof(siginfo_t, member), sizeof(siginfo.member));
+
+// undef annoying "POSIX friendliness" macros
+#undef si_pid
+#undef si_uid
+#undef si_overrun
+#undef si_status
+#undef si_utime
+#undef si_stime
+#undef si_addr
+#undef si_addr_lsb
+#undef si_band
+#undef si_fd
+
+int main() {
+  printf("  ExpectFields(siginfo_type,\n");
+  printf("   {\n");
+
+#if !defined(__NetBSD__)
+  P(si_signo);
+  P(si_errno);
+  P(si_code);
+
+#if defined(__GLIBC__)
+  P(_sifields._kill.si_pid);
+  P(_sifields._kill.si_uid);
+  P(_sifields._timer.si_tid);
+  P(_sifields._timer.si_overrun);
+  P(_sifields._timer.si_sigval);
+  P(_sifields._rt.si_pid);
+  P(_sifields._rt.si_uid);
+  P(_sifields._rt.si_sigval);
+  P(_sifields._sigchld.si_pid);
+  P(_sifields._sigchld.si_uid);
+  P(_sifields._sigchld.si_status);
+  P(_sifields._sigchld.si_utime);
+  P(_sifields._sigchld.si_stime);
+  P(_sifields._sigfault.si_addr);
+  P(_sifields._sigfault.si_addr_lsb);
+  P(_sifields._sigfault._bounds._addr_bnd._lower);
+  P(_sifields._sigfault._bounds._addr_bnd._upper);
+  P(_sifields._sigfault._bounds._pkey);
+  P(_sifields._sigpoll.si_band);
+  P(_sifields._sigpoll.si_fd);
+  P(_sifields._sigsys._call_addr);
+  P(_sifields._sigsys._syscall);
+  P(_sifields._sigsys._arch);
+#endif // defined(__GLIBC__)
+
+#if defined(__FreeBSD__)
+  // these are top-level fields on FreeBSD
+  P(si_pid);
+  P(si_uid);
+  P(si_status);
+  P(si_addr);
+  P(si_value);
+  P(_reason._fault._trapno);
+  P(_reason._timer._timerid);
+  P(_reason._timer._overrun);
+  P(_reason._mesgq._mqd);
+  P(_reason._poll._band);
+#endif // defined(__FreeBSD__)
+
+#else // defined(__NetBSD__)
+
+  P(_info._signo);
+  P(_info._code);
+  P(_info._errno);
+  P(_info._reason._rt._pid);
+  P(_info._reason._rt._uid);
+  P(_info._reason._rt._value);
+  P(_info._reason._child._pid);
+  P(_info._reason._child._uid);
+  P(_info._reason._child._status);
+  P(_info._reason._child._utime);
+  P(_info._reason._child._stime);
+  P(_info._reason._fault._addr);
+  P(_info._reason._fault._trap);
+  P(_info._reason._fault._trap2);
+  P(_info._reason._fault._trap3);
+  P(_info._reason._poll._band);
+  P(_info._reason._poll._fd);
+  P(_info._reason._syscall._sysnum);
+  P(_info._reason._syscall._retval);
+  P(_info._reason._syscall._error);
+  P(_info._reason._syscall._args);
+  P(_info._reason._ptrace_state._pe_report_event);
+  P(_info._reason._ptrace_state._option._pe_other_pid);
+  P(_info._reason._ptrace_state._option._pe_lwp);
+
+#endif // defined(__NetBSD__)
+
+  printf("   });\n");
+
+  return 0;
+}
Index: lldb/unittests/Platform/PlatformSiginfoTest.cpp
===
--- /dev/null
+++ lldb/unittests/Platform/PlatformSiginfoTest.cpp
@@ -0,0 +1,311 @@
+//===-- PlatformSiginfoTest.cpp ---===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===--===//
+
+#include "gtest/gtest.h"
+
+#include 
+#include 
+
+#include "Plugins/Platform/FreeBSD/PlatformFreeBSD.h"
+#include "Plu

[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-27 Thread Michał Górny via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1a8f60f5f5b8: [lldb] [gdb-remote] Support getting siginfo 
via API (authored by mgorny).
Herald added a project: LLDB.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118055

Files:
  lldb/bindings/interface/SBThread.i
  lldb/include/lldb/API/SBPlatform.h
  lldb/include/lldb/API/SBTarget.h
  lldb/include/lldb/API/SBThread.h
  lldb/include/lldb/API/SBType.h
  lldb/include/lldb/Target/Thread.h
  lldb/source/API/SBThread.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ThreadGDBRemote.h
  lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py

Index: lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
===
--- lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
+++ lldb/test/API/functionalities/gdb_remote_client/TestGDBRemoteClient.py
@@ -490,3 +490,99 @@
  lldb.eStopReasonSignal)
 self.assertEqual(process.threads[0].GetStopDescription(100),
  'signal SIGUSR1')
+
+def do_siginfo_test(self, platform, target_yaml, raw_data, expected):
+class MyResponder(MockGDBServerResponder):
+def qSupported(self, client_supported):
+return "PacketSize=3fff;QStartNoAckMode+;qXfer:siginfo:read+"
+
+def qXferRead(self, obj, annex, offset, length):
+if obj == "siginfo":
+return raw_data, False
+else:
+return None, False
+
+def haltReason(self):
+return "T02"
+
+def cont(self):
+return self.haltReason()
+
+self.server.responder = MyResponder()
+
+self.runCmd("platform select " + platform)
+target = self.createTarget(target_yaml)
+process = self.connect(target)
+
+error = lldb.SBError()
+siginfo = process.threads[0].GetSiginfo(error)
+self.assertTrue(siginfo, error)
+
+for key, value in expected.items():
+self.assertEqual(siginfo.GetValueForExpressionPath("." + key)
+ .GetValueAsUnsigned(),
+ value)
+
+
+def test_siginfo_linux_amd64(self):
+data = (
+  # si_signo si_errnosi_code
+"\x11\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # __pad0   si_pid  si_uid
+"\x00\x00\x00\x00\xbf\xf7\x0b\x00\xe8\x03\x00\x00"
+  # si_status
+"\x0c\x00\x00\x00" + "\x00" * 100)
+expected = {
+"si_signo": 17,  # SIGCHLD
+"si_errno": 0,
+"si_code": 1,  # CLD_EXITED
+"_sifields._sigchld.si_pid": 784319,
+"_sifields._sigchld.si_uid": 1000,
+"_sifields._sigchld.si_status": 12,
+"_sifields._sigchld.si_utime": 0,
+"_sifields._sigchld.si_stime": 0,
+}
+self.do_siginfo_test("remote-linux", "basic_eh_frame.yaml",
+ data, expected)
+
+def test_siginfo_linux_i386(self):
+data = (
+  # si_signo si_errnosi_code
+"\x11\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # si_pid   si_uid  si_status
+"\x49\x43\x07\x00\xe8\x03\x00\x00\x0c\x00\x00\x00"
++ "\x00" * 104)
+expected = {
+"si_signo": 17,  # SIGCHLD
+"si_errno": 0,
+"si_code": 1,  # CLD_EXITED
+"_sifields._sigchld.si_pid": 475977,
+"_sifields._sigchld.si_uid": 1000,
+"_sifields._sigchld.si_status": 12,
+"_sifields._sigchld.si_utime": 0,
+"_sifields._sigchld.si_stime": 0,
+}
+self.do_siginfo_test("remote-linux", "basic_eh_frame-i386.yaml",
+ data, expected)
+
+def test_siginfo_freebsd_amd64(self):
+data = (
+  # si_signo si_errnosi_code
+"\x0b\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00"
+  # si_pid   si_uid  si_status
+"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
+  # si_addr
+"\x76\x98\xba\xdc\xfe\x00\x00\x00"
+  # si_statussi_trapno
+"\x00\x00\x00\x00\x00\x00\x00\x00\x0c\x00\x00\x00"
++ "\x00" * 36)
+
+expected = {
+"si_signo": 11,  # SIGSEGV
+"si_errno": 0,
+"si_code": 1,  # SEGV_MAPERR
+"si_addr": 0xfedcba9876,
+"_reason._fault._trapno": 12,

[Lldb-commits] [PATCH] D118358: [lldb][ARM/AArch64] Update dissembler to v9.3-a

2022-01-27 Thread David Spickett via Phabricator via lldb-commits
DavidSpickett created this revision.
Herald added subscribers: ctetreau, kristof.beyls.
DavidSpickett requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This means sve2 is enabled by default and the v8.8 mops (memcpy
and memset acceleration instructions) and HBC (hinted conditional
branch) extensions can be disassembled.

v9.3-a is equivalent to v8.8-a except that in v9.0-a sve2 was
enabled by default so v9.3-a includes that too.

MTE remains an optional extension, only enabled for specific CPUs.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118358

Files:
  lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp


Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1097,19 +1097,19 @@
   thumb_arch_name.erase(0, 3);
   thumb_arch_name.insert(0, "thumb");
 } else {
-  thumb_arch_name = "thumbv8.7a";
+  thumb_arch_name = "thumbv9.3a";
 }
 thumb_arch.GetTriple().setArchName(llvm::StringRef(thumb_arch_name));
   }
 
   // If no sub architecture specified then use the most recent arm architecture
-  // so the disassembler will return all instruction. Without it we will see a
-  // lot of unknow opcode in case the code uses instructions which are not
-  // available in the oldest arm version (used when no sub architecture is
-  // specified)
+  // so the disassembler will return all instructions. Without it we will see a
+  // lot of unknown opcodes if the code uses instructions which are not
+  // available in the oldest arm version (which is used when no sub 
architecture
+  // is specified).
   if (triple.getArch() == llvm::Triple::arm &&
   triple.getSubArch() == llvm::Triple::NoSubArch)
-triple.setArchName("armv8.7a");
+triple.setArchName("armv9.3a");
 
   std::string features_str;
   const char *triple_str = triple.getTriple().c_str();
@@ -1179,9 +1179,9 @@
   }
 
   // If any AArch64 variant, enable latest ISA with any optional
-  // extensions like SVE.
+  // extensions like MTE.
   if (triple.isAArch64()) {
-features_str += "+v8.7a,+sve2,+mte";
+features_str += "+v9.3a,+mte";
 
 if (triple.getVendor() == llvm::Triple::Apple)
   cpu = "apple-latest";


Index: lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
===
--- lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
+++ lldb/source/Plugins/Disassembler/LLVMC/DisassemblerLLVMC.cpp
@@ -1097,19 +1097,19 @@
   thumb_arch_name.erase(0, 3);
   thumb_arch_name.insert(0, "thumb");
 } else {
-  thumb_arch_name = "thumbv8.7a";
+  thumb_arch_name = "thumbv9.3a";
 }
 thumb_arch.GetTriple().setArchName(llvm::StringRef(thumb_arch_name));
   }
 
   // If no sub architecture specified then use the most recent arm architecture
-  // so the disassembler will return all instruction. Without it we will see a
-  // lot of unknow opcode in case the code uses instructions which are not
-  // available in the oldest arm version (used when no sub architecture is
-  // specified)
+  // so the disassembler will return all instructions. Without it we will see a
+  // lot of unknown opcodes if the code uses instructions which are not
+  // available in the oldest arm version (which is used when no sub architecture
+  // is specified).
   if (triple.getArch() == llvm::Triple::arm &&
   triple.getSubArch() == llvm::Triple::NoSubArch)
-triple.setArchName("armv8.7a");
+triple.setArchName("armv9.3a");
 
   std::string features_str;
   const char *triple_str = triple.getTriple().c_str();
@@ -1179,9 +1179,9 @@
   }
 
   // If any AArch64 variant, enable latest ISA with any optional
-  // extensions like SVE.
+  // extensions like MTE.
   if (triple.isAArch64()) {
-features_str += "+v8.7a,+sve2,+mte";
+features_str += "+v9.3a,+mte";
 
 if (triple.getVendor() == llvm::Triple::Apple)
   cpu = "apple-latest";
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 33eb3f1 - [lldb] Delete TestBacktraceAll.py

2022-01-27 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2022-01-27T15:01:08+01:00
New Revision: 33eb3f14eb42316524efe71a916b727fe563d973

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

LOG: [lldb] Delete TestBacktraceAll.py

This test is completely nondeterministic, environment-dependent and does
not test what it was supposed to test (reverting the associated patch
does not make it fail).

I tried to figure out what the patch was meant to fix to see if I can
create a better test with the current tools, but I was not able to
understand the problem (it sounds like it has something to do with local
classes, but I don't understand the details).

Added: 


Modified: 


Removed: 
lldb/test/API/functionalities/thread/backtrace_all/Makefile
lldb/test/API/functionalities/thread/backtrace_all/ParallelTask.cpp
lldb/test/API/functionalities/thread/backtrace_all/TestBacktraceAll.py



diff  --git a/lldb/test/API/functionalities/thread/backtrace_all/Makefile 
b/lldb/test/API/functionalities/thread/backtrace_all/Makefile
deleted file mode 100644
index cd092b7725618..0
--- a/lldb/test/API/functionalities/thread/backtrace_all/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-CXXFLAGS_EXTRAS := -std=c++11
-CXX_SOURCES := ParallelTask.cpp
-ENABLE_THREADS := YES
-
-include Makefile.rules

diff  --git 
a/lldb/test/API/functionalities/thread/backtrace_all/ParallelTask.cpp 
b/lldb/test/API/functionalities/thread/backtrace_all/ParallelTask.cpp
deleted file mode 100644
index 8e0f76f691b98..0
--- a/lldb/test/API/functionalities/thread/backtrace_all/ParallelTask.cpp
+++ /dev/null
@@ -1,152 +0,0 @@
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-class TaskPoolImpl
-{
-public:
-TaskPoolImpl(uint32_t num_threads) :
-m_stop(false)
-{
-for (uint32_t i = 0; i < num_threads; ++i)
-m_threads.emplace_back(Worker, this);
-}
-
-~TaskPoolImpl()
-{
-Stop();
-}
-
-template
-std::future::type>
-AddTask(F&& f, Args&&... args)
-{
-auto task = std::make_shared::type()>>(
-std::bind(std::forward(f), std::forward(args)...));
-
-std::unique_lock lock(m_tasks_mutex);
-assert(!m_stop && "Can't add task to TaskPool after it is stopped");
-m_tasks.emplace([task](){ (*task)(); });
-lock.unlock();
-m_tasks_cv.notify_one();
-
-return task->get_future();
-}
-
-void
-Stop()
-{
-std::unique_lock lock(m_tasks_mutex);
-m_stop = true;
-m_tasks_mutex.unlock();
-m_tasks_cv.notify_all();
-for (auto& t : m_threads)
-t.join();
-}
-
-private:
-static void
-Worker(TaskPoolImpl* pool)
-{
-while (true)
-{
-std::unique_lock lock(pool->m_tasks_mutex);
-if (pool->m_tasks.empty())
-pool->m_tasks_cv.wait(lock, [pool](){ return 
!pool->m_tasks.empty() || pool->m_stop; });
-if (pool->m_tasks.empty())
-break;
-
-std::function f = pool->m_tasks.front();
-pool->m_tasks.pop();
-lock.unlock();
-
-f();
-}
-}
-
-std::queue> m_tasks;
-std::mutexm_tasks_mutex;
-std::condition_variable   m_tasks_cv;
-bool  m_stop;
-std::vector  m_threads;
-};
-
-class TaskPool
-{
-public:
-// Add a new task to the thread pool and return a std::future belongs for 
the newly created task.
-// The caller of this function have to wait on the future for this task to 
complete.
-template
-static std::future::type>
-AddTask(F&& f, Args&&... args)
-{
-return GetImplementation().AddTask(std::forward(f), 
std::forward(args)...);
-}
-
-// Run all of the specified tasks on the thread pool and wait until all of 
them are finished
-// before returning
-template
-static void
-RunTasks(T&&... t)
-{
-RunTaskImpl::Run(std::forward(t)...);
-}
-
-private:
-static TaskPoolImpl&
-GetImplementation()
-{
-static TaskPoolImpl 
g_task_pool_impl(std::thread::hardware_concurrency());
-return g_task_pool_impl;
-}
-
-template
-struct RunTaskImpl;
-};
-
-template
-struct TaskPool::RunTaskImpl
-{
-static void
-Run(H&& h, T&&... t)
-{
-auto f = AddTask(std::forward(h));
-RunTaskImpl::Run(std::forward(t)...);
-f.wait();
-}
-};
-
-template<>
-struct TaskPool::RunTaskImpl<>
-{
-static void
-Run() {}
-};
-
-int main()
-{
-std::vector> tasks;
-for (int i = 0; i < 10; ++i)
-{
-tasks.emplace_back(TaskPool::AddTask([](int i){
-uint32_t s =

[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham reopened this revision.
jingham added a comment.
This revision is now accepted and ready to land.
Herald added a subscriber: JDevlieghere.

We don't return errors separately for any of the API's that return an SBValue.  
SBValue's carry their error with them (SBValue.GetError()) so it would be 
confusing to have two errors.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118055

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


[Lldb-commits] [PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2022-01-27 Thread Simon Pilgrim via Phabricator via lldb-commits
RKSimon updated this revision to Diff 403574.
RKSimon added a comment.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

update lldb docs as well


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

Files:
  clang/docs/ClangFormatStyleOptions.rst
  clang/docs/UsersManual.rst
  lldb/docs/resources/build.rst
  lldb/docs/resources/test.rst
  llvm/cmake/modules/CheckCompilerVersion.cmake
  llvm/docs/CMake.rst
  llvm/docs/GettingStarted.rst
  llvm/docs/GettingStartedVS.rst
  llvm/docs/ReleaseNotes.rst
  llvm/include/llvm/Support/Compiler.h

Index: llvm/include/llvm/Support/Compiler.h
===
--- llvm/include/llvm/Support/Compiler.h
+++ llvm/include/llvm/Support/Compiler.h
@@ -77,12 +77,21 @@
 /// * 1916: VS2017, version 15.9
 /// * 1920: VS2019, version 16.0
 /// * 1921: VS2019, version 16.1
+/// * 1922: VS2019, version 16.2
+/// * 1923: VS2019, version 16.3
+/// * 1924: VS2019, version 16.4
+/// * 1925: VS2019, version 16.5
+/// * 1926: VS2019, version 16.6
+/// * 1927: VS2019, version 16.7
+/// * 1928: VS2019, version 16.8 + 16.9
+/// * 1929: VS2019, version 16.10 + 16.11
+/// * 1930: VS2022, version 17.0
 #ifdef _MSC_VER
 #define LLVM_MSC_PREREQ(version) (_MSC_VER >= (version))
 
-// We require at least MSVC 2017.
-#if !LLVM_MSC_PREREQ(1910)
-#error LLVM requires at least MSVC 2017.
+// We require at least VS 2019.
+#if !LLVM_MSC_PREREQ(1920)
+#error LLVM requires at least VS 2019.
 #endif
 
 #else
@@ -94,12 +103,8 @@
 /// Sadly, this is separate from just rvalue reference support because GCC
 /// and MSVC implemented this later than everything else. This appears to be
 /// corrected in MSVC 2019 but not MSVC 2017.
-#if __has_feature(cxx_rvalue_references) || defined(__GNUC__) ||   \
-LLVM_MSC_PREREQ(1920)
+/// FIXME: Remove LLVM_HAS_RVALUE_REFERENCE_THIS macro
 #define LLVM_HAS_RVALUE_REFERENCE_THIS 1
-#else
-#define LLVM_HAS_RVALUE_REFERENCE_THIS 0
-#endif
 
 /// Expands to '&' if ref-qualifiers for *this are supported.
 ///
Index: llvm/docs/ReleaseNotes.rst
===
--- llvm/docs/ReleaseNotes.rst
+++ llvm/docs/ReleaseNotes.rst
@@ -65,7 +65,7 @@
 Changes to building LLVM
 
 
-* ...
+* Building LLVM with Visual Studio now requires version 2019 or later.
 
 Changes to TableGen
 ---
Index: llvm/docs/GettingStartedVS.rst
===
--- llvm/docs/GettingStartedVS.rst
+++ llvm/docs/GettingStartedVS.rst
@@ -36,7 +36,7 @@
 
 Hardware
 
-Any system that can adequately run Visual Studio 2017 is fine. The LLVM
+Any system that can adequately run Visual Studio 2019 is fine. The LLVM
 source tree including the git index consumes approximately 3GB.
 Object files, libraries and executables consume approximately 5GB in
 Release mode and much more in Debug mode. SSD drive and >16GB RAM are
@@ -45,13 +45,14 @@
 
 Software
 
-You will need `Visual Studio `_ 2017 or
-higher, with the latest Update installed. Visual Studio Community Edition
+You will need `Visual Studio `_ 2019 or
+later, with the latest Update installed. Visual Studio Community Edition
 suffices.
 
 You will also need the `CMake `_ build system since it
 generates the project files you will use to build with. CMake is bundled with
-Visual Studio 2019 so separate installation is not required.
+Visual Studio 2019 so separate installation is not required. If you do install
+CMake separately, Visual Studio 2022 will require CMake Version 3.21 or later.
 
 If you would like to run the LLVM tests you will need `Python
 `_. Version 3.6 and newer are known to work. You can
Index: llvm/docs/GettingStarted.rst
===
--- llvm/docs/GettingStarted.rst
+++ llvm/docs/GettingStarted.rst
@@ -238,7 +238,7 @@
 * Clang 3.5
 * Apple Clang 6.0
 * GCC 5.1
-* Visual Studio 2017
+* Visual Studio 2019
 
 Anything older than these toolchains *may* work, but will require forcing the
 build system with a special option and is not really a supported host platform.
@@ -273,8 +273,8 @@
 This section mostly applies to Linux and older BSDs. On macOS, you should
 have a sufficiently modern Xcode, or you will likely need to upgrade until you
 do. Windows does not have a "system compiler", so you must install either Visual
-Studio 2017 or a recent version of mingw64. FreeBSD 10.0 and newer have a modern
-Clang as the system compiler.
+Studio 2019 (or later), or a recent version of mingw64. FreeBSD 10.0 and newer
+have a modern Clang as the system compiler.
 
 However, some Linux distributions and some other or older BSDs sometimes have
 extremely old versions of G

[Lldb-commits] [PATCH] D114639: Raise the minimum Visual Studio version to VS2019

2022-01-27 Thread Aaron Ballman via Phabricator via lldb-commits
aaron.ballman added a comment.
Herald added a subscriber: JDevlieghere.

In D114639#3273831 , @RKSimon wrote:

> In D114639#3273761 , 
> @stella.stamenova wrote:
>
>> Can we update the lldb instructions as part of this change to also point to 
>> VS2019? Alternatively, I can send a separate change for that.
>
> I'll add it to this patch - are people happy for me to get this in before the 
> 14.x branch?

I'm fine with that (we can always roll it back in the branch if it turns out to 
be a burden).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114639

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


[Lldb-commits] [lldb] 48c36a1 - [lldb/test] Disable test_launch_scripted_process_stack_frames on x86_64

2022-01-27 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2022-01-27T18:42:08+01:00
New Revision: 48c36a15a363e32757c51aa69de7adf88c143c37

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

LOG: [lldb/test] Disable test_launch_scripted_process_stack_frames on x86_64

There seems to be an issue on x86_64 when launching a ScriptdProcess.
This disables temporarely the test that causes the bot to timeout until
I finish investigating the issue.

Signed-off-by: Med Ismail Bennani 

Added: 


Modified: 
lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py

Removed: 




diff  --git 
a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py 
b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
index 0c215f082c5d3..2e80f74622fb4 100644
--- a/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
+++ b/lldb/test/API/functionalities/scripted_process/TestScriptedProcess.py
@@ -142,6 +142,7 @@ def create_stack_skinny_corefile(self, file):
 self.assertTrue(self.dbg.DeleteTarget(target), "Couldn't delete 
target")
 
 @skipUnlessDarwin
+@skipIf(archs=no_match(['arm64', 'arm64e']))
 @skipIfOutOfTreeDebugserver
 def test_launch_scripted_process_stack_frames(self):
 """Test that we can launch an lldb scripted process from the command



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


[Lldb-commits] [PATCH] D118405: [LLD][MinGW] Add --heap argument support

2022-01-27 Thread Mateusz Mikuła via Phabricator via lldb-commits
mati865 created this revision.
mati865 added a reviewer: mstorsjo.
mati865 added a project: lld.
Herald added a subscriber: dang.
mati865 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Noticed in https://github.com/msys2/MINGW-packages/pull/10567

Untested but should work fine judging by COFF driver code.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118405

Files:
  lld/MinGW/Driver.cpp
  lld/MinGW/Options.td
  lld/test/MinGW/driver.test


Index: lld/test/MinGW/driver.test
===
--- lld/test/MinGW/driver.test
+++ lld/test/MinGW/driver.test
@@ -340,3 +340,8 @@
 
 RUN: ld.lld -### -m i386pep foo.o --disable-stdcall-fixup 
--enable-stdcall-fixup 2>&1 | FileCheck -check-prefix ENABLE-FIXUP %s
 ENABLE-FIXUP: -stdcall-fixup{{ }}
+
+RUN: ld.lld -### foo.o -m i386pep -heap 8388608,16384 2>&1 | FileCheck 
-check-prefix=HEAP %s
+RUN: ld.lld -### foo.o -m i386pep --heap 8388608,16384 2>&1 | FileCheck 
-check-prefix=HEAP %s
+RUN: ld.lld -### foo.o -m i386pep --heap=8388608,16384 2>&1 | FileCheck 
-check-prefix=HEAP %s
+HEAP: -heap:8388608,16384
Index: lld/MinGW/Options.td
===
--- lld/MinGW/Options.td
+++ lld/MinGW/Options.td
@@ -66,6 +66,7 @@
 defm gc_sections: B<"gc-sections",
 "Remove unused sections",
 "Don't remove unused sections">;
+defm heap: Eq<"heap", "Set size of the initial heap">;
 def help: F<"help">, HelpText<"Print option help">;
 defm high_entropy_va: B_disable<"high-entropy-va",
 "Set the 'high entropy VA' flag", "Don't set the 'high entropy VA' flag">;
Index: lld/MinGW/Driver.cpp
===
--- lld/MinGW/Driver.cpp
+++ lld/MinGW/Driver.cpp
@@ -264,6 +264,8 @@
 add("-filealign:" + StringRef(a->getValue()));
   if (auto *a = args.getLastArg(OPT_section_alignment))
 add("-align:" + StringRef(a->getValue()));
+  if (auto *a = args.getLastArg(OPT_heap))
+add("-heap:" + StringRef(a->getValue()));
 
   if (auto *a = args.getLastArg(OPT_o))
 add("-out:" + StringRef(a->getValue()));


Index: lld/test/MinGW/driver.test
===
--- lld/test/MinGW/driver.test
+++ lld/test/MinGW/driver.test
@@ -340,3 +340,8 @@
 
 RUN: ld.lld -### -m i386pep foo.o --disable-stdcall-fixup --enable-stdcall-fixup 2>&1 | FileCheck -check-prefix ENABLE-FIXUP %s
 ENABLE-FIXUP: -stdcall-fixup{{ }}
+
+RUN: ld.lld -### foo.o -m i386pep -heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
+RUN: ld.lld -### foo.o -m i386pep --heap 8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
+RUN: ld.lld -### foo.o -m i386pep --heap=8388608,16384 2>&1 | FileCheck -check-prefix=HEAP %s
+HEAP: -heap:8388608,16384
Index: lld/MinGW/Options.td
===
--- lld/MinGW/Options.td
+++ lld/MinGW/Options.td
@@ -66,6 +66,7 @@
 defm gc_sections: B<"gc-sections",
 "Remove unused sections",
 "Don't remove unused sections">;
+defm heap: Eq<"heap", "Set size of the initial heap">;
 def help: F<"help">, HelpText<"Print option help">;
 defm high_entropy_va: B_disable<"high-entropy-va",
 "Set the 'high entropy VA' flag", "Don't set the 'high entropy VA' flag">;
Index: lld/MinGW/Driver.cpp
===
--- lld/MinGW/Driver.cpp
+++ lld/MinGW/Driver.cpp
@@ -264,6 +264,8 @@
 add("-filealign:" + StringRef(a->getValue()));
   if (auto *a = args.getLastArg(OPT_section_alignment))
 add("-align:" + StringRef(a->getValue()));
+  if (auto *a = args.getLastArg(OPT_heap))
+add("-heap:" + StringRef(a->getValue()));
 
   if (auto *a = args.getLastArg(OPT_o))
 add("-out:" + StringRef(a->getValue()));
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] cd31763 - Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

2022-01-27 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2022-01-27T13:29:34-08:00
New Revision: cd317637708decd8faf34dd9773a8b2dec424010

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

LOG: Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

We have been noticing issues with the lldb bots on builds using versions below 
clang 14 and dwarf 2, so to make sure we can get clean builds for a while, we 
are disabling the tests for those versions

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

Added: 


Modified: 
lldb/test/API/tools/lldb-server/TestLldbGdbServer.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py 
b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
index 18461568c02ce..94b6123e0a4fd 100644
--- a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
+++ b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
@@ -28,6 +28,8 @@ class 
LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
 
 mydir = TestBase.compute_mydir(__file__)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_thread_suffix_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -41,6 +43,8 @@ def test_thread_suffix_supported(self):
 self.expect_gdbremote_sequence()
 
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_list_threads_in_stop_reply_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -52,6 +56,8 @@ def test_list_threads_in_stop_reply_supported(self):
 True)
 self.expect_gdbremote_sequence()
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<'3 '4'])
 def test_c_packet_works(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -63,6 +69,8 @@ def test_c_packet_works(self):
 self.expect_gdbremote_sequence()
 
 @skipIfWindows # No pty support to test any inferior output
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_inferior_print_exit(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior(
@@ -76,6 +84,8 @@ def test_inferior_print_exit(self):
 context = self.expect_gdbremote_sequence()
 self.assertIsNotNone(context)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_first_launch_stop_reply_thread_matches_first_qC(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -91,6 +101,8 @@ def 
test_first_launch_stop_reply_thread_matches_first_qC(self):
 context = self.expect_gdbremote_sequence()
 self.assertEqual(context.get("thread_id_QC"), 
context.get("thread_id_?"))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_attach_commandline_continue_app_exits(self):
 self.build()
 self.set_inferior_startup_attach()
@@ -116,6 +128,8 @@ def test_attach_commandline_continue_app_exits(self):
 lldbgdbserverutils.process_is_running(
 procs["inferior"].pid, False))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_one_valid_result(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -133,6 +147,8 @@ def test_qRegisterInfo_returns_one_valid_result(self):
 self.assert_valid_reg_info(
 lldbgdbserverutils.parse_reg_info_response(reg_info_packet))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_all_valid_results(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -146,6 +162,8 @@ def test_qRegisterInfo_returns_all_valid_results(self):
 for reg_info in self.parse_register_info_packets(context):
 self.assert_valid_reg_info(reg_info)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_contains_required_generics_debugserver(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -175,6 +193,8 @@ def 
test_qRegisterInfo_contains_required_generics_debugserver(self):
 # Ensure we have a flags register.
 self.assertIn('flags', generic_regs)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_co

[Lldb-commits] [PATCH] D118395: Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

2022-01-27 Thread Shubham Sandeep Rastogi via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcd317637708d: Disable TestLldbGdbServer on Dwarf2 and clang 
versions below 14 (authored by rastogishubham).
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118395

Files:
  lldb/test/API/tools/lldb-server/TestLldbGdbServer.py

Index: lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
===
--- lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
+++ lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
@@ -28,6 +28,8 @@
 
 mydir = TestBase.compute_mydir(__file__)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_thread_suffix_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -41,6 +43,8 @@
 self.expect_gdbremote_sequence()
 
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_list_threads_in_stop_reply_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -52,6 +56,8 @@
 True)
 self.expect_gdbremote_sequence()
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<'3 '4'])
 def test_c_packet_works(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -63,6 +69,8 @@
 self.expect_gdbremote_sequence()
 
 @skipIfWindows # No pty support to test any inferior output
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_inferior_print_exit(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior(
@@ -76,6 +84,8 @@
 context = self.expect_gdbremote_sequence()
 self.assertIsNotNone(context)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_first_launch_stop_reply_thread_matches_first_qC(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -91,6 +101,8 @@
 context = self.expect_gdbremote_sequence()
 self.assertEqual(context.get("thread_id_QC"), context.get("thread_id_?"))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_attach_commandline_continue_app_exits(self):
 self.build()
 self.set_inferior_startup_attach()
@@ -116,6 +128,8 @@
 lldbgdbserverutils.process_is_running(
 procs["inferior"].pid, False))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_one_valid_result(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -133,6 +147,8 @@
 self.assert_valid_reg_info(
 lldbgdbserverutils.parse_reg_info_response(reg_info_packet))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_all_valid_results(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -146,6 +162,8 @@
 for reg_info in self.parse_register_info_packets(context):
 self.assert_valid_reg_info(reg_info)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_contains_required_generics_debugserver(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -175,6 +193,8 @@
 # Ensure we have a flags register.
 self.assertIn('flags', generic_regs)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_contains_at_least_one_register_set(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -215,6 +235,8 @@
 @expectedFailureAll(oslist=["windows"]) # no avx for now.
 @skipIf(archs=no_match(['amd64', 'i386', 'x86_64']))
 @add_test_categories(["llgs"])
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_contains_avx_registers(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -249,12 +271,16 @@
 # We should have exactly one thread.
 self.assertEqual(len(threads), 1)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qThreadInfo_contains_thread_launch(self):
 self.build()
 self.set_inferior_startup_launch()
 self.qThreadInfo_contains_thread()
 
 @expectedFailureAll(osl

[Lldb-commits] [lldb] ee54868 - Revert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"

2022-01-27 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2022-01-27T13:36:21-08:00
New Revision: ee54868a76e32fdfa8d1efe5e418460e54246a4e

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

LOG: Revert "Disable TestLldbGdbServer on Dwarf2 and clang versions below 14"

This reverts commit cd317637708decd8faf34dd9773a8b2dec424010.

Added: 


Modified: 
lldb/test/API/tools/lldb-server/TestLldbGdbServer.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py 
b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
index 94b6123e0a4fd..18461568c02ce 100644
--- a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
+++ b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
@@ -28,8 +28,6 @@ class 
LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
 
 mydir = TestBase.compute_mydir(__file__)
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_thread_suffix_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -43,8 +41,6 @@ def test_thread_suffix_supported(self):
 self.expect_gdbremote_sequence()
 
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_list_threads_in_stop_reply_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -56,8 +52,6 @@ def test_list_threads_in_stop_reply_supported(self):
 True)
 self.expect_gdbremote_sequence()
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<'3 '4'])
 def test_c_packet_works(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -69,8 +63,6 @@ def test_c_packet_works(self):
 self.expect_gdbremote_sequence()
 
 @skipIfWindows # No pty support to test any inferior output
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_inferior_print_exit(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior(
@@ -84,8 +76,6 @@ def test_inferior_print_exit(self):
 context = self.expect_gdbremote_sequence()
 self.assertIsNotNone(context)
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_first_launch_stop_reply_thread_matches_first_qC(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -101,8 +91,6 @@ def 
test_first_launch_stop_reply_thread_matches_first_qC(self):
 context = self.expect_gdbremote_sequence()
 self.assertEqual(context.get("thread_id_QC"), 
context.get("thread_id_?"))
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_attach_commandline_continue_app_exits(self):
 self.build()
 self.set_inferior_startup_attach()
@@ -128,8 +116,6 @@ def test_attach_commandline_continue_app_exits(self):
 lldbgdbserverutils.process_is_running(
 procs["inferior"].pid, False))
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_one_valid_result(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -147,8 +133,6 @@ def test_qRegisterInfo_returns_one_valid_result(self):
 self.assert_valid_reg_info(
 lldbgdbserverutils.parse_reg_info_response(reg_info_packet))
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_all_valid_results(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -162,8 +146,6 @@ def test_qRegisterInfo_returns_all_valid_results(self):
 for reg_info in self.parse_register_info_packets(context):
 self.assert_valid_reg_info(reg_info)
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_contains_required_generics_debugserver(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -193,8 +175,6 @@ def 
test_qRegisterInfo_contains_required_generics_debugserver(self):
 # Ensure we have a flags register.
 self.assertIn('flags', generic_regs)
 
-@skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_contains_at_least_one_register_set(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -235,8 +215,6 @@ def targetHasAVX(self):
 @expectedFailureAll(oslist=["

[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-27 Thread Michał Górny via Phabricator via lldb-commits
mgorny added a comment.

In D118055#3276558 , @jingham wrote:

> We don't return errors separately for any of the API's that return an 
> SBValue.  SBValue's carry their error with them (SBValue.GetError()) so it 
> would be confusing to have two errors.

I'm sorry but I can't figure out how to set the error inside `SBValue`. The 
only user-facing thing that seems to allow passing `Status` seems to be 
`ValueObjectConstResult::Create()` but it feels like it's not supposed to be 
used like this (and it doesn't seem to preserve my `Status` either).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118055

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


[Lldb-commits] [PATCH] D118265: [lldb] Make ReadCStringFromMemory default to read from the file-cache.

2022-01-27 Thread Adrian Prantl via Phabricator via lldb-commits
aprantl accepted this revision.
aprantl added a comment.
This revision is now accepted and ready to land.

force_live_memory=false means use the file cache iff:

- the address has a Section
- the section is read-only

Otherwise it reads from memory.

Based on that this looks safe to me.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118265

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


[Lldb-commits] [lldb] 867fdec - Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

2022-01-27 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2022-01-27T14:02:35-08:00
New Revision: 867fdec1945df3c1031d3cefdc97903131a3482b

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

LOG: Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

We have been noticing issues with the lldb bots on builds using versions below 
clang 14 and dwarf 2, so to make sure we can get clean builds for a while, we 
are disabling the tests for those versions

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

Added: 


Modified: 
lldb/test/API/tools/lldb-server/TestLldbGdbServer.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py 
b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
index 18461568c02ce..c6ecaf88b1be8 100644
--- a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
+++ b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
@@ -28,6 +28,8 @@ class 
LldbGdbServerTestCase(gdbremote_testcase.GdbRemoteTestCaseBase, DwarfOpcod
 
 mydir = TestBase.compute_mydir(__file__)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_thread_suffix_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -41,6 +43,8 @@ def test_thread_suffix_supported(self):
 self.expect_gdbremote_sequence()
 
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_list_threads_in_stop_reply_supported(self):
 server = self.connect_to_debug_monitor()
 self.assertIsNotNone(server)
@@ -52,6 +56,8 @@ def test_list_threads_in_stop_reply_supported(self):
 True)
 self.expect_gdbremote_sequence()
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_c_packet_works(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -63,6 +69,8 @@ def test_c_packet_works(self):
 self.expect_gdbremote_sequence()
 
 @skipIfWindows # No pty support to test any inferior output
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_inferior_print_exit(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior(
@@ -76,6 +84,8 @@ def test_inferior_print_exit(self):
 context = self.expect_gdbremote_sequence()
 self.assertIsNotNone(context)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_first_launch_stop_reply_thread_matches_first_qC(self):
 self.build()
 procs = self.prep_debug_monitor_and_inferior()
@@ -91,6 +101,8 @@ def 
test_first_launch_stop_reply_thread_matches_first_qC(self):
 context = self.expect_gdbremote_sequence()
 self.assertEqual(context.get("thread_id_QC"), 
context.get("thread_id_?"))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_attach_commandline_continue_app_exits(self):
 self.build()
 self.set_inferior_startup_attach()
@@ -116,6 +128,8 @@ def test_attach_commandline_continue_app_exits(self):
 lldbgdbserverutils.process_is_running(
 procs["inferior"].pid, False))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_one_valid_result(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -133,6 +147,8 @@ def test_qRegisterInfo_returns_one_valid_result(self):
 self.assert_valid_reg_info(
 lldbgdbserverutils.parse_reg_info_response(reg_info_packet))
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_returns_all_valid_results(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -146,6 +162,8 @@ def test_qRegisterInfo_returns_all_valid_results(self):
 for reg_info in self.parse_register_info_packets(context):
 self.assert_valid_reg_info(reg_info)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_contains_required_generics_debugserver(self):
 self.build()
 self.prep_debug_monitor_and_inferior()
@@ -175,6 +193,8 @@ def 
test_qRegisterInfo_contains_required_generics_debugserver(self):
 # Ensure we have a flags register.
 self.assertIn('flags', generic_regs)
 
+@skipIf(compiler="clang", compiler_version=['<', '14.0'])
+@skipIf(dwarf_version=['<', '3'])
 def test_qRegisterInfo_co

[Lldb-commits] [lldb] cf93a08 - Fixed typos in TestLldbGdbServer.py

2022-01-27 Thread Shubham Sandeep Rastogi via lldb-commits

Author: Shubham Sandeep Rastogi
Date: 2022-01-27T14:12:24-08:00
New Revision: cf93a085754e221f73a2877c946dcb2beb6039d7

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

LOG: Fixed typos in TestLldbGdbServer.py

Fixed more typos

Added: 


Modified: 
lldb/test/API/tools/lldb-server/TestLldbGdbServer.py

Removed: 




diff  --git a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py 
b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
index c6ecaf88b1be..12f3b5886d38 100644
--- a/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
+++ b/lldb/test/API/tools/lldb-server/TestLldbGdbServer.py
@@ -1044,7 +1044,7 @@ def test_qSupported_returns_known_stub_features(self):
 self.assertTrue(len(supported_dict) > 0)
 
 @skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<',3'4'])
+@skipIf(dwarf_version=['<','3'])
 def test_qSupported_auvx(self):
 expected = ('+' if lldbplatformutil.getPlatform()
 in ["freebsd", "linux", "netbsd"] else '-')
@@ -1350,7 +1350,7 @@ def test_P_and_p_thread_suffix_work(self):
 @skipIfWindows # No pty support to test any inferior output
 @add_test_categories(["llgs"])
 @skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['3', '4'])
+@skipIf(dwarf_version=['<', '3'])
 def test_launch_via_A(self):
 self.build()
 exe_path = self.getBuildArtifact("a.out")
@@ -1377,7 +1377,7 @@ def test_launch_via_A(self):
 @skipIfWindows # No pty support to test any inferior output
 @add_test_categories(["llgs"])
 @skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['<',3'4'])
+@skipIf(dwarf_version=['<','3'])
 def test_launch_via_vRun(self):
 self.build()
 exe_path = self.getBuildArtifact("a.out")
@@ -1421,7 +1421,7 @@ def test_launch_via_vRun_no_args(self):
 @skipIfWindows # No pty support to test any inferior output
 @add_test_categories(["llgs"])
 @skipIf(compiler="clang", compiler_version=['<', '14.0'])
-@skipIf(dwarf_version=['3', '4'])
+@skipIf(dwarf_version=['<', '3'])
 def test_QEnvironment(self):
 self.build()
 exe_path = self.getBuildArtifact("a.out")



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


[Lldb-commits] [PATCH] D118055: [lldb] [gdb-remote] Support getting siginfo via API

2022-01-27 Thread Jim Ingham via Phabricator via lldb-commits
jingham added a comment.

Yes, you probably need to make another change, which is actually probably a 
good idea as well.

The immediate problem is that the default constructed SBValue is empty, it has 
a null ValueObjectSP, so until you somehow make it valid you can't get a valid 
error from it, in which to set your error string.  By the time you've made a 
valid SBValue it's too late.

But I think actually you should fix this by having a

ValueObjectSP  lldb_private::Thread::GetSiginfoValue()

then the SB API will just wrap that call.  That way you can make a real 
ValueObject, with a real error, and return that at any stage.

That will fix your problem, but the real reason for doing this is that 
lldb_private code can't call back into the SB API's.   So if anybody in 
lldb_private land needed the ValueObject that wrapped the Siginfo information, 
which is after all the handiest form in which to have it, they would be out of 
luck.

I didn't get a chance to review this, sorry about that.  But in general, SB 
API's should not do any more work than is necessary to marshal the incoming 
arguments & figure out which lldb_private API to dispatch it to.  Otherwise 
you've written code is going to end up getting duplicated somewhere (in a 
command or somewhere else it's needed...)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118055

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


[Lldb-commits] [PATCH] D118425: [lldb] Update the lldb build instructions on Windows

2022-01-27 Thread Stella Stamenova via Phabricator via lldb-commits
stella.stamenova created this revision.
stella.stamenova added reviewers: JDevlieghere, dblaikie.
stella.stamenova requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The existing instructions for lldb on Windows can be more explicit. This adds a 
few details on how to install various components and the easiest way to get to 
a working build.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D118425

Files:
  lldb/docs/resources/build.rst


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -92,24 +92,30 @@
 * `GnuWin32 `_ for CoreUtils and Make.
 * `Python 3 `_.  Make sure to (1) 
get
   the x64 variant if that's what you're targetting and (2) install the debug
-  library if you want to build a debug lldb.
+  library if you want to build a debug lldb. The standalone installer is the
+  easiest way to get the debug library.
 * `Python Tools for Visual Studio
-  `_. If you plan to debug test
-  failures or even write new tests at all, PTVS is an indispensable debugging
+  `_. If you plan to debug test failures
+  or even write new tests at all, PTVS is an indispensable debugging
   extension to VS that enables full editing and debugging support for Python
   (including mixed native/managed debugging).
+* `SWIG for Windows _`
 
 The steps outlined here describes how to set up your system and install the
 required dependencies such that they can be found when needed during the build
 process. They only need to be performed once.
 
-#. Install Visual Studio with the Windows SDK and ATL components.
+#. Install Visual Studio with the "Desktop Development with C++" workload and
+   the "Python Development" workload.
 #. Install GnuWin32, making sure ``\bin`` is added to
your PATH environment variable. Verify that utilities like ``dirname`` and
``make`` are available from your terminal.
 #. Install SWIG for Windows, making sure  is added to
your PATH environment variable. Verify that ``swig`` is available from your
terminal.
+#. Install Python 3 from the standalone installer and include the debug 
libraries
+   in the install, making sure the Python install path is added to your PATH
+   environment variable.
 #. Register the Debug Interface Access DLLs with the Registry from a privileged
terminal.
 


Index: lldb/docs/resources/build.rst
===
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -92,24 +92,30 @@
 * `GnuWin32 `_ for CoreUtils and Make.
 * `Python 3 `_.  Make sure to (1) get
   the x64 variant if that's what you're targetting and (2) install the debug
-  library if you want to build a debug lldb.
+  library if you want to build a debug lldb. The standalone installer is the
+  easiest way to get the debug library.
 * `Python Tools for Visual Studio
-  `_. If you plan to debug test
-  failures or even write new tests at all, PTVS is an indispensable debugging
+  `_. If you plan to debug test failures
+  or even write new tests at all, PTVS is an indispensable debugging
   extension to VS that enables full editing and debugging support for Python
   (including mixed native/managed debugging).
+* `SWIG for Windows _`
 
 The steps outlined here describes how to set up your system and install the
 required dependencies such that they can be found when needed during the build
 process. They only need to be performed once.
 
-#. Install Visual Studio with the Windows SDK and ATL components.
+#. Install Visual Studio with the "Desktop Development with C++" workload and
+   the "Python Development" workload.
 #. Install GnuWin32, making sure ``\bin`` is added to
your PATH environment variable. Verify that utilities like ``dirname`` and
``make`` are available from your terminal.
 #. Install SWIG for Windows, making sure  is added to
your PATH environment variable. Verify that ``swig`` is available from your
terminal.
+#. Install Python 3 from the standalone installer and include the debug libraries
+   in the install, making sure the Python install path is added to your PATH
+   environment variable.
 #. Register the Debug Interface Access DLLs with the Registry from a privileged
terminal.
 
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 4a64955 - [lldb] Remove reproducers documentation

2022-01-27 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2022-01-27T19:35:28-08:00
New Revision: 4a64955c37570ef5f98db705d290d75adbeaf442

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

LOG: [lldb] Remove reproducers documentation

Added: 


Modified: 
lldb/docs/index.rst

Removed: 
lldb/docs/design/reproducers.rst



diff  --git a/lldb/docs/design/reproducers.rst 
b/lldb/docs/design/reproducers.rst
deleted file mode 100644
index cac8721196d3e..0
--- a/lldb/docs/design/reproducers.rst
+++ /dev/null
@@ -1,205 +0,0 @@
-Reproducers
-===
-
-As unbelievable as it may sound, the debugger has bugs. These bugs might
-manifest themselves as errors, missing results or even a crash. Quite often
-these bugs don't reproduce in simple, isolated scenarios. The debugger deals
-with a lot of moving parts and subtle 
diff erences can easily add up.
-
-Reproducers in LLDB improve the experience for both the users encountering bugs
-and the developers working on resolving them. The general idea consists of
-*capturing* all the information necessary to later *replay* a debug session
-while debugging the debugger.
-
-.. contents::
-   :local:
-
-Usage
--
-
-Reproducers are a generic concept in LLDB and are not inherently coupled with
-the command line driver. The functionality can be used for anything that uses
-the SB API and the driver is just one example. However, because it's probably
-the most common way users interact with lldb, that's the workflow described in
-this section.
-
-Capture
-```
-
-Until reproducer capture is enabled by default, you need to launch LLDB in
-capture mode. For the command line driver, this means passing ``--capture``.
-You cannot enable reproducer capture from within LLDB, as this would be too
-late to capture initialization of the debugger.
-
-.. code-block:: bash
-
-  $ lldb --capture
-
-In capture mode, LLDB will keep track of all the information it needs to replay
-the current debug session. Most data is captured lazily to limit the impact on
-performance. To create the reproducer, use the ``reproducer generate``
-sub-command. It's always possible to check the status of the reproducers with
-the ``reproducer status`` sub-command. Note that generating the reproducer
-terminates the debug session.
-
-.. code-block:: none
-
-  (lldb) reproducer status
-  Reproducer is in capture mode.
-  (lldb) reproducer generate
-  Reproducer written to '/path/to/reproducer'
-  Please have a look at the directory to assess if you're willing to share the 
contained information.
-
-
-The resulting reproducer is a directory. It was a conscious decision to not
-compress and archive it automatically. The reproducer can contain potentially
-sensitive information like object and symbol files, their paths on disk, debug
-information, memory excerpts of the inferior process, etc.
-
-Replay
-``
-
-It is strongly recommended to replay the reproducer locally to ensure it
-actually reproduces the expected behavior. If the reproducer doesn't behave
-correctly locally, it means there's a bug in the reproducer implementation that
-should be addressed.
-
-To replay a reproducer, simply pass its path to LLDB through the ``--replay``
-flag. It is unnecessary to pass any other command line flags. The flags that
-were passed to LLDB during capture are already part of the reproducer.
-
-.. code-block:: bash
-
-  $ lldb --replay /path/to/reproducer
-
-
-During replay LLDB will behave similar to batch mode. The session should be
-identical to the recorded debug session. The only expected 
diff erences are that
-the binary being debugged doesn't actually run during replay. That means that
-you won't see any of its side effects, like things being printed to the
-terminal. Another expected 
diff erence is the behavior of the ``reproducer
-generate`` command, which becomes a NOOP during replay.
-
-Augmenting a Bug Report with a Reproducer
-`
-
-A reproducer can significantly improve a bug report, but it in itself is not
-sufficient. Always describe the expected and unexpected behavior. Just like the
-debugger can have bugs, the reproducer can have bugs too.
-
-
-Design
---
-
-
-Replay
-``
-
-Reproducers support two replay modes. The main and most common mode is active
-replay. It's called active, because it's LLDB that is driving replay by calling
-the captured SB API functions one after each other. The second mode is passive
-replay. In this mode, LLDB sits idle until an SB API function is called, for
-example from Python, and then replays just this individual call.
-
-Active Replay
-^
-
-No matter how a reproducer was captured, they can always be replayed with the
-command line driver. When a reproducer is passed with the ``--replay`` fla

[Lldb-commits] [PATCH] D118425: [lldb] Update the lldb build instructions on Windows

2022-01-27 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere accepted this revision.
JDevlieghere added a comment.
This revision is now accepted and ready to land.

LGTM.

From my own notes:

- I wrote down that I neede "MSVC C++ x64/x86 build tool". Not sure if that's 
really required?
- As someone who's used to working on the command line, it took me way to long 
to figure out that I had to run `"%ProgramFiles(x86)%\Microsoft Visual 
Studio\2019\Community\Common7\Tools\VsDevCmd" -arch=amd64 -host_arch=amd64 
-no_logo` before I could do anything useful. Not sure if that's worth mention 
here as well.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118425

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


[Lldb-commits] [PATCH] D118395: Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

2022-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

What's the failure mode?

I find it highly unlikely that compiler or dwarf info version has anything to 
do with the failures. lldb-server tests don't read debug info at all and they 
might just as well be compiled with -g0.

The only unusual thing I can think of which makes these tests different from 
all other lldb-server tests is that there is so many of them in the same file. 
Are you sure you're not just running into some per-test timeout limit?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118395

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


[Lldb-commits] [PATCH] D78801: [LLDB] Add class WasmProcess for WebAssembly debugging

2022-01-27 Thread Xu Jun via Phabricator via lldb-commits
xujuntwt95329 added a comment.

Hi @paolosev, **many thanks for such a great patch which makes it possible to 
debug WebAssembly applications.** It is really really useful especially in 
non-browser environments.

We have enabled source debugging feature in **WebAssembly Micro Runtime 
** based on your patch 
(thanks @vwzm228 for the great work to make this happen!), 
and we have put the link of this patch to the ATTRIBUTIONS 
,
 and the acknowledgements in the document 
.

Please let me know if you have any concern or suggestion about this :)


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D78801

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


[Lldb-commits] [PATCH] D118395: Disable TestLldbGdbServer on Dwarf2 and clang versions below 14

2022-01-27 Thread Pavel Labath via Phabricator via lldb-commits
labath added a comment.

Also, if you're running these tests on some kind of a matrix bot, maybe you can 
just skip all lldb-server tests completely (dotest.py --skip-categories llgs). 
Given that they don't use debug info, they definitely don't provide any useful 
signal in these contexts.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D118395

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