[Lldb-commits] [lldb] [lldb-mcp] Launch lldb on demand, if needed. (PR #158701)
John Harrison via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 16 09:33:50 PDT 2025
================
@@ -35,24 +41,88 @@ using namespace llvm;
using namespace lldb;
using namespace lldb_protocol::mcp;
+using lldb_private::Environment;
using lldb_private::File;
+using lldb_private::FileSpec;
+using lldb_private::FileSystem;
+using lldb_private::Host;
using lldb_private::MainLoop;
using lldb_private::MainLoopBase;
using lldb_private::NativeFile;
namespace {
+constexpr size_t kForwardIOBufferSize = 1024;
+
inline void exitWithError(llvm::Error Err, StringRef Prefix = "") {
handleAllErrors(std::move(Err), [&](ErrorInfoBase &Info) {
WithColor::error(errs(), Prefix) << Info.message() << '\n';
});
std::exit(EXIT_FAILURE);
}
-constexpr size_t kForwardIOBufferSize = 1024;
+FileSpec driverPath() {
+ Environment host_env = Host::GetEnvironment();
+
+ // Check if an override for which lldb we're using exists, otherwise look next
+ // to the current binary.
+ std::string lldb_exe_path = host_env.lookup("LLDB_EXE_PATH");
+ auto &fs = FileSystem::Instance();
+ if (fs.Exists(lldb_exe_path)) {
+ return FileSpec(lldb_exe_path);
+ }
+
+ FileSpec lldb_exec_spec = lldb_private::HostInfo::GetProgramFileSpec();
+ lldb_exec_spec.SetFilename("lldb");
----------------
ashgti wrote:
Added a specific name for Windows.
https://github.com/llvm/llvm-project/pull/158701
More information about the lldb-commits
mailing list