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

Wed, 28 Apr 1999 11:04:32 -0500
Michael J Davis <michael.j.davis@tvguide.com>
RE: [HACKERS]  How do I get the backend server into gdb?

You can attach to a running process using gdb... 'gdb -t <pid>' or
something like that...its been awhile since I've used it, sorry...

On Wed, 28 Apr 1999, Michael J Davis wrote:

> 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
> 

Marc G. Fournier                   ICQ#7615664               IRC Nick: Scrappy
Systems Administrator @ hub.org 
primary: scrappy@hub.org           secondary: scrappy@{freebsd|postgresql}.org 


Wed, 28 Apr 1999 13:18:51 -0300 (ADT)
The Hermit Hacker <scrappy@hub.org>
RE: [HACKERS]  How do I get the backend server into gdb?
> 
> 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@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: finger dz@tango.cs.unitn.it  |
+----------------------------------------------------------------------+

Thu, 29 Apr 1999 11:28:22 +0200 (MET DST)
Massimo Dal Zotto <dz@cs.unitn.it>
Re: [HACKERS]  How do I get the backend server into gdb?
Massimo Dal Zotto <dz@cs.unitn.it> writes:
> 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.

Since it's a -o option, I see no need to force it to be used on every
connection.  Instead start psql with environment variable
	PGOPTIONS="-W 15"
or whatever you need for the particular session.  The PGOPTIONS are sent
in the connection request and then catenated to whatever the postmaster
might have in its -o switch.

(BTW, it might be a good idea to go through the backend command-line
switches carefully and see if any of them could be security holes.
I'm feeling paranoid because of Matthias Schmitt's unresolved report...)

			regards, tom lane

Thu, 29 Apr 1999 18:33:46 -0400
Tom Lane <tgl@sss.pgh.pa.us>
Re: [HACKERS] How do I get the backend server into gdb? 
> Since it's a -o option, I see no need to force it to be used on every
> connection.  Instead start psql with environment variable
> 	PGOPTIONS="-W 15"
> or whatever you need for the particular session.  The PGOPTIONS are sent
> in the connection request and then catenated to whatever the postmaster
> might have in its -o switch.
> 
> (BTW, it might be a good idea to go through the backend command-line
> switches carefully and see if any of them could be security holes.
> I'm feeling paranoid because of Matthias Schmitt's unresolved report...)

I didn't know it did that.

-- 
  Bruce Momjian                        |  http://www.op.net/~candle
  maillist@candle.pha.pa.us            |  (610) 853-3000
  +  If your life is a hard drive,     |  830 Blythe Avenue
  +  Christ can be your backup.        |  Drexel Hill, Pennsylvania 19026

Thu, 29 Apr 1999 19:56:11 -0400 (EDT)
Bruce Momjian <maillist@candle.pha.pa.us>
Re: [HACKERS] How do I get the backend server into gdb?