Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEBMn-0000OZ-6W for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2022 15:12:01 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oEBMl-0007X3-UR for pgsql-hackers@arkaria.postgresql.org; Wed, 20 Jul 2022 15:11:59 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEBMl-0007UE-Ks for pgsql-hackers@lists.postgresql.org; Wed, 20 Jul 2022 15:11:59 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oEBMi-0006Ov-5L; Wed, 20 Jul 2022 15:11:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 26KFBp8s1723773; Wed, 20 Jul 2022 11:11:51 -0400 From: Tom Lane To: Alvaro Herrera cc: Dave Page , Andres Freund , Pavel Stehule , pgsql-hackers@lists.postgresql.org Subject: Re: pgsql: Default to hidden visibility for extension libraries where possi In-reply-to: <20220720140430.2s6nyy5s6b4rpu23@alvherre.pgsql> References: <20220720140430.2s6nyy5s6b4rpu23@alvherre.pgsql> Comments: In-reply-to Alvaro Herrera message dated "Wed, 20 Jul 2022 16:04:30 +0200" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1723702.1658329875.0@sss.pgh.pa.us> Date: Wed, 20 Jul 2022 11:11:51 -0400 Message-ID: <1723772.1658329911@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1723702.1658329875.1@sss.pgh.pa.us> Alvaro Herrera writes: > On 2022-Jul-20, Tom Lane wrote: >> I'll try to do some research later today to identify anything else >> we need to mark in plpgsql. I recall doing some work specifically >> creating functions for pldebugger's use, but I'll need to dig. > I suppose you're probably thinking of commit 53ef6c40f1e7; that didn't > expose functions directly, but through plpgsql_plugin_ptr. Maybe that > one does need to be made PGDLLEXPORT, since currently it isn't. After some experimentation, it does not need to be marked: pldebugger gets at that via find_rendezvous_variable(), so there is no need for any explicit linkage at all between plpgsql.so and plugin_debugger.so. Along the way, I made a quick hack to get pldebugger to load into v15/HEAD. It lacks #ifdef's which'd be needed so that it'd still compile against older branches, but perhaps this'll save someone some time. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="pldebugger-shmem.patch"; charset="us-ascii" Content-ID: <1723702.1658329875.2@sss.pgh.pa.us> Content-Description: pldebugger-shmem.patch Content-Transfer-Encoding: quoted-printable diff --git a/plugin_debugger.c b/plugin_debugger.c index 6620021..1bd2057 100644 --- a/plugin_debugger.c +++ b/plugin_debugger.c @@ -114,6 +114,8 @@ static debugger_language_t *debugger_languages[] =3D { NULL }; = +static shmem_request_hook_type prev_shmem_request_hook =3D NULL; + /********************************************************************** * Function declarations **********************************************************************/ @@ -124,6 +126,7 @@ void _PG_init( void ); /* initialize this module wh= en we are dynamically load * Local (hidden) function prototypes **********************************************************************/ = +static void pldebugger_shmem_request( void ); //static char ** fetchArgNames( PLpgSQL_function * func, int * name= Count ); static void * writen( int peer, void * src, size_t len ); static bool connectAsServer( void ); @@ -154,6 +157,15 @@ void _PG_init( void ) for (i =3D 0; debugger_languages[i] !=3D NULL; i++) debugger_languages[i]->initialize(); = + prev_shmem_request_hook =3D shmem_request_hook; + shmem_request_hook =3D pldebugger_shmem_request; +} + +static void pldebugger_shmem_request( void ) +{ + if (prev_shmem_request_hook) + prev_shmem_request_hook(); + reserveBreakpoints(); dbgcomm_reserve(); } ------- =_aaaaaaaaaa0--