Re: To connect a debbuger...

From: Gregory Stark <stark(at)enterprisedb(dot)com>
To: "Jonathan Scher" <js(at)oxado(dot)com>
Cc: <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: To connect a debbuger...
Date: 2007-03-12 18:09:20
Message-ID: 87slcaxrjj.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Jonathan Scher" <js(at)oxado(dot)com> writes:

> I attach gdb to /usr/.../bin/postgres, then I put a breakpoint. Whenever
> postgres stop on that breakpoint, it just kills/restarts the server instead of
> asking me what to do.

Not sure why it's crashing but you don't want to run postgres itself under the
debugger, at least not usually. What you have to do is start postgres up
normally, connect to it with psql or whatever client you want, then in a
separate shell run something like:

(gdb) shell ps auxww | grep [i]dle
stark 3724 0.0 0.1 36180 2044 ? Ts 18:07 0:00 postgres: stark postgres [local] idle
(gdb) attach 3724
Attaching to process 3724
Reading symbols from /usr/local/pgsql/bin/postgres...done.
...

> Reading symbols from /usr/local/pgsql/bin/postgres...(no debugging symbols
> found)...done.

Also, you'll want to configure with --enable-debug or else your gdb session
isn't going to be very enlightening.

Personally I suggest:

CFLAGS='-O0 -g' ./configure --enable-debug --enable-depend --enable-cassert

--
Gregory Stark
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jonathan Scher 2007-03-12 18:33:00 To connect a debbuger...
Previous Message Tom Lane 2007-03-12 17:56:50 Re: Bitmapscan changes