Thread: Debug crash
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?
isophoqote
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.
Alif Isophoqote napsal(a): > 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? At first it depends on your OS. On unixes you should get core dump (check ulimit setting). And if you have a core dump, then take you favorite debugger and print stack trace. It should show you your function. Zdenek