Re: backend debug information

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: backend debug information
Дата
Msg-id 19258.987456270@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: backend debug information  (selkovjr@mcs.anl.gov)
Список pgsql-interfaces
selkovjr@mcs.anl.gov writes:
> As far as debugging, short of being able to run a postgres under gdb
> while connecting clients to it (I wish I knew whether that was at all
> possible),

It's easy to attach gdb to a running backend process; I do that all the
time.  Usual procedure is:
1. Fire up psql in another window2. Determine PID of backend attached to your psql3. gdb /path/to/postgres/executable4.
"attachPID"5. Set breakpoint at desired location(s), continue6. Execute problem query in psql
 

On some platforms you don't have to mention the executable file, as
gdb can figure it out by looking at the process you attach to.  On
others you need to give it.

Setting breakpoints in dynamically loaded shared libraries (ie, user
datatype code) may be easy, painful, or impossible depending on your
platform.  However, you usually can catch a SEGV in such code in any
case; just let the failure happen while gdb is attached.

Don't forget to build your datatype code with -g, and the backend too,
or you'll not be able to learn much.
        regards, tom lane


В списке pgsql-interfaces по дате отправления:

Предыдущее
От: selkovjr@mcs.anl.gov
Дата:
Сообщение: Re: backend debug information
Следующее
От: selkovjr@mcs.anl.gov
Дата:
Сообщение: Re: making data types