From 3fc31de1c3202ea6f016dcce424ed3d437a0c052 Mon Sep 17 00:00:00 2001 From: Rushabh Lathia Date: Mon, 21 Mar 2022 15:42:47 +0530 Subject: [PATCH 1/3] Fix code compilation against v15. Upstream commit 98e93a1fc93e9b54eb477d870ec744e9e1669f34 clean up messy API for src/port/thread.c. In this process, it also cleanup additional header file include which was basically needed for pldebugger. This commit adjust pldebugger to include needed one. DB-1719. --- dbgcomm.c | 1 + 1 file changed, 1 insertion(+) diff --git a/dbgcomm.c b/dbgcomm.c index 074a69d..ed20123 100644 --- a/dbgcomm.c +++ b/dbgcomm.c @@ -14,6 +14,7 @@ #include "postgres.h" #include +#include #ifdef HAVE_SYS_SELECT_H #include #endif From 5ec5d5cbd199e5e65257d5b3d60c251a9eaa8e64 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 20 Jul 2022 16:38:12 +0100 Subject: [PATCH 2/3] Fix copyright year. --- README.pldebugger | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.pldebugger b/README.pldebugger index 8125f26..77ed287 100644 --- a/README.pldebugger +++ b/README.pldebugger @@ -100,7 +100,7 @@ The pl/pgsql debugger API is released under the Artistic Licence v2.0. https://opensource.org/licenses/artistic-license-2.0 -Copyright (c) 2004-2020 EnterpriseDB Corporation. All Rights Reserved. +Copyright (c) 2004-2022 EnterpriseDB Corporation. All Rights Reserved. Contact From 87a34870c8242541ac7b2930a92d59b5e8cd6dd6 Mon Sep 17 00:00:00 2001 From: Dave Page Date: Wed, 20 Jul 2022 16:43:55 +0100 Subject: [PATCH 3/3] Fix PG15 support. Original patch by Tom Lane: https://www.postgresql.org/message-id/1723772.1658329911%40sss.pgh.pa.us --- plugin_debugger.c | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/plugin_debugger.c b/plugin_debugger.c index 6620021..ee7a45e 100644 --- a/plugin_debugger.c +++ b/plugin_debugger.c @@ -114,6 +114,10 @@ static debugger_language_t *debugger_languages[] = { NULL }; +#if (PG_VERSION_NUM >= 150000) +static shmem_request_hook_type prev_shmem_request_hook = NULL; +#endif + /********************************************************************** * Function declarations **********************************************************************/ @@ -124,7 +128,10 @@ void _PG_init( void ); /* initialize this module when we are dynamically load * Local (hidden) function prototypes **********************************************************************/ -//static char ** fetchArgNames( PLpgSQL_function * func, int * nameCount ); +#if (PG_VERSION_NUM >= 150000) +static void pldebugger_shmem_request( void ); +#endif + static void * writen( int peer, void * src, size_t len ); static bool connectAsServer( void ); static bool connectAsClient( Breakpoint * breakpoint ); @@ -154,9 +161,25 @@ void _PG_init( void ) for (i = 0; debugger_languages[i] != NULL; i++) debugger_languages[i]->initialize(); +#if (PG_VERSION_NUM >= 150000) + prev_shmem_request_hook = shmem_request_hook; + shmem_request_hook = pldebugger_shmem_request; +#else + reserveBreakpoints(); + dbgcomm_reserve(); +#endif +} + +#if (PG_VERSION_NUM >= 150000) +static void pldebugger_shmem_request( void ) +{ + if (prev_shmem_request_hook) + prev_shmem_request_hook(); + reserveBreakpoints(); dbgcomm_reserve(); } +#endif /* * CREATE OR REPLACE FUNCTION pldbg_oid_debug( functionOID OID ) RETURNS INTEGER AS 'pldbg_oid_debug' LANGUAGE C;