Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
Euler Taveira <euler@eulerto.com>
From: "Euler Taveira" <euler@eulerto.com>
To: "Bryan Green" <dbryan.green@gmail.com>,
"Michael Paquier" <michael@paquier.xyz>,
"Jakub Wartak" <jakub.wartak@enterprisedb.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-27T20:13:39Z
Lists: pgsql-hackers
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add backtrace support for Windows using DbgHelp API
- 65707ed9afc9 19 (unreleased) landed
On Mon, Oct 27, 2025, at 2:58 PM, Bryan Green wrote: > Thanks for even glancing at this. I did not add any regression > tests because the output goes to the server log and not the client. > Since Michael said WIN32-specific tests and mentioned log pattern, he is referring to TAP tests. You can add src/test/modules/test_backtrace that exercises this code path. I didn't test your patch but I'm wondering if we could add an abstraction here. I mean invent pg_backtrace() and pg_backtrace_symbols() that maps to the current functions (Unix-like). On Windows these functions are mapped to win32_backtrace() (that encapsulates CaptureStackBackTrace()) and a new win32_backtrace_symbols() (that encapsulates the rest of the code). There Windows-specific functions should be added to src/port -- my suggestion is win32backtrace.c. Besides that you have to adjust backtrace_symbols in both configure.ac and meson.build so it runs the code path inside HAVE_BACKTRACE_SYMBOLS. -- Euler Taveira EDB https://www.enterprisedb.com/