Re: Debug crash - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: Debug crash
Date
Msg-id 20081211084941.GA22961@svana.org
Whole thread Raw
In response to Debug crash  ("Alif Isophoqote" <isophoqote@gmail.com>)
List pgsql-hackers
On Thu, Dec 11, 2008 at 04:29:56PM +0800, Alif Isophoqote wrote:
> Hi,
>
> I am developing a backend module for postgresql. For some queries,
> postgresql crashes: segmentation fault (most probably due to my own code).
> How to get the function name & line number where it crashes?

Arrange for a core dump to be dropped and use gdb.

Alternativly, if you know the dump is in a specific backend, use GDB to
attach to the backend in question before it crashes. Then GDB will stop
your program at the point of a segfault and you can examine all the
state, fix things on the fly, etc.

Oh, you'll need debug symbols in both the backend server and your
module, otherwise you're setting youself up for a lot of pain.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> Please line up in a tree and maintain the heap invariant while
> boarding. Thank you for flying nlogn airlines.

pgsql-hackers by date:

Previous
From: "Alif Isophoqote"
Date:
Subject: Debug crash
Next
From: Zdenek Kotala
Date:
Subject: Re: Debug crash