Re: Seg fault on completing query

Поиск
Список
Период
Сортировка
От Gerhard Häring
Тема Re: Seg fault on completing query
Дата
Msg-id slrnb719a6.1mc.gerhard.haering@haering.opus-gmbh.net
обсуждение исходный текст
Ответ на Seg fault on completing query  (Chris Jewell <vs0u8055@liv.ac.uk>)
Список pgsql-interfaces
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



В списке pgsql-interfaces по дате отправления:

Предыдущее
От: Chris Jewell
Дата:
Сообщение: Seg fault on completing query
Следующее
От: "Jeroen T. Vermeulen"
Дата:
Сообщение: Re: Seg fault on completing query