@@ -477,21 +477,33 @@ bool AddPythonDLLToSearchPath() {
477477}
478478#endif
479479
480- #ifdef LLDB_PYTHON_SHARED_LIBRARY_FILENAME
480+ #ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
481481// / Returns whether `python3x.dll` is in the DLL search path.
482482bool IsPythonDLLInPath () {
483483#define WIDEN2 (x ) L##x
484484#define WIDEN (x ) WIDEN2(x)
485485 WCHAR foundPath[MAX_PATH];
486486 DWORD result =
487- SearchPathW (nullptr , WIDEN (LLDB_PYTHON_SHARED_LIBRARY_FILENAME ), nullptr ,
487+ SearchPathW (nullptr , WIDEN (LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME ), nullptr ,
488488 MAX_PATH, foundPath, nullptr );
489489#undef WIDEN2
490490#undef WIDEN
491491
492492 return result > 0 ;
493493}
494494#endif
495+
496+ void SetupPythonRuntimeLibrary () {
497+ #ifdef LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME
498+ if (!IsPythonDLLInPath ())
499+ #ifdef LLDB_PYTHON_DLL_RELATIVE_PATH
500+ if (AddPythonDLLToSearchPath ())
501+ return
502+ #endif
503+ llvm::errs () << " error: unable to find "
504+ << LLDB_PYTHON_RUNTIME_LIBRARY_FILENAME << " .\n " ;
505+ #endif
506+ }
495507#endif
496508
497509std::string EscapeString (std::string arg) {
@@ -796,13 +808,8 @@ int main(int argc, char const *argv[]) {
796808 " ~/Library/Logs/DiagnosticReports/.\n " );
797809#endif
798810
799- #if defined(_WIN32) && defined(LLDB_PYTHON_SHARED_LIBRARY_FILENAME)
800- if (!IsPythonDLLInPath ())
801- #ifdef LLDB_PYTHON_DLL_RELATIVE_PATH
802- if (!AddPythonDLLToSearchPath ())
803- #endif
804- llvm::errs () << " error: unable to find "
805- << LLDB_PYTHON_SHARED_LIBRARY_FILENAME << " .\n " ;
811+ #ifdef _WIN32
812+ SetupPythonRuntimeLibrary ();
806813#endif
807814
808815 // Parse arguments.
0 commit comments