Re: debugging libpq backend code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: mahendrakar s <mahendrakarforpg(at)gmail(dot)com>
Cc: pgsql-novice <pgsql-novice(at)lists(dot)postgresql(dot)org>
Subject: Re: debugging libpq backend code
Date: 2022-11-05 19:39:39
Message-ID: 2732738.1667677179@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

mahendrakar s <mahendrakarforpg(at)gmail(dot)com> writes:
> I'm trying to debug libpq backend code (files: auth.c, auth-sasl.c in
> directory src/backend/libpq).
> I followed: Developer FAQ - PostgreSQL wiki and attached postgres
> process ( because connection is still in progress and I don't see
> backend process yet when I try to connect through psql). I could set
> the break-points but these are not hit while it must. I think I should
> not be attaching postmaster parent process instead attach the backend
> process but how?

The traditional answer is to set pre_auth_delay high enough to give
yourself time to identify the new backend process (via "ps") and
attach to it in gdb.

You might also be able to attach to the postmaster in gdb and
persuade it to follow the fork(), but I'm not very sure about
the details of making that work while not complicating your
life with a bunch of other postmaster children.

regards, tom lane

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Ankit Kumar Pandey 2022-11-06 13:09:02 Todo item: distinct clause - guidance
Previous Message mahendrakar s 2022-11-05 18:10:38 debugging libpq backend code