Re: debugging C functions
| От | Tom Lane | 
|---|---|
| Тема | Re: debugging C functions | 
| Дата | |
| Msg-id | 17641.1056117025@sss.pgh.pa.us обсуждение исходный текст | 
| Ответ на | debugging C functions ("Nigel J. Andrews" <nandrews@investsystems.co.uk>) | 
| Список | pgsql-general | 
"Nigel J. Andrews" <nandrews@investsystems.co.uk> writes:
> 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.
You won't be able to set a breakpoint in the function if its shared
library hasn't been loaded into the process yet.  I'd suggest something
like
    <start fresh session>
    psql=> LOAD 'libraryname';
    <attach to backend with gdb>
    gdb> b myfunc
    gdb> cont
    psql=> SELECT myfunc();
If gdb still claims not to know the function with this approach, you
probably also need to issue a "sharedlibrary" command to gdb to force
it to absorb symbol definitions from the shlib.  I think on most
platforms the above sequence will work without that, though.
            regards, tom lane
		
	В списке pgsql-general по дате отправления: