List:MySQL++« Previous MessageNext Message »
From:Marco Turchi Date:March 10 2005 6:34am
Subject:Re: Segmentation fault->Result res = query.store();
View as plain text  
>I'm not sure if core dump files save the libraries they were run with...
>would make sense if they did.  If this is so, it is still using the
>lib from /usr/local/lib instead of the one you compiled with.
>
>This could explain why there is no info in the backtrace (stripped libs?).
>
>You may need to delete the core files, make sure LD_LIBRARY_PATH is set,
>and run resetdb again to make a new core dump.
>  
>
I'm sure that LD_LIBRARY_PATH is set, but every time that I run 
.libs/resetdb and create the core dump file, and then run "gdb 
.libs/resetdb corefile" I obtain the same results of the previous email.

So I've moveded the simple1.cc from examples directory to another 
directory. I've changed the code in the following way:
#include <mysql++.h>

#include <iostream>
#include <iomanip>

using namespace std;
using namespace mysqlpp;

int
main(int argc, char *argv[])
{   
   
    try {
        const char* kdb = "marco";
        const char* host= "turchi";
        const char* user= "marco";
        const char* psw= "turchi";
        int it;
            for(it =0; it < argc; it++)
             {
                    cout << argv[it] << endl;
               }

        Connection con(use_exceptions);
        bool success = false;
        success = con.connect(kdb, "", user, psw);
         if (!success) {
                        cerr << "Database connection failed." << endl <<

endl;
                }
 
        cout << "correct connectio"<< endl;
        Query query = con.query();

        query << "select * from parole";
        cout << "Query: " << query.preview() << endl;

        Result res = query.store();
        cout << "Records Found: " << res.size() << endl << endl;

        Row row;
   
        Result::iterator i;

        cout.precision(3);
        for (i = res.begin(); i != res.end(); i++) {
            row = *i;
    }

        return 0;
    }
    catch (BadQuery& er) {
        // Handle any connection or query errors that may come up
        cerr << "Error: " << er.what() << endl;
        return -1;
    }
    catch (BadConversion& er) {
        // Handle bad conversions
        cerr << "Error: " << er.what() << "\"." << endl
            << "retrieved data size: " << er.retrieved
            << " actual data size: " << er.actual_size << endl;
        return -1;
    }
    catch (exception& er) {
        cerr << "Error: " << er.what() << endl;
        return -1;
    }
}

I've compiled and linked:
g++ -I/usr/include/mysql++ -I/usr/local/mysql/include/mysql -DVERBOSE=2  
-Wall  -pthread  -g -O2   -c simple1.cc
g++ -pthread  -g -O2   -L/usr/lib/mysql    util.o  simple1.o 
/usr/local/lib/libmysqlpp.so -lz /usr/lib/mysql/libmysqlclient_r.a
-lcrypt -lnsl -lm -lpthread -lc -lnss_files -lnss_dns -lresolv 
-Wl,--rpath -Wl,/usr/local/lib -Wl,--rpath
-Wl,/usr/local/lib -o simple1

I've created a databse using the mysql command line, the name is parole, 
with one table mades of two field: id text(char 200) and then run all.
It conncets to the database, but I've a segmentation fault at line 
->Result res = query.store();

So I create the backtrack:

#0  0x00cb22a9 in ResUse (this=0xbfffa954, result=0xbfffa970, m=0x0) at 
char_traits.h:135
135           { return strlen(__s); }
(gdb) bt
#0  0x00cb22a9 in ResUse (this=0xbfffa954, result=0xbfffa970, m=0x0) at 
char_traits.h:135
#1  0x00caa61c in mysqlpp::Connection::store (this=0xbfffaad0, 
str=@0xffffffff, throw_excptns=true) at result.h:157
#2  0x00cb1ec2 in mysqlpp::Query::store (this=0x8343088, p=@0xbfffaa2c) 
at connection.h:139
#3  0x0804df74 in main (argc=-1073763936, argv=0xbfffa990) at query.h:90

thank for your time
Marco



Thread
Segmentation fault->Result res = query.store();Marco Turchi9 Mar
  • Re: Segmentation fault->Result res = query.store();Warren Young9 Mar
    • Re: Segmentation fault->Result res = query.store();Marco Turchi9 Mar
      • Re: Segmentation fault->Result res = query.store();Marco Turchi9 Mar
        • Re: Segmentation fault->Result res = query.store();Warren Young9 Mar
          • Re: Segmentation fault->Result res = query.store();Marco Turchi9 Mar
      • Re: Segmentation fault->Result res = query.store();Warren Young9 Mar
  • Re: Segmentation fault->Result res = query.store();Chris Frey9 Mar
    • Re: Segmentation fault->Result res = query.store();Warren Young9 Mar
      • Re: Segmentation fault->Result res = query.store();Marco Turchi10 Mar
        • Re: Segmentation fault->Result res = query.store();Chris Frey10 Mar
          • Re: Segmentation fault->Result res = query.store();Marco Turchi10 Mar
            • Re: Segmentation fault->Result res = query.store();Chris Frey10 Mar
              • Re: Segmentation fault->Result res = query.store();Marco Turchi10 Mar
                • Re: Segmentation fault->Result res = query.store();Chris Frey10 Mar
                  • Re: Segmentation fault->Result res = query.store();Marco Turchi10 Mar
                    • Re: Segmentation fault->Result res = query.store();Earl Miles11 Mar
                      • Re: Segmentation fault->Result res = query.store();Warren Young11 Mar
        • Re: Segmentation fault->Result res = query.store();Warren Young11 Mar
          • Re: Segmentation fault->Result res = query.store();Warren Young11 Mar
            • Re: Segmentation fault->Result res = query.store();Chris Frey11 Mar
              • Re: Segmentation fault->Result res = query.store();Warren Young12 Mar
      • mysql++ installdon thompson10 Mar
        • Re: mysql++ install solveddon thompson10 Mar