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 1qFgWx-0000pK-Uh for pgsql-general@arkaria.postgresql.org; Sat, 01 Jul 2023 19:45:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1qFgWu-000553-Ua for pgsql-general@arkaria.postgresql.org; Sat, 01 Jul 2023 19:45:12 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFgWu-00054t-HQ for pgsql-general@lists.postgresql.org; Sat, 01 Jul 2023 19:45:12 +0000 Received: from mout-u-204.mailbox.org ([80.241.59.204]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qFgWn-001VLv-8S for pgsql-general@lists.postgresql.org; Sat, 01 Jul 2023 19:45:11 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [IPv6:2001:67c:2050:b231:465::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-u-204.mailbox.org (Postfix) with ESMTPS id 4QtjMH3H2vz9sS7; Sat, 1 Jul 2023 21:44:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ewie.name; s=MBO0001; t=1688240699; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=a5ZbxwBLRpMHXz6+Kk65Va7fPR4NAKm3CWODeTBez2c=; b=arxt4nZnAMK3imrDJb2HRbD1+W3S1DAbExXLcbZaWNCT4o3eS2MWuPz+W7qE6C2MVecfYI LH6bndigDRCHETwCCyJcYjjnk3xTLkK1SCszU3qUR29ax2BktkFhLm+HpxeJjVTj0GB53j 6WAMTFm/52C9Bt5tMeWnxAbpGN6TU0ry07PP/vJePS9b/j8QRdwck822WB0SYJ8cfL2TJV 74i3VbB6OB9Saqk43Uqs9N9Jq8tiyPqo1JR8SGEbFOFwy5QSdZdoFza9mrm0/PIJCFc0rd hUau2oTwzCBom1OBgUlBx6kS7lA/EEqL03jGzDneV46A9JVNEwHWqK8s40tYMw== Date: Sat, 1 Jul 2023 21:44:58 +0200 (CEST) From: Erik Wienhold To: Wen Yi , pgsql-general Message-ID: <1258483511.481646.1688240698486@office.mailbox.org> In-Reply-To: References: Subject: Re: [Beginner Question] How to print the call link graph? MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Normal X-Rspamd-Queue-Id: 4QtjMH3H2vz9sS7 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 01/07/2023 09:10 CEST Wen Yi wrote: > > I use the gdb to track the postgres like this: > > ... > pq_getbyte () at pqcomm.c:980 > 980 in pqcomm.c > (gdb) next > 985 in pqcomm.c > (gdb) next > 986 in pqcomm.c > (gdb) next > SocketBackend (inBuf=0x7ffc8f7e1310) at postgres.c:372 > > 372 postgres.c: Directory not empty. > (gdb) next > 403 in postgres.c > (gdb) next > 406 in postgres.c > (gdb) next > 407 in postgres.c > (gdb) next > ... > > But the question is: > It's too slow to input 'next' to run the postgres, I used to try to use the > 'continut', but the gdb will run the postgres directly and not print the > function name and code line > > I want to it print like this: > > ... -> pq_getbyte () at pqcomm.c:980 -> SocketBackend (inBuf=0x7ffc8f7e1310) at postgres.c:372 -> ... > > Can someone provide me some advice? > Thanks in advance! The Postgres wiki has a page on this topic: https://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Linux/BSD Look for "backtrace" and gdb's bt command. -- Erik