Page 2 of 2 FirstFirst 12
Results 21 to 27 of 27

Thread: Problem with SqLite and Qt

  1. #21
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with SqLite and Qt

    Well I did hit continue and gdb give me this:

    Failed to read a valid object file image from memory.

    (gdb) backtrace
    Stopped due to shared library event
    #0 0xb7f0ec70 in _dl_debug_state () from /lib/ld-linux.so.2
    #1 0xb7f036f6 in dl_main () from /lib/ld-linux.so.2
    #2 0xb7f13e6b in _dl_sysdep_start () from /lib/ld-linux.so.2
    #3 0xb7f012c4 in _dl_start () from /lib/ld-linux.so.2
    #4 0xb7f008d7 in _start () from /lib/ld-linux.so.2
    (gdb) info args
    No symbol table info available.
    (gdb) info local
    No symbol table info available.
    (gdb) frame 0
    #0 0xb7f0ec70 in _dl_debug_state () from /lib/ld-linux.so.2
    (gdb) info args
    No symbol table info available.
    (gdb) info local
    No symbol table info available.
    (gdb) continue
    [Thread debugging using libthread_db enabled]
    [New Thread -1221592864 (LWP 6190)]
    Stopped due to shared library event
    (gdb) continue
    [Switching to Thread -1221592864 (LWP 6190)]
    Stopped due to shared library event
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue

    Breakpoint 1, MainWindow::createConnection (this=0x80d9990) at mainwindow.ui.h:354
    /home/ken/NetLogger/mainwindow.ui.h:354:12111:beg:0x806100c
    (gdb) info thread
    * 1 Thread -1221592864 (LWP 6190) MainWindow::createConnection (this=0x80d9990) at mainwindow.ui.h:354
    (gdb) backtrace
    #0 MainWindow::createConnection (this=0x80d9990) at mainwindow.ui.h:354
    #1 0x08054c10 in MainWindow::init (this=0x80d9990) at mainwindow.ui.h:53
    #2 0x0805a7e0 in MainWindow (this=0x80d9990, parent=0x0, name=0x0, fl=1) at mainwindow.cpp:740
    #3 0x0804f660 in main (argc=
    Cannot access memory at address 0x0

    ) at main.cpp:21
    (gdb) info breakpoints
    Num Type Disp Enb Address What
    1 breakpoint keep y 0x0806100c in MainWindow::createConnection() at mainwindow.ui.h:354
    breakpoint already hit 1 time
    (gdb) info args
    this = (class MainWindow * const) 0x80d9990
    (gdb) info local
    No locals.
    (gdb) whatis this
    type = class MainWindow * const
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue
    Stopped due to shared library event
    (gdb) continue

    Program received signal SIGSEGV, Segmentation fault.
    0x0806108a in MainWindow::createConnection (this=0x80d9990) at mainwindow.ui.h:355
    /home/ken/NetLogger/mainwindow.ui.h:355:12154:beg:0x806108a
    (gdb) info thread
    * 1 Thread -1221592864 (LWP 6190) 0x0806108a in MainWindow::createConnection (this=0x80d9990) at mainwindow.ui.h:355
    (gdb) backtrace
    #0 0x0806108a in MainWindow::createConnection (this=0x80d9990) at mainwindow.ui.h:355
    #1 0x08054c10 in MainWindow::init (this=0x80d9990) at mainwindow.ui.h:53
    #2 0x0805a7e0 in MainWindow (this=0x80d9990, parent=0x0, name=0x0, fl=1) at mainwindow.cpp:740
    #3 0x0804f660 in main (argc=
    Cannot access memory at address 0x0

    ) at main.cpp:21
    (gdb) info args
    this = (class MainWindow * const) 0x80d9990
    (gdb) info local
    No locals.
    (gdb) step
    Couldn't get registers: No such process.
    (gdb) info thread
    Couldn't get registers: No such process.
    (gdb) backtrace
    (gdb) Process exited

  2. #22
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with SqLite and Qt

    What exactly should we be looking at? I see you have a segfault What's inside mainwindow.ui.h:355?

  3. #23
    Join Date
    Jun 2007
    Location
    Louisiana
    Posts
    77
    Thanks
    1
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Problem with SqLite and Qt

    A call to QSqlDatabase::setDatabasename()

  4. #24
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with SqLite and Qt

    Quote Originally Posted by wysota View Post
    If I have to perform some time intensive experiments and I'm short on time, so I know that I can barely make it with a non-crashing app, then I prefer it to crash now and then if I can continue the experiment without losing the already gathered data
    I believe that a better approach is to save the data before the crash occurs, because you can't trust the memory contents after it.

    Quote Originally Posted by wysota View Post
    remember the bug in the proxy model that caused you so much trouble?
    Yes, I do remember, even better than you. It had nothing to do with crashes and preserving critical data. Simply a few empty columns were visible in the QTableView.

    Quote Originally Posted by wysota View Post
    I don't know what makes you think I changed my mind.
    So if you didn't change your mind, you still agree with me, right?

    Quote Originally Posted by wysota View Post
    If the app is broken, it's not safe to continue, but not every SIGSEGV means the app is broken.
    We already agreed that in case of a SIGSEGV, you can't tell what caused it, so as you said, you can only guess.

    Quote Originally Posted by wysota View Post
    I give you an example that there exists a possibility of using the approach and you counter with an argument that it might not always be possible to use it.
    But earlier I've said that the stack might not be valid and you countered it with an argument that it might not always be a problem.

    Don't you think you are a bit inconsistent in the way you treat arguments?

  5. #25
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with SqLite and Qt

    Quote Originally Posted by ad5xj View Post
    A call to QSqlDatabase::setDatabasename()
    Could you post the code of MainWindow::createConnection()?

  6. #26
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Problem with SqLite and Qt

    Quote Originally Posted by jacek View Post
    I believe that a better approach is to save the data before the crash occurs, because you can't trust the memory contents after it.
    Yes, of course, provided it is possible. Dumping lots of data to disk (or even ramdisk) takes time. If you can do it in an incremental fashion, it's ok, but otherwise it will slow down the experiment even more. I know you like your apps to be perfect and bug free and I completely agree with you, but sometimes the practical side differs from the theory and it's nice to have a way that can save you in such cases.

    Yes, I do remember, even better than you. It had nothing to do with crashes and preserving critical data. Simply a few empty columns were visible in the QTableView.
    The point is you wasted a lot of time to find the problem. And the problem wasn't in your code, so fixing it wasn't that easy.

    So if you didn't change your mind, you still agree with me, right?
    Read my post again.

    We already agreed that in case of a SIGSEGV, you can't tell what caused it, so as you said, you can only guess.
    No, not in that case. Here you can be pretty certain what happened by tracking the state of the application and performing some checks. And even if you couldn't, if you test your application enough, you can assume the problem doesn't come from somewhere else. And even if you didn't, you can continue and if something is really broken, the segfault will occur again and you can abort the app then.

    Consider this snippet:
    Qt Code:
    1. void somehandler(int){ flag = TRUE; }
    2. //...
    3. signal(SIGSEGV, somehandler);
    4. protected[4] = 7; // sigsegv here
    5. signal(SIGSEGV, SIG_DFL);
    6. if(flag){ ... }
    To copy to clipboard, switch view to plain text mode 

    Here I can pretty well define where the segmentation fault occured and the example can be considered practical - it mimics a try-catch block.

    But earlier I've said that the stack might not be valid and you countered it with an argument that it might not always be a problem.
    But even earlier I said you can save the data and then you said the data might be on the stack and it might be broken. But I never said anything about saving the data from the stack, I was talking about saving data - some data.

    Don't you think you are a bit inconsistent in the way you treat arguments?
    I don't see any inconsistencies in my reasoning. I just see you can't admit that trapping SIGSEGV is not only a theoretical possibility. I have given you an example of such use and you still say the same. Maybe the snippet from this post will make you reconsider. Being stubborn in this case won't make your arguments better.

    Quote Originally Posted by jacek View Post
    Could you post the code of MainWindow::createConnection()?
    And the range of line numbers, please.

  7. #27
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with SqLite and Qt

    Quote Originally Posted by wysota View Post
    Yes, of course, provided it is possible.
    Exactly the same thing can be said about your approach --- you can try to dump data after you intercept SIGSEGV, but it might not be possible. If I had to choose between possible decrease of performance and correct data, I would choose correct data.

    Quote Originally Posted by wysota View Post
    The point is you wasted a lot of time to find the problem. And the problem wasn't in your code, so fixing it wasn't that easy.
    But still it has nothing to do with the subject of this discussion, that is whether it is practical or not to recover from faults that caused SIGSEGV.

    Quote Originally Posted by wysota View Post
    you can continue and if something is really broken, the segfault will occur again and you can abort the app then.
    By that time your application could do something nasty. What if the SIGSEGV was caused by a buffer overflow? IMO fail-fast is much safer approach.

    Quote Originally Posted by wysota View Post
    Here I can pretty well define where the segmentation fault occured and the example can be considered practical - it mimics a try-catch block.
    I wouldn't call such abuse a practical example. Anyway, yes, you can provoke a segmentation fault and continue execution, but you are dragging this discussion away from where it started --- recovery from memory faults.

    Quote Originally Posted by wysota View Post
    But even earlier I said you can save the data and then you said the data might be on the stack and it might be broken. But I never said anything about saving the data from the stack, I was talking about saving data - some data.
    I'm afraid you failed to see the forest behind the trees. What I tried to show you is that you rebuke my arguments, yet at the same time you use exactly the same kind of argumentation to support your point. That's what I call an inconsistency.

    Quote Originally Posted by wysota View Post
    Being stubborn in this case won't make your arguments better.
    If you are going to step further into using ad hominem arguments, let's better simply agree that:
    1. my point is that it's impractical to recover from memory faults and continue execution after receiving SIGSEGV, because you can't be sure about the state of the memory and what caused the signal to be emitted,
    2. you don't agree with me.

Similar Threads

  1. SQLite driver unavailable
    By kandalf in forum Installation and Deployment
    Replies: 5
    Last Post: 11th February 2009, 16:36
  2. Bulk insert into SQLite
    By munna in forum Qt Programming
    Replies: 6
    Last Post: 19th November 2007, 03:56
  3. SQLite make problems
    By raphaelf in forum Newbie
    Replies: 21
    Last Post: 3rd July 2007, 14:40
  4. SQLITE database problems
    By phoenix in forum Newbie
    Replies: 3
    Last Post: 30th April 2007, 21:38
  5. Reading umlaut letters from sqlite database
    By Djony in forum Qt Programming
    Replies: 11
    Last Post: 17th November 2006, 10:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.