Re: [PATCH] Add Windows support for backtrace_functions (MSVC only)
Bryan Green <dbryan.green@gmail.com>
From: Bryan Green <dbryan.green@gmail.com>
To: Jakub Wartak <jakub.wartak@enterprisedb.com>
Cc: Euler Taveira <euler@eulerto.com>, Álvaro Herrera <alvherre@kurilemu.de>, Michael Paquier <michael@paquier.xyz>, pgsql-hackers <pgsql-hackers@postgresql.org>
Date: 2025-10-30T09:17:34Z
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
Attachments
- v3-0001-Add-Windows-support-for-backtrace_functions.patch (text/plain) patch v3-0001
On 10/30/2025 2:01 AM, Jakub Wartak wrote:
> On Thu, Oct 30, 2025 at 4:06 AM Bryan Green <dbryan.green@gmail.com> wrote:
>
> [..]
>
> Hi Bryan, cfbot is red. I'm was fan of having those tests for this
> (bring complexity and we didn't have tests for Linux backtrace
> anyway), but now MINGW win32 is failing on those tests where the
> feature is not present:
>
> [03:57:44.552] ------------------------------------- 8<
> -------------------------------------
> [03:57:44.552] stderr:
> [03:57:44.552] # Failed test 'backtrace has valid format'
> [03:57:44.552] # at
> C:/cirrus/src/test/modules/test_backtrace/t/t_windows_backtrace.pl
> line 106.
> [03:57:44.552] # Failed test 'Unable to determine scenario -
> PostgreSQL should always have export symbols'
> [03:57:44.552] # at
> C:/cirrus/src/test/modules/test_backtrace/t/t_windows_backtrace.pl
> line 180.
> [03:57:44.552] # Failed test 'Scenario mismatch: expected 2, got 0'
> [03:57:44.552] # at
> C:/cirrus/src/test/modules/test_backtrace/t/t_windows_backtrace.pl
> line 224.
> [03:57:44.552] # Failed test 'PL/pgSQL error has deeper stack (found
> 0 frames)'
> [03:57:44.552] # at
> C:/cirrus/src/test/modules/test_backtrace/t/t_windows_backtrace.pl
> line 318.
> [03:57:44.552] # Failed test 'multiple rapid errors produced
> backtraces (0 addresses found)'
> [03:57:44.552] # at
> C:/cirrus/src/test/modules/test_backtrace/t/t_windows_backtrace.pl
> line 366.
> [03:57:44.552] # Looks like you failed 5 tests of 19.
>
> Anyway, as expected this was thrown:
> 2025-10-30 03:57:37.973 GMT client backend[244] t_windows_backtrace.pl
> BACKTRACE: backtrace generation is not supported by this installation
>
> Please see attached files for convenience as I already had them on
> disk. They are from https://commitfest.postgresql.org/patch/6116/ ->
> https://cirrus-ci.com/task/5155398535086080 -> artifacts.
>
> Instead of
> +# Skip if not Windows
> +if ($^O ne 'MSWin32')
> +{
> + plan skip_all => 'Windows-specific backtrace tests';
> +}
>
> Maybe we could also bypass MINGW too like below ? (but I have no
> access, so i havent tried)
> use Config;
> # Skip if not Windows or MINGW/MSYS is detected
> if ($^O ne 'MSWin32' || $Config{'ccname'} =~ /gcc|mingw/i ||
> defined($ENV{'MSYSTEM'}))
> {
> plan skip_all => 'Windows-specific backtrace tests';
> }
>
> -J.
Thanks for the feedback. Apologies for forgetting about filtering mingw
out of the tests. I have made changes to the test as well as
meson.build in the test_backtrace directory to keep it from running on
mingw. My cirrus build is all green across all the platforms. Find v3
attached.
Bryan Green