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

Search Discussions

  • Martijn van Oosterhout at Dec 11, 2008 at 8:50 am

    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.
  • Zdenek Kotala at Dec 11, 2008 at 8:54 am

    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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-hackers @
categoriespostgresql
postedDec 11, '08 at 8:30a
activeDec 11, '08 at 8:54a
posts3
users3
websitepostgresql.org...
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase