Skip to content

Commit

Permalink
Merge branch 'EnterpriseDB:master' into print-vars-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ng-galien authored Sep 29, 2022
2 parents 631d30f + 87a3487 commit f49f85f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.pldebugger
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions dbgcomm.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "postgres.h"

#include <unistd.h>
#include <netdb.h>
#ifdef HAVE_SYS_SELECT_H
#include <sys/select.h>
#endif
Expand Down
25 changes: 24 additions & 1 deletion plugin_debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
**********************************************************************/
Expand All @@ -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 );
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit f49f85f

Please sign in to comment.