Skip to content

Commit

Permalink
Fix PG15 support.
Browse files Browse the repository at this point in the history
  • Loading branch information
dpage committed Jul 20, 2022
1 parent 5ec5d5c commit 87a3487
Showing 1 changed file with 24 additions and 1 deletion.
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 87a3487

Please sign in to comment.