Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with disassembler and SIGILL signal
Forum Updated to NodeBB v4.3 + New Features

Problem with disassembler and SIGILL signal

Scheduled Pinned Locked Moved Solved General and Desktop
59 Posts 4 Posters 22.0k Views 4 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amaury
    wrote on last edited by Amaury
    #34

    I didn't tried that but it works with another program I don't have any SIGILL error ...

    the problem with this is that I have something like 18 pages and 500 lines by pages on average.

    So that said to find out where the problem is do I have to check each lines of my program ? :/

    mrjjM 1 Reply Last reply
    0
    • A Amaury

      I didn't tried that but it works with another program I don't have any SIGILL error ...

      the problem with this is that I have something like 18 pages and 500 lines by pages on average.

      So that said to find out where the problem is do I have to check each lines of my program ? :/

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #35

      @Amaury
      Well if ONLY this program does it. Its not compiler.
      But you should be really clear about it.
      Else you can waste tons of time.

      So yes, if it is program error in your code. You will need to find the actual line/the bug.

      You can try http://valgrind.org/ but its takes time to use and understand.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Amaury
        wrote on last edited by
        #36

        Thanks for the support , I need to debug my program before I continue so I prefer to waste little time to understand and use the program.
        I can't try to debug the code line per line it would take too long and it should be everywhere .

        At least when I'm done with it I finally have to find a solution to start my app on boot but for now if it crashes all the time it's not really usefull.

        mrjjM 1 Reply Last reply
        0
        • A Amaury

          Thanks for the support , I need to debug my program before I continue so I prefer to waste little time to understand and use the program.
          I can't try to debug the code line per line it would take too long and it should be everywhere .

          At least when I'm done with it I finally have to find a solution to start my app on boot but for now if it crashes all the time it's not really usefull.

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #37

          @Amaury
          Well u should look for array copy. dangling pointers.
          old char * types and stuff like that.
          To get SIGILL from program bug , you must corrupt
          something in the code segment.
          Easy way is to use dangling pointer.

          So maybe you can guess at functions where it might happen.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Amaury
            wrote on last edited by Amaury
            #38

            @mrjj
            Well right now you're talking to me in japanese ^^
            I'm going to have a look on that didn't had time yesterday , I think I can be helped for one thing or two :)
            I'll come back if my problem is solve or not.

            mrjjM 1 Reply Last reply
            0
            • A Amaury

              @mrjj
              Well right now you're talking to me in japanese ^^
              I'm going to have a look on that didn't had time yesterday , I think I can be helped for one thing or two :)
              I'll come back if my problem is solve or not.

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #39

              @Amaury

              Oh :) sorry.
              What i mean is SIGILL means "what the hell is that instruction" from the cpu.
              This can happen if compiler setting is slightly off for target.
              OR
              you can also have it happen if you write over the end of an array
              or use a pointer that is not set.
              Like
              MyClass *c1; /// dangling pointer
              c1->somfunc()
              Then when CPU tries to run the func it sees some random garbage at that location
              and might say SIGILL.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                Amaury
                wrote on last edited by
                #40

                Alright that's clearer ^^
                So if I need to create a dangling pointer where do I need to declare it ?
                into the class itself ?

                mrjjM 1 Reply Last reply
                0
                • A Amaury

                  Alright that's clearer ^^
                  So if I need to create a dangling pointer where do I need to declare it ?
                  into the class itself ?

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #41

                  @Amaury
                  Well you can declare it anywhere. :)
                  You want to try crash on purpose`?

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    Amaury
                    wrote on last edited by
                    #42

                    Yes I'd like to look at all my pointers, see if there's somewhere that one is not declared or thing like that.

                    mrjjM 1 Reply Last reply
                    0
                    • A Amaury

                      Yes I'd like to look at all my pointers, see if there's somewhere that one is not declared or thing like that.

                      mrjjM Offline
                      mrjjM Offline
                      mrjj
                      Lifetime Qt Champion
                      wrote on last edited by
                      #43

                      @Amaury

                      • one is not declared
                        I assume you mean instantiated or in non japanese
                        new'ed
                        as in
                        ClassX * varX = new X()
                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        Amaury
                        wrote on last edited by Amaury
                        #44

                        Yes that's alright .

                        Btw I got a question , there's some code that I didn't develop myself and I was wondering if there could be an error in some parameters here's the setup :

                        main.cpp

                        
                        static const QString path = "localhost";
                        DataBase MemTampon::Db(path);
                        
                        int main(int argc, char *argv[])
                        {
                            QApplication a(argc, argv);
                        
                            QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));
                            QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
                        
                            QTranslator *qtTranslator = new QTranslator;
                                qtTranslator->load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
                                a.installTranslator(qtTranslator);
                        
                                MemTampon::Db.aff_Temperature();
                                MemTampon::Db.aff_Humidite();
                                MemTampon::Db.aff_Puissance();
                                MemTampon::Db.aff_Nom_SD();
                        
                            MainWindow w;
                            w.show();
                        
                            return a.exec();
                        
                        }
                        

                        memtampon.h (memtampon.cpp is empty)

                        class MemTampon
                        {
                        public:
                            static DataBase Db;
                            static Options Opt;
                        
                        };
                        
                        

                        and Database.cpp

                        DataBase::DataBase(const QString &path)
                        {
                                db = QSqlDatabase::addDatabase("QMYSQL");
                                db.setHostName("localhost");
                                db.setDatabaseName("SmartDevice_DB_V1");
                                db.setUserName("root");
                                db.setPassword("root");
                        
                                if (!db.open())
                                {
                                   qDebug() << "Error: connection with database fail";
                                }
                                else
                                {
                                   qDebug() << "Database: connection ok";
                                }
                        }
                        

                        I assume that with the path variable I am able to call the functions that are in my cpp but, it tells me that path is an unused parameter could it possibly give me an error ?

                        1 Reply Last reply
                        0
                        • mrjjM Offline
                          mrjjM Offline
                          mrjj
                          Lifetime Qt Champion
                          wrote on last edited by
                          #45

                          Its impossible to say
                          But global variables are good candidate to be check. (always)

                          I dont think
                          static const QString path;
                          can give such error.

                          1 Reply Last reply
                          0
                          • A Offline
                            A Offline
                            Amaury
                            wrote on last edited by
                            #46

                            Thank you I was a little disapointed by this function and wasn't able to say if that was correct or not

                            mrjjM kshegunovK 2 Replies Last reply
                            0
                            • A Amaury

                              Thank you I was a little disapointed by this function and wasn't able to say if that was correct or not

                              mrjjM Offline
                              mrjjM Offline
                              mrjj
                              Lifetime Qt Champion
                              wrote on last edited by
                              #47

                              @Amaury
                              Well you can always single step it and see if something happens.

                              1 Reply Last reply
                              0
                              • A Amaury

                                Thank you I was a little disapointed by this function and wasn't able to say if that was correct or not

                                kshegunovK Offline
                                kshegunovK Offline
                                kshegunov
                                Moderators
                                wrote on last edited by
                                #48

                                @Amaury
                                Also you can cut the code that you suspect and see if the problem manifest itself. I wouldn't in principle initialize anything outside of main (like your database) if I can help it, that way I stumble on to less errors in my code, and thus makes for an easier time debugging. Still, my best guess is there some subtle architecture mismatch, so the compiler generates a mostly valid code. However I have no clue how to really test that at present.

                                Read and abide by the Qt Code of Conduct

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  Amaury
                                  wrote on last edited by Amaury
                                  #49

                                  By using step I can't see any bugs so that's not here.

                                  By the way I'm using the memory check Valgind through QT and when I do a memory check thats starting but I got this message after a few seconds :

                                  Analyzing memory of /home/pi/Desktop/SmartDevice/SauvegardeRASPI/New/build-SmartDevice_QT_V11-Desktop-Debug/SmartDevice_QT_V11
                                      <frame>
                                        <ip>0x485F6F0</ip>
                                        <obj>/usr/lib/arm-linux-gnueabihf/libarmmem.so</obj>
                                      </frame>
                                    </stack>
                                  Analyzing finished.
                                  ** Unknown error **
                                  

                                  I followed the steps here :
                                  http://doc.qt.io/qtcreator/creator-valgrind-overview.html
                                  http://doc.qt.io/qtcreator/creator-analyzer.html

                                  1 Reply Last reply
                                  0
                                  • A Offline
                                    A Offline
                                    Amaury
                                    wrote on last edited by
                                    #50

                                    @kshegunov
                                    If I don't declare it there where could I do it ? As said before that's not a code that I did myself and I don't really understand the way that it works (how the "path" is used thorugh the different pages ...

                                    kshegunovK 1 Reply Last reply
                                    0
                                    • A Amaury

                                      @kshegunov
                                      If I don't declare it there where could I do it ? As said before that's not a code that I did myself and I don't really understand the way that it works (how the "path" is used thorugh the different pages ...

                                      kshegunovK Offline
                                      kshegunovK Offline
                                      kshegunov
                                      Moderators
                                      wrote on last edited by
                                      #51

                                      @Amaury said in Problem with disassembler and SIGILL signal:

                                      If I don't declare it there where could I do it

                                      From the looks of it you can safely put the db initialization in main (after you've created the application object). As for the string, it's okay to leave it as a global.

                                      Read and abide by the Qt Code of Conduct

                                      1 Reply Last reply
                                      0
                                      • A Offline
                                        A Offline
                                        Amaury
                                        wrote on last edited by Amaury
                                        #52

                                        @kshegunov

                                        I tried like that but that doesn't work got a qualified-id in declaration before '(' token error

                                        static const QString path = "localhost";
                                        
                                        int main(int argc, char *argv[])
                                        {
                                            QApplication a(argc, argv);
                                            DataBase MemTampon::Db(path);
                                        .
                                        .
                                        .
                                        }
                                        

                                        Even with the string inside the main ...

                                        kshegunovK 1 Reply Last reply
                                        0
                                        • A Amaury

                                          @kshegunov

                                          I tried like that but that doesn't work got a qualified-id in declaration before '(' token error

                                          static const QString path = "localhost";
                                          
                                          int main(int argc, char *argv[])
                                          {
                                              QApplication a(argc, argv);
                                              DataBase MemTampon::Db(path);
                                          .
                                          .
                                          .
                                          }
                                          

                                          Even with the string inside the main ...

                                          kshegunovK Offline
                                          kshegunovK Offline
                                          kshegunov
                                          Moderators
                                          wrote on last edited by
                                          #53

                                          It should be:

                                          DataBase Db(path);
                                          

                                          You're not initializing a static anymore.

                                          Read and abide by the Qt Code of Conduct

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved