================
@@ -426,6 +433,47 @@ SBError Driver::ProcessArgs(const opt::InputArgList &args, 
bool &exiting) {
   return error;
 }
 
+#ifdef _WIN32
+// Returns the full path to the lldb.exe executable
+inline std::wstring GetPathToExecutableW() {
+  // Iterate until we reach the Windows max path length (32,767).
+  std::vector<WCHAR> buffer;
+  buffer.resize(MAX_PATH);
+  while (buffer.size() < 32767) {
+    if (GetModuleFileNameW(NULL, buffer.data(), buffer.size()) < buffer.size())
+      return std::wstring(buffer.begin(), buffer.end());
+    buffer.resize(buffer.size() * 2);
+  }
+  return L"";
+}
+
+// Resolve the full path of the directory defined by
+// LLDB_PYTHON_DLL_RELATIVE_PATH. If it exists, add it to the list of DLL 
search
+// directories.
+void AddPythonDLLToSearchPath() {
+  std::wstring modulePath = GetPathToExecutableW();
+  if (modulePath.empty()) {
+    WithColor::error() << "Unable to find python: " << GetLastError() << '\n';
----------------
adrian-prantl wrote:

We typically with the word "error:" in the error color, and not the entire 
message.

https://github.com/llvm/llvm-project/pull/162509
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to