[Lldb-commits] [lldb] [lldb-vscode] Display a more descriptive summary for containers and pointers (PR #65514)

2023-09-06 Thread River Riddle via lldb-commits


@@ -1,8 +1,9 @@
-from lldbsuite.test.lldbtest import *
 import os
-import vscode
 import time
 
+import vscode

River707 wrote:

Are the changes in this file necessary?

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


[Lldb-commits] [lldb] [lldb-vscode] Display a more descriptive summary for containers and pointers (PR #65514)

2023-09-06 Thread River Riddle via lldb-commits

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


[Lldb-commits] [lldb] [lldb-vscode] Display a more descriptive summary for containers and pointers (PR #65514)

2023-09-06 Thread River Riddle via lldb-commits


@@ -132,6 +132,84 @@ std::vector GetStrings(const 
llvm::json::Object *obj,
   return strs;
 }
 
+/// Create a short summary for a container that contains the summary of its
+/// first children, so that the user can get a glimpse of its contents at a
+/// glance.
+static std::optional
+GetSyntheticSummaryForContainer(lldb::SBValue &v) {
+  if (v.TypeIsPointerType() || !v.MightHaveChildren())
+return std::nullopt;
+  /// As this operation can be potentially slow, we limit the total time spent
+  /// fetching children to a few ms.
+  const auto max_evaluation_time = std::chrono::milliseconds(10);
+  /// We don't want to generate a extremely long summary string, so we limit 
its
+  /// length.
+  const size_t max_length = 32;
+
+  auto start = std::chrono::steady_clock::now();
+  std::string summary;
+  llvm::raw_string_ostream os(summary);
+  os << "{";
+
+  llvm::StringRef separator = "";
+
+  for (size_t i = 0, e = v.GetNumChildren(); i < e; ++i) {
+// If we reached the time limit or exceeded the number of characters, we
+// dump `...` to signal that there are more elements in the collection.
+if (summary.size() > max_length ||
+(std::chrono::steady_clock::now() - start) > max_evaluation_time) {
+  os << separator << "...";
+  break;
+}
+lldb::SBValue child = v.GetChildAtIndex(i);
+
+if (llvm::StringRef name = child.GetName(); !name.empty()) {
+  llvm::StringRef value;
+  if (llvm::StringRef summary = child.GetSummary(); !summary.empty())
+value = summary;
+  else
+value = child.GetValue();
+
+  if (!value.empty()) {
+// If the child is an indexed entry, we don't show its index to save
+// characters.
+if (name.starts_with("["))
+  os << separator << value;
+else
+  os << separator << name << ":" << value;
+separator = ", ";
+  }
+}
+  }
+  os << "}";
+
+  if (summary == "{...}" || summary == "{}")
+return std::nullopt;
+  return summary;
+}
+
+/// Return whether we should dereference an SBValue in order to generate a more
+/// meaningful summary string.
+static bool ShouldBeDereferencedForSummary(lldb::SBValue &v) {
+  if (!v.GetType().IsPointerType() && !v.GetType().IsReferenceType())

River707 wrote:

Do we have tests for this `false` cases?

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


[Lldb-commits] [lldb] [lldb-vscode] Display a more descriptive summary for containers and pointers (PR #65514)

2023-09-06 Thread River Riddle via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb-vscode] Show a fake child with the raw value of synthetic types (PR #65552)

2023-09-06 Thread River Riddle via lldb-commits

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


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


[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-27 Thread River Riddle via lldb-commits

https://github.com/River707 created 
https://github.com/llvm/llvm-project/pull/67628

LLDB_EXPORT_ALL_SYMBOLS is useful when building out-of-tree plugins and 
extensions that rely on LLDB's internal symbols. For example, this is how the 
Mojo language provides its REPL and debugger support.

Supporting this on windows is kind of tricky because this is normally expected 
to be done using dllexport/dllimport, but lldb uses these with the public api. 
This PR takes an approach similar to what LLVM does with 
LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, and what chromium does for 
[abseil](https://github.com/chromium/chromium/blob/253d14e20fdc0cab05e5516770dceca18f9bddaf/third_party/abseil-cpp/generate_def_files.py),
 and uses a python script to extract the necessary symbols by looking at the 
symbol table for the various lldb libraries.

>From 4cc073bb514fe08115f194143987e8460d43a77d Mon Sep 17 00:00:00 2001
From: River Riddle 
Date: Wed, 27 Sep 2023 18:59:53 -0700
Subject: [PATCH] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS

LLDB_EXPORT_ALL_SYMBOLS is useful when building out-of-tree
plugins and extensions that rely on LLDB's internal symbols. For
example, this is how the Mojo language provides its REPL and
debugger support.

Supporting this on windows is kind of tricky because this is normally
expected to be done using dllexport/dllimport, but lldb uses these
with the public api. This PR takes an approach similar to what LLVM
does with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, and what chromium
does for 
[abseil](https://github.com/chromium/chromium/blob/253d14e20fdc0cab05e5516770dceca18f9bddaf/third_party/abseil-cpp/generate_def_files.py),
and uses a python script to extract the necessary symbols by looking at
the symbol table for the various lldb libraries.
---
 lldb/cmake/modules/LLDBConfig.cmake  |  10 +-
 lldb/scripts/msvc_extract_private_symbols.py | 100 +++
 lldb/source/API/CMakeLists.txt   |  37 +++
 3 files changed, 139 insertions(+), 8 deletions(-)
 create mode 100644 lldb/scripts/msvc_extract_private_symbols.py

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 19283b3cbb0194f..380016ce48015fa 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -122,14 +122,8 @@ if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
   endif()
 endif()
 
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
-"Causes lldb to export all symbols when building liblldb.")
-else()
-  # Windows doesn't support toggling this, so don't bother making it a
-  # cache variable.
-  set(LLDB_EXPORT_ALL_SYMBOLS 0)
-endif()
+set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
+  "Causes lldb to export all symbols when building liblldb.")
 
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
diff --git a/lldb/scripts/msvc_extract_private_symbols.py 
b/lldb/scripts/msvc_extract_private_symbols.py
new file mode 100644
index 000..47325d56c0d792f
--- /dev/null
+++ b/lldb/scripts/msvc_extract_private_symbols.py
@@ -0,0 +1,100 @@
+"""A tool for extracting a list of private lldb symbols to export for MSVC.
+
+When exporting symbols from a dll or exe we either need to mark the symbols in
+the source code as __declspec(dllexport) or supply a list of symbols to the
+linker. Private symbols in LLDB don't explicitly specific dllexport, so we
+automate that by examining the symbol table.
+"""
+
+import argparse
+import os
+import re
+import subprocess
+import sys
+
+
+def extract_symbols(nm_path: str, lib: str):
+"""Extract all of the private lldb symbols from the given path to llvm-nm 
and
+library to extract from."""
+
+# Matches mangled symbols containing 'lldb_private'.
+lldb_sym_re = r"0* [BT] (?P[?]+[^?].*lldb_private.*)"
+
+# '-g' means we only get global symbols.
+# '-p' do not waste time sorting the symbols.
+process = subprocess.Popen(
+[nm_path, "-g", "-p", lib],
+bufsize=1,
+stdout=subprocess.PIPE,
+stdin=subprocess.PIPE,
+universal_newlines=True,
+)
+process.stdin.close()
+
+lldb_symbols = set()
+for line in process.stdout:
+match = re.match(lldb_sym_re, line)
+if match:
+symbol = match.group("symbol")
+assert symbol.count(" ") == 0, (
+"Regex matched too much, probably got " "undecorated name as 
well"
+)
+# Deleting destructors start with ?_G or ?_E and can be discarded
+# because link.exe gives you a warning telling you they can't be
+# exported if you don't.
+if symbol.startswith("??_G") or symbol.startswith("??_E"):
+continue
+lldb_symbols.add(symbol)
+
+return lldb_symbols
+
+
+def main():
+parser = argparse.ArgumentParser(description="Generate LLDB dll exports")
+parser.add_argument(
+"-o", metavar="file", type=str, help="Th

[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-27 Thread River Riddle via lldb-commits

https://github.com/River707 updated 
https://github.com/llvm/llvm-project/pull/67628

>From 5174dcdd77567cc4e0dd063f6e5b7fce18dd767b Mon Sep 17 00:00:00 2001
From: River Riddle 
Date: Wed, 27 Sep 2023 18:59:53 -0700
Subject: [PATCH] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS

LLDB_EXPORT_ALL_SYMBOLS is useful when building out-of-tree
plugins and extensions that rely on LLDB's internal symbols. For
example, this is how the Mojo language provides its REPL and
debugger support.

Supporting this on windows is kind of tricky because this is normally
expected to be done using dllexport/dllimport, but lldb uses these
with the public api. This PR takes an approach similar to what LLVM
does with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, and what chromium
does for 
[abseil](https://github.com/chromium/chromium/blob/253d14e20fdc0cab05e5516770dceca18f9bddaf/third_party/abseil-cpp/generate_def_files.py),
and uses a python script to extract the necessary symbols by looking at
the symbol table for the various lldb libraries.
---
 lldb/cmake/modules/LLDBConfig.cmake  |  10 +-
 lldb/scripts/msvc_extract_private_symbols.py | 100 +++
 lldb/source/API/CMakeLists.txt   |  37 +++
 3 files changed, 139 insertions(+), 8 deletions(-)
 create mode 100644 lldb/scripts/msvc_extract_private_symbols.py

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 19283b3cbb0194f..380016ce48015fa 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -122,14 +122,8 @@ if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
   endif()
 endif()
 
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
-"Causes lldb to export all symbols when building liblldb.")
-else()
-  # Windows doesn't support toggling this, so don't bother making it a
-  # cache variable.
-  set(LLDB_EXPORT_ALL_SYMBOLS 0)
-endif()
+set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
+  "Causes lldb to export all symbols when building liblldb.")
 
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
diff --git a/lldb/scripts/msvc_extract_private_symbols.py 
b/lldb/scripts/msvc_extract_private_symbols.py
new file mode 100644
index 000..91ed02ffa8665f0
--- /dev/null
+++ b/lldb/scripts/msvc_extract_private_symbols.py
@@ -0,0 +1,100 @@
+"""A tool for extracting a list of private lldb symbols to export for MSVC.
+
+When exporting symbols from a dll or exe we either need to mark the symbols in
+the source code as __declspec(dllexport) or supply a list of symbols to the
+linker. Private symbols in LLDB don't explicitly specific dllexport, so we
+automate that by examining the symbol table.
+"""
+
+import argparse
+import os
+import re
+import subprocess
+import sys
+
+
+def extract_symbols(nm_path: str, lib: str):
+"""Extract all of the private lldb symbols from the given path to llvm-nm 
and
+library to extract from."""
+
+# Matches mangled symbols containing 'lldb_private'.
+lldb_sym_re = r"0* [BT] (?P[?]+[^?].*lldb_private.*)"
+
+# '-g' means we only get global symbols.
+# '-p' do not waste time sorting the symbols.
+process = subprocess.Popen(
+[nm_path, "-g", "-p", lib],
+bufsize=1,
+stdout=subprocess.PIPE,
+stdin=subprocess.PIPE,
+universal_newlines=True,
+)
+process.stdin.close()
+
+lldb_symbols = set()
+for line in process.stdout:
+match = re.match(lldb_sym_re, line)
+if match:
+symbol = match.group("symbol")
+assert symbol.count(" ") == 0, (
+"Regex matched too much, probably got undecorated name as well"
+)
+# Deleting destructors start with ?_G or ?_E and can be discarded
+# because link.exe gives you a warning telling you they can't be
+# exported if you don't.
+if symbol.startswith("??_G") or symbol.startswith("??_E"):
+continue
+lldb_symbols.add(symbol)
+
+return lldb_symbols
+
+
+def main():
+parser = argparse.ArgumentParser(description="Generate LLDB dll exports")
+parser.add_argument(
+"-o", metavar="file", type=str, help="The name of the resultant export 
file."
+)
+parser.add_argument("--nm", help="Path to the llvm-nm executable.")
+parser.add_argument(
+"libs",
+metavar="lib",
+type=str,
+nargs="+",
+help="The libraries to extract symbols from.",
+)
+args = parser.parse_args()
+
+# Get the list of libraries to extract symbols from
+libs = list()
+for lib in args.libs:
+# When invoked by cmake the arguments are the cmake target names of the
+# libraries, so we need to add .lib/.a to the end and maybe lib to the
+# start to get the filename. Also allow objects.
+suffixes = [".lib", ".a", ".obj", ".o"]
+if not any([lib.endswith(s) for s in suffixes]):
+ 

[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-28 Thread River Riddle via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-28 Thread River Riddle via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-28 Thread River Riddle via lldb-commits

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


[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-28 Thread River Riddle via lldb-commits


@@ -0,0 +1,100 @@
+"""A tool for extracting a list of private lldb symbols to export for MSVC.
+
+When exporting symbols from a dll or exe we either need to mark the symbols in
+the source code as __declspec(dllexport) or supply a list of symbols to the
+linker. Private symbols in LLDB don't explicitly specific dllexport, so we
+automate that by examining the symbol table.
+"""
+
+import argparse
+import os
+import re
+import subprocess
+import sys
+
+
+def extract_symbols(nm_path: str, lib: str):
+"""Extract all of the private lldb symbols from the given path to llvm-nm 
and
+library to extract from."""
+
+# Matches mangled symbols containing 'lldb_private'.
+lldb_sym_re = r"0* [BT] (?P[?]+[^?].*lldb_private.*)"
+
+# '-g' means we only get global symbols.
+# '-p' do not waste time sorting the symbols.
+process = subprocess.Popen(
+[nm_path, "-g", "-p", lib],
+bufsize=1,
+stdout=subprocess.PIPE,
+stdin=subprocess.PIPE,
+universal_newlines=True,
+)
+process.stdin.close()
+
+lldb_symbols = set()
+for line in process.stdout:
+match = re.match(lldb_sym_re, line)
+if match:
+symbol = match.group("symbol")
+assert symbol.count(" ") == 0, (
+"Regex matched too much, probably got undecorated name as well"
+)
+# Deleting destructors start with ?_G or ?_E and can be discarded
+# because link.exe gives you a warning telling you they can't be
+# exported if you don't.
+if symbol.startswith("??_G") or symbol.startswith("??_E"):
+continue
+lldb_symbols.add(symbol)
+
+return lldb_symbols
+
+
+def main():
+parser = argparse.ArgumentParser(description="Generate LLDB dll exports")
+parser.add_argument(
+"-o", metavar="file", type=str, help="The name of the resultant export 
file."
+)
+parser.add_argument("--nm", help="Path to the llvm-nm executable.")
+parser.add_argument(
+"libs",
+metavar="lib",
+type=str,
+nargs="+",
+help="The libraries to extract symbols from.",
+)
+args = parser.parse_args()
+
+# Get the list of libraries to extract symbols from
+libs = list()
+for lib in args.libs:
+# When invoked by cmake the arguments are the cmake target names of the
+# libraries, so we need to add .lib/.a to the end and maybe lib to the
+# start to get the filename. Also allow objects.
+suffixes = [".lib", ".a", ".obj", ".o"]
+if not any([lib.endswith(s) for s in suffixes]):
+for s in suffixes:
+if os.path.exists(lib + s):
+lib = lib + s
+break
+if os.path.exists("lib" + lib + s):
+lib = "lib" + lib + s
+break

River707 wrote:

Tried this, but it actually ends up being a bit more convoluted because there 
are two loops to break from instead of just one (either need to recheck the 
suffix, or use the weird `else` after for loop + continue/break)

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


[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-28 Thread River Riddle via lldb-commits

https://github.com/River707 updated 
https://github.com/llvm/llvm-project/pull/67628

>From da965dd04c810f0bde7ed3353f13ce5d7d064d88 Mon Sep 17 00:00:00 2001
From: River Riddle 
Date: Wed, 27 Sep 2023 18:59:53 -0700
Subject: [PATCH] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS

LLDB_EXPORT_ALL_SYMBOLS is useful when building out-of-tree
plugins and extensions that rely on LLDB's internal symbols. For
example, this is how the Mojo language provides its REPL and
debugger support.

Supporting this on windows is kind of tricky because this is normally
expected to be done using dllexport/dllimport, but lldb uses these
with the public api. This PR takes an approach similar to what LLVM
does with LLVM_EXPORT_SYMBOLS_FOR_PLUGINS, and what chromium
does for 
[abseil](https://github.com/chromium/chromium/blob/253d14e20fdc0cab05e5516770dceca18f9bddaf/third_party/abseil-cpp/generate_def_files.py),
and uses a python script to extract the necessary symbols by looking at
the symbol table for the various lldb libraries.
---
 lldb/cmake/modules/LLDBConfig.cmake  |  10 +-
 lldb/scripts/msvc_extract_private_symbols.py | 102 +++
 lldb/source/API/CMakeLists.txt   |  37 +++
 3 files changed, 141 insertions(+), 8 deletions(-)
 create mode 100644 lldb/scripts/msvc_extract_private_symbols.py

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index 19283b3cbb0194f..380016ce48015fa 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -122,14 +122,8 @@ if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
   endif()
 endif()
 
-if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
-  set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
-"Causes lldb to export all symbols when building liblldb.")
-else()
-  # Windows doesn't support toggling this, so don't bother making it a
-  # cache variable.
-  set(LLDB_EXPORT_ALL_SYMBOLS 0)
-endif()
+set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
+  "Causes lldb to export all symbols when building liblldb.")
 
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
diff --git a/lldb/scripts/msvc_extract_private_symbols.py 
b/lldb/scripts/msvc_extract_private_symbols.py
new file mode 100644
index 000..05e8b0e2095ca33
--- /dev/null
+++ b/lldb/scripts/msvc_extract_private_symbols.py
@@ -0,0 +1,102 @@
+"""A tool for extracting a list of private lldb symbols to export for MSVC.
+
+When exporting symbols from a dll or exe we either need to mark the symbols in
+the source code as __declspec(dllexport) or supply a list of symbols to the
+linker. Private symbols in LLDB don't explicitly specific dllexport, so we
+automate that by examining the symbol table.
+"""
+
+import argparse
+import os
+import re
+import subprocess
+import sys
+
+
+def extract_symbols(nm_path: str, lib: str):
+"""Extract all of the private lldb symbols from the given path to llvm-nm 
and
+library to extract from."""
+
+# Matches mangled symbols containing 'lldb_private'.
+lldb_sym_re = r"0* [BT] (?P[?]+[^?].*lldb_private.*)"
+
+# '-g' means we only get global symbols.
+# '-p' do not waste time sorting the symbols.
+process = subprocess.Popen(
+[nm_path, "-g", "-p", lib],
+bufsize=1,
+stdout=subprocess.PIPE,
+stdin=subprocess.PIPE,
+universal_newlines=True,
+)
+process.stdin.close()
+
+lldb_symbols = set()
+for line in process.stdout:
+match = re.match(lldb_sym_re, line)
+if match:
+symbol = match.group("symbol")
+assert (
+symbol.count(" ") == 0
+), "Regex matched too much, probably got undecorated name as well"
+# Deleting destructors start with ?_G or ?_E and can be discarded
+# because link.exe gives you a warning telling you they can't be
+# exported if you don't.
+if symbol.startswith("??_G") or symbol.startswith("??_E"):
+continue
+lldb_symbols.add(symbol)
+
+return lldb_symbols
+
+
+def main():
+parser = argparse.ArgumentParser(description="Generate LLDB dll exports")
+parser.add_argument(
+"-o", metavar="file", type=str, help="The name of the resultant export 
file."
+)
+parser.add_argument("--nm", help="Path to the llvm-nm executable.")
+parser.add_argument(
+"libs",
+metavar="lib",
+type=str,
+nargs="+",
+help="The libraries to extract symbols from.",
+)
+args = parser.parse_args()
+
+# Get the list of libraries to extract symbols from
+libs = list()
+for lib in args.libs:
+# When invoked by cmake the arguments are the cmake target names of the
+# libraries, so we need to add .lib/.a to the end and maybe lib to the
+# start to get the filename. Also allow objects.
+suffixes = [".lib", ".a", ".obj", ".o"]
+if not any([lib.endswith(s) for s in suffixes]):
+ 

[Lldb-commits] [lldb] [lldb] Add windows support for LLDB_EXPORT_ALL_SYMBOLS (PR #67628)

2023-09-29 Thread River Riddle via lldb-commits

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


[Lldb-commits] [lldb] a3252d1 - [lldb][NFC] Move various constructor definitions from .h to .cpp

2023-03-30 Thread River Riddle via lldb-commits

Author: River Riddle
Date: 2023-03-30T13:25:30-07:00
New Revision: a3252d1a2c568792974a4bc7413b0c61a43053e9

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

LOG: [lldb][NFC] Move various constructor definitions from .h to .cpp

I ran into issues with linking downstream language plugin to liblldb in
debug builds, hitting link time errors of form:

```
undefined reference to `vtable for  lldb_private::'
```

Anchoring the vtable to the .cpp files resolved those issues.

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

Added: 


Modified: 
lldb/include/lldb/Expression/ExpressionVariable.h
lldb/include/lldb/Expression/Materializer.h
lldb/include/lldb/Symbol/TypeSystem.h
lldb/source/Expression/ExpressionVariable.cpp
lldb/source/Expression/Materializer.cpp
lldb/source/Symbol/TypeSystem.cpp

Removed: 




diff  --git a/lldb/include/lldb/Expression/ExpressionVariable.h 
b/lldb/include/lldb/Expression/ExpressionVariable.h
index 27343530780a1..ec18acb94417c 100644
--- a/lldb/include/lldb/Expression/ExpressionVariable.h
+++ b/lldb/include/lldb/Expression/ExpressionVariable.h
@@ -29,8 +29,7 @@ class ExpressionVariable
 
   LLVMCastKind getKind() const { return m_kind; }
 
-  ExpressionVariable(LLVMCastKind kind) : m_flags(0), m_kind(kind) {}
-
+  ExpressionVariable(LLVMCastKind kind);
   virtual ~ExpressionVariable();
 
   std::optional GetByteSize() { return m_frozen_sp->GetByteSize(); }
@@ -208,8 +207,7 @@ class PersistentExpressionState : public 
ExpressionVariableList {
 
   LLVMCastKind getKind() const { return m_kind; }
 
-  PersistentExpressionState(LLVMCastKind kind) : m_kind(kind) {}
-
+  PersistentExpressionState(LLVMCastKind kind);
   virtual ~PersistentExpressionState();
 
   virtual lldb::ExpressionVariableSP

diff  --git a/lldb/include/lldb/Expression/Materializer.h 
b/lldb/include/lldb/Expression/Materializer.h
index aae94f86a71e6..8f850c3f46439 100644
--- a/lldb/include/lldb/Expression/Materializer.h
+++ b/lldb/include/lldb/Expression/Materializer.h
@@ -69,6 +69,7 @@ class Materializer {
 
   class PersistentVariableDelegate {
   public:
+PersistentVariableDelegate();
 virtual ~PersistentVariableDelegate();
 virtual ConstString GetName() = 0;
 virtual void DidDematerialize(lldb::ExpressionVariableSP &variable) = 0;

diff  --git a/lldb/include/lldb/Symbol/TypeSystem.h 
b/lldb/include/lldb/Symbol/TypeSystem.h
index a16f4af2be6d6..dfef87232628b 100644
--- a/lldb/include/lldb/Symbol/TypeSystem.h
+++ b/lldb/include/lldb/Symbol/TypeSystem.h
@@ -77,6 +77,7 @@ class TypeSystem : public PluginInterface,
public std::enable_shared_from_this {
 public:
   // Constructors and Destructors
+  TypeSystem();
   ~TypeSystem() override;
 
   // LLVM RTTI support

diff  --git a/lldb/source/Expression/ExpressionVariable.cpp 
b/lldb/source/Expression/ExpressionVariable.cpp
index a397a34601d0c..325dd5bc8a2ad 100644
--- a/lldb/source/Expression/ExpressionVariable.cpp
+++ b/lldb/source/Expression/ExpressionVariable.cpp
@@ -15,6 +15,8 @@
 
 using namespace lldb_private;
 
+ExpressionVariable::ExpressionVariable(LLVMCastKind kind)
+: m_flags(0), m_kind(kind) {}
 ExpressionVariable::~ExpressionVariable() = default;
 
 uint8_t *ExpressionVariable::GetValueBytes() {
@@ -30,6 +32,8 @@ uint8_t *ExpressionVariable::GetValueBytes() {
   return nullptr;
 }
 
+PersistentExpressionState::PersistentExpressionState(LLVMCastKind kind)
+: m_kind(kind) {}
 PersistentExpressionState::~PersistentExpressionState() = default;
 
 lldb::addr_t PersistentExpressionState::LookupSymbol(ConstString name) {

diff  --git a/lldb/source/Expression/Materializer.cpp 
b/lldb/source/Expression/Materializer.cpp
index 0932dc6f95b1f..6e344dfd57c4b 100644
--- a/lldb/source/Expression/Materializer.cpp
+++ b/lldb/source/Expression/Materializer.cpp
@@ -1598,5 +1598,7 @@ void Materializer::Dematerializer::Wipe() {
   m_process_address = LLDB_INVALID_ADDRESS;
 }
 
+Materializer::PersistentVariableDelegate::PersistentVariableDelegate() =
+default;
 Materializer::PersistentVariableDelegate::~PersistentVariableDelegate() =
 default;

diff  --git a/lldb/source/Symbol/TypeSystem.cpp 
b/lldb/source/Symbol/TypeSystem.cpp
index 4eae2c98b12ec..9647102e96c61 100644
--- a/lldb/source/Symbol/TypeSystem.cpp
+++ b/lldb/source/Symbol/TypeSystem.cpp
@@ -36,6 +36,7 @@ size_t LanguageSet::Size() const { return bitvector.count(); }
 bool LanguageSet::Empty() const { return bitvector.none(); }
 bool LanguageSet::operator[](unsigned i) const { return bitvector[i]; }
 
+TypeSystem::TypeSystem() = default;
 TypeSystem::~TypeSystem() = default;
 
 static TypeSystemSP CreateInstanceHelper(lldb::LanguageType language,



___
lldb-commit

[Lldb-commits] [lldb] 4c484f1 - [llvm] Add a SFINAE template parameter to DenseMapInfo

2021-11-16 Thread River Riddle via lldb-commits

Author: River Riddle
Date: 2021-11-16T18:54:14Z
New Revision: 4c484f11d355e4293f7b245a9330f0a1e89630ac

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

LOG: [llvm] Add a SFINAE template parameter to DenseMapInfo

This allows for using SFINAE partial specialization for DenseMapInfo.
In MLIR, this is particularly useful as it will allow for defining partial
specializations that support all Attribute, Op, and Type classes without
needing to specialize DenseMapInfo for each individual class.

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

Added: 


Modified: 
clang/include/clang/AST/TypeOrdering.h
clang/include/clang/Basic/SourceLocation.h
clang/include/clang/Sema/Sema.h
lldb/include/lldb/Utility/ConstString.h
llvm/include/llvm/ADT/APInt.h
llvm/include/llvm/ADT/APSInt.h
llvm/include/llvm/ADT/ArrayRef.h
llvm/include/llvm/ADT/DenseMapInfo.h
llvm/include/llvm/ADT/Hashing.h
llvm/include/llvm/ADT/ImmutableList.h
llvm/include/llvm/ADT/PointerIntPair.h
llvm/include/llvm/ADT/StringRef.h
llvm/include/llvm/BinaryFormat/WasmTraits.h
llvm/include/llvm/CodeGen/SelectionDAGNodes.h
llvm/include/llvm/IR/Attributes.h
llvm/include/llvm/Support/TypeSize.h
llvm/lib/Support/APInt.cpp
llvm/unittests/ADT/DenseMapTest.cpp
mlir/include/mlir/Dialect/SPIRV/IR/SPIRVOps.h
mlir/include/mlir/IR/Attributes.h
mlir/include/mlir/IR/BuiltinOps.h
mlir/include/mlir/IR/OpDefinition.h
mlir/include/mlir/IR/Types.h
mlir/include/mlir/Support/LLVM.h

Removed: 




diff  --git a/clang/include/clang/AST/TypeOrdering.h 
b/clang/include/clang/AST/TypeOrdering.h
index 6630105136f5c..8037f98cc9651 100644
--- a/clang/include/clang/AST/TypeOrdering.h
+++ b/clang/include/clang/AST/TypeOrdering.h
@@ -34,7 +34,6 @@ struct QualTypeOrdering {
 }
 
 namespace llvm {
-  template struct DenseMapInfo;
 
   template<> struct DenseMapInfo {
 static inline clang::QualType getEmptyKey() { return clang::QualType(); }

diff  --git a/clang/include/clang/Basic/SourceLocation.h 
b/clang/include/clang/Basic/SourceLocation.h
index ba2e9156a2b12..543245a811db5 100644
--- a/clang/include/clang/Basic/SourceLocation.h
+++ b/clang/include/clang/Basic/SourceLocation.h
@@ -23,8 +23,6 @@
 
 namespace llvm {
 
-template  struct DenseMapInfo;
-
 class FoldingSetNodeID;
 template  struct FoldingSetTrait;
 
@@ -467,7 +465,7 @@ namespace llvm {
   /// Define DenseMapInfo so that FileID's can be used as keys in DenseMap and
   /// DenseSets.
   template <>
-  struct DenseMapInfo {
+  struct DenseMapInfo {
 static clang::FileID getEmptyKey() {
   return {};
 }
@@ -488,7 +486,7 @@ namespace llvm {
   /// Define DenseMapInfo so that SourceLocation's can be used as keys in
   /// DenseMap and DenseSet. This trait class is eqivalent to
   /// DenseMapInfo which uses SourceLocation::ID is used as a key.
-  template <> struct DenseMapInfo {
+  template <> struct DenseMapInfo {
 static clang::SourceLocation getEmptyKey() {
   constexpr clang::SourceLocation::UIntTy Zero = 0;
   return clang::SourceLocation::getFromRawEncoding(~Zero);

diff  --git a/clang/include/clang/Sema/Sema.h b/clang/include/clang/Sema/Sema.h
index 5f5755ef13435..a159be2b5fb17 100644
--- a/clang/include/clang/Sema/Sema.h
+++ b/clang/include/clang/Sema/Sema.h
@@ -74,7 +74,6 @@
 
 namespace llvm {
   class APSInt;
-  template  struct DenseMapInfo;
   template  class DenseSet;
   class SmallBitVector;
   struct InlineAsmIdentifierInfo;

diff  --git a/lldb/include/lldb/Utility/ConstString.h 
b/lldb/include/lldb/Utility/ConstString.h
index 52d3556418f6c..2756f1fd72038 100644
--- a/lldb/include/lldb/Utility/ConstString.h
+++ b/lldb/include/lldb/Utility/ConstString.h
@@ -409,7 +409,7 @@ class ConstString {
   static size_t StaticMemorySize();
 
 protected:
-  template  friend struct ::llvm::DenseMapInfo;
+  template  friend struct ::llvm::DenseMapInfo;
   /// Only used by DenseMapInfo.
   static ConstString FromStringPoolPointer(const char *ptr) {
 ConstString s;

diff  --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 71d75db91c103..595cd94b6b8f6 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -31,7 +31,7 @@ class raw_ostream;
 template  class SmallVectorImpl;
 template  class ArrayRef;
 template  class Optional;
-template  struct DenseMapInfo;
+template  struct DenseMapInfo;
 
 class APInt;
 
@@ -1817,7 +1817,7 @@ class LLVM_NODISCARD APInt {
 
   unsigned BitWidth; ///< The number of bits in this APInt.
 
-  friend struct DenseMapInfo;
+  friend struct DenseMapInfo;
   friend class APSInt;
 
   /// This constructor is used only internally for speed of construction of
@@ -2251,7 +2251,7 @@ void StoreIntToMemory(const

[Lldb-commits] [lldb] dc1a2cb - [lldb][windows] Cover more symbols in LLDB_EXPORT_ALL_SYMBOLS

2023-09-30 Thread River Riddle via lldb-commits

Author: River Riddle
Date: 2023-09-30T16:06:19-07:00
New Revision: dc1a2cb9718966e9050e32962dc86377088f2d7e

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

LOG: [lldb][windows] Cover more symbols in LLDB_EXPORT_ALL_SYMBOLS

Followup to #67628 that relaxes the symbol regex a bit to cover more
lldb_private symbols.

Added: 


Modified: 
lldb/scripts/msvc_extract_private_symbols.py

Removed: 




diff  --git a/lldb/scripts/msvc_extract_private_symbols.py 
b/lldb/scripts/msvc_extract_private_symbols.py
index 05e8b0e2095ca33..b741310d717c23c 100644
--- a/lldb/scripts/msvc_extract_private_symbols.py
+++ b/lldb/scripts/msvc_extract_private_symbols.py
@@ -18,7 +18,7 @@ def extract_symbols(nm_path: str, lib: str):
 library to extract from."""
 
 # Matches mangled symbols containing 'lldb_private'.
-lldb_sym_re = r"0* [BT] (?P[?]+[^?].*lldb_private.*)"
+lldb_sym_re = r"[0-9a-zA-Z]* [BT] (?P[?]+[^?].*lldb_private.*)"
 
 # '-g' means we only get global symbols.
 # '-p' do not waste time sorting the symbols.



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


[Lldb-commits] [lldb] [lldb][windows] Export dwarf plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits

https://github.com/River707 created 
https://github.com/llvm/llvm-project/pull/71087

These are already exported in non-windows builds, they aren't in the msvc path 
because we explicitly limit the symbols exported to prevent hitting the symbol 
export limit.

These symbols are useful for downstream projects that want to utilize code 
within the dwarf plugin. The Mojo language uses these to implement dwarf 
handling within its debugger plugin.

>From 105284ac2924a83655fafb6c8c7896bd247aee24 Mon Sep 17 00:00:00 2001
From: River Riddle 
Date: Thu, 2 Nov 2023 11:12:18 -0700
Subject: [PATCH] [lldb][windows] Export dwarf plugin symbols in
 LLDB_EXPORT_ALL_SYMBOLS

These are already exported in non-windows builds, they aren't
in the msvc path because we explicitly limit the symbols exported
to prevent hitting the symbol export limit.

These symbols are useful for downstream projects that want to
utilize code within the dwarf plugin. The Mojo language uses these
to implement dwarf handling within its debugger plugin.
---
 lldb/source/API/CMakeLists.txt | 8 +---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 895c6221a8073cf..76e6caceb392303 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -196,13 +196,15 @@ elseif (LLDB_EXPORT_ALL_SYMBOLS)
   MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and 
lldb_private namespaces")
 
   # Pull out the various lldb libraries linked into liblldb, these will be used
-  # when looking for symbols to extract. We ignore plugin libraries here,
-  # because these symbols aren't publicly exposed.
+  # when looking for symbols to extract. We ignore most plugin libraries here,
+  # because we may expose more symbols than the DLL limit and these symbols
+  # aren't useful to expose.
   get_target_property(all_liblldb_libs liblldb LINK_LIBRARIES)
   set(lldb_libs "")
   foreach(lib ${all_liblldb_libs})
 if(TARGET ${lib} AND ${lib} MATCHES "^lldb" AND
-   NOT ${lib} MATCHES "^lldbPlugin")
+   (${lib} MATCHES "^lldbPluginSymbolFileDWARF" OR
+NOT ${lib} MATCHES "^lldbPlugin"))
   get_target_property(lib_type ${lib} TYPE)
   if("${lib_type}" STREQUAL "STATIC_LIBRARY")
 list(APPEND lldb_libs ${lib})

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


[Lldb-commits] [lldb] [lldb][windows] Export dwarf plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits


@@ -196,13 +196,15 @@ elseif (LLDB_EXPORT_ALL_SYMBOLS)
   MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and 
lldb_private namespaces")
 
   # Pull out the various lldb libraries linked into liblldb, these will be used
-  # when looking for symbols to extract. We ignore plugin libraries here,
-  # because these symbols aren't publicly exposed.
+  # when looking for symbols to extract. We ignore most plugin libraries here,
+  # because we may expose more symbols than the DLL limit and these symbols
+  # aren't useful to expose.
   get_target_property(all_liblldb_libs liblldb LINK_LIBRARIES)
   set(lldb_libs "")
   foreach(lib ${all_liblldb_libs})
 if(TARGET ${lib} AND ${lib} MATCHES "^lldb" AND
-   NOT ${lib} MATCHES "^lldbPlugin")
+   (${lib} MATCHES "^lldbPluginSymbolFileDWARF" OR
+NOT ${lib} MATCHES "^lldbPlugin"))

River707 wrote:

SGTM, will update!

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


[Lldb-commits] [lldb] [lldb][windows] Export dwarf plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits

https://github.com/River707 updated 
https://github.com/llvm/llvm-project/pull/71087

>From 7201d6d99c22450681b9f788e5fe1833d50ab7c4 Mon Sep 17 00:00:00 2001
From: River Riddle 
Date: Thu, 2 Nov 2023 11:12:18 -0700
Subject: [PATCH] [lldb][windows] All exporting plugin symbols in
 LLDB_EXPORT_ALL_SYMBOLS

Plugins aren't exported by default in the msvc path because we explicitly
limit the symbols exported to prevent hitting the symbol export limit.
Some plugins, however, can still be useful for downstream projects to
build on, e.g. the Mojo language uses parts of the dwarf plugin to implement
dwarf handling within its debugger plugin.

This PR adds a cmake variable in the MSVC path,
LLDB_EXPORT_ALL_SYMBOLS_PLUGINS, that allows for providing the set
of plugins to export symbols from.
---
 lldb/cmake/modules/LLDBConfig.cmake | 5 +
 lldb/source/API/CMakeLists.txt  | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index ce5e666a6f5e1ac..7efcc87b9799dd9 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -128,6 +128,11 @@ set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 set(LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE "" CACHE PATH
   "When `LLDB_EXPORT_ALL_SYMBOLS` is enabled, this specifies the exports file 
to use when building liblldb.")
 
+if (CMAKE_SYSTEM_NAME MATCHES "Windows")
+  set(LLDB_EXPORT_ALL_SYMBOLS_PLUGINS "" CACHE STRING
+"When `LLDB_EXPORT_ALL_SYMBOLS` is enabled, this specifies the plugins 
whose symbols should be exported.")
+endif()
+
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
 endif()
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 895c6221a8073cf..582af90eda8a4e0 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -196,13 +196,15 @@ elseif (LLDB_EXPORT_ALL_SYMBOLS)
   MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and 
lldb_private namespaces")
 
   # Pull out the various lldb libraries linked into liblldb, these will be used
-  # when looking for symbols to extract. We ignore plugin libraries here,
-  # because these symbols aren't publicly exposed.
+  # when looking for symbols to extract. We ignore most plugin libraries here,
+  # because we may expose more symbols than the DLL limit and these symbols
+  # aren't useful to expose.
   get_target_property(all_liblldb_libs liblldb LINK_LIBRARIES)
   set(lldb_libs "")
   foreach(lib ${all_liblldb_libs})
 if(TARGET ${lib} AND ${lib} MATCHES "^lldb" AND
-   NOT ${lib} MATCHES "^lldbPlugin")
+   (${lib} IN_LIST LLDB_EXPORT_ALL_SYMBOLS_PLUGINS OR
+NOT ${lib} MATCHES "^lldbPlugin"))
   get_target_property(lib_type ${lib} TYPE)
   if("${lib_type}" STREQUAL "STATIC_LIBRARY")
 list(APPEND lldb_libs ${lib})

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


[Lldb-commits] [lldb] [lldb][windows] Export dwarf plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits

https://github.com/River707 updated 
https://github.com/llvm/llvm-project/pull/71087

>From f47a42ab9878dc2664f749a6524e80f8953322af Mon Sep 17 00:00:00 2001
From: River Riddle 
Date: Thu, 2 Nov 2023 11:12:18 -0700
Subject: [PATCH] [lldb][windows] Allow exporting plugin symbols in
 LLDB_EXPORT_ALL_SYMBOLS

Plugins aren't exported by default in the msvc path because we explicitly
limit the symbols exported to prevent hitting the symbol export limit.
Some plugins, however, can still be useful for downstream projects to
build on, e.g. the Mojo language uses parts of the dwarf plugin to implement
dwarf handling within its debugger plugin.

This PR adds a cmake variable in the MSVC path,
LLDB_EXPORT_ALL_SYMBOLS_PLUGINS, that allows for providing the set
of plugins to export symbols from.
---
 lldb/cmake/modules/LLDBConfig.cmake | 5 +
 lldb/source/API/CMakeLists.txt  | 8 +---
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lldb/cmake/modules/LLDBConfig.cmake 
b/lldb/cmake/modules/LLDBConfig.cmake
index ce5e666a6f5e1ac..7efcc87b9799dd9 100644
--- a/lldb/cmake/modules/LLDBConfig.cmake
+++ b/lldb/cmake/modules/LLDBConfig.cmake
@@ -128,6 +128,11 @@ set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
 set(LLDB_EXPORT_ALL_SYMBOLS_EXPORTS_FILE "" CACHE PATH
   "When `LLDB_EXPORT_ALL_SYMBOLS` is enabled, this specifies the exports file 
to use when building liblldb.")
 
+if (CMAKE_SYSTEM_NAME MATCHES "Windows")
+  set(LLDB_EXPORT_ALL_SYMBOLS_PLUGINS "" CACHE STRING
+"When `LLDB_EXPORT_ALL_SYMBOLS` is enabled, this specifies the plugins 
whose symbols should be exported.")
+endif()
+
 if ((NOT MSVC) OR MSVC12)
   add_definitions( -DHAVE_ROUND )
 endif()
diff --git a/lldb/source/API/CMakeLists.txt b/lldb/source/API/CMakeLists.txt
index 895c6221a8073cf..582af90eda8a4e0 100644
--- a/lldb/source/API/CMakeLists.txt
+++ b/lldb/source/API/CMakeLists.txt
@@ -196,13 +196,15 @@ elseif (LLDB_EXPORT_ALL_SYMBOLS)
   MESSAGE("-- Symbols (liblldb): exporting all symbols from the lldb and 
lldb_private namespaces")
 
   # Pull out the various lldb libraries linked into liblldb, these will be used
-  # when looking for symbols to extract. We ignore plugin libraries here,
-  # because these symbols aren't publicly exposed.
+  # when looking for symbols to extract. We ignore most plugin libraries here,
+  # because we may expose more symbols than the DLL limit and these symbols
+  # aren't useful to expose.
   get_target_property(all_liblldb_libs liblldb LINK_LIBRARIES)
   set(lldb_libs "")
   foreach(lib ${all_liblldb_libs})
 if(TARGET ${lib} AND ${lib} MATCHES "^lldb" AND
-   NOT ${lib} MATCHES "^lldbPlugin")
+   (${lib} IN_LIST LLDB_EXPORT_ALL_SYMBOLS_PLUGINS OR
+NOT ${lib} MATCHES "^lldbPlugin"))
   get_target_property(lib_type ${lib} TYPE)
   if("${lib_type}" STREQUAL "STATIC_LIBRARY")
 list(APPEND lldb_libs ${lib})

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


[Lldb-commits] [lldb] [lldb][windows] Allow exporting plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits

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


[Lldb-commits] [lldb] [lldb][windows] Allow exporting plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits

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


[Lldb-commits] [lldb] [lldb][windows] Allow exporting plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits

River707 wrote:

Thanks for the reviews!!

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


[Lldb-commits] [lldb] [lldb][windows] Allow exporting plugin symbols in LLDB_EXPORT_ALL_SYMBOLS (PR #71087)

2023-11-02 Thread River Riddle via lldb-commits

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