Mesa (main): dzn: add a debug-flag to wait for the debugger
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Jun 1 09:07:09 UTC 2022
Module: Mesa
Branch: main
Commit: 9f3a5b43134976adcf4ddcac75c0a31c295921de
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=9f3a5b43134976adcf4ddcac75c0a31c295921de
Author: Erik Faye-Lund <erik.faye-lund at collabora.com>
Date: Thu May 19 14:06:42 2022 +0200
dzn: add a debug-flag to wait for the debugger
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 at collabora.com>
Acked-by: Jesse Natalie <jenatali at microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16640>
---
src/microsoft/vulkan/dzn_device.c | 8 ++++++++
src/microsoft/vulkan/dzn_private.h | 1 +
2 files changed, 9 insertions(+)
diff --git a/src/microsoft/vulkan/dzn_device.c b/src/microsoft/vulkan/dzn_device.c
index 2c34f35fd78..941d0ddb77c 100644
--- a/src/microsoft/vulkan/dzn_device.c
+++ b/src/microsoft/vulkan/dzn_device.c
@@ -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();
diff --git a/src/microsoft/vulkan/dzn_private.h b/src/microsoft/vulkan/dzn_private.h
index 48bae7a38af..f9142fe389f 100644
--- a/src/microsoft/vulkan/dzn_private.h
+++ b/src/microsoft/vulkan/dzn_private.h
@@ -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 {
More information about the mesa-commit
mailing list