Results 1 to 13 of 13

Thread: [S60] Char - A data abort exception has occurred.

  1. #1
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default [S60] Char - A data abort exception has occurred.

    Hi, when i call this funcion: char *res =(char*) bsearch(ssid, ptr, 9704447, 17, comparator); i use a comparator function.

    comparator():
    Qt Code:
    1. int comparator(const void *a, const void *b)
    2. {
    3. qDebug()<<"comparator()";
    4. const char *aa = (const char *)a, *bb = (const char *)b;
    5. qDebug()<<"1";
    6. for (int i = 0; i < 6; ++i) {
    7. qDebug()<<"2";
    8. qDebug()<<"i:"<<i;
    9. qDebug()<<"i:"<<i<<" aa:"<<aa[i]<<" bb:"<<bb[i];
    10. qDebug()<<"3";
    11. if (aa[i] != bb[i]) {
    12. return aa[i] - bb[i];
    13. }
    14. }
    15. return 0;
    16. }
    To copy to clipboard, switch view to plain text mode 

    My aplication crash, it is the debug:

    Executable file: 9058 2010-10-25T01:46:47 C:\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb \meoKeyMap.exe
    Package: 9380 2010-10-25T01:46:50 C:\Users\Ze\Documents\Qt\meoKeyMap\meoKeyMap.sis
    Deploying application to 'Nokia E51 USB (COM4)'...
    Copying installation file...
    Installing application...
    Starting application...
    Application running with pid 875.

    [Qt Message] comparator()
    Process 875, thread 876 stopped at 0x7b95028c: A data abort exception has occurred.
    [Qt Message] 1
    [Qt Message] 2
    [Qt Message] i: 0
    Finished.

  2. #2
    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: [S60] Char - A data abort exception has occurred.

    What is it exactly that you are trying to do? Since you are using Qt, why not use the facilities it provides? Or at least what std C++ provides (like strings instead of C strings).
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: [S60] Char - A data abort exception has occurred.

    Hi, i change it for qStrings and it works in PC but when i compile in the mobile it crash:

    Qt Code:
    1. int comparator(const void *a, const void *b)
    2. {
    3.  
    4. qDebug()<<"1";
    5. QString aaa(const_cast<char*>(reinterpret_cast<const char*>(a)));
    6. QString bbb(const_cast<char*>(reinterpret_cast<const char*>(b)));
    7. qDebug()<<"2";
    8.  
    9. for (int i = 0; i < 6; ++i) {
    10. if (aaa.at(i).toAscii() != bbb.at(i).toAscii()) {
    11. // qDebug()<<"diference1:"<<aaa.at(i).toAscii() - bbb.at(i).toAscii();
    12. return aaa.at(i).toAscii() - bbb.at(i).toAscii();
    13. //return aa[i] - bb[i];
    14. }
    15. }
    16.  
    17. return 0;
    18. }
    To copy to clipboard, switch view to plain text mode 

    Executable file: 9064 2010-10-25T11:55:40 C:\NokiaQtSDK\Symbian\SDK\epoc32\release\gcce\udeb \meoKeyMap.exe
    Package: 9332 2010-10-25T11:55:42 C:\Users\Ze\Documents\Qt\meoKeyMap\meoKeyMap.sis
    Deploying application to 'Nokia E51 USB (COM6)'...
    Copying installation file...
    Installing application...
    Starting application...
    Application running with pid 1103.
    [Qt Message] 1
    Process 1103, thread 1104 stopped at 0x7b9e1644: A data abort exception has occurred.
    Finished.

    A lot of people ask me for a backtrace, do you know how can i get it using qt and the debugger?!

  4. #4
    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: [S60] Char - A data abort exception has occurred.

    Why are you using bsearch() in the first place? If you have a sorted array, use qLowerBound(), qUpperBound() or qBinaryFind(). You don't need any custom comparators for that and certainly no C-ish code like this.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: [S60] Char - A data abort exception has occurred.

    I have a sorted text file not an array. I have a QFile::map():
    Qt Code:
    1. uchar* ptr = f.map(0,fileSize,QFile::NoOptions);
    To copy to clipboard, switch view to plain text mode 

    Can i do that with this?!

  6. #6
    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: [S60] Char - A data abort exception has occurred.

    Yes, why not? Of course provided each item in the file is of the same size.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. #7
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: [S60] Char - A data abort exception has occurred.

    Qt Code:
    1. qBinaryFind(container.begin(), container.end(), value);
    To copy to clipboard, switch view to plain text mode 

    But i can't do ptr.begin, can i give him the values? because i already know them!

  8. #8
    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: [S60] Char - A data abort exception has occurred.

    What values?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  9. #9
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: [S60] Char - A data abort exception has occurred.

    i'm doing that way:

    Qt Code:
    1. const char* aa=reinterpret_cast<const char*>(f.map(0,f.size(),QFile::NoOptions));
    2.  
    3. QList<QByteArray> bla = QByteArray::fromRawData(aa,f.size()).split("\n");
    4.  
    5. QVector<int>::iterator i = qBinaryFind(bla.begin(),bla.end(),"111111");
    To copy to clipboard, switch view to plain text mode 

    it gives me some errors that i can't figure out:

    ..\binaryFind\mainwindow.cpp:26: error: invalid conversion from 'const char*' to 'char'

    ..\binaryFind\mainwindow.cpp:26: error: initializing argument 1 of 'QList<QByteArray> QByteArray::split(char) const'

    ..\binaryFind\mainwindow.cpp:27: error: cannot convert 'QList<QByteArray>::iterator' to 'int*' in initialization

  10. #10
    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: [S60] Char - A data abort exception has occurred.

    Well, the code doesn't make any sense (syntactically) so I can't blame the compiler for refusing to build it.

    And logically with the above code mapping the file to memory has no sense because you are copying anyway when calling split().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  11. #11
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: [S60] Char - A data abort exception has occurred.

    Can you help doing that job?! I know that i need more background from c/c++.... :s

  12. #12
    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: [S60] Char - A data abort exception has occurred.

    Ok, here is a solution that copies the data. If you want to avoid a copy, modify it to suit your needs:
    Qt Code:
    1. QFile f(...);
    2. f.open(QFile::ReadOnly|QFile::Text);
    3. QStringList lines = QString(f.readAll()).split("\n");
    4. QStringList::iterator iter = qBinaryFind(lines, QString("111111"));
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #13
    Join Date
    Mar 2010
    Posts
    56
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows Symbian S60

    Default Re: [S60] Char - A data abort exception has occurred.

    Thanks, i implement the binary seach by my self and use the QFile::seek to go the position i want in the file, and it work great! Thanks for all

Similar Threads

  1. A Data abort exception has occured
    By newbis60 in forum Qt Programming
    Replies: 6
    Last Post: 15th October 2010, 16:30
  2. QtService Installation Problem: occurred while nmake.
    By lwinhtooko in forum Installation and Deployment
    Replies: 0
    Last Post: 15th October 2010, 09:20
  3. fatal err or C1001: An internal error has occurred in the compiler.
    By noodles in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 11th August 2010, 13:47
  4. converiosn of hex data char array to Qstring
    By manoagp in forum Qt Programming
    Replies: 1
    Last Post: 17th March 2010, 09:04
  5. char to const char* with atof
    By mickey in forum General Programming
    Replies: 5
    Last Post: 29th February 2008, 04:10

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.