On 02/04/2012 02:37 AM, Dave Potts wrote:
> I have just inherited a private C module that lives in the context of
> the server with little or no documentation.
>
> It crashes taking the database down, is there any advice on how to
> debug this type of beast ?
>
> This is not a problem with the postgres server but user module.
While I cannot offer advice specific to PostgreSQL (and someone here
might be better equipped to do that if there is anything that must be
done special for PostgreSQL), I can say that what you need to do is try
to use the debugger to catch the crash.
If you can do that, then you can get a backtrace and start working from
there.
If you are not comfortable with the debugger, you can instead put
debugging statements in your custom module. This way, you can trace
where it is crashing. If you are running on a system that has glibc, it
provides some helpful functions where you can display backtraces at
arbitrary points in your code:
http://www.linuxjournal.com/article/6391
http://www.gnu.org/software/libc/manual/html_node/Backtraces.html
In any case, good luck!
--- Mike
--
A man who reasons deliberately, manages it better after studying Logic
than he could before, if he is sincere about it and has common sense.
--- Carveth Read, “Logic”