Commit 488d35ac by Ben Clayton

Vulkan/Debug: Fix `DAP_LOG` macro

Variadic arguments weren't using the ## prefix, and causing build failures on certain compilers. Also always `printf()` the "Waiting for debugger connection..." message. If we're debugging, then writing to `stdout` isn't an offence. Bug: b/145351270 Change-Id: I2f86b118043ef2b2b6d291834c9f134a4db5c18d Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/40091Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarBen Clayton <bclayton@google.com>
parent 815b4d88
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#define ENABLE_DAP_LOGGING 0 #define ENABLE_DAP_LOGGING 0
#if ENABLE_DAP_LOGGING #if ENABLE_DAP_LOGGING
# define DAP_LOG(msg, ...) printf(msg "\n", __VA_ARGS__) # define DAP_LOG(msg, ...) printf(msg "\n", ##__VA_ARGS__)
#else #else
# define DAP_LOG(...) \ # define DAP_LOG(...) \
do \ do \
...@@ -104,6 +104,7 @@ Server::Impl::Impl(const std::shared_ptr<Context> &context, int port) ...@@ -104,6 +104,7 @@ Server::Impl::Impl(const std::shared_ptr<Context> &context, int port)
dap::SetFunctionBreakpointsResponse response; dap::SetFunctionBreakpointsResponse response;
for(auto const &bp : req.breakpoints) for(auto const &bp : req.breakpoints)
{ {
DAP_LOG("Setting breakpoint for function '%s'", bp.name.c_str());
lock.addFunctionBreakpoint(bp.name.c_str()); lock.addFunctionBreakpoint(bp.name.c_str());
response.breakpoints.push_back({}); response.breakpoints.push_back({});
} }
...@@ -467,12 +468,13 @@ Server::Impl::Impl(const std::shared_ptr<Context> &context, int port) ...@@ -467,12 +468,13 @@ Server::Impl::Impl(const std::shared_ptr<Context> &context, int port)
return dap::ConfigurationDoneResponse(); return dap::ConfigurationDoneResponse();
}); });
DAP_LOG("Waiting for debugger connection..."); printf("Waiting for debugger connection...\n");
server->start(port, [&](const std::shared_ptr<dap::ReaderWriter> &rw) { server->start(port, [&](const std::shared_ptr<dap::ReaderWriter> &rw) {
session->bind(rw); session->bind(rw);
ctx->addListener(this); ctx->addListener(this);
}); });
configurationDone.wait(); configurationDone.wait();
printf("Debugger connection established\n");
} }
Server::Impl::~Impl() Server::Impl::~Impl()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment