Index: cmake/LLDBDependencies.cmake =================================================================== --- cmake/LLDBDependencies.cmake +++ cmake/LLDBDependencies.cmake @@ -69,6 +69,7 @@ lldbPluginProcessElfCore lldbPluginJITLoaderGDB Ws2_32 + Rpcrt4 ) endif () Index: source/Host/windows/PipeWindows.cpp =================================================================== --- source/Host/windows/PipeWindows.cpp +++ source/Host/windows/PipeWindows.cpp @@ -15,6 +15,7 @@ #include #include +#include #include #include @@ -96,14 +97,23 @@ { llvm::SmallString<128> pipe_name; Error error; - do { + ::UUID unique_id; + ::RPC_CSTR unique_string; + if (SUCCEEDED(::UuidCreate(&unique_id)) && + SUCCEEDED(::UuidToStringA(&unique_id, &unique_string))) + { pipe_name = prefix; pipe_name += "-"; - for (unsigned i = 0; i < 6; i++) { - pipe_name += "0123456789abcdef"[llvm::sys::Process::GetRandomNumber() & 15]; - } - Error error = CreateNew(pipe_name, child_process_inherit); - } while (error.GetError() == ERROR_ALREADY_EXISTS); + pipe_name += *unique_string; + ::RpcStringFreeA(&unique_string); + error = CreateNew(pipe_name, child_process_inherit); + } + else + { + // Running out of memory is about the only reason the UUID or string + // creation could have failed. + error.SetError(ERROR_NOT_ENOUGH_MEMORY, eErrorTypeWin32); + } if (error.Success()) name = pipe_name; return error;