Tom Lane wrote:
> It's not hard. Start psql, then in another window use ps to determine
> the PID of the connected backend. (The pg_stat_activity view might help
> too.) Then
>
> gdb /path/to/postgres-executable PID
> gdb> b whereever
> gdb> cont
>
> and away you go.
I'd add that when working with shared libraries, you need to make sure
they are loaded before you attach to the process (I think there is a way
to deal with it after the fact, but I'm not sure of the details). To do
that, either execute a function in the library (e.g. select
dblink_connect...) or use the LOAD command like this:
regression=# load '$libdir/dblink';
LOAD
HTH,
Joe