Vulkan debugger: Don't wait for debugger by default.
Only wait when the `VK_WAIT_FOR_DEBUGGER` env var is set.
Long term I want to move away from relying on environment variables, but this is currently consistent with the `VK_DEBUGGER_PORT` env var which also enables the debugger.
Bug: b/148135662
Change-Id: I990d907d7570569e9d6716cf5d13e9846f4a5c02
Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40429
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Tested-by: Ben Clayton <bclayton@google.com>
Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Vulkan/Debug/Server.cpp b/src/Vulkan/Debug/Server.cpp
index d6e17b6..d283aa9 100644
--- a/src/Vulkan/Debug/Server.cpp
+++ b/src/Vulkan/Debug/Server.cpp
@@ -468,13 +468,18 @@
return dap::ConfigurationDoneResponse();
});
- printf("Waiting for debugger connection...\n");
server->start(port, [&](const std::shared_ptr<dap::ReaderWriter> &rw) {
session->bind(rw);
ctx->addListener(this);
});
- configurationDone.wait();
- printf("Debugger connection established\n");
+
+ static bool waitForDebugger = getenv("VK_WAIT_FOR_DEBUGGER") != nullptr;
+ if(waitForDebugger)
+ {
+ printf("Waiting for debugger connection...\n");
+ configurationDone.wait();
+ printf("Debugger connection established\n");
+ }
}
Server::Impl::~Impl()