[Lldb-commits] [lldb] 70aad4e - [lldb][NFCI] Use llvm's libDebugInfo for DebugRanges

2023-05-23 Thread Felipe de Azevedo Piovezan via lldb-commits

Author: Felipe de Azevedo Piovezan
Date: 2023-05-23T11:11:10-04:00
New Revision: 70aad4ec90f2df69b91a356b91c3dd16e15be3d1

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

LOG: [lldb][NFCI] Use llvm's libDebugInfo for DebugRanges

In an effort to unify the different dwarf parsers available in the codebase,
this commit removes LLDB's custom parsing for the `.debug_ranges` DWARF section,
instead calling into LLVM's parser.

Subsequent work should look into unifying `llvm::DWARDebugRangeList` (whose
entries are pairs of (start, end) addresses) with `lldb::DWARFRangeList` (whose
entries are pairs of (start, length)). The lists themselves are also different
data structures, but functionally equivalent.

Depends on D150363

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

Added: 


Modified: 
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h

Removed: 




diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
index d3598de5b3d31..7c6740d77aaf8 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
@@ -8,67 +8,35 @@
 
 #include "DWARFDebugRanges.h"
 #include "DWARFUnit.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
 
 using namespace lldb_private;
 
-static dw_addr_t GetBaseAddressMarker(uint32_t addr_size) {
-  switch(addr_size) {
-case 2:
-  return 0x;
-case 4:
-  return 0x;
-case 8:
-  return 0x;
-  }
-  llvm_unreachable("GetBaseAddressMarker unsupported address size.");
-}
-
 DWARFDebugRanges::DWARFDebugRanges() : m_range_map() {}
 
 void DWARFDebugRanges::Extract(DWARFContext &context) {
-  DWARFRangeList range_list;
-  lldb::offset_t offset = 0;
-  dw_offset_t debug_ranges_offset = offset;
-  while (Extract(context, &offset, range_list)) {
-range_list.Sort();
-m_range_map[debug_ranges_offset] = range_list;
-debug_ranges_offset = offset;
-  }
-}
-
-bool DWARFDebugRanges::Extract(DWARFContext &context,
-   lldb::offset_t *offset_ptr,
-   DWARFRangeList &range_list) {
-  range_list.Clear();
-
-  lldb::offset_t range_offset = *offset_ptr;
-  const DWARFDataExtractor &debug_ranges_data = context.getOrLoadRangesData();
-  uint32_t addr_size = debug_ranges_data.GetAddressByteSize();
-  dw_addr_t base_addr = 0;
-  dw_addr_t base_addr_marker = GetBaseAddressMarker(addr_size);
-
-  while (
-  debug_ranges_data.ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) {
-dw_addr_t begin = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
-dw_addr_t end = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
-
-if (!begin && !end) {
-  // End of range list
-  break;
-}
-
-if (begin == base_addr_marker) {
-  base_addr = end;
-  continue;
+  llvm::DWARFDataExtractor extractor =
+  context.getOrLoadRangesData().GetAsLLVM();
+  llvm::DWARFDebugRangeList extracted_list;
+  uint64_t current_offset = 0;
+  auto extract_next_list = [&] {
+if (auto error = extracted_list.extract(extractor, ¤t_offset)) {
+  consumeError(std::move(error));
+  return false;
 }
-
-// Filter out empty ranges
-if (begin < end)
-  range_list.Append(DWARFRangeList::Entry(begin + base_addr, end - begin));
+return true;
+  };
+
+  uint64_t previous_offset = current_offset;
+  while (extractor.isValidOffset(current_offset) && extract_next_list()) {
+DWARFRangeList &lldb_range_list = m_range_map[previous_offset];
+lldb_range_list.Reserve(extracted_list.getEntries().size());
+for (auto &range : extracted_list.getEntries())
+  lldb_range_list.Append(range.StartAddress,
+ range.EndAddress - range.StartAddress);
+lldb_range_list.Sort();
+previous_offset = current_offset;
   }
-
-  // Make sure we consumed at least something
-  return range_offset != *offset_ptr;
 }
 
 DWARFRangeList

diff  --git a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h 
b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
index 5d5ddada6c2f9..2e06cd5daf6f3 100644
--- a/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
+++ b/lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
@@ -26,9 +26,6 @@ class DWARFDebugRanges {
 dw_offset_t debug_ranges_offset) const;
 
 protected:
-  bool Extract(lldb_private::DWARFContext &context, lldb::offset_t *offset_ptr,
-   DWARFRangeList &range_list);
-
   std::map m_range_map;
 };
 



___
lldb-commits mailing list
lldb-commits@li

[Lldb-commits] [PATCH] D150366: [lldb][NFCI] Use llvm's libDebugInfo for DebugRanges

2023-05-23 Thread Felipe de Azevedo Piovezan via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG70aad4ec90f2: [lldb][NFCI] Use llvm's libDebugInfo for 
DebugRanges (authored by fdeazeve).

Changed prior to commit:
  https://reviews.llvm.org/D150366?vs=521300&id=524731#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150366

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

Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h
@@ -26,9 +26,6 @@
 dw_offset_t debug_ranges_offset) const;
 
 protected:
-  bool Extract(lldb_private::DWARFContext &context, lldb::offset_t *offset_ptr,
-   DWARFRangeList &range_list);
-
   std::map m_range_map;
 };
 
Index: lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
===
--- lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
+++ lldb/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp
@@ -8,67 +8,35 @@
 
 #include "DWARFDebugRanges.h"
 #include "DWARFUnit.h"
+#include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h"
 
 using namespace lldb_private;
 
-static dw_addr_t GetBaseAddressMarker(uint32_t addr_size) {
-  switch(addr_size) {
-case 2:
-  return 0x;
-case 4:
-  return 0x;
-case 8:
-  return 0x;
-  }
-  llvm_unreachable("GetBaseAddressMarker unsupported address size.");
-}
-
 DWARFDebugRanges::DWARFDebugRanges() : m_range_map() {}
 
 void DWARFDebugRanges::Extract(DWARFContext &context) {
-  DWARFRangeList range_list;
-  lldb::offset_t offset = 0;
-  dw_offset_t debug_ranges_offset = offset;
-  while (Extract(context, &offset, range_list)) {
-range_list.Sort();
-m_range_map[debug_ranges_offset] = range_list;
-debug_ranges_offset = offset;
-  }
-}
-
-bool DWARFDebugRanges::Extract(DWARFContext &context,
-   lldb::offset_t *offset_ptr,
-   DWARFRangeList &range_list) {
-  range_list.Clear();
-
-  lldb::offset_t range_offset = *offset_ptr;
-  const DWARFDataExtractor &debug_ranges_data = context.getOrLoadRangesData();
-  uint32_t addr_size = debug_ranges_data.GetAddressByteSize();
-  dw_addr_t base_addr = 0;
-  dw_addr_t base_addr_marker = GetBaseAddressMarker(addr_size);
-
-  while (
-  debug_ranges_data.ValidOffsetForDataOfSize(*offset_ptr, 2 * addr_size)) {
-dw_addr_t begin = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
-dw_addr_t end = debug_ranges_data.GetMaxU64(offset_ptr, addr_size);
-
-if (!begin && !end) {
-  // End of range list
-  break;
-}
-
-if (begin == base_addr_marker) {
-  base_addr = end;
-  continue;
+  llvm::DWARFDataExtractor extractor =
+  context.getOrLoadRangesData().GetAsLLVM();
+  llvm::DWARFDebugRangeList extracted_list;
+  uint64_t current_offset = 0;
+  auto extract_next_list = [&] {
+if (auto error = extracted_list.extract(extractor, ¤t_offset)) {
+  consumeError(std::move(error));
+  return false;
 }
-
-// Filter out empty ranges
-if (begin < end)
-  range_list.Append(DWARFRangeList::Entry(begin + base_addr, end - begin));
+return true;
+  };
+
+  uint64_t previous_offset = current_offset;
+  while (extractor.isValidOffset(current_offset) && extract_next_list()) {
+DWARFRangeList &lldb_range_list = m_range_map[previous_offset];
+lldb_range_list.Reserve(extracted_list.getEntries().size());
+for (auto &range : extracted_list.getEntries())
+  lldb_range_list.Append(range.StartAddress,
+ range.EndAddress - range.StartAddress);
+lldb_range_list.Sort();
+previous_offset = current_offset;
   }
-
-  // Make sure we consumed at least something
-  return range_offset != *offset_ptr;
 }
 
 DWARFRangeList
___
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits


[Lldb-commits] [lldb] 3c276ea - [lldb][NFCI] Merge implementations of ObjectFileMachO::GetMinimumOSVersion and ObjectFileMachO::GetSDKVersion

2023-05-23 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-05-23T10:26:08-07:00
New Revision: 3c276eaf8f4a4adab3c0b25c78b5c1fdbf071a94

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

LOG: [lldb][NFCI] Merge implementations of ObjectFileMachO::GetMinimumOSVersion 
and ObjectFileMachO::GetSDKVersion

These functions do the exact same thing (even if they look slightly
different). I yanked the common implementation, cleaned it up, and
shoved it into its own function.

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

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index dfd5ae728cefb..0c33ece464bb9 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -5899,138 +5899,65 @@ void ObjectFileMachO::GetLLDBSharedCacheUUID(addr_t 
&base_addr, UUID &uuid) {
 #endif
 }
 
-llvm::VersionTuple ObjectFileMachO::GetMinimumOSVersion() {
-  if (!m_min_os_version) {
-lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
-for (uint32_t i = 0; i < m_header.ncmds; ++i) {
-  const lldb::offset_t load_cmd_offset = offset;
-
-  llvm::MachO::version_min_command lc = {};
-  if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
-break;
-  if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_TVOS ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_WATCHOS) {
-if (m_data.GetU32(&offset, &lc.version,
-  (sizeof(lc) / sizeof(uint32_t)) - 2)) {
-  const uint32_t  = lc.version >> 16;
-  const uint32_t yy = (lc.version >> 8) & 0xffu;
-  const uint32_t zz = lc.version & 0xffu;
-  if () {
-m_min_os_version = llvm::VersionTuple(, yy, zz);
-break;
-  }
-}
-  } else if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) {
-// struct build_version_command {
-// uint32_tcmd;/* LC_BUILD_VERSION */
-// uint32_tcmdsize;/* sizeof(struct
-// build_version_command) plus */
-// /* ntools * sizeof(struct
-// build_tool_version) */
-// uint32_tplatform;   /* platform */
-// uint32_tminos;  /* X.Y.Z is encoded in nibbles
-// .yy.zz */ uint32_tsdk;/* X.Y.Z is encoded in
-// nibbles .yy.zz */ uint32_tntools; /* number of
-// tool entries following this */
-// };
-
-offset += 4; // skip platform
-uint32_t minos = m_data.GetU32(&offset);
-
-const uint32_t  = minos >> 16;
-const uint32_t yy = (minos >> 8) & 0xffu;
-const uint32_t zz = minos & 0xffu;
-if () {
-  m_min_os_version = llvm::VersionTuple(, yy, zz);
-  break;
-}
-  }
+static llvm::VersionTuple FindMinimumVersionInfo(DataExtractor &data,
+ lldb::offset_t offset,
+ size_t ncmds) {
+  for (size_t i = 0; i < ncmds; i++) {
+const lldb::offset_t load_cmd_offset = offset;
+llvm::MachO::load_command lc = {};
+if (data.GetU32(&offset, &lc.cmd, 2) == nullptr)
+  break;
 
-  offset = load_cmd_offset + lc.cmdsize;
+uint32_t version = 0;
+if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_TVOS ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_WATCHOS) {
+  // struct version_min_command {
+  //   uint32_t cmd; // LC_VERSION_MIN_*
+  //   uint32_t cmdsize;
+  //   uint32_t version; // X.Y.Z encoded in nibbles .yy.zz
+  //   uint32_t sdk;
+  // };
+  // We want to read version.
+  version = data.GetU32(&offset);
+} else if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) {
+  // struct build_version_command {
+  //   uint32_t cmd; // LC_BUILD_VERSION
+  //   uint32_t cmdsize;
+  //   uint32_t platform;
+  //   uint32_t minos; // X.Y.Z encoded in nibbles .yy.zz
+  //   uint32_t sdk;
+  //   uint32_t ntools;
+  // };
+  // We want to read minos.
+  offset += sizeof(uint32_t); // Skip over platform
+  version = data.GetU32(&offset); // Extract minos
 }
 
-if (!m_min_os_version) {
-  // Set version to an empty value so w

[Lldb-commits] [PATCH] D151120: [lldb][NFCI] Merge implementations of ObjectFileMachO::GetMinimumOSVersion and ObjectFileMachO::GetSDKVersion

2023-05-23 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG3c276eaf8f4a: [lldb][NFCI] Merge implementations of 
ObjectFileMachO::GetMinimumOSVersion and… (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151120

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp

Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -5899,138 +5899,65 @@
 #endif
 }
 
-llvm::VersionTuple ObjectFileMachO::GetMinimumOSVersion() {
-  if (!m_min_os_version) {
-lldb::offset_t offset = MachHeaderSizeFromMagic(m_header.magic);
-for (uint32_t i = 0; i < m_header.ncmds; ++i) {
-  const lldb::offset_t load_cmd_offset = offset;
-
-  llvm::MachO::version_min_command lc = {};
-  if (m_data.GetU32(&offset, &lc.cmd, 2) == nullptr)
-break;
-  if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_TVOS ||
-  lc.cmd == llvm::MachO::LC_VERSION_MIN_WATCHOS) {
-if (m_data.GetU32(&offset, &lc.version,
-  (sizeof(lc) / sizeof(uint32_t)) - 2)) {
-  const uint32_t  = lc.version >> 16;
-  const uint32_t yy = (lc.version >> 8) & 0xffu;
-  const uint32_t zz = lc.version & 0xffu;
-  if () {
-m_min_os_version = llvm::VersionTuple(, yy, zz);
-break;
-  }
-}
-  } else if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) {
-// struct build_version_command {
-// uint32_tcmd;/* LC_BUILD_VERSION */
-// uint32_tcmdsize;/* sizeof(struct
-// build_version_command) plus */
-// /* ntools * sizeof(struct
-// build_tool_version) */
-// uint32_tplatform;   /* platform */
-// uint32_tminos;  /* X.Y.Z is encoded in nibbles
-// .yy.zz */ uint32_tsdk;/* X.Y.Z is encoded in
-// nibbles .yy.zz */ uint32_tntools; /* number of
-// tool entries following this */
-// };
-
-offset += 4; // skip platform
-uint32_t minos = m_data.GetU32(&offset);
-
-const uint32_t  = minos >> 16;
-const uint32_t yy = (minos >> 8) & 0xffu;
-const uint32_t zz = minos & 0xffu;
-if () {
-  m_min_os_version = llvm::VersionTuple(, yy, zz);
-  break;
-}
-  }
+static llvm::VersionTuple FindMinimumVersionInfo(DataExtractor &data,
+ lldb::offset_t offset,
+ size_t ncmds) {
+  for (size_t i = 0; i < ncmds; i++) {
+const lldb::offset_t load_cmd_offset = offset;
+llvm::MachO::load_command lc = {};
+if (data.GetU32(&offset, &lc.cmd, 2) == nullptr)
+  break;
 
-  offset = load_cmd_offset + lc.cmdsize;
+uint32_t version = 0;
+if (lc.cmd == llvm::MachO::LC_VERSION_MIN_MACOSX ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_IPHONEOS ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_TVOS ||
+lc.cmd == llvm::MachO::LC_VERSION_MIN_WATCHOS) {
+  // struct version_min_command {
+  //   uint32_t cmd; // LC_VERSION_MIN_*
+  //   uint32_t cmdsize;
+  //   uint32_t version; // X.Y.Z encoded in nibbles .yy.zz
+  //   uint32_t sdk;
+  // };
+  // We want to read version.
+  version = data.GetU32(&offset);
+} else if (lc.cmd == llvm::MachO::LC_BUILD_VERSION) {
+  // struct build_version_command {
+  //   uint32_t cmd; // LC_BUILD_VERSION
+  //   uint32_t cmdsize;
+  //   uint32_t platform;
+  //   uint32_t minos; // X.Y.Z encoded in nibbles .yy.zz
+  //   uint32_t sdk;
+  //   uint32_t ntools;
+  // };
+  // We want to read minos.
+  offset += sizeof(uint32_t); // Skip over platform
+  version = data.GetU32(&offset); // Extract minos
 }
 
-if (!m_min_os_version) {
-  // Set version to an empty value so we don't keep trying to
-  m_min_os_version = llvm::VersionTuple();
+if (version) {
+  const uint32_t  = version >> 16;
+  const uint32_t yy = (version >> 8) & 0xffu;
+  const uint32_t zz = version & 0xffu;
+  if ()
+return llvm::VersionTuple(, yy, zz);
 }
+offset = load_cmd_offset + lc.cmdsize;
   }
+  return llvm::VersionTuple();
+}
 
+llvm::VersionTuple ObjectFileMachO::GetMinimumOSVersion() {
+  if (!m_min_os_version)
+m_min_os_version = FindMinimumVersionInfo(
+  

[Lldb-commits] [PATCH] D151236: [lldb][NFCI] Remove unused member from ObjectFileMachO

2023-05-23 Thread Alex Langford via Phabricator via lldb-commits
bulbazord created this revision.
bulbazord added reviewers: jasonmolenda, JDevlieghere.
Herald added a project: All.
bulbazord requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

>From what I can see, `m_mach_segments` is completely unused. Let's
remove it.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151236

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h


Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -269,7 +269,6 @@
   static lldb_private::ConstString GetSectionNameEHFrame();
 
   llvm::MachO::dysymtab_command m_dysymtab;
-  std::vector m_mach_segments;
   std::vector m_mach_sections;
   std::optional m_min_os_version;
   std::optional m_sdk_versions;
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -940,9 +940,9 @@
  lldb::offset_t file_offset,
  lldb::offset_t length)
 : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -952,9 +952,9 @@
  const lldb::ProcessSP &process_sp,
  lldb::addr_t header_addr)
 : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -1622,10 +1622,6 @@
   const bool segment_is_encrypted =
   (load_cmd.flags & SG_PROTECTED_VERSION_1) != 0;
 
-  // Keep a list of mach segments around in case we need to get at data that
-  // isn't stored in the abstracted Sections.
-  m_mach_segments.push_back(load_cmd);
-
   // Use a segment ID of the segment index shifted left by 8 so they never
   // conflict with any of the sections.
   SectionSP segment_sp;


Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -269,7 +269,6 @@
   static lldb_private::ConstString GetSectionNameEHFrame();
 
   llvm::MachO::dysymtab_command m_dysymtab;
-  std::vector m_mach_segments;
   std::vector m_mach_sections;
   std::optional m_min_os_version;
   std::optional m_sdk_versions;
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -940,9 +940,9 @@
  lldb::offset_t file_offset,
  lldb::offset_t length)
 : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -952,9 +952,9 @@
  const lldb::ProcessSP &process_sp,
  lldb::addr_t header_addr)
 : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m

[Lldb-commits] [lldb] f237513 - [LLDB] Add some declarations related to REPL support for mojo

2023-05-23 Thread walter erquinigo via lldb-commits

Author: walter erquinigo
Date: 2023-05-23T13:39:43-05:00
New Revision: f237513cda8e6ec32579ff047b008e22422db2ff

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

LOG: [LLDB] Add some declarations related to REPL support for mojo

This simple diff declares some enum values needed to create a REPL for the mojo 
language.

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

Added: 
lldb/source/Expression/ExpressionTypeSystemHelper.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.cpp

Modified: 
lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
lldb/include/lldb/Expression/ExpressionVariable.h
lldb/include/lldb/Expression/REPL.h
lldb/source/Expression/CMakeLists.txt
lldb/source/Expression/ExpressionVariable.cpp
lldb/source/Expression/REPL.cpp
lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
lldb/source/Plugins/REPL/Clang/ClangREPL.h

Removed: 




diff  --git a/lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h 
b/lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
index 2ba675db86623..72b9ccbf7dd0c 100644
--- a/lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
+++ b/lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
@@ -11,35 +11,25 @@
 #define LLDB_EXPRESSION_EXPRESSIONTYPESYSTEMHELPER_H
 
 #include "llvm/Support/Casting.h"
+#include "llvm/Support/ExtensibleRTTI.h"
 
 namespace lldb_private {
 
 /// \class ExpressionTypeSystemHelper ExpressionTypeSystemHelper.h
 /// "lldb/Expression/ExpressionTypeSystemHelper.h"
 /// A helper object that the Expression can pass to its ExpressionParser
-/// to provide generic information that
-/// any type of expression will need to supply.  It's only job is to support
-/// dyn_cast so that the expression parser can cast it back to the requisite
-/// specific type.
+/// to provide generic information that any type of expression will need to
+/// supply.  It's only job is to support dyn_cast so that the expression parser
+/// can cast it back to the requisite specific type.
 ///
 
-class ExpressionTypeSystemHelper {
+class ExpressionTypeSystemHelper
+: public llvm::RTTIExtends {
 public:
-  enum LLVMCastKind {
-eKindClangHelper,
-eKindSwiftHelper,
-eKindGoHelper,
-kNumKinds
-  };
+  /// LLVM RTTI support
+  static char ID;
 
-  LLVMCastKind getKind() const { return m_kind; }
-
-  ExpressionTypeSystemHelper(LLVMCastKind kind) : m_kind(kind) {}
-
-  ~ExpressionTypeSystemHelper() = default;
-
-protected:
-  LLVMCastKind m_kind;
+  virtual ~ExpressionTypeSystemHelper() = default;
 };
 
 } // namespace lldb_private

diff  --git a/lldb/include/lldb/Expression/ExpressionVariable.h 
b/lldb/include/lldb/Expression/ExpressionVariable.h
index ec18acb94417c..ad85a21df5115 100644
--- a/lldb/include/lldb/Expression/ExpressionVariable.h
+++ b/lldb/include/lldb/Expression/ExpressionVariable.h
@@ -18,19 +18,20 @@
 #include "lldb/Core/ValueObject.h"
 #include "lldb/Utility/ConstString.h"
 #include "lldb/lldb-public.h"
+#include "llvm/Support/ExtensibleRTTI.h"
 
 namespace lldb_private {
 
 class ExpressionVariable
-: public std::enable_shared_from_this {
+: public std::enable_shared_from_this,
+  public llvm::RTTIExtends {
 public:
-  // See TypeSystem.h for how to add subclasses to this.
-  enum LLVMCastKind { eKindClang, eKindSwift, eKindGo, kNumKinds };
+  /// LLVM RTTI support
+  static char ID;
 
-  LLVMCastKind getKind() const { return m_kind; }
+  ExpressionVariable();
 
-  ExpressionVariable(LLVMCastKind kind);
-  virtual ~ExpressionVariable();
+  virtual ~ExpressionVariable() = default;
 
   std::optional GetByteSize() { return m_frozen_sp->GetByteSize(); }
 
@@ -109,7 +110,6 @@ class ExpressionVariable
   // these should be private
   lldb::ValueObjectSP m_frozen_sp;
   lldb::ValueObjectSP m_live_sp;
-  LLVMCastKind m_kind;
 };
 
 /// \class ExpressionVariableList ExpressionVariable.h
@@ -200,14 +200,

[Lldb-commits] [PATCH] D150303: [LLDB] Add some declarations related to REPL support for mojo

2023-05-23 Thread walter erquinigo via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf237513cda8e: [LLDB] Add some declarations related to REPL 
support for mojo (authored by wallace).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150303

Files:
  lldb/include/lldb/Expression/ExpressionTypeSystemHelper.h
  lldb/include/lldb/Expression/ExpressionVariable.h
  lldb/include/lldb/Expression/REPL.h
  lldb/source/Expression/CMakeLists.txt
  lldb/source/Expression/ExpressionTypeSystemHelper.cpp
  lldb/source/Expression/ExpressionVariable.cpp
  lldb/source/Expression/REPL.cpp
  lldb/source/Plugins/ExpressionParser/Clang/CMakeLists.txt
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionHelper.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangExpressionVariable.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
  lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
  lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
  lldb/source/Plugins/REPL/Clang/ClangREPL.h

Index: lldb/source/Plugins/REPL/Clang/ClangREPL.h
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.h
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.h
@@ -14,8 +14,11 @@
 namespace lldb_private {
 /// Implements a Clang-based REPL for C languages on top of LLDB's REPL
 /// framework.
-class ClangREPL : public REPL {
+class ClangREPL : public llvm::RTTIExtends {
 public:
+  // LLVM RTTI support
+  static char ID;
+
   ClangREPL(lldb::LanguageType language, Target &target);
 
   ~ClangREPL() override;
Index: lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
===
--- lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
+++ lldb/source/Plugins/REPL/Clang/ClangREPL.cpp
@@ -15,8 +15,10 @@
 
 LLDB_PLUGIN_DEFINE(ClangREPL)
 
+char ClangREPL::ID;
+
 ClangREPL::ClangREPL(lldb::LanguageType language, Target &target)
-: REPL(eKindClang, target), m_language(language),
+: llvm::RTTIExtends(target), m_language(language),
   m_implicit_expr_result_regex("\\$[0-9]+") {}
 
 ClangREPL::~ClangREPL() = default;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.h
@@ -72,11 +72,12 @@
ExecutionContext &exe_ctx) override;
 
 private:
-  class ClangUtilityFunctionHelper : public ClangExpressionHelper {
+  class ClangUtilityFunctionHelper
+  : public llvm::RTTIExtends {
   public:
-ClangUtilityFunctionHelper() = default;
-
-~ClangUtilityFunctionHelper() override = default;
+// LLVM RTTI support
+static char ID;
 
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be self-contained.
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp
@@ -176,6 +176,8 @@
   }
 }
 
+char ClangUtilityFunction::ClangUtilityFunctionHelper::ID;
+
 void ClangUtilityFunction::ClangUtilityFunctionHelper::ResetDeclMap(
 ExecutionContext &exe_ctx, bool keep_result_in_memory) {
   std::shared_ptr ast_importer;
Index: lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
===
--- lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
+++ lldb/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h
@@ -51,13 +51,16 @@
 
   enum { kDefaultTimeout = 50u };
 
-  class ClangUserExpressionHelper : public ClangExpressionHelper {
+  class ClangUserExpressionHelper
+  : public llvm::RTTIExtends {
   public:
+// LLVM RTTI support
+static char ID;
+
 ClangUserExpressionHelper(Target &target, bool top_level)
 : m_target(target), m_top_level(top_level) {}
 
-~ClangUserExpressionHelper() override = default;
-
 /// Return the object that the parser should use when resolving external
 /// values.  May be NULL if everything should be

[Lldb-commits] [PATCH] D151236: [lldb][NFCI] Remove unused member from ObjectFileMachO

2023-05-23 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


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151236

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


[Lldb-commits] [lldb] 973f1fe - [lldb][NFCI] Remove unused member from ObjectFileMachO

2023-05-23 Thread Alex Langford via lldb-commits

Author: Alex Langford
Date: 2023-05-23T15:14:47-07:00
New Revision: 973f1fe7a8591c7af148e573491ab68cc15b6ecf

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

LOG: [lldb][NFCI] Remove unused member from ObjectFileMachO

>From what I can see, `m_mach_segments` is completely unused. Let's
remove it.

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

Added: 


Modified: 
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h

Removed: 




diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 0c33ece464bb9..d78ed63b0e42d 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -940,9 +940,9 @@ ObjectFileMachO::ObjectFileMachO(const lldb::ModuleSP 
&module_sp,
  lldb::offset_t file_offset,
  lldb::offset_t length)
 : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -952,9 +952,9 @@ ObjectFileMachO::ObjectFileMachO(const lldb::ModuleSP 
&module_sp,
  const lldb::ProcessSP &process_sp,
  lldb::addr_t header_addr)
 : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -1622,10 +1622,6 @@ void ObjectFileMachO::ProcessSegmentCommand(
   const bool segment_is_encrypted =
   (load_cmd.flags & SG_PROTECTED_VERSION_1) != 0;
 
-  // Keep a list of mach segments around in case we need to get at data that
-  // isn't stored in the abstracted Sections.
-  m_mach_segments.push_back(load_cmd);
-
   // Use a segment ID of the segment index shifted left by 8 so they never
   // conflict with any of the sections.
   SectionSP segment_sp;

diff  --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h 
b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
index bea77c3d4eb95..7099a4fbadf40 100644
--- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -269,7 +269,6 @@ class ObjectFileMachO : public lldb_private::ObjectFile {
   static lldb_private::ConstString GetSectionNameEHFrame();
 
   llvm::MachO::dysymtab_command m_dysymtab;
-  std::vector m_mach_segments;
   std::vector m_mach_sections;
   std::optional m_min_os_version;
   std::optional m_sdk_versions;



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


[Lldb-commits] [PATCH] D151236: [lldb][NFCI] Remove unused member from ObjectFileMachO

2023-05-23 Thread Alex Langford via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rG973f1fe7a859: [lldb][NFCI] Remove unused member from 
ObjectFileMachO (authored by bulbazord).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151236

Files:
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
  lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h


Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -269,7 +269,6 @@
   static lldb_private::ConstString GetSectionNameEHFrame();
 
   llvm::MachO::dysymtab_command m_dysymtab;
-  std::vector m_mach_segments;
   std::vector m_mach_sections;
   std::optional m_min_os_version;
   std::optional m_sdk_versions;
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -940,9 +940,9 @@
  lldb::offset_t file_offset,
  lldb::offset_t length)
 : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -952,9 +952,9 @@
  const lldb::ProcessSP &process_sp,
  lldb::addr_t header_addr)
 : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -1622,10 +1622,6 @@
   const bool segment_is_encrypted =
   (load_cmd.flags & SG_PROTECTED_VERSION_1) != 0;
 
-  // Keep a list of mach segments around in case we need to get at data that
-  // isn't stored in the abstracted Sections.
-  m_mach_segments.push_back(load_cmd);
-
   // Use a segment ID of the segment index shifted left by 8 so they never
   // conflict with any of the sections.
   SectionSP segment_sp;


Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.h
@@ -269,7 +269,6 @@
   static lldb_private::ConstString GetSectionNameEHFrame();
 
   llvm::MachO::dysymtab_command m_dysymtab;
-  std::vector m_mach_segments;
   std::vector m_mach_sections;
   std::optional m_min_os_version;
   std::optional m_sdk_versions;
Index: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
===
--- lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -940,9 +940,9 @@
  lldb::offset_t file_offset,
  lldb::offset_t length)
 : ObjectFile(module_sp, file, file_offset, length, data_sp, data_offset),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(false),
-  m_reexported_dylibs(), m_allow_assembly_emulation_unwind_plans(true) {
+  m_mach_sections(), m_entry_point_address(), m_thread_context_offsets(),
+  m_thread_context_offsets_valid(false), m_reexported_dylibs(),
+  m_allow_assembly_emulation_unwind_plans(true) {
   ::memset(&m_header, 0, sizeof(m_header));
   ::memset(&m_dysymtab, 0, sizeof(m_dysymtab));
 }
@@ -952,9 +952,9 @@
  const lldb::ProcessSP &process_sp,
  lldb::addr_t header_addr)
 : ObjectFile(module_sp, process_sp, header_addr, header_data_sp),
-  m_mach_segments(), m_mach_sections(), m_entry_point_address(),
-  m_thread_context_offsets(), m_thread_context_offsets_valid(f

[Lldb-commits] [lldb] 429e748 - Revert "[lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` module"

2023-05-23 Thread Med Ismail Bennani via lldb-commits

Author: Med Ismail Bennani
Date: 2023-05-23T16:03:34-07:00
New Revision: 429e74839506ea8ba962d24647264ed81f680bbf

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

LOG: Revert "[lldb] Move PassthroughScriptedProcess to `lldb.scripted_process` 
module"

This reverts commit 273a2d337f675f3ee050f281b1fecc3e806b9a3c, since it
might be the cause for `TestStackCoreScriptedProcess` and
`TestInteractiveScriptedProcess` failures on GreenDragon:

https://green.lab.llvm.org/green/job/lldb-cmake/55460/`

Added: 


Modified: 
lldb/examples/python/scripted_process/scripted_process.py

lldb/test/API/functionalities/interactive_scripted_process/interactive_scripted_process.py

Removed: 




diff  --git a/lldb/examples/python/scripted_process/scripted_process.py 
b/lldb/examples/python/scripted_process/scripted_process.py
index b809f6c8224c3..a0880fbb6268f 100644
--- a/lldb/examples/python/scripted_process/scripted_process.py
+++ b/lldb/examples/python/scripted_process/scripted_process.py
@@ -1,7 +1,6 @@
 from abc import ABCMeta, abstractmethod
 
 import lldb
-import json, struct, signal
 
 class ScriptedProcess(metaclass=ABCMeta):
 
@@ -226,6 +225,7 @@ def create_breakpoint(self, addr, error):
  % self.__class__.__name__)
 return False
 
+
 class ScriptedThread(metaclass=ABCMeta):
 
 """
@@ -376,162 +376,6 @@ def get_extended_info(self):
 """
 return self.extended_info
 
-
-class PassthroughScriptedProcess(ScriptedProcess):
-driving_target = None
-driving_process = None
-
-def __init__(self, exe_ctx, args, launched_driving_process=True):
-super().__init__(exe_ctx, args)
-
-self.driving_target = None
-self.driving_process = None
-
-self.driving_target_idx = args.GetValueForKey("driving_target_idx")
-if self.driving_target_idx and self.driving_target_idx.IsValid():
-idx = self.driving_target_idx.GetUnsignedIntegerValue(42)
-self.driving_target = 
self.target.GetDebugger().GetTargetAtIndex(idx)
-
-if launched_driving_process:
-self.driving_process = self.driving_target.GetProcess()
-for driving_thread in self.driving_process:
-structured_data = lldb.SBStructuredData()
-structured_data.SetFromJSON(
-json.dumps(
-{
-"driving_target_idx": idx,
-"thread_idx": driving_thread.GetIndexID(),
-}
-)
-)
-
-self.threads[
-driving_thread.GetThreadID()
-] = PassthroughScriptedThread(self, structured_data)
-
-for module in self.driving_target.modules:
-path = module.file.fullpath
-load_addr = 
module.GetObjectFileHeaderAddress().GetLoadAddress(
-self.driving_target
-)
-self.loaded_images.append({"path": path, "load_addr": 
load_addr})
-
-def get_memory_region_containing_address(self, addr):
-mem_region = lldb.SBMemoryRegionInfo()
-error = self.driving_process.GetMemoryRegionInfo(addr, mem_region)
-if error.Fail():
-return None
-return mem_region
-
-def read_memory_at_address(self, addr, size, error):
-data = lldb.SBData()
-bytes_read = self.driving_process.ReadMemory(addr, size, error)
-
-if error.Fail():
-return data
-
-data.SetDataWithOwnership(
-error,
-bytes_read,
-self.driving_target.GetByteOrder(),
-self.driving_target.GetAddressByteSize(),
-)
-
-return data
-
-def write_memory_at_address(self, addr, data, error):
-return self.driving_process.WriteMemory(
-addr, bytearray(data.uint8.all()), error
-)
-
-def get_process_id(self):
-return self.driving_process.GetProcessID()
-
-def is_alive(self):
-return True
-
-def get_scripted_thread_plugin(self):
-return 
f"{PassthroughScriptedThread.__module__}.{PassthroughScriptedThread.__name__}"
-
-
-class PassthroughScriptedThread(ScriptedThread):
-def __init__(self, process, args):
-super().__init__(process, args)
-driving_target_idx = args.GetValueForKey("driving_target_idx")
-thread_idx = args.GetValueForKey("thread_idx")
-
-# TODO: Change to Walrus operator (:=) with oneline if assignment
-# Requires python 3.8
-val = thread_idx.GetUnsignedIntegerValue()
-if val is not None:
-self.idx = v

[Lldb-commits] [PATCH] D151268: [lldb][DataFormatter] Add dereference support to libstdcpp std::shared_ptr formatter

2023-05-23 Thread Michael Buch via Phabricator via lldb-commits
Michael137 created this revision.
Herald added a project: All.
Michael137 requested review of this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

This mimicks the implementation of the libstdcpp std::unique_ptr
formatter.

This has been attempted several years ago in
`0789722d85cf1f1fdbe2ffb2245ea0ba034a9f94` but was reverted in
`e7dd3972094c2f2fb42dc9d4d5344e54a431e2ce`.

The difference to the original patch is that we now maintain
a `$$dereference$$` member and we only store weak pointers
to the other children inside the synthetic frontend. This is
what the libc++ formatters do to prevent the recursion mentioned
in the revert commit.

This patch addresses https://github.com/llvm/llvm-project/issues/62825


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151268

Files:
  lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
  
lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp

Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/main.cpp
@@ -1,12 +1,17 @@
 #include 
 #include 
 
+struct Foo {
+  int mem = 5;
+};
+
 int
 main()
 {
 std::shared_ptr nsp;
 std::shared_ptr isp(new int{123});
 std::shared_ptr ssp = std::make_shared("foobar");
+std::shared_ptr fsp = std::make_shared();
 
 std::weak_ptr nwp;
 std::weak_ptr iwp = isp;
@@ -15,6 +20,7 @@
 nsp.reset(); // Set break point at this line.
 isp.reset();
 ssp.reset();
+fsp.reset();
 
 return 0; // Set break point at this line.
 }
Index: lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
===
--- lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
+++ lldb/test/API/functionalities/data-formatter/data-formatter-stl/libstdcpp/smart_ptr/TestDataFormatterStdSmartPtr.py
@@ -33,6 +33,13 @@
 self.expect("frame variable iwp", substrs=['iwp = 123'])
 self.expect("frame variable swp", substrs=['swp = "foobar"'])
 
+self.expect("frame variable *nsp", substrs=['*nsp = '])
+self.expect("frame variable *isp", substrs=['*isp = 123'])
+self.expect("frame variable *ssp", substrs=['*ssp = "foobar"'])
+self.expect("frame variable *fsp", substrs=['*fsp = (mem = 5)'])
+
+self.expect("frame variable fsp->mem", substrs=['(int) f->mem = 5'])
+
 self.runCmd("continue")
 
 self.expect("frame variable nsp", substrs=['nsp = nullptr'])
Index: lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
===
--- lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
+++ lldb/source/Plugins/Language/CPlusPlus/LibStdcpp.cpp
@@ -73,6 +73,15 @@
   bool MightHaveChildren() override;
 
   size_t GetIndexOfChildWithName(ConstString name) override;
+private:
+
+  // The lifetime of a ValueObject and all its derivative ValueObjects
+  // (children, clones, etc.) is managed by a ClusterManager. These
+  // objects are only destroyed when every shared pointer to any of them
+  // is destroyed, so we must not store a shared pointer to any ValueObject
+  // derived from our backend ValueObject (since we're in the same cluster).
+  ValueObject* m_ptr_obj = nullptr; // Underlying pointer (held, not owned)
+  ValueObject* m_obj_obj = nullptr; // Underlying object (held, not owned)
 };
 
 } // end of anonymous namespace
@@ -367,24 +376,48 @@
 
 lldb::ValueObjectSP
 LibStdcppSharedPtrSyntheticFrontEnd::GetChildAtIndex(size_t idx) {
-  ValueObjectSP valobj_sp = m_backend.GetSP();
-  if (!valobj_sp)
-return lldb::ValueObjectSP();
-
   if (idx == 0)
-return valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true);
-  else
-return lldb::ValueObjectSP();
+return m_ptr_obj->GetSP();
+  if (idx == 1)
+return m_obj_obj->GetSP();
+
+  return lldb::ValueObjectSP();
 }
 
-bool LibStdcppSharedPtrSyntheticFrontEnd::Update() { return false; }
+bool LibStdcppSharedPtrSyntheticFrontEnd::Update() {
+  auto backend = m_backend.GetSP();
+  if (!backend)
+return false;
+
+  auto valobj_sp = backend->GetNonSyntheticValue();
+  if (!valobj_sp)
+return false;
+
+  auto ptr_obj_sp = valobj_sp->GetChildMemberWithName(ConstString("_M_ptr"), true);
+  if (!ptr_obj_sp)
+return false;
+
+  m_ptr_obj = ptr_obj_sp->Clone(ConstString("pointer")).get();
+
+  if (m_ptr_obj) {
+Status error;
+ValueObjectSP obj_obj = m_ptr_obj->Dereferen

[Lldb-commits] [PATCH] D151269: Pass CMAKE_SYSROOT through to lldb tests.

2023-05-23 Thread Daniel Thornburgh via Phabricator via lldb-commits
mysterymath created this revision.
Herald added a project: All.
mysterymath updated this revision to Diff 524935.
mysterymath added a comment.
mysterymath updated this revision to Diff 524937.
mysterymath added a project: LLDB.
Herald added a subscriber: JDevlieghere.
mysterymath added a reviewer: labath.
mysterymath added reviewers: phosek, abrachet.
mysterymath updated this revision to Diff 524939.
mysterymath published this revision for review.
Herald added a subscriber: lldb-commits.

Update commit message.


mysterymath added a comment.

More style fixes.


mysterymath added a comment.

Restore accidentally removed flag.


This allows the LLDB tests to succeed in (e.g. CI) environments where
system libraries are provied hermetically as a sysroot.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151269

Files:
  lldb/test/Shell/helper/build.py
  lldb/test/Shell/helper/toolchain.py
  lldb/test/Shell/lit.site.cfg.py.in


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 config.python_executable = "@Python3_EXECUTABLE@"
 config.have_zlib = @LLVM_ENABLE_ZLIB@
Index: lldb/test/Shell/helper/toolchain.py
===
--- lldb/test/Shell/helper/toolchain.py
+++ lldb/test/Shell/helper/toolchain.py
@@ -44,6 +44,8 @@
 build_script_args.append('--libs-dir={0}'.format(config.llvm_libs_dir))
 if config.objc_gnustep_dir:
 
build_script_args.append('--objc-gnustep-dir="{0}"'.format(config.objc_gnustep_dir))
+if config.cmake_sysroot:
+build_script_args.append('--sysroot={0}'.format(config.cmake_sysroot))
 
 lldb_init = _get_lldb_init_path(config)
 
@@ -140,6 +142,9 @@
 # The clang module cache is used for building inferiors.
 host_flags += ['-fmodules-cache-path={}'.format(config.clang_module_cache)]
 
+if config.cmake_sysroot:
+host_flags += ['--sysroot={}'.format(config.cmake_sysroot)]
+
 host_flags = ' '.join(host_flags)
 config.substitutions.append(('%clang_host', '%clang ' + host_flags))
 config.substitutions.append(('%clangxx_host', '%clangxx ' + host_flags))
Index: lldb/test/Shell/helper/build.py
===
--- lldb/test/Shell/helper/build.py
+++ lldb/test/Shell/helper/build.py
@@ -61,6 +61,12 @@
 default=False,
 help='Include and link GNUstep libobjc2 (Windows and Linux 
only)')
 
+parser.add_argument('--sysroot',
+metavar='directory',
+dest='sysroot',
+required=False,
+help='If specified, a sysroot to be passed via --sysroot')
+
 if sys.platform == 'darwin':
 parser.add_argument('--apple-sdk',
 metavar='apple_sdk',
@@ -254,6 +260,7 @@
"--objc-gnustep specified without path to libobjc2"
 self.objc_gnustep_inc = os.path.join(args.objc_gnustep_dir, 'include') 
if args.objc_gnustep_dir else None
 self.objc_gnustep_lib = os.path.join(args.objc_gnustep_dir, 'lib') if 
args.objc_gnustep_dir else None
+self.sysroot = args.sysroot
 
 def _exe_file_name(self):
 assert self.mode != 'compile'
@@ -679,6 +686,8 @@
 args.extend(['-fobjc-runtime=gnustep-2.0', '-I', 
self.objc_gnustep_inc])
 if sys.platform == "win32":
 args.extend(['-Xclang', '-gcodeview', '-Xclang', 
'--dependent-lib=msvcrtd'])
+elif self.sysroot:
+args.extend(['--sysroot', self.sysroot])
 
 if self.std:
 args.append('-std={0}'.format(self.std))
@@ -713,6 +722,8 @@
 args.extend(['-Wl,-rpath,' + self.objc_gnustep_lib])
 elif sys.platform == 'win32':
 args.extend(['-fuse-ld=lld-link', '-g', '-Xclang', 
'--dependent-lib=msvcrtd'])
+elif self.sysroot:
+args.extend(['--sysroot', self.sysroot])
 
 return ('linking', self._obj_file_names(), self._exe_file_name(), 
None, args)
 


Index: lldb/test/Shell/lit.site.cfg.py.in
===
--- lldb/test/Shell/lit.site.cfg.py.in
+++ lldb/test/Shell/lit.site.cfg.py.in
@@ -13,6 +13,7 @@
 # Since it comes from the command line, it may have backslashes which
 # should not need to be escaped.
 config.lldb_lit_tools_dir = lit_config.substitute(r"@LLDB_LIT_TOOLS_DIR@")
+config.cmake_sysroot = lit_config.substitute("@CMAKE_SYSROOT@")
 config.target_triple = "@LLVM_TARGET_TRIPLE@"
 co

[Lldb-commits] [PATCH] D151269: [lldb] Pass CMAKE_SYSROOT through to lldb tests

2023-05-23 Thread Jonas Devlieghere via Phabricator via lldb-commits
JDevlieghere added a comment.

The change itself looks fine, but isn't this an issue for the API tests too? If 
so, how is the sys root passed to `dotest.py` and can the shell tests do the 
same?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D151269

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


[Lldb-commits] [PATCH] D150928: Two bug fixes for loading process save-core created core files, plus perf improvements

2023-05-23 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda added a comment.

Thanks for the review comments, really helpful.  I've also added a new block to 
`DynamicLoader::LoadBinaryWithUUIDAndAddress` to make the binary search system: 
(1) `Target::GetOrCreateModule` (lldb already has it), (2) 
`Symbols::LocateExecutableObjectFile` / `Symbols::LocateExecutableSymbolFile` 
(on a macOS system, this would be your Spotlight search), and then finally (3) 
`Symbols::DownloadObjectAndSymbolFile` with the `force_symbol_search` as passed 
in.  I need to retest this with these different use cases to make sure it's all 
working correctly still, but looking pretty good now.




Comment at: lldb/source/Core/DynamicLoader.cpp:216-218
+if (!module_sp || !module_sp->GetSymbolFileFileSpec()) {
+  Symbols::DownloadObjectAndSymbolFile(module_spec, error,
+   force_symbol_search);

bulbazord wrote:
> I think this **technically** changes behavior and probably not in a desirable 
> way. Specifically, we previously only called `DownloadObjectAndSymbolFile` if 
> `force_symbol_search` was true. Now you're passing it through which makes 
> sense looking at the interface of `DownloadObjectAndSymbolFile`. However, 
> peeking at the beginning of that function we see this code block:
> ```
>   // When dbgshell_command is empty, the user has not enabled the use of an
>   // external program to find the symbols, don't run it for them.
>   if (!force_lookup && dbgshell_command.empty())
> return false;
> ```
> This means that even if `force_lookup` is false (or `force_symbol_search` as 
> it's written here), if `dbgshell_command` is non-empty we'll still perform 
> the lookup (assuming all the other checks pass) which is probably not what we 
> intended performance-wise. That condition in the block above should probably 
> be something like `!force_lookup || dbgshell_command.empty()` instead of `&&`.
Good catch.  This is behavior I want, but it sure isn't real clear from the way 
this method is written.  I will add some comments to make it clear that we want 
to do this external-program-lookup if either `force_lookup` is set, or if the 
user set `dbgshell_command` manually in their com.apple.DebugSymbols 
preferences.



Comment at: lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp:7021
 }
-const bool address_is_slide = true;
 bool changed = false;
+module_sp->SetLoadAddress(process.GetTarget(), value, value_is_offset,

bulbazord wrote:
> nit: this can be const
it's not clearly written, this is actually an output parameter from 
Module::SetLoadAddress.  The obvious next question is - why is it initialized.  
It should not be, I'll remove the initialization.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D150928

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


[Lldb-commits] [lldb] 23e26cb - [lldb] Fix typos in documentation

2023-05-23 Thread Kazu Hirata via lldb-commits

Author: Kazu Hirata
Date: 2023-05-23T22:10:59-07:00
New Revision: 23e26cb98d5f817b951d6e7e2346246fc937ffb6

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

LOG: [lldb] Fix typos in documentation

Added: 


Modified: 
lldb/docs/resources/fuzzing.rst
lldb/docs/use/ondemand.rst
lldb/docs/use/variable.rst

Removed: 




diff  --git a/lldb/docs/resources/fuzzing.rst b/lldb/docs/resources/fuzzing.rst
index 2b1e7bd1eaafd..b827b32e74d50 100644
--- a/lldb/docs/resources/fuzzing.rst
+++ b/lldb/docs/resources/fuzzing.rst
@@ -9,7 +9,7 @@ LLDB has fuzzers that provide automated `fuzz testing 


[Lldb-commits] [PATCH] D151292: lldb WIP/RFC: Adding support for address fixing on AArch64 with high and low memory addresses

2023-05-23 Thread Jason Molenda via Phabricator via lldb-commits
jasonmolenda created this revision.
jasonmolenda added reviewers: DavidSpickett, JDevlieghere, jingham, omjavaid.
jasonmolenda added a project: LLDB.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
jasonmolenda requested review of this revision.
Herald added a subscriber: lldb-commits.

The number of bits used for addressing on AArch64 is a bit more complicated 
than we're representing today in lldb.  The same values apply to both EL0 and 
EL1 execution, but the number of bits used in addressing may be different for 
low memory (0x000...) versus high memory (0xfff...) addresses.  The Darwin 
kernel always has the same page table setup for low and high memory, but I'm 
supporting some teams that need to have different settings for each, and 
they're managing to capture a single corefile / JTAG connection capturing the 
virtual addresses for both high and low memory in a single process. Having a 
single number of addressing bits cannot handle this situation today.  
Internally we use the Linux model of code address and data address mask, but 
that also doesn't encompass this concept.

This patch adds a high memory code and data mask, mirroring our existing 
code/data masks.  By default the high memory masks will either be default value 
0, or will have the same mask values.  I'll need three ways of receiving the 
correct address bit numbers:  a setting, an LC_NOTE way to get it from a 
corefile, and a qProcessInfo way of getting it from a gdb-remote connection to 
a JTAG etc device.

To start, I changed `target.process.virtual-addressable-bits` from taking a 
uint to an array of strings (it should be an array of uint's but I wasn't 
getting that to work correctly, I'll play around with it more later).  The 
array can be zero elements (no user override), a single element (used for all 
addresses, like today), or two elements (first number is low memory, second 
number is high memory).  The alternative is to have an additional setting for 
those environments that need to specify a different address mask for high 
memory vrs. low memory.

I also changed `Process::GetDataAddressMask` and `Process::GetCodeAddressMask` 
to have a clear set of precedence for values.  If the user specifies a number 
of addressing bits in that setting, this overrides what the system might tell 
lldb.  The user's specified values do not overwrite/set the Process address 
mask.

Current behavior is that the mask is overwritten by the setting value if the 
mask is unset.  But once the mask is set, the user setting is ignored.  In 
practice this means you can set the setting ONCE in a Process lifetime, and 
then further changes to the setting are ignored.  Made it a little annoying to 
experiment with this environment when I first started working on it. :)

None of this should change behavior on linux, but if folks from the linux world 
have a comment or reaction to this change, I would be interested to hear 
opinions.  I haven't done much testing beyond the one test corefile, and I 
still need to work out how the two values are communicated in corefiles & live 
debug, but those are trivial details on the core idea.

FTR this is the AArch64 TCR_EL1.T0SZ and TCR_EL1.T1SZ.  The values of this 
control register apply to both EL0 and EL1 execution, but the T0SZ value 
applies to the TTBR0_EL1 for low memory addresses and the TCR_EL1.T1SZ applies 
to TTBR1_EL1 for high memory addresses.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151292

Files:
  lldb/include/lldb/Target/Process.h
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.cpp
  lldb/source/Plugins/ABI/AArch64/ABIMacOSX_arm64.h
  lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp
  lldb/source/Target/Process.cpp
  lldb/source/Target/TargetProperties.td

Index: lldb/source/Target/TargetProperties.td
===
--- lldb/source/Target/TargetProperties.td
+++ lldb/source/Target/TargetProperties.td
@@ -252,9 +252,9 @@
   def SteppingRunsAllThreads: Property<"run-all-threads", "Boolean">,
 DefaultFalse,
 Desc<"If true, stepping operations will run all threads.  This is equivalent to setting the run-mode option to 'all-threads'.">;
-  def VirtualAddressableBits: Property<"virtual-addressable-bits", "UInt64">,
-DefaultUnsignedValue<0>,
-Desc<"The number of bits used for addressing. If the value is 39, then bits 0..38 are used for addressing. The default value of 0 means unspecified.">;
+  def VirtualAddressableBits: Property<"virtual-addressable-bits", "Array">,
+ElementType<"String">,
+Desc<"The number of bits used for addressing. If the value is 39, then bits 0..38 are used for addressing. If two values are provided, the first value is for low memory addresses, the second value for high memory addresses.  This is uncommon.">;
   def FollowForkMode: Property<"follow-fork-mode", "Enum">,
 DefaultEnumValue<"eFollowParent">,
 EnumValues