Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)

From: "Euler Taveira" <euler(at)eulerto(dot)com>
To: "Bryan Green" <dbryan(dot)green(at)gmail(dot)com>, "Michael Paquier" <michael(at)paquier(dot)xyz>, "Jakub Wartak" <jakub(dot)wartak(at)enterprisedb(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
Date: 2025-10-27 20:13:39
Message-ID: 7379da2a-10e1-4fb2-bd77-212daf4b00b8@app.fastmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2025-10-27 20:17:03 Re: display hot standby state in psql prompt
Previous Message Masahiko Sawada 2025-10-27 20:09:43 Re: Add uuid_to_base32hex() and base32hex_to_uuid() built-in functions