debugging C functions

From: "Nigel J(dot) Andrews" <nandrews(at)investsystems(dot)co(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: debugging C functions
Date: 2003-06-20 11:07:01
Message-ID: Pine.LNX.4.21.0306201108140.29248-100000@ponder.fairway2k.co.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Darko Prenosil 2003-06-20 11:16:25 Re: Unable to create or drop plpgsql
Previous Message Ron Johnson 2003-06-20 11:06:07 Re: A creepy story about dates. How to prevent it?