Re: [HACKERS] How do I get the backend server into gdb?

From: Massimo Dal Zotto <dz(at)cs(dot)unitn(dot)it>
To: hackers(at)postgreSQL(dot)org (PostgreSQL Hackers)
Cc: michael(dot)j(dot)davis(at)tvguide(dot)com (Michael J Davis)
Subject: Re: [HACKERS] How do I get the backend server into gdb?
Date: 1999-04-29 09:28:22
Message-ID: 199904290928.LAA01786@nikita.wizard.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>
> I need to debug this connection problem I am having with Access97. My
> question is how can I get the new Postgres backend that starts up for Access
> into debug (gdb)? I can get the PostMaster open in gdb.
>
> Thanks, Michael
>

$ postgres -h
postgres: illegal option -- h
Usage: postgres [options] [dbname]
...
-W wait N seconds to allow attach from a debugger

I added the -W option for this purpose. You should start the postmaster
with the following option:

postmaster -o '-W 15' ...

The -W option is passed to the backend which sleeps 15 seconds before doing
any work. In the meantime you have the time to do a ps, find the backend pid
and attach gdb to the process.

Obviously you can't do that in a production environment because it adda a
fixed delay for each connection which will make your users very angry.

--
Massimo Dal Zotto

+----------------------------------------------------------------------+
| Massimo Dal Zotto email: dz(at)cs(dot)unitn(dot)it |
| Via Marconi, 141 phone: ++39-0461534251 |
| 38057 Pergine Valsugana (TN) www: http://www.cs.unitn.it/~dz/ |
| Italy pgp: finger dz(at)tango(dot)cs(dot)unitn(dot)it |
+----------------------------------------------------------------------+

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Vadim Mikheev 1999-04-29 11:22:25 Re: [HACKERS] Lock freeze ? in MVCC
Previous Message Mark Jewiss 1999-04-29 09:24:46 Re: [SQL] LIMIT