Обсуждение: Réf. : Re: Réf. : Debugging SPI Cfunctions

Поиск
Список
Период
Сортировка

Réf. : Re: Réf. : Debugging SPI Cfunctions

От
bsimon@loxane.com
Дата:

I do use gdb with eclipse but I don't manage to enter the source code of my spi C functions.

Suppose I have a SPI functions that :

1) connects to the db (SPIConnect)
2) Executes a simple select (SPIExec)
3) Writes result of the select in a text file
4) disconnects from the db (SPIFinish)

Then I have a C (libpq) client program that calls my spi functions like this :

PQExec(conn,"SELECT mySpiFunction()");    

 the problem is ->  I can't step into this line !

We have many  C SPI functions registered on our server, I just would like to find a way to debug them ...

Thanks.

Benjamin.




Joe Conway <mail@joeconway.com>

13/01/2005 16:08

       
        Pour :        bsimon@loxane.com
        cc :        pgsql-general@postgresql.org
        Objet :        Re: Réf. : [GENERAL] Debugging SPI C functions



bsimon@loxane.com wrote:
> Aren't there any way to debug server programming functions (whatever the
> language) ??

What's wrong with gdb?

Joe


Re: Réf. : Re: Réf

От
Alvaro Herrera
Дата:
On Thu, Jan 13, 2005 at 04:23:29PM +0100, bsimon@loxane.com wrote:

> Then I have a C (libpq) client program that calls my spi functions like
> this :
>
> PQExec(conn,"SELECT mySpiFunction()");
>
>  the problem is ->  I can't step into this line !

Of course not.  The processing is done server side, so the debugging
should occur server side too.  You have to connect GDB with the backend
serving the connection, and step through function execution there.

--
Alvaro Herrera (<alvherre[@]dcc.uchile.cl>)
"La experiencia nos dice que el hombre peló millones de veces las patatas,
pero era forzoso admitir la posibilidad de que en un caso entre millones,
las patatas pelarían al hombre" (Ijon Tichy)

Re: Réf. : Re: Réf. : Debugging SPI Cfunctions

От
Tom Lane
Дата:
bsimon@loxane.com writes:
> Then I have a C (libpq) client program that calls my spi functions like=20
> this :
> PQExec(conn,"SELECT mySpiFunction()");=20
>  the problem is ->  I can't step into this line !

Of course not --- the execution of mySpiFunction is in a different
process.  You need to set up a second instance of gdb that's attached
to the postgres backend process your application is using.

            regards, tom lane