Re: [HACKERS] Blowing core - anyone have any ideas? - Mailing list pgsql-hackers

From Vince Vielhaber
Subject Re: [HACKERS] Blowing core - anyone have any ideas?
Date
Msg-id XFMail.990520153204.vev@michvhf.com
Whole thread Raw
In response to Re: [HACKERS] Blowing core - anyone have any ideas?  (jwieck@debis.com (Jan Wieck))
List pgsql-hackers
On 20-May-99 Jan Wieck wrote:
>>
>>
>> Ok, I'm trying to finish cleaning up libpq++ and with v6.4.0 and with
>> the snapshot I grabbed a few minutes ago I get the same thing.
>>
>> The library builds and installs fine.
>> The examples build fine.
>> The examples run fine UNTIL they end.  After the program ends and the
>> destructor finishes I get a core dump from a seg fault.  Running it in
>> the debugger (the library and the example are both compiled with -g) I
>> get this for a backtrace:
>>
>> (gdb) bt
>> #0  0x1000000 in ?? ()
>> #1  0x38000000 in ?? ()
>> Error accessing memory address 0x7ec1e: Invalid argument.
>> (gdb)
>>
>> Any ideas where to look?   This is on FreeBSD 2.2.6 (can't upgrade it
>> just yet - it's too busy).
> 
>     Unfortunately  I  can't  compile  the  examples. I'm not very
>     familiar with C++ and the cryptic error messages I get  about
>     "undefined"  references  surely result from some wrong shared
>     lib setups here.
> 
>     Anyway - the above tells that something corrupted  the  stack
>     and  that the core is mostly useless (except for including it
>     into replies to spam mail).
> 
>     The destructor eventually calls  PQuntrace(),  PQclear()  and
>     PQfinish().   Try setting breakpoints on them and then single
>     step until shit happens.

Actually I ended up making some progress.  It's not fixed, but I made
some progress.

All the examples compiled and ran before, the only difference was that
I discovered they weren't much of an example since they didn't use the
main header file or the installed libraries.  They used the libraries
in the source tree and the headers of the individual files that make up
libpq++.  So I took the original libpq++.H (horribly out of date) and 
reworked it to the current and individual headers.  And I changed the
makefile to not look into the source tree but rather into the installed
header and library.  That's when it started blowing core.

Right before I stopped for the day (but may delve back into it tonite)
I created a new header (called libpq+++.H) consisting of just pgdatabase.h
and pgconnection.h (pgenv.h is gone now).  Compiled and ran - did NOT
blow up!!!  So it looks like it's got something to do with that header.  
I'll probably re-create it one step at a time and see when things begin
to go awry.  I'm wondering if this is related to the comment in testlo.cc
about dumping core.

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH   email: vev@michvhf.com   flame-mail: /dev/null      # include <std/disclaimers.h>
       TEAM-OS2       Online Campground Directory    http://www.camping-usa.com      Online Giftshop Superstore
http://www.cloudninegifts.com
==========================================================================




pgsql-hackers by date:

Previous
From: Andy Farrell
Date:
Subject: Re: [HACKERS] Postgres 6.4.2 connection problem solved
Next
From: "Matthew C. Aycock"
Date:
Subject: 64 bit version on Solaris 7...