public inbox for [email protected]
help / color / mirror / Atom feeddebugging libpq backend code
2+ messages / 2 participants
[nested] [flat]
* debugging libpq backend code
@ 2022-11-05 18:10 mahendrakar s <[email protected]>
2022-11-05 19:39 ` Re: debugging libpq backend code Tom Lane <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: mahendrakar s @ 2022-11-05 18:10 UTC (permalink / raw)
To: pgsql-novice <[email protected]>
Hello All,
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? how do I get the backend process id? Please note that
ps -ef does not show backend process and also I can't run `select
pg_backend_pid()` as connection is not authorized yet.
Can you suggest how to debug this backend code? especially files:
auth.c, auth-sasl.c in directory src/backend/libpq).
Appreciate your help.
Thanks,
Mahendrakar.
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: debugging libpq backend code
2022-11-05 18:10 debugging libpq backend code mahendrakar s <[email protected]>
@ 2022-11-05 19:39 ` Tom Lane <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Tom Lane @ 2022-11-05 19:39 UTC (permalink / raw)
To: mahendrakar s <[email protected]>; +Cc: pgsql-novice <[email protected]>
mahendrakar s <[email protected]> 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
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2022-11-05 19:39 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2022-11-05 18:10 debugging libpq backend code mahendrakar s <[email protected]>
2022-11-05 19:39 ` Tom Lane <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox