Re: gdb with postgres - Mailing list pgsql-hackers

From Robert Haas
Subject Re: gdb with postgres
Date
Msg-id BANLkTin0cGarhdsTpnrdms7R4CYCk_RcOw@mail.gmail.com
Whole thread Raw
In response to gdb with postgres  (HuangQi <huangqiyx@gmail.com>)
Responses Re: gdb with postgres
List pgsql-hackers
On Mon, Jun 6, 2011 at 3:43 AM, HuangQi <huangqiyx@gmail.com> wrote:
> Hi,
>    I was using gdb to debug postgres. In order to debug the backend of
> running query, I start postgres first and use "select * from
> pg_backend_pid()" to ask for backend pid. Then I start gdb in another bash
> window with "gdb postgres" and attach the pid obtained above and set the
> breakpoint. Then I run the query from the first window. However, the
> debugging precess which is shown below is not going to the breakpoint. I
> tried many different breakpoints, but it always start from the 305
> client_read_ended().
>
> GNU gdb 6.6
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you are
> welcome to change it and/or distribute copies of it under certain
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for details.
> This GDB was configured as "sparc-sun-solaris2.10"...
> (gdb) b qp_add_paths_to_joinrel
> Breakpoint 1 at 0x1a6744: file joinpath.c, line 67.
> (gdb) attach 23903
> Attaching to program `/usrlocal/pgsql/bin/postgres', process 23903
> Retry #1:
> Retry #2:
> Retry #3:
> Retry #4:
> [New LWP 1]
> 0xff0cbaa4 in _rt_boot () from /usr/lib/ld.so.1
> (gdb) n
> Single stepping until exit from function _rt_boot,
> which has no line number information.
> secure_read (port=0x4a7760, ptr=0x455948, len=8192) at be-secure.c:305
> 305                     client_read_ended();
> (gdb) n
> pq_recvbuf () at pqcomm.c:767
> 767                     if (r < 0)
> (gdb) n
> 769                             if (errno == EINTR)
> (gdb) n
> 782                     if (r == 0)
> (gdb) n
> 788                             return EOF;
> (gdb) n
> 791                     PqRecvLength += r;
> (gdb)
> Any one know what is going wrong? BTW, as you can see, the system is
> solaris.

Perhaps you want "c" for "continue" rather than "n" for "next".

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


pgsql-hackers by date:

Previous
From: Kohei Kaigai
Date:
Subject: [v9.2] Fix leaky-view problem, part 1
Next
From: HuangQi
Date:
Subject: Re: gdb with postgres