dzn: add a debug-flag to wait for the debugger
authorErik Faye-Lund <erik.faye-lund@collabora.com>
Thu, 19 May 2022 12:06:42 +0000 (14:06 +0200)
committerMarge Bot <emma+marge@anholt.net>
Wed, 1 Jun 2022 08:54:21 +0000 (08:54 +0000)
It's geneunely useful to wait for the debugger to attach in some cases.
So let's add a debug-flag and staill untik the debugger has attached.

Acked-by: Boris Brezillon <boris.brezillon@collabora.com>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16640>

src/microsoft/vulkan/dzn_device.c
src/microsoft/vulkan/dzn_private.h

index 2c34f35..941d0dd 100644 (file)
@@ -110,6 +110,7 @@ static const struct debug_control dzn_debug_options[] = {
    { "signature", DZN_DEBUG_SIG },
    { "gbv", DZN_DEBUG_GBV },
    { "d3d12", DZN_DEBUG_D3D12 },
+   { "debugger", DZN_DEBUG_DEBUGGER },
    { NULL, 0 }
 };
 
@@ -179,6 +180,13 @@ dzn_instance_create(const VkInstanceCreateInfo *pCreateInfo,
    instance->debug_flags =
       parse_debug_string(getenv("DZN_DEBUG"), dzn_debug_options);
 
+   if (instance->debug_flags & DZN_DEBUG_DEBUGGER) {
+      /* wait for debugger to attach... */
+      while (!IsDebuggerPresent()) {
+         Sleep(100);
+      }
+   }
+
    instance->dxil_validator = dxil_create_validator(NULL);
    instance->d3d12.serialize_root_sig = d3d12_get_serialize_root_sig();
 
index 48bae7a..f9142fe 100644 (file)
@@ -920,6 +920,7 @@ enum dzn_debug_flags {
    DZN_DEBUG_SIG = 1 << 5,
    DZN_DEBUG_GBV = 1 << 6,
    DZN_DEBUG_D3D12 = 1 << 7,
+   DZN_DEBUG_DEBUGGER = 1 << 8,
 };
 
 struct dzn_instance {