pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: Wen Yi <wen-yi@qq.com>
To: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: [Beginner Question] How to print the call link graph?
Date: Sat, 1 Jul 2023 21:44:58 +0200 (CEST)
Message-ID: <1258483511.481646.1688240698486@office.mailbox.org> (raw)
In-Reply-To: <tencent_AAA2992A43F2C4A5BBE9486BB888D449AD0A@qq.com>
References: <tencent_AAA2992A43F2C4A5BBE9486BB888D449AD0A@qq.com>

> On 01/07/2023 09:10 CEST Wen Yi <wen-yi@qq.com> 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





view thread (6+ messages)  latest in thread

Message-ID: <1258483511.481646.1688240698486@office.mailbox.org>
Permalink:  ../1258483511.481646.1688240698486@office.mailbox.org/
Also on:    postgresql.org/message-id/1258483511.481646.1688240698486@office.mailbox.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: ewie@ewie.name, wen-yi@qq.com
  Subject: Re: [Beginner Question] How to print the call link graph?
  In-Reply-To: <1258483511.481646.1688240698486@office.mailbox.org>
  References: <tencent_AAA2992A43F2C4A5BBE9486BB888D449AD0A@qq.com> <1258483511.481646.1688240698486@office.mailbox.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox