From: Bryan Green <dbryan.green@gmail.com>
To: Álvaro Herrera <alvherre@kurilemu.de>
Cc: Euler Taveira <euler@eulerto.com>
Cc: Jakub Wartak <jakub.wartak@enterprisedb.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
Date: Mon, 23 Feb 2026 14:31:34 -0600
Message-ID: <00e2f579-99d8-4b80-94c0-745612ac2ff5@gmail.com> (raw)
In-Reply-To: <202602232005.2cmbj5ougsfv@alvherre.pgsql>
References: <202602232005.2cmbj5ougsfv@alvherre.pgsql>
On 2/23/2026 2:16 PM, Álvaro Herrera wrote:
> Hello, thanks for following up.
>
> However, I was going over the commit message one final time after your
> reply, and I noticed that SymInitialize()'s documentation says quite
> explicitly:
>
> "Do not use the handle returned by GetCurrentProcess"
> https://learn.microsoft.com/en-us/windows/win32/api/dbghelp/nf-dbghelp-syminitialize
>
> which is exactly what we do with this patch.
>
> I think we should DuplicateHandle() on the GetCurrentProcess() handle
> (which then obviously needs CloseHandle afterwards). Would you agree?
>
> Here's the whole thing again with edited commit message and some trivial
> stylistic changes.
>
>
> I was amused to discover that Solaris, macOS and FreeBSD all copied the
> backtrace() interface from glibc, and the only platform in the buildfarm
> other than Windows that seems to lack support for backtraces is Alpine
> Linux.
>
> Regards
>
Ouch. Can't believe I missed that. Yeah, that is a no go. We could
use openprocess with the getcurrentprocessid. Let me look this over.
And yes, regardless of which way we do it we will need a CloseHandle.
--
Bryan Green
EDB: https://www.enterprisedb.com
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: dbryan.green@gmail.com, alvherre@kurilemu.de, euler@eulerto.com, jakub.wartak@enterprisedb.com, michael@paquier.xyz
Subject: Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
In-Reply-To: <00e2f579-99d8-4b80-94c0-745612ac2ff5@gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox