Re: Question about debugger

From: Neil Conway <neilc(at)samurai(dot)com>
To: kkim3(at)ncsu(dot)edu
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Question about debugger
Date: 2003-10-17 05:03:37
Message-ID: 1066367017.582.13.camel@tokyo
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 2003-10-15 at 11:43, kkim3(at)ncsu(dot)edu wrote:
> Hello,
>
> I'm a student who use postgresql. I'd like to debug postgres source code.I
> tried to use "ddd" in linux. The thing what I want to do is debugging
> backend part.How can I do that. The commands that I used until now are
> following.
>
> 1. ddd postgres
> 2. In the ddd,I tried to attach pid. (but I can't find pid about backend)
> 3. When I tried to run program with break point,I met error like "can't
> find 2003-10-15(that is the date and time when I run)".
>
> So,I'm not sure how can I use "ddd". Could let me know how can I use this?

If you'd like info on using ddd, read the ddd docs or ask on their
mailing list -- there shouldn't be anything particularly unique about
using ddd on PostgreSQL rather than any other program that uses fork().

In any case, it's pretty straightforward to use gdb. I do the following:

1. build PostgreSQL with --enable-debug. Also, debugging is less painful
if you use CFLAGS='-O0'.

2. start up PostgreSQL and connect to it

3. find the PID of the postgres backend using ps or some equivalent

4. run 'gdb -p xxx', where xxx is the PID of the postgres backend
process -- then set breakpoints, and all that jazz.

-Neil

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-10-17 06:13:37 Re: Still a few flaws in configure's default CFLAGS selection
Previous Message Stephen 2003-10-17 04:21:20 Re: Some thoughts about i/o priorities and throttling vacuum