debugging C functions - Mailing list pgsql-general

From Nigel J. Andrews
Subject debugging C functions
Date
Msg-id Pine.LNX.4.21.0306201108140.29248-100000@ponder.fairway2k.co.uk
Whole thread Raw
Responses Re: debugging C functions  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: debugging C functions  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-general

I'm being dim again so can anyone point me to my mistake please?

On a linux system (debian errrr...latest, stable one) and postgresql 7.3.3

Compiling and linking with:

cc -g -fpic -I blah -o blah.o blah.c
ld -g -fpic -shared -o blah.so blah.o

(and trying the link stage with cc instead of ld just on the slim possibility)

Then in psql creating the function with:

create function blah() returns trigger as '/full/path/blah.so', 'blah' language
'C';

and the trigger with:

create trigger blah_trg before insert on blah
 for each row execute procedure public.blah();

(The function got created in public by postgres but I then switched user before
creating the trigger and public isn't in it's search_path)

Attaching the debugger to the backend process I can't set a break point on my
function, it says 'Function "blah" not defined' and when it segments somewhere
under SPI_execp called from my function the stack trace has all the postgres
symbols but just a '??' at the place my function is obviously sitting.

nm tells me blah is defined in the text segment as an external symbol and
without any name mangling. The only thing I can see is that asking nm for all
symbols, even the debugging ones, doesn't display anything different to what it
shows without that switch. Now I know this looks like it's not a postgresql
issue but I'd appreciate any pointers you folks can give. This has me baffled.

Thanks

--
Nigel Andrews





pgsql-general by date:

Previous
From: Ron Johnson
Date:
Subject: Re: A creepy story about dates. How to prevent it?
Next
From: "Kallol Nandi"
Date:
Subject: Re: JDBC in PostgreSql for Linux