Library mismatch [Edited title]



  • hi masters,
    we met a problem:Virtual function pointer become 0x00000000, which make program crash (segment fault)!!!
    The program and libQt*.so (QtEmbedded-4.4.1) are cross-compiled with mipsel-linux-uclibc-, and no error occurs in building.
    But running the program with libQt*.so on mips borad crashed with segment fault error.
    we follow the code in gdb: QFrame:event(e->type=QEvent::Paint) => QWidget:event(e->type=QEvent::Paint) => paintEvent(e),
    and find that paintEvent became 0x00000000, which make program crash. Wired!!! what happened to paintEvent ? why it became 0x0? HELP!!!



  • What exactly becomes 0x0?
    this?
    a virtual functions (however that shall work)?

    please, a bit more code and the exact location of the crash could perhaps help a bit.
    Do you have some custom widgets? How is the code?




  • DEMO code:

    @
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QFrame* pFrame = new QFrame();

    pFrame->show();

    a.exec();

    return 0;
    }
    @


    GDB debug info:

    (gdb) s
    0x2aea3dcc in QWidget::event (this=0x2c1efdc8, event=0x7fff7638) at kernel/qwidget.cpp:7157
    7157 in kernel/qwidget.cpp
    Could not insert single-step breakpoint at 0x0
    (gdb)
    0x2aea3dcc in QWidget::event (this=0x2c1efdc8, event=0x7fff7638) at kernel/qwidget.cpp:7157
    7157 in kernel/qwidget.cpp
    Could not insert single-step breakpoint at 0x0
    (gdb) bt
    #0 QWidget::event (this=0x2c1efdc8, event=0x7fff7638) at kernel/qwidget.cpp:7157
    #1 0x2b444478 in QFrame::event (this=0x2c1efdc8, e=0x7fff7638) at widgets/qframe.cpp:652
    #2 0x2ae1ff9c in QApplicationPrivate::notify_helper () from /phone/lib/QT/libQtGui.so.4
    #3 0x2ae1fd04 in QApplication::notify () from /phone/lib/QT/libQtGui.so.4
    #4 0x2bcd504c in QCoreApplication::notifyInternal () from /phone/lib/QT/libQtCore.so.4
    #5 0x2ae2173c in QCoreApplication::sendSpontaneousEvent () from /phone/lib/QT/libQtGui.so.4
    #6 0x2aebedf0 in qt_sendSpontaneousEvent () at widgets/qframe.h:137
    #7 0x2ae99a1c in QWidgetPrivate::drawWidget (this=0x2c1f71b0, pdev=0x2c208424, rgn=@0x7fff76b8, offset=@0x2c202814, flags=5,
    sharedPainter=0x2c2052b0) at kernel/qwidget.cpp:4523
    #8 0x2b0c4b3c in QWidgetBackingStore::cleanRegion () at widgets/qframe.h:137
    #9 0x2b0c2308 in qt_syncBackingStore () at widgets/qframe.h:137
    #10 0x2aea44c4 in QWidget::event (this=0x2c1efdc8, event=0x2c2050e8) at kernel/qwidget.cpp:7303
    #11 0x2b444478 in QFrame::event (this=0x2c1efdc8, e=0x2c2050e8) at widgets/qframe.cpp:652
    #12 0x2ae1ff9c in QApplicationPrivate::notify_helper () from /phone/lib/QT/libQtGui.so.4
    #13 0x2ae1fd04 in QApplication::notify () from /phone/lib/QT/libQtGui.so.4
    #14 0x2bcd504c in QCoreApplication::notifyInternal () from /phone/lib/QT/libQtCore.so.4
    #15 0x2ae0e060 in QCoreApplication::sendEvent () from /phone/lib/QT/libQtGui.so.4
    #16 0x2bcd67ec in QCoreApplicationPrivate::sendPostedEvents () from /phone/lib/QT/libQtCore.so.4
    #17 0x2bd261c0 in QEventDispatcherUNIX::processEvents () from /phone/lib/QT/libQtCore.so.4
    #18 0x2aed03a0 in QEventDispatcherQWS::processEvents () at widgets/qframe.h:137
    #19 0x2bcd19c0 in QEventLoop::processEvents () from /phone/lib/QT/libQtCore.so.4
    #20 0x2bcd1b8c in QEventLoop::exec () from /phone/lib/QT/libQtCore.so.4
    #21 0x2bcd5a48 in QCoreApplication::exec () from /phone/lib/QT/libQtCore.so.4
    #22 0x2ae1dc4c in QApplication::exec () from /phone/lib/QT/libQtGui.so.4
    #23 0x00400d2c in main ()


    virtual function pointer: QFrame::paintEvent  address became 0x0,
    

    just as gdb show:
    (gdb)
    0x2aea3dcc in QWidget::event (this=0x2c1efdc8, event=0x7fff7638) at kernel/qwidget.cpp:7157
    7157 in kernel/qwidget.cpp
    Could not insert single-step breakpoint at 0x0

    BTW, we run another program to print the vtable of QFrame, and find that a slot of vtable is 0x00000000, which maybe paintEvent pointer slot.

    vtable :

    0x2b7d7fb8 0x2b7d7fe8 0x2b7d8084 0x2b440174 0x2b440208 0x2b441ba4 0x2bcf16cc 0x2bcf163c
    0x2bcf166c 0x2bcf169c 0x2bcf45f8 0x2bcf4628 0x2ae8ba18 0x2ae9f9fc 0x2b441110 0x2aea1938
    0x2aea4500 0x2aed6c10 0x2aea3194 0x2aea3334 0x2aea3384 0x2aea3144 0x2aea33dc 0x2aea347c
    0x2aea3540 0x2aea3590 0x2aea3610 0x2aea3690 0x2aea36c0 0x00000000 0x2aea3720 0x2aea3750
    0x2aea37b0 0x2aea3800 0x2aea342c 0x2aea3780 0x2aea39d8 0x2aea3a08 0x2aea3a38 0x2aea3a68
    0x2aea3a98 0x2aea3ac8 0x2aea3af8 0x2b441b00 0x2aed5630 0x2aea3850 0x2aea38a0 0x2ae9c0e8



  • we configure QtEmbedded-4.4.1 lib, like:

    ./configure -prefix /workshop/debug-4.4.1 -embedded mips -little-endian -xplatform qws/linux-mips-g++ -no-qt3support



  • Are you sure that you are building your app against exactly the same Qt libs that are deployed on your device? Can you show the checksums of the libs on your device and build machine to prove it please?

    I think that such a mismatch could cause problems like this as function offsets will be different between the two.

    Are you able to run the Qt examples on your target device?



  • [quote author="ZapB" date="1301317648"]Are you sure that you are building your app against exactly the same Qt libs that are deployed on your device? Can you show the checksums of the libs on your device and build machine to prove it please?

    I think that such a mismatch could cause problems like this as function offsets will be different between the two.

    Are you able to run the Qt examples on your target device?[/quote]

    Something like this, are you crosscompiling?



  • I don't see any useful information in the backtrace. This kind of weird problem is more likely related to a system misconfiguration (like the problem ZapB mentioned. I would suggest you check your environment and switch to a newer Qt version. 441 is a bit too old and it might contain a lot of bugs you don't want to see.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.