pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Gerhard Häring <haering_postgresql@gmx.de>
To: pgsql-interfaces@postgresql.org
Subject: Re: Seg fault on completing query
Date: Thu, 13 Mar 2003 15:36:08 +0000 (UTC)
Message-ID: <slrnb719a6.1mc.gerhard.haering@haering.opus-gmbh.net> (raw)
References: <3E70A394.9080802@liv.ac.uk>

Chris Jewell <vs0u8055@liv.ac.uk> wrote:
>     Hi,
> 
> I'm working on a frontend to a Postgresql database.  I've chosen C in 
> which to work, mainly because I wanted to learn the language.  So, I'm 
> using the pqlib frontend library.  The C source I have is below.  I 
> compile it (on linux) with gcc -g -Wall -lpq -oantibug antibug.c.  When 
> I run the executable, it prints out the query to the screen ok, but also 
> prints a "Segmentation Fault" on completion of the list.  Does anyone 
> know why?

This is really a C/Linux/gcc question. I haven't looked at your source, so
just some general remarks:

You'll want to compile your program with "-g" as an additional compiler
switch. Then you also want core dumps to be written to disk
"ulimit -c unlimited" in your shell.

You can then analyze the core dump using gdb:

$ gdb /path/to/your/app
gdb> core /path/to/corefile # usually just 'core'
gdb> bt      # short for 'backtrace'

You'll then see where your program crashed.

Alternatively, run your app under gdb (or a GUI frontend like ddd/gvd/...)
in the first place to see where it crashes.

HTH,

-- Gerhard




view thread (3+ messages)  latest in thread

Message-ID: <slrnb719a6.1mc.gerhard.haering@haering.opus-gmbh.net>
Permalink:  ../slrnb719a6.1mc.gerhard.haering@haering.opus-gmbh.net/
Also on:    postgresql.org/message-id/slrnb719a6.1mc.gerhard.haering@haering.opus-gmbh.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: haering_postgresql@gmx.de
  Subject: Re: Seg fault on completing query
  In-Reply-To: <slrnb719a6.1mc.gerhard.haering@haering.opus-gmbh.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox