[Lldb-commits] [lldb] 98d0703 - Revert "[LLDB] Skip TestVSCode_disconnect.test_launch arm/linux"

2021-03-31 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2021-03-31T15:22:49+05:00
New Revision: 98d070396d2b80b8abcad1c24c5875b33495ada0

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

LOG: Revert "[LLDB] Skip TestVSCode_disconnect.test_launch arm/linux"

This reverts commit 73cf85e527f69c495daece7c74743b9073d4717c.

Added: 


Modified: 
lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py

Removed: 




diff  --git 
a/lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py 
b/lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
index 226aad63e234f..dd4f69855f2d3 100644
--- a/lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
+++ b/lldb/test/API/tools/lldb-vscode/disconnect/TestVSCode_disconnect.py
@@ -29,7 +29,6 @@ def disconnect_and_assert_no_output_printed(self):
 @skipIfDarwin
 @skipIfWindows
 @skipIfRemote
-@skipIf(oslist=["linux"], archs=["arm"])
 def test_launch(self):
 """
 This test launches a process that would creates a file, but we 
disconnect



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


[Lldb-commits] [PATCH] D99603: [lldb] [client] Support for multiprocess extension

2021-03-31 Thread Michał Górny via Phabricator via lldb-commits
mgorny updated this revision to Diff 334404.
mgorny added a comment.

Added better PID mismatch handling in `SetThreadStopInfo()`. Not that most of 
the call sites actually check the return value...


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

https://reviews.llvm.org/D99603

Files:
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
  lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
  lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h

Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h
@@ -341,7 +341,7 @@
 
   size_t UpdateThreadPCsFromStopReplyThreadsValue(std::string &value);
 
-  size_t UpdateThreadIDsFromStopReplyThreadsValue(std::string &value);
+  size_t UpdateThreadIDsFromStopReplyThreadsValue(llvm::StringRef value);
 
   bool HandleNotifyPacket(StringExtractorGDBRemote &packet);
 
Index: lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
===
--- lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -1495,22 +1495,22 @@
   m_thread_pcs.clear();
 }
 
-size_t
-ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue(std::string &value) {
+size_t ProcessGDBRemote::UpdateThreadIDsFromStopReplyThreadsValue(
+llvm::StringRef value) {
   m_thread_ids.clear();
-  size_t comma_pos;
-  lldb::tid_t tid;
-  while ((comma_pos = value.find(',')) != std::string::npos) {
-value[comma_pos] = '\0';
-// thread in big endian hex
-tid = StringConvert::ToUInt64(value.c_str(), LLDB_INVALID_THREAD_ID, 16);
-if (tid != LLDB_INVALID_THREAD_ID)
-  m_thread_ids.push_back(tid);
-value.erase(0, comma_pos + 1);
-  }
-  tid = StringConvert::ToUInt64(value.c_str(), LLDB_INVALID_THREAD_ID, 16);
-  if (tid != LLDB_INVALID_THREAD_ID)
-m_thread_ids.push_back(tid);
+  lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID();
+  StringExtractorGDBRemote thread_ids{value};
+
+  do {
+auto pid_tid = thread_ids.GetPidTid(pid);
+if (pid_tid && pid_tid->first == pid) {
+  lldb::tid_t tid = pid_tid->second;
+  if (tid != LLDB_INVALID_THREAD_ID &&
+  tid != StringExtractorGDBRemote::AllProcesses)
+m_thread_ids.push_back(tid);
+}
+  } while (thread_ids.GetChar() == ',');
+
   return m_thread_ids.size();
 }
 
@@ -1527,7 +1527,7 @@
 value.erase(0, comma_pos + 1);
   }
   pc = StringConvert::ToUInt64(value.c_str(), LLDB_INVALID_ADDRESS, 16);
-  if (pc != LLDB_INVALID_THREAD_ID)
+  if (pc != LLDB_INVALID_ADDRESS)
 m_thread_pcs.push_back(pc);
   return m_thread_pcs.size();
 }
@@ -2146,6 +2146,7 @@
 }
 
 StateType ProcessGDBRemote::SetThreadStopInfo(StringExtractor &stop_packet) {
+  lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID();
   stop_packet.SetFilePos(0);
   const char stop_type = stop_packet.GetChar();
   switch (stop_type) {
@@ -2160,14 +2161,12 @@
 if (stop_id == 0) {
   // Our first stop, make sure we have a process ID, and also make sure we
   // know about our registers
-  if (GetID() == LLDB_INVALID_PROCESS_ID) {
-lldb::pid_t pid = m_gdb_comm.GetCurrentProcessID();
-if (pid != LLDB_INVALID_PROCESS_ID)
+  if (GetID() == LLDB_INVALID_PROCESS_ID && pid != LLDB_INVALID_PROCESS_ID)
   SetID(pid);
-  }
   BuildDynamicRegisterInfo(true);
 }
 // Stop with signal and thread info
+lldb::pid_t stop_pid = LLDB_INVALID_PROCESS_ID;
 lldb::tid_t tid = LLDB_INVALID_THREAD_ID;
 const uint8_t signo = stop_packet.GetHexU8();
 llvm::StringRef key;
@@ -2196,24 +2195,18 @@
 value.getAsInteger(16, x);
 exc_data.push_back(x);
   } else if (key.compare("thread") == 0) {
-// thread in big endian hex
-if (value.getAsInteger(16, tid))
+// thread-id
+StringExtractorGDBRemote thread_id{value};
+auto pid_tid = thread_id.GetPidTid(pid);
+if (pid_tid) {
+  stop_pid = pid_tid->first;
+  tid = pid_tid->second;
+} else
   tid = LLDB_INVALID_THREAD_ID;
   } else if (key.compare("threads") == 0) {
 std::lock_guard guard(
 m_thread_list_real.GetMutex());
-
-m_thread_ids.clear();
-// A comma separated list of all threads in the current
-// process that includes the thread for this stop reply packet
-lldb::tid_t tid;
-while (!value.empty()) {
-  llvm::StringRef tid_str;
-  std::tie(tid_str, value) = value.split(',');
-  if (tid_str.getAsInteger(16, tid))
-tid = LLDB_INVALID_THREAD_ID;
-  m_thread_ids.push_back(tid);
-}
+UpdateThread

[Lldb-commits] [PATCH] D99653: [nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-03-31 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil created this revision.
jankratochvil added reviewers: labath, grimar, clayborg.
jankratochvil added a project: LLDB.
Herald added a subscriber: JDevlieghere.
jankratochvil requested review of this revision.

Refactor code only for D98289 .


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99653

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -235,15 +235,7 @@
   /// Return a rangelist's offset based on an index. The index designates
   /// an entry in the rangelist table's offset array and is supplied by
   /// DW_FORM_rnglistx.
-  llvm::Optional GetRnglistOffset(uint32_t Index) const {
-if (!m_rnglist_table)
-  return llvm::None;
-if (llvm::Optional off = m_rnglist_table->getOffsetEntry(
-m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
-Index))
-  return *off + m_ranges_base;
-return llvm::None;
-  }
+  llvm::Optional GetRnglistOffset(uint32_t Index) const;
 
   llvm::Optional GetLoclistOffset(uint32_t Index) {
 if (!m_loclist_table_header)
@@ -291,6 +283,8 @@
 return &m_die_array[0];
   }
 
+  llvm::Optional GetRnglist();
+
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;
   DWARFUnitHeader m_header;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -495,6 +495,19 @@
 ranges_base, toString(table_or_error.takeError()).c_str());
 }
 
+llvm::Optional DWARFUnit::GetRnglist() {
+  return m_rnglist_table;
+}
+
+llvm::Optional DWARFUnit::GetRnglistOffset(uint32_t Index) const {
+  if (!GetRnglist())
+return llvm::None;
+  if (llvm::Optional off = GetRnglist()->getOffsetEntry(
+  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), 
Index))
+return *off + m_ranges_base;
+  return llvm::None;
+}
+
 void DWARFUnit::SetStrOffsetsBase(dw_offset_t str_offsets_base) {
   m_str_offsets_base = str_offsets_base;
 }
@@ -936,11 +949,11 @@
 return ranges;
   }
 
-  if (!m_rnglist_table)
+  if (!GetRnglist())
 return llvm::createStringError(errc::invalid_argument,
"missing or invalid range list table");
 
-  auto range_list_or_error = m_rnglist_table->findList(
+  auto range_list_or_error = GetRnglist()->findList(
   m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), offset);
   if (!range_list_or_error)
 return range_list_or_error.takeError();
@@ -971,7 +984,7 @@
 DWARFUnit::FindRnglistFromIndex(uint32_t index) {
   if (llvm::Optional offset = GetRnglistOffset(index))
 return FindRnglistFromOffset(*offset);
-  if (m_rnglist_table)
+  if (GetRnglist())
 return llvm::createStringError(errc::invalid_argument,
"invalid range list table index %d", index);
 


Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
@@ -235,15 +235,7 @@
   /// Return a rangelist's offset based on an index. The index designates
   /// an entry in the rangelist table's offset array and is supplied by
   /// DW_FORM_rnglistx.
-  llvm::Optional GetRnglistOffset(uint32_t Index) const {
-if (!m_rnglist_table)
-  return llvm::None;
-if (llvm::Optional off = m_rnglist_table->getOffsetEntry(
-m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(),
-Index))
-  return *off + m_ranges_base;
-return llvm::None;
-  }
+  llvm::Optional GetRnglistOffset(uint32_t Index) const;
 
   llvm::Optional GetLoclistOffset(uint32_t Index) {
 if (!m_loclist_table_header)
@@ -291,6 +283,8 @@
 return &m_die_array[0];
   }
 
+  llvm::Optional GetRnglist();
+
   SymbolFileDWARF &m_dwarf;
   std::shared_ptr m_dwo;
   DWARFUnitHeader m_header;
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
@@ -495,6 +495,19 @@
 ranges_base, toString(table_or_error.takeError()).c_str());
 }
 
+llvm::Optional DWARFUnit::GetRnglist() {
+  return m_rnglist_table;
+}
+
+llvm::Optional DWARFUnit::GetRnglistOffset(uint32_t Index) const {
+  if (!GetRnglist())
+return llvm::None;
+  if (llvm::Optional off = GetRnglist()->getOffsetEntry(
+  m_dwarf.GetDWARFContext().getOrLoadRngListsData().GetAsLLVM(), Index))
+retur

[Lldb-commits] [PATCH] D98289: [lldb] 2/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-03-31 Thread Jan Kratochvil via Phabricator via lldb-commits
jankratochvil updated this revision to Diff 334412.
jankratochvil retitled this revision from "[lldb] Fix DW_AT_ranges 
DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)" to "[lldb] 2/2: 
Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by 
GCC)".
jankratochvil added a reviewer: clayborg.
jankratochvil removed a project: LLVM.

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98289

Files:
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp
  lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.h
  lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s

Index: lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
===
--- /dev/null
+++ lldb/test/Shell/SymbolFile/DWARF/DW_AT_range-DW_FORM_sec_offset.s
@@ -0,0 +1,138 @@
+# DW_AT_ranges can use DW_FORM_sec_offset (instead of DW_FORM_rnglistx).
+# In such case DW_AT_rnglists_base does not need to be present.
+
+# REQUIRES: x86
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj %s > %t
+# RUN: %lldb %t -o "image lookup -v -s lookup_rnglists" \
+# RUN:   -o exit | FileCheck %s
+
+# Failure was the block range 1..2 was not printed plus:
+# error: DW_AT_range-DW_FORM_sec_offset.s.tmp {0x003f}: DIE has DW_AT_ranges(0xc) attribute, but range extraction failed (missing or invalid range list table), please file a bug and attach the file at the start of this error message
+
+# CHECK-LABEL: image lookup -v -s lookup_rnglists
+# CHECK:  Function: id = {0x0029}, name = "rnglists", range = [0x-0x0003)
+# CHECK:Blocks: id = {0x0029}, range = [0x-0x0003)
+# CHECK-NEXT:   id = {0x003f}, range = [0x0001-0x0002)
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
+# RUN:   --defsym RNGLISTX=0 %s > %t-rnglistx
+# RUN: %lldb %t-rnglistx -o "image lookup -v -s lookup_rnglists" \
+# RUN:   -o exit 2>&1 | FileCheck --check-prefix=RNGLISTX %s
+
+# RNGLISTX-LABEL: image lookup -v -s lookup_rnglists
+# RNGLISTX: error: DW_AT_range-DW_FORM_sec_offset.s.tmp-rnglistx : DW_FORM_rnglistx cannot be used without DW_AT_rnglists_base
+
+# RUN: llvm-mc -triple=x86_64-pc-linux -filetype=obj \
+# RUN:   --defsym RNGLISTX=0 --defsym RNGLISTBASE=0 %s > %t-rnglistbase
+# RUN: %lldb %t-rnglistbase -o "image lookup -v -s lookup_rnglists" \
+# RUN:   -o exit 2>&1 | FileCheck --check-prefix=RNGLISTBASE %s
+
+# RNGLISTBASE-LABEL: image lookup -v -s lookup_rnglists
+# RNGLISTBASE: error: DW_AT_range-DW_FORM_sec_offset.s.tmp-rnglistbase {0x0043}: DIE has DW_AT_ranges(0x0) attribute, but range extraction failed (invalid range list table index 0), please file a bug and attach the file at the start of this error message
+
+.text
+rnglists:
+nop
+.Lblock1_begin:
+lookup_rnglists:
+nop
+.Lblock1_end:
+nop
+.Lrnglists_end:
+
+.section.debug_abbrev,"",@progbits
+.byte   1   # Abbreviation Code
+.byte   17  # DW_TAG_compile_unit
+.byte   1   # DW_CHILDREN_yes
+.byte   37  # DW_AT_producer
+.byte   8   # DW_FORM_string
+.byte   17  # DW_AT_low_pc
+.byte   27  # DW_FORM_addrx
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   115 # DW_AT_addr_base
+.byte   23  # DW_FORM_sec_offset
+.ifdef RNGLISTBASE
+.byte   0x74# DW_AT_rnglists_base
+.byte   23  # DW_FORM_sec_offset
+.endif
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   2   # Abbreviation Code
+.byte   46  # DW_TAG_subprogram
+.byte   1   # DW_CHILDREN_yes
+.byte   17  # DW_AT_low_pc
+.byte   1   # DW_FORM_addr
+.byte   18  # DW_AT_high_pc
+.byte   6   # DW_FORM_data4
+.byte   3   # DW_AT_name
+.byte   8   # DW_FORM_string
+.byte   0   # EOM(1)
+.byte   0   # EOM(2)
+.byte   5   # Abbreviation Code
+.byte   11  # DW_TAG_lexical_block
+.byte   0   # DW_CHILDREN_no
+.byte   85  # DW_AT_ranges
+.ifndef RNGLISTX
+.byte   0x17# DW_FORM_sec_offset
+.else
+.byte   0x23# DW_FORM_rnglistx
+.endif
+.byte   0   #

[Lldb-commits] [lldb] feb6f2c - Revert "[LLDB] Arm64/Linux test case for MTE and Pointer Authentication regset"

2021-03-31 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2021-03-31T17:12:14+05:00
New Revision: feb6f2c78fa9474e7329c4a809f175b1675d0975

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

LOG: Revert "[LLDB] Arm64/Linux test case for MTE and Pointer Authentication 
regset"

This reverts commit 9ab677180091a690cd99d4ac55d5fb9e1149b1ec.

Reason: LLDB AArch64/Linux buildbot failure.

Added: 


Modified: 
lldb/packages/Python/lldbsuite/test/lldbtest.py

Removed: 
lldb/test/API/commands/register/register/aarch64_dynamic_regset/Makefile

lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
lldb/test/API/commands/register/register/aarch64_dynamic_regset/main.c



diff  --git a/lldb/packages/Python/lldbsuite/test/lldbtest.py 
b/lldb/packages/Python/lldbsuite/test/lldbtest.py
index a9928af677a6e..958cadd3a7c81 100644
--- a/lldb/packages/Python/lldbsuite/test/lldbtest.py
+++ b/lldb/packages/Python/lldbsuite/test/lldbtest.py
@@ -1269,7 +1269,7 @@ def isPPC64le(self):
 return True
 return False
 
-def getCPUInfo(self):
+def isAArch64SVE(self):
 triple = self.dbg.GetSelectedPlatform().GetTriple()
 
 # TODO other platforms, please implement this function
@@ -1290,16 +1290,7 @@ def getCPUInfo(self):
 except:
 return False
 
-return cpuinfo
-
-def isAArch64SVE(self):
-return "sve" in self.getCPUInfo()
-
-def isAArch64MTE(self):
-return "mte" in self.getCPUInfo()
-
-def isAArch64PAuth(self):
-return "paca" in self.getCPUInfo()
+return " sve " in cpuinfo
 
 def hasLinuxVmFlags(self):
 """ Check that the target machine has "VmFlags" lines in

diff  --git 
a/lldb/test/API/commands/register/register/aarch64_dynamic_regset/Makefile 
b/lldb/test/API/commands/register/register/aarch64_dynamic_regset/Makefile
deleted file mode 100644
index 5fc881c2db97c..0
--- a/lldb/test/API/commands/register/register/aarch64_dynamic_regset/Makefile
+++ /dev/null
@@ -1,5 +0,0 @@
-C_SOURCES := main.c
-
-CFLAGS_EXTRAS := -march=armv8-a+sve
-
-include Makefile.rules

diff  --git 
a/lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
 
b/lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
deleted file mode 100644
index ecaefb0e657e8..0
--- 
a/lldb/test/API/commands/register/register/aarch64_dynamic_regset/TestArm64DynamicRegsets.py
+++ /dev/null
@@ -1,109 +0,0 @@
-"""
-Test AArch64 dynamic register sets
-"""
-
-import lldb
-from lldbsuite.test.decorators import *
-from lldbsuite.test.lldbtest import *
-from lldbsuite.test import lldbutil
-
-
-class RegisterCommandsTestCase(TestBase):
-
-def check_sve_register_size(self, set, name, expected):
-reg_value = set.GetChildMemberWithName(name)
-self.assertTrue(reg_value.IsValid(),
-'Expected a register named %s' % (name))
-self.assertEqual(reg_value.GetByteSize(), expected,
- 'Expected a register %s size == %i bytes' % (name, 
expected))
-
-def sve_regs_read_dynamic(self, sve_registers):
-vg_reg = sve_registers.GetChildMemberWithName("vg")
-vg_reg_value = sve_registers.GetChildMemberWithName(
-"vg").GetValueAsUnsigned()
-
-z_reg_size = vg_reg_value * 8
-p_reg_size = int(z_reg_size / 8)
-
-for i in range(32):
-z_regs_value = '{' + \
-' '.join('0x{:02x}'.format(i + 1)
- for _ in range(z_reg_size)) + '}'
-self.expect('register read z%i' %
-(i), substrs=[z_regs_value])
-
-# Set P registers with random test values. The P registers are 
predicate
-# registers, which hold one bit for each byte available in a Z 
register.
-# For below mentioned values of P registers, P(0,5,10,15) will have all
-# Z register lanes set while P(4,9,14) will have no lanes set.
-p_value_bytes = ['0xff', '0x55', '0x11', '0x01', '0x00']
-for i in range(16):
-p_regs_value = '{' + \
-' '.join(p_value_bytes[i % 5] for _ in range(p_reg_size)) + '}'
-self.expect('register read p%i' % (i), substrs=[p_regs_value])
-
-self.expect("register read ffr", substrs=[p_regs_value])
-
-for i in range(32):
-z_regs_value = '{' + \
-' '.join('0x{:02x}'.format(32 - i)
- for _ in range(z_reg_size)) + '}'
-self.runCmd("register write z%i '%s'" % (i, z_regs_value))
-self.expect('register read z%i' % (i), substrs=[z_regs_value])
-
-for i in range(16):
-p_regs_value = '{' +

[Lldb-commits] [lldb] 71b648f - Revert "[LLDB] Arm64/Linux Add MTE and Pointer Authentication registers"

2021-03-31 Thread Muhammad Omair Javaid via lldb-commits

Author: Muhammad Omair Javaid
Date: 2021-03-31T17:12:14+05:00
New Revision: 71b648f7158c7a0b4918eaa3e94d307e4bbfce97

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

LOG: Revert "[LLDB] Arm64/Linux Add MTE and Pointer Authentication registers"

This reverts commit 1164b4e2957290e814c3dd781a68e504dd39148e.

Reason: LLDB AArch64 Linux buildbot failure

Added: 


Modified: 
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.h
lldb/source/Plugins/Process/Linux/NativeThreadLinux.h
lldb/source/Plugins/Process/POSIX/NativeProcessELF.h
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp
lldb/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.h
lldb/source/Plugins/Process/Utility/RegisterInfos_arm64.h

Removed: 




diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
index 50c299b030edf..09cf72c044822 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_arm64.cpp
@@ -33,17 +33,6 @@
 #define NT_ARM_SVE 0x405 /* ARM Scalable Vector Extension */
 #endif
 
-#ifndef NT_ARM_PAC_MASK
-#define NT_ARM_PAC_MASK 0x406 /* Pointer authentication code masks */
-#endif
-
-#ifndef NT_ARM_TAGGED_ADDR_CTRL
-#define NT_ARM_TAGGED_ADDR_CTRL 0x409 /* Tagged address control register */
-#endif
-
-#define HWCAP_PACA (1 << 30)
-#define HWCAP2_MTE (1 << 18)
-
 #define REG_CONTEXT_SIZE (GetGPRSize() + GetFPRSize())
 
 using namespace lldb;
@@ -73,18 +62,6 @@ 
NativeRegisterContextLinux::CreateHostNativeRegisterContextLinux(
 .Success())
   opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskSVE);
 
-NativeProcessLinux &process = native_thread.GetProcess();
-
-llvm::Optional auxv_at_hwcap =
-process.GetAuxValue(AuxVector::AUXV_AT_HWCAP);
-if (auxv_at_hwcap && (*auxv_at_hwcap & HWCAP_PACA))
-  opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskPAuth);
-
-llvm::Optional auxv_at_hwcap2 =
-process.GetAuxValue(AuxVector::AUXV_AT_HWCAP2);
-if (auxv_at_hwcap && (*auxv_at_hwcap2 & HWCAP2_MTE))
-  opt_regsets.Set(RegisterInfoPOSIX_arm64::eRegsetMaskMTE);
-
 auto register_info_up =
 std::make_unique(target_arch, opt_regsets);
 return std::make_unique(
@@ -105,9 +82,6 @@ 
NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
   ::memset(&m_hwp_regs, 0, sizeof(m_hwp_regs));
   ::memset(&m_hbp_regs, 0, sizeof(m_hbp_regs));
   ::memset(&m_sve_header, 0, sizeof(m_sve_header));
-  ::memset(&m_pac_mask, 0, sizeof(m_pac_mask));
-
-  m_mte_ctrl_reg = 0;
 
   // 16 is just a maximum value, query hardware for actual watchpoint count
   m_max_hwp_supported = 16;
@@ -119,8 +93,6 @@ 
NativeRegisterContextLinux_arm64::NativeRegisterContextLinux_arm64(
   m_fpu_is_valid = false;
   m_sve_buffer_is_valid = false;
   m_sve_header_is_valid = false;
-  m_pac_mask_is_valid = false;
-  m_mte_ctrl_is_valid = false;
 
   if (GetRegisterInfo().IsSVEEnabled())
 m_sve_state = SVEState::Unknown;
@@ -257,22 +229,6 @@ NativeRegisterContextLinux_arm64::ReadRegister(const 
RegisterInfo *reg_info,
 src = (uint8_t *)GetSVEBuffer() + offset;
   }
 }
-  } else if (IsPAuth(reg)) {
-error = ReadPAuthMask();
-if (error.Fail())
-  return error;
-
-offset = reg_info->byte_offset - GetRegisterInfo().GetPAuthOffset();
-assert(offset < GetPACMaskSize());
-src = (uint8_t *)GetPACMask() + offset;
-  } else if (IsMTE(reg)) {
-error = ReadMTEControl();
-if (error.Fail())
-  return error;
-
-offset = reg_info->byte_offset - GetRegisterInfo().GetMTEOffset();
-assert(offset < GetMTEControlSize());
-src = (uint8_t *)GetMTEControl() + offset;
   } else
 return Status("failed - register wasn't recognized to be a GPR or an FPR, "
   "write strategy unknown");
@@ -431,17 +387,6 @@ Status NativeRegisterContextLinux_arm64::WriteRegister(
 return WriteAllSVE();
   }
 }
-  } else if (IsMTE(reg)) {
-error = ReadMTEControl();
-if (error.Fail())
-  return error;
-
-offset = reg_info->byte_offset - GetRegisterInfo().GetMTEOffset();
-assert(offset < GetMTEControlSize());
-dst = (uint8_t *)GetMTEControl() + offset;
-::memcpy(dst, reg_value.GetBytes(), reg_info->byte_size);
-
-return WriteMTEControl();
   }
 
   return Status("Failed to write register value");
@@ -530,14 +475,6 @@ bool NativeRegisterContextLinux_arm64::IsSVE(unsigned reg) 
const {
   return GetRegisterInfo().IsSVEReg(reg);
 }
 
-bool NativeRegisterContextLinux_arm64::IsPA

[Lldb-commits] [PATCH] D99653: [nfc] [lldb] 1/2: Fix DW_AT_ranges DW_FORM_sec_offset not using DW_AT_rnglists_base (used by GCC)

2021-03-31 Thread Greg Clayton via Phabricator via lldb-commits
clayborg requested changes to this revision.
clayborg added a comment.
This revision now requires changes to proceed.

Looks good as long as we fix to DWARFUnit::GetRnglist() to not return a full 
copy of the "llvm::Optional" each time it is 
called.




Comment at: lldb/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp:498-500
+llvm::Optional DWARFUnit::GetRnglist() {
+  return m_rnglist_table;
+}

Return "const llvm::Optional &" to avoid making a 
copy.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99653

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


[Lldb-commits] [PATCH] D99694: Add support for getting signed ObjC tagged pointer values

2021-03-31 Thread Jim Ingham via Phabricator via lldb-commits
jingham created this revision.
jingham added a reviewer: JDevlieghere.
jingham requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

The ObjC runtime offers both signed & unsigned tagged pointer value
accessors to tagged pointer providers, but lldb's tagged pointer
code only implemented the unsigned one.  This patch adds an
emulation of the signed one.

  

The motivation for doing this is that NSNumbers use the signed
accessor (they are always signed) and we need to follow that in our
summary provider or we will get incorrect values for negative
NSNumbers.

  

The data-formatter-objc test file had NSNumber examples (along with lots of 
other
goodies) but the NSNumber values weren't tested.  So I also added
checks for those values to the test.

  

I also did a quick audit of the other types in that main.m file, and
it looks like pretty much all the other values are either intermediates
or are tested.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D99694

Files:
  lldb/source/Plugins/Language/ObjC/Cocoa.cpp
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCClassDescriptorV2.h
  lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.h
  
lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
  lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
  
lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py

Index: lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjCCF.py
@@ -45,7 +45,6 @@
 '(Point) point = (v=7, h=12)', '(Point *) point_ptr = (v=7, h=12)',
 '(SEL) foo_selector = "foo_selector_impl"'
 ]
-
 self.expect("frame variable", substrs=expect_strings)
 
 if self.getArchitecture() in ['i386', 'x86_64']:
@@ -56,3 +55,28 @@
 '(HIRect) hi_rect = origin=(x = 3, y = 5) size=(width = 4, height = 6)',
 ]
 self.expect("frame variable", substrs=extra_string)
+
+# The original tests left out testing the NSNumber values, so do that here.
+# This set is all pointers, with summaries, so we only check the summary.
+var_list_pointer = [
+['NSNumber *', 'num1','(int)5'],
+['NSNumber *', 'num2','(float)3.14'],
+['NSNumber *', 'num3','(double)3.14'],
+['NSNumber *', 'num4','(int128_t)18446744073709551614'],
+['NSNumber *', 'num5','(char)65'],
+['NSNumber *', 'num6','(long)255'],
+['NSNumber *', 'num7','(long)200'],
+['NSNumber *', 'num8_Y',  'YES'],
+['NSNumber *', 'num8_N',  'NO'],
+['NSNumber *', 'num9','(short)-31616'],
+['NSNumber *', 'num_at1', '(int)12'],
+['NSNumber *', 'num_at2', '(int)-12'],
+['NSNumber *', 'num_at3', '(double)12.5'],
+['NSNumber *', 'num_at4', '(double)-12.5'],
+['NSDecimalNumber *', 'decimal_number', '123456 x 10^-10'],
+['NSDecimalNumber *', 'decimal_number_neg', '-123456 x 10^10']
+]
+for type, var_path, summary in var_list_pointer:
+self.expect_var_path(var_path, summary, None, type)
+
+
Index: lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
===
--- lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
+++ lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h
@@ -86,11 +86,18 @@
 }
 
 virtual bool IsValid() = 0;
-
+// There are two routines in the ObjC runtime that tagged pointer clients 
+// can call to get the value from their tagged pointer, one that retrieves 
+// it as an unsigned value and one a signed value.  These two 
+// GetTaggedPointerInfo methods mirror those two ObjC runtime calls.
 virtual bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
   uint64_t *value_bits = nullptr,
   uint64_t *payload = nullptr) = 0;
 
+virtual bool GetTaggedPointerInfoSigned(uint64_t *info_bits = nullptr,
+int64_t *value_bits = nullptr,
+uint64_t *payload = nullptr) = 0;
+
 virtual uint64_t GetInstanceSize() = 0;
 
 // use to implement version-specific additional constraints on pointers
Index: lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp
===
--

[Lldb-commits] [lldb] dfc8da1 - [lldb] Remove LLDB_CAPTURE_REPRODUCER override

2021-03-31 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-31T21:10:56-07:00
New Revision: dfc8da19c5d7ed48f62a4cc588b641f2deee8789

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

LOG: [lldb] Remove LLDB_CAPTURE_REPRODUCER override

Remove the LLDB_CAPTURE_REPRODUCER as it is inherently dangerous. The
reproducers require careful initialization which cannot be guaranteed by
overwriting the reproducer mode at this level.

If we want to provide this functionality, we should do it in the driver
instead. It was originally added to enable capture in CI, but we now
have a dedicated CI job that captures and replays the test suite.

Added: 


Modified: 
lldb/source/Utility/Reproducer.cpp

Removed: 




diff  --git a/lldb/source/Utility/Reproducer.cpp 
b/lldb/source/Utility/Reproducer.cpp
index d9207b1eb49f3..b63863c535faf 100644
--- a/lldb/source/Utility/Reproducer.cpp
+++ b/lldb/source/Utility/Reproducer.cpp
@@ -20,15 +20,6 @@ using namespace lldb_private::repro;
 using namespace llvm;
 using namespace llvm::yaml;
 
-static llvm::Optional GetEnv(const char *var) {
-  std::string val = llvm::StringRef(getenv(var)).lower();
-  if (val == "0" || val == "off")
-return false;
-  if (val == "1" || val == "on")
-return true;
-  return {};
-}
-
 Reproducer &Reproducer::Instance() { return *InstanceImpl(); }
 
 llvm::Error Reproducer::Initialize(ReproducerMode mode,
@@ -36,16 +27,6 @@ llvm::Error Reproducer::Initialize(ReproducerMode mode,
   lldbassert(!InstanceImpl() && "Already initialized.");
   InstanceImpl().emplace();
 
-  // The environment can override the capture mode.
-  if (mode != ReproducerMode::Replay) {
-if (llvm::Optional override = GetEnv("LLDB_CAPTURE_REPRODUCER")) {
-  if (*override)
-mode = ReproducerMode::Capture;
-  else
-mode = ReproducerMode::Off;
-}
-  }
-
   switch (mode) {
   case ReproducerMode::Capture: {
 if (!root) {



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


[Lldb-commits] [PATCH] D99701: [lldb-vscode] Consistently use return EXIT_SUCCESS and EXIT_FAILURE (NFC)

2021-03-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: wallace, clayborg.
JDevlieghere requested review of this revision.

Consistently use `return` with `EXIT_SUCCESS` or `EXIT_FAILURE` instead of 
mix-and-matching `return`, `exit` `0,` `1` etc.


https://reviews.llvm.org/D99701

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -3105,7 +3105,7 @@
 } else {
   llvm::errs() << "\"--launch-target\" requires \"--comm-file\" to be "
   "specified\n";
-  exit(EXIT_FAILURE);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3118,7 +3118,7 @@
 
   if (input_args.hasArg(OPT_help)) {
 printHelp(T, llvm::sys::path::filename(argv[0]));
-return 0;
+return EXIT_SUCCESS;
   }
 
   if (auto *arg = input_args.getLastArg(OPT_port)) {
@@ -3127,7 +3127,7 @@
 portno = strtol(optarg, &remainder, 0);
 if (remainder == optarg || *remainder != '\0') {
   fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
-  exit(1);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3144,7 +3144,7 @@
   g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
   g_vsc.output.descriptor = StreamDescriptor::from_socket(socket_fd, 
false);
 } else {
-  exit(1);
+  return EXIT_FAILURE;
 }
   } else {
 g_vsc.input.descriptor = StreamDescriptor::from_file(fileno(stdin), false);
@@ -3158,15 +3158,15 @@
 if (status == lldb_vscode::PacketStatus::EndOfFile)
   break;
 if (status != lldb_vscode::PacketStatus::Success)
-  return 1; // Fatal error
+  return EXIT_FAILURE;
 
 if (!g_vsc.HandleObject(object))
-  return 1;
+  return EXIT_FAILURE;
 ++packet_idx;
   }
 
   // We must terminate the debugger in a thread before the C++ destructor
   // chain messes everything up.
   lldb::SBDebugger::Terminate();
-  return 0;
+  return EXIT_SUCCESS;
 }


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -3105,7 +3105,7 @@
 } else {
   llvm::errs() << "\"--launch-target\" requires \"--comm-file\" to be "
   "specified\n";
-  exit(EXIT_FAILURE);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3118,7 +3118,7 @@
 
   if (input_args.hasArg(OPT_help)) {
 printHelp(T, llvm::sys::path::filename(argv[0]));
-return 0;
+return EXIT_SUCCESS;
   }
 
   if (auto *arg = input_args.getLastArg(OPT_port)) {
@@ -3127,7 +3127,7 @@
 portno = strtol(optarg, &remainder, 0);
 if (remainder == optarg || *remainder != '\0') {
   fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
-  exit(1);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3144,7 +3144,7 @@
   g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
   g_vsc.output.descriptor = StreamDescriptor::from_socket(socket_fd, false);
 } else {
-  exit(1);
+  return EXIT_FAILURE;
 }
   } else {
 g_vsc.input.descriptor = StreamDescriptor::from_file(fileno(stdin), false);
@@ -3158,15 +3158,15 @@
 if (status == lldb_vscode::PacketStatus::EndOfFile)
   break;
 if (status != lldb_vscode::PacketStatus::Success)
-  return 1; // Fatal error
+  return EXIT_FAILURE;
 
 if (!g_vsc.HandleObject(object))
-  return 1;
+  return EXIT_FAILURE;
 ++packet_idx;
   }
 
   // We must terminate the debugger in a thread before the C++ destructor
   // chain messes everything up.
   lldb::SBDebugger::Terminate();
-  return 0;
+  return EXIT_SUCCESS;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D99702: [lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the debugger

2021-03-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere created this revision.
JDevlieghere added reviewers: wallace, clayborg.
JDevlieghere requested review of this revision.

Make sure we always terminate the debugger by using a RAII object.


https://reviews.llvm.org/D99702

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -44,6 +44,7 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
@@ -3112,6 +3113,10 @@
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
+  // Terminate the debugger before the C++ destructor chain kicks in.
+  auto terminate_debugger =
+  llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
+
   RegisterRequestCallbacks();
 
   int portno = -1;
@@ -3165,8 +3170,5 @@
 ++packet_idx;
   }
 
-  // We must terminate the debugger in a thread before the C++ destructor
-  // chain messes everything up.
-  lldb::SBDebugger::Terminate();
   return 0;
 }


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -44,6 +44,7 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
@@ -3112,6 +3113,10 @@
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
+  // Terminate the debugger before the C++ destructor chain kicks in.
+  auto terminate_debugger =
+  llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
+
   RegisterRequestCallbacks();
 
   int portno = -1;
@@ -3165,8 +3170,5 @@
 ++packet_idx;
   }
 
-  // We must terminate the debugger in a thread before the C++ destructor
-  // chain messes everything up.
-  lldb::SBDebugger::Terminate();
   return 0;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 54c3c2e - [lldb-vscode] Consistently use return EXIT_SUCCESS and EXIT_FAILURE (NFC)

2021-03-31 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-31T21:41:59-07:00
New Revision: 54c3c2e82874d8ee65b32f1f79bfd494b0551986

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

LOG: [lldb-vscode] Consistently use return EXIT_SUCCESS and EXIT_FAILURE (NFC)

Consistently use return with EXIT_SUCCESS or EXIT_FAILURE instead of
mix-and-matching return, exit 0, 1 etc.

Differential revision: https://reviews.llvm.org/D99701

Added: 


Modified: 
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 9a6a0f5b69f06..896ea61f97426 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -3105,7 +3105,7 @@ int main(int argc, char *argv[]) {
 } else {
   llvm::errs() << "\"--launch-target\" requires \"--comm-file\" to be "
   "specified\n";
-  exit(EXIT_FAILURE);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3118,7 +3118,7 @@ int main(int argc, char *argv[]) {
 
   if (input_args.hasArg(OPT_help)) {
 printHelp(T, llvm::sys::path::filename(argv[0]));
-return 0;
+return EXIT_SUCCESS;
   }
 
   if (auto *arg = input_args.getLastArg(OPT_port)) {
@@ -3127,7 +3127,7 @@ int main(int argc, char *argv[]) {
 portno = strtol(optarg, &remainder, 0);
 if (remainder == optarg || *remainder != '\0') {
   fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
-  exit(1);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3144,7 +3144,7 @@ int main(int argc, char *argv[]) {
   g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
   g_vsc.output.descriptor = StreamDescriptor::from_socket(socket_fd, 
false);
 } else {
-  exit(1);
+  return EXIT_FAILURE;
 }
   } else {
 g_vsc.input.descriptor = StreamDescriptor::from_file(fileno(stdin), false);
@@ -3168,5 +3168,5 @@ int main(int argc, char *argv[]) {
   // We must terminate the debugger in a thread before the C++ destructor
   // chain messes everything up.
   lldb::SBDebugger::Terminate();
-  return 0;
+  return EXIT_SUCCESS;
 }



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


[Lldb-commits] [lldb] b7e2c2a - [lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the debugger

2021-03-31 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-31T21:41:59-07:00
New Revision: b7e2c2acb8eea471d0960f01d4c75d45156bd9ae

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

LOG: [lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the 
debugger

Make sure we always terminate the debugger by using a RAII object.

Differential revision: https://reviews.llvm.org/D99702

Added: 


Modified: 
lldb/tools/lldb-vscode/lldb-vscode.cpp

Removed: 




diff  --git a/lldb/tools/lldb-vscode/lldb-vscode.cpp 
b/lldb/tools/lldb-vscode/lldb-vscode.cpp
index 896ea61f9742..cf68386f7432 100644
--- a/lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ b/lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -44,6 +44,7 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
@@ -3112,6 +3113,10 @@ int main(int argc, char *argv[]) {
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
+  // Terminate the debugger before the C++ destructor chain kicks in.
+  auto terminate_debugger =
+  llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
+
   RegisterRequestCallbacks();
 
   int portno = -1;
@@ -3165,8 +3170,5 @@ int main(int argc, char *argv[]) {
 ++packet_idx;
   }
 
-  // We must terminate the debugger in a thread before the C++ destructor
-  // chain messes everything up.
-  lldb::SBDebugger::Terminate();
   return EXIT_SUCCESS;
 }



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


[Lldb-commits] [lldb] d182893 - [lldb] Remove references to LLDB_CAPTURE_REPRODUCER

2021-03-31 Thread Jonas Devlieghere via lldb-commits

Author: Jonas Devlieghere
Date: 2021-03-31T21:42:00-07:00
New Revision: d1828937ed8d79a772ec60a8f3c7f4a873f581d4

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

LOG: [lldb] Remove references to LLDB_CAPTURE_REPRODUCER

Remove the remaining references to LLDB_CAPTURE_REPRODUCER. I removed
the functionality in an earlier commit but forgot that there was a
corresponding test and logic to unset it in our test suite.

Added: 


Modified: 
lldb/docs/design/reproducers.rst
lldb/test/API/lit.cfg.py
lldb/test/Shell/Reproducer/lit.local.cfg
lldb/test/Shell/lit.cfg.py

Removed: 
lldb/test/Shell/Reproducer/TestCaptureEnvOverride.test



diff  --git a/lldb/docs/design/reproducers.rst 
b/lldb/docs/design/reproducers.rst
index d8ad3dd7866d4..99e34d812deed 100644
--- a/lldb/docs/design/reproducers.rst
+++ b/lldb/docs/design/reproducers.rst
@@ -182,13 +182,6 @@ Reproducers are tested in the following ways:
unsupported by adding ``UNSUPPORTED: lldb-repro`` to the top of the shell
test or adding the ``skipIfReproducer`` decorator for the API tests.
 
-Additional testing is possible:
-
- - It's possible to unconditionally capture reproducers while running the
-   entire test suite by setting the ``LLDB_CAPTURE_REPRODUCER`` environment
-   variable. Assuming no bugs in reproducers, this can also help to reproduce
-   and investigate test failures.
-
 Knows Issues
 
 

diff  --git a/lldb/test/API/lit.cfg.py b/lldb/test/API/lit.cfg.py
index cbb457e9328c6..9f63dc144a07e 100644
--- a/lldb/test/API/lit.cfg.py
+++ b/lldb/test/API/lit.cfg.py
@@ -252,11 +252,6 @@ def delete_module_cache(path):
   config.environment['FREEBSD_LEGACY_PLUGIN'] = os.environ[
   'FREEBSD_LEGACY_PLUGIN']
 
-# Propagate LLDB_CAPTURE_REPRODUCER
-if 'LLDB_CAPTURE_REPRODUCER' in os.environ:
-  config.environment['LLDB_CAPTURE_REPRODUCER'] = os.environ[
-  'LLDB_CAPTURE_REPRODUCER']
-
 # Propagate XDG_CACHE_HOME
 if 'XDG_CACHE_HOME' in os.environ:
   config.environment['XDG_CACHE_HOME'] = os.environ['XDG_CACHE_HOME']

diff  --git a/lldb/test/Shell/Reproducer/TestCaptureEnvOverride.test 
b/lldb/test/Shell/Reproducer/TestCaptureEnvOverride.test
deleted file mode 100644
index 122a05980aa79..0
--- a/lldb/test/Shell/Reproducer/TestCaptureEnvOverride.test
+++ /dev/null
@@ -1,17 +0,0 @@
-# This tests the LLDB_CAPTURE_REPRODUCER override.
-
-# RUN: %lldb -b -o 'reproducer status' --capture --capture-path %t.repro 
/bin/ls | FileCheck %s --check-prefix CAPTURE
-# RUN: %lldb -b -o 'reproducer status' --capture | FileCheck %s --check-prefix 
CAPTURE
-
-# RUN: LLDB_CAPTURE_REPRODUCER=1 %lldb -b -o 'reproducer status' | FileCheck 
%s --check-prefix CAPTURE
-# RUN: LLDB_CAPTURE_REPRODUCER=ON %lldb -b -o 'reproducer status' | FileCheck 
%s --check-prefix CAPTURE
-# RUN: LLDB_CAPTURE_REPRODUCER=on %lldb -b -o 'reproducer status' | FileCheck 
%s --check-prefix CAPTURE
-
-# RUN: LLDB_CAPTURE_REPRODUCER=0 %lldb -b -o 'reproducer status' --capture 
--capture-path %t.repro | FileCheck %s --check-prefix OFF
-# RUN: LLDB_CAPTURE_REPRODUCER=0 %lldb -b -o 'reproducer status' --capture | 
FileCheck %s --check-prefix OFF
-
-# RUN: LLDB_CAPTURE_REPRODUCER=bogus %lldb -b -o 'reproducer status' --capture 
| FileCheck %s --check-prefix CAPTURE
-# RUN: LLDB_CAPTURE_REPRODUCER=bogus %lldb -b -o 'reproducer status' | 
FileCheck %s --check-prefix OFF
-
-# CAPTURE: Reproducer is in capture mode.
-# OFF: Reproducer is off.

diff  --git a/lldb/test/Shell/Reproducer/lit.local.cfg 
b/lldb/test/Shell/Reproducer/lit.local.cfg
index 30f97f28279d4..9de095f189f56 100644
--- a/lldb/test/Shell/Reproducer/lit.local.cfg
+++ b/lldb/test/Shell/Reproducer/lit.local.cfg
@@ -2,10 +2,6 @@
 if 'LLVM_DISABLE_CRASH_REPORT' in config.environment:
   del config.environment['LLVM_DISABLE_CRASH_REPORT']
 
-# Unset the always capture environment override.
-if 'LLDB_CAPTURE_REPRODUCER' in config.environment:
-  del config.environment['LLDB_CAPTURE_REPRODUCER']
-
 if 'system-windows' in config.available_features:
   config.unsupported = True
 

diff  --git a/lldb/test/Shell/lit.cfg.py b/lldb/test/Shell/lit.cfg.py
index c4730b284b23c..964efc8c3505f 100644
--- a/lldb/test/Shell/lit.cfg.py
+++ b/lldb/test/Shell/lit.cfg.py
@@ -42,7 +42,6 @@
 llvm_config.with_system_environment([
 'FREEBSD_LEGACY_PLUGIN',
 'HOME',
-'LLDB_CAPTURE_REPRODUCER',
 'TEMP',
 'TMP',
 'XDG_CACHE_HOME',



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


[Lldb-commits] [PATCH] D99701: [lldb-vscode] Consistently use return EXIT_SUCCESS and EXIT_FAILURE (NFC)

2021-03-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG54c3c2e82874: [lldb-vscode] Consistently use return 
EXIT_SUCCESS and EXIT_FAILURE (NFC) (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D99701?vs=334585&id=334587#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99701

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -3105,7 +3105,7 @@
 } else {
   llvm::errs() << "\"--launch-target\" requires \"--comm-file\" to be "
   "specified\n";
-  exit(EXIT_FAILURE);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3118,7 +3118,7 @@
 
   if (input_args.hasArg(OPT_help)) {
 printHelp(T, llvm::sys::path::filename(argv[0]));
-return 0;
+return EXIT_SUCCESS;
   }
 
   if (auto *arg = input_args.getLastArg(OPT_port)) {
@@ -3127,7 +3127,7 @@
 portno = strtol(optarg, &remainder, 0);
 if (remainder == optarg || *remainder != '\0') {
   fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
-  exit(1);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3144,7 +3144,7 @@
   g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
   g_vsc.output.descriptor = StreamDescriptor::from_socket(socket_fd, 
false);
 } else {
-  exit(1);
+  return EXIT_FAILURE;
 }
   } else {
 g_vsc.input.descriptor = StreamDescriptor::from_file(fileno(stdin), false);
@@ -3168,5 +3168,5 @@
   // We must terminate the debugger in a thread before the C++ destructor
   // chain messes everything up.
   lldb::SBDebugger::Terminate();
-  return 0;
+  return EXIT_SUCCESS;
 }


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -3105,7 +3105,7 @@
 } else {
   llvm::errs() << "\"--launch-target\" requires \"--comm-file\" to be "
   "specified\n";
-  exit(EXIT_FAILURE);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3118,7 +3118,7 @@
 
   if (input_args.hasArg(OPT_help)) {
 printHelp(T, llvm::sys::path::filename(argv[0]));
-return 0;
+return EXIT_SUCCESS;
   }
 
   if (auto *arg = input_args.getLastArg(OPT_port)) {
@@ -3127,7 +3127,7 @@
 portno = strtol(optarg, &remainder, 0);
 if (remainder == optarg || *remainder != '\0') {
   fprintf(stderr, "'%s' is not a valid port number.\n", optarg);
-  exit(1);
+  return EXIT_FAILURE;
 }
   }
 
@@ -3144,7 +3144,7 @@
   g_vsc.input.descriptor = StreamDescriptor::from_socket(socket_fd, true);
   g_vsc.output.descriptor = StreamDescriptor::from_socket(socket_fd, false);
 } else {
-  exit(1);
+  return EXIT_FAILURE;
 }
   } else {
 g_vsc.input.descriptor = StreamDescriptor::from_file(fileno(stdin), false);
@@ -3168,5 +3168,5 @@
   // We must terminate the debugger in a thread before the C++ destructor
   // chain messes everything up.
   lldb::SBDebugger::Terminate();
-  return 0;
+  return EXIT_SUCCESS;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D99702: [lldb-vscode] Use LLVM's ScopeExit to ensure we always terminate the debugger

2021-03-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGb7e2c2acb8ee: [lldb-vscode] Use LLVM's ScopeExit to 
ensure we always terminate the debugger (authored by JDevlieghere).
Herald added a project: LLDB.

Changed prior to commit:
  https://reviews.llvm.org/D99702?vs=334586&id=334588#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99702

Files:
  lldb/tools/lldb-vscode/lldb-vscode.cpp


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -44,6 +44,7 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
@@ -3112,6 +3113,10 @@
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
+  // Terminate the debugger before the C++ destructor chain kicks in.
+  auto terminate_debugger =
+  llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
+
   RegisterRequestCallbacks();
 
   int portno = -1;
@@ -3165,8 +3170,5 @@
 ++packet_idx;
   }
 
-  // We must terminate the debugger in a thread before the C++ destructor
-  // chain messes everything up.
-  lldb::SBDebugger::Terminate();
   return EXIT_SUCCESS;
 }


Index: lldb/tools/lldb-vscode/lldb-vscode.cpp
===
--- lldb/tools/lldb-vscode/lldb-vscode.cpp
+++ lldb/tools/lldb-vscode/lldb-vscode.cpp
@@ -44,6 +44,7 @@
 #include 
 
 #include "llvm/ADT/ArrayRef.h"
+#include "llvm/ADT/ScopeExit.h"
 #include "llvm/Option/Arg.h"
 #include "llvm/Option/ArgList.h"
 #include "llvm/Option/Option.h"
@@ -3112,6 +3113,10 @@
   // Initialize LLDB first before we do anything.
   lldb::SBDebugger::Initialize();
 
+  // Terminate the debugger before the C++ destructor chain kicks in.
+  auto terminate_debugger =
+  llvm::make_scope_exit([] { lldb::SBDebugger::Terminate(); });
+
   RegisterRequestCallbacks();
 
   int portno = -1;
@@ -3165,8 +3170,5 @@
 ++packet_idx;
   }
 
-  // We must terminate the debugger in a thread before the C++ destructor
-  // chain messes everything up.
-  lldb::SBDebugger::Terminate();
   return EXIT_SUCCESS;
 }
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [PATCH] D99694: Add support for getting signed ObjC tagged pointer values

2021-03-31 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

LGTM with a little nit. Please `clang-format` the patch before landing.




Comment at: 
lldb/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h:89-100
+// There are two routines in the ObjC runtime that tagged pointer clients 
+// can call to get the value from their tagged pointer, one that retrieves 
+// it as an unsigned value and one a signed value.  These two 
+// GetTaggedPointerInfo methods mirror those two ObjC runtime calls.
 virtual bool GetTaggedPointerInfo(uint64_t *info_bits = nullptr,
   uint64_t *value_bits = nullptr,
   uint64_t *payload = nullptr) = 0;

Please make this a Doxygen comment and include both methods in a group. 


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D99694

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


[Lldb-commits] [lldb] 3bea730 - [lldb] Fix compilation with gcc-6.5

2021-03-31 Thread Pavel Labath via lldb-commits

Author: Pavel Labath
Date: 2021-04-01T08:44:50+02:00
New Revision: 3bea7306e8669f94bacafae68748a9139cfc0b98

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

LOG: [lldb] Fix compilation with gcc-6.5

This fixes (works around) two errors with gcc-6.5.
- in the RegisterContext_x86 files, gcc is unable to synthesize a
  default constructor -- it thinks it needs to initialize the virtual
  base class, even though said classes are abstract. I fix that by
  providing a dummy constructor.
- In ReproducerInstrumentationTest, it is not able to deduce that the
  TestingRegistry class is movable (it contains a map of unique
  pointers). I change the type from Optional to
  unique_ptr GetMmapData() { return llvm::None; }
 
 protected:
+  // NB: This constructor is here only because gcc<=6.5 requires a virtual base
+  // class initializer on abstract class (even though it is never used). It can
+  // be deleted once we move to gcc>=7.0.
+  NativeRegisterContextLinux(NativeThreadProtocol &thread)
+  : NativeRegisterContextRegisterInfo(thread, nullptr) {}
+
   lldb::ByteOrder GetByteOrder() const;
 
   virtual Status ReadRegisterRaw(uint32_t reg_index, RegisterValue ®_value);

diff  --git 
a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp 
b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
index c197d70825b4b..bd4b168f4964e 100644
--- a/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
+++ b/lldb/source/Plugins/Process/Linux/NativeRegisterContextLinux_x86_64.cpp
@@ -292,6 +292,8 @@ 
NativeRegisterContextLinux_x86_64::NativeRegisterContextLinux_x86_64(
 const ArchSpec &target_arch, NativeThreadProtocol &native_thread)
 : NativeRegisterContextRegisterInfo(
   native_thread, CreateRegisterInfoInterface(target_arch)),
+  NativeRegisterContextLinux(native_thread),
+  NativeRegisterContextDBReg_x86(native_thread),
   m_xstate_type(XStateType::Invalid), m_ymm_set(), m_mpx_set(),
   m_reg_info(), m_gpr_x86_64() {
   // Set up data about ranges of valid registers.

diff  --git 
a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h 
b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
index c0c6ce29eab53..a4ed8bfb97eaf 100644
--- a/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
+++ b/lldb/source/Plugins/Process/Utility/NativeRegisterContextDBReg_x86.h
@@ -16,6 +16,12 @@ namespace lldb_private {
 class NativeRegisterContextDBReg_x86
 : public virtual NativeRegisterContextRegisterInfo {
 public:
+  // NB: This constructor is here only because gcc<=6.5 requires a virtual base
+  // class initializer on abstract class (even though it is never used). It can
+  // be deleted once we move to gcc>=7.0.
+  NativeRegisterContextDBReg_x86(NativeThreadProtocol &thread)
+  : NativeRegisterContextRegisterInfo(thread, nullptr) {}
+
   Status IsWatchpointHit(uint32_t wp_index, bool &is_hit) override;
 
   Status GetWatchpointHitIndex(uint32_t &wp_index,

diff  --git a/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp 
b/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp
index e9f6fcf34e17f..ce259c5969e09 100644
--- a/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp
+++ b/lldb/unittests/Utility/ReproducerInstrumentationTest.cpp
@@ -50,7 +50,7 @@ class TestingRegistry : public Registry {
   TestingRegistry();
 };
 
-static llvm::Optional g_registry;
+static std::unique_ptr g_registry;
 static llvm::Optional g_serializer;
 static llvm::Optional g_deserializer;
 
@@ -75,13 +75,13 @@ inline TestInstrumentationData GetTestInstrumentationData() 
{
 class TestInstrumentationDataRAII {
 public:
   TestInstrumentationDataRAII(llvm::raw_string_ostream &os) {
-g_registry.emplace();
+g_registry = std::make_unique();
 g_serializer.emplace(os);
 g_deserializer.reset();
   }
 
   TestInstrumentationDataRAII(llvm::StringRef buffer) {
-g_registry.emplace();
+g_registry = std::make_unique();
 g_serializer.reset();
 g_deserializer.emplace(buffer);
   }



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