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 1orP17-0002Ep-3i for pgsql-novice@arkaria.postgresql.org; Sat, 05 Nov 2022 19:39:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1orP15-0000pW-FR for pgsql-novice@arkaria.postgresql.org; Sat, 05 Nov 2022 19:39:43 +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 1orP15-0000pN-6q for pgsql-novice@lists.postgresql.org; Sat, 05 Nov 2022 19:39:43 +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 1orP13-0002Tb-8m for pgsql-novice@lists.postgresql.org; Sat, 05 Nov 2022 19:39:42 +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 2A5Jddia2732739; Sat, 5 Nov 2022 15:39:39 -0400 From: Tom Lane To: mahendrakar s cc: pgsql-novice Subject: Re: debugging libpq backend code In-reply-to: References: Comments: In-reply-to mahendrakar s message dated "Sat, 05 Nov 2022 23:40:38 +0530" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <2732737.1667677179.1@sss.pgh.pa.us> Date: Sat, 05 Nov 2022 15:39:39 -0400 Message-ID: <2732738.1667677179@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk mahendrakar s 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