Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. QtCreator debugger whats happened?
Forum Updated to NodeBB v4.3 + New Features

QtCreator debugger whats happened?

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
24 Posts 5 Posters 6.7k Views 2 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.
  • Simon PlattenS Offline
    Simon PlattenS Offline
    Simon Platten
    wrote on last edited by Simon Platten
    #7

    @jsulm, please explain why this is an issue?

    I have a linked list with a static member that points to the head of the list, the linked list is derived from QObject as it uses signals and slots.

    If this is the real issue then it's a serious limitation.

    Kind Regards,
    Simon Platten

    jsulmJ 1 Reply Last reply
    0
    • Simon PlattenS Simon Platten

      @jsulm, please explain why this is an issue?

      I have a linked list with a static member that points to the head of the list, the linked list is derived from QObject as it uses signals and slots.

      If this is the real issue then it's a serious limitation.

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by jsulm
      #8

      @Simon-Platten Why do you have a STATIC member which points to the head of the list? What happens if you create more than one instance on that list? To which head of the list will that static member point?
      Example:

      MyList list1;
      list1.append(...);
      ...
      MyList list2;
      list2.appen(...);
      ...
      list1.head <- To which lists head does it point if "head" is static?
      

      If this static member is a pointer then there is no issue with QApplication instance. But I don't get why this member is static.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      Simon PlattenS 1 Reply Last reply
      0
      • jsulmJ jsulm

        @Simon-Platten Why do you have a STATIC member which points to the head of the list? What happens if you create more than one instance on that list? To which head of the list will that static member point?
        Example:

        MyList list1;
        list1.append(...);
        ...
        MyList list2;
        list2.appen(...);
        ...
        list1.head <- To which lists head does it point if "head" is static?
        

        If this static member is a pointer then there is no issue with QApplication instance. But I don't get why this member is static.

        Simon PlattenS Offline
        Simon PlattenS Offline
        Simon Platten
        wrote on last edited by Simon Platten
        #9

        @jsulm, there will only ever be one list of this type in the application. The head of the list is a static pointer, simply because all instances of that class will get the same head pointer, if it isn't static, how else would they get it? The alternative is for every node to traverse the list everytime to find the head. There are over a hundred nodes in the list...

        Kind Regards,
        Simon Platten

        jsulmJ 1 Reply Last reply
        0
        • Simon PlattenS Simon Platten

          @jsulm, there will only ever be one list of this type in the application. The head of the list is a static pointer, simply because all instances of that class will get the same head pointer, if it isn't static, how else would they get it? The alternative is for every node to traverse the list everytime to find the head. There are over a hundred nodes in the list...

          jsulmJ Offline
          jsulmJ Offline
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #10

          @Simon-Platten said in QtCreator debugger whats happened?:

          there will only ever be one list of this type in the application. The head of the list is a static pointer, simply because all instances of that class will get the same head poi

          I don't get it: you say you will have only one instance ("there will only ever be one list of this type in the application") and then you say: "simply because all instances of that class". So, how many instances are you going to have? And even if there will be only one instance there is no reason to have head as static.
          Each instance can simply have its own head pointer (not static):

          template<typename T> class MyList
          {
          private:
              struct Node
              {
                  T data;
                  Node* next;
              };
              Node* first; // This is actually the pointer to the head
          };
          

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • Simon PlattenS Offline
            Simon PlattenS Offline
            Simon Platten
            wrote on last edited by Simon Platten
            #11

            @jsulm, in your example this means that every node has its own 'first' pointer, where as a static 'first' would be common to all nodes of that type without having to maintain it for every instance, just the static 'first' would be modified. This is not a very elegant solution. This is exactly the sort of thing that static members are intended for.

            To clarify, I have a single class that is used for the nodes and the linked list, there is only one instance of this linked list in the application. There are well over 100 nodes in the linked list.

            Can you explain why using statics would cause the debugger to behave this way?

            Kind Regards,
            Simon Platten

            jsulmJ 1 Reply Last reply
            0
            • Simon PlattenS Simon Platten

              @jsulm, in your example this means that every node has its own 'first' pointer, where as a static 'first' would be common to all nodes of that type without having to maintain it for every instance, just the static 'first' would be modified. This is not a very elegant solution. This is exactly the sort of thing that static members are intended for.

              To clarify, I have a single class that is used for the nodes and the linked list, there is only one instance of this linked list in the application. There are well over 100 nodes in the linked list.

              Can you explain why using statics would cause the debugger to behave this way?

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #12

              @Simon-Platten Not every node but every list has its own pointer to the first element in the list.
              Maybe we are talking about different things? What do you mean if you say "node"? Don't you mean "list"? Node is actually one entry in a list/tree.
              MyList - a class representing a list.
              Node - an entry in the list (contains a data field and pointer to next node).
              head - points to the first node in the list.
              Maybe I just don't understand your use case and you really want all MyList instances to handle exactly same data (in this case a static head pointer is the way to go).
              I don't know whether this static is the problem with the debugger - that was just an assumption.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • Simon PlattenS Offline
                Simon PlattenS Offline
                Simon Platten
                wrote on last edited by Simon Platten
                #13

                @jsulm, In my code the list and the node are one in the same, thats why I have a static pointer to head. Every node has access to the head of the list, I don't need another structure or class to define the list, because the list and the nodes share the same class.

                Simply example:

                    class clsNode {
                    private:
                       static clsNode* mpobjHead;
                       clsNode* mpobjNext;
                  /* other members... for the node instance */
                    public:
                        clsNode();
                
                        static clsNode* pobjGetHead() { return mpobjHead; }
                        clsNode* pobjGetNext() { return mpobjNext; }
                    };
                

                Kind Regards,
                Simon Platten

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #14

                  Hi,

                  Since you are using Qt and you are implementing a linked list, why not use QLinkedList ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • Simon PlattenS Offline
                    Simon PlattenS Offline
                    Simon Platten
                    wrote on last edited by
                    #15

                    @SGaist , Thank you, I'm pretty sure that the implementation of my linked list is ok, as this application is working fine without problems and the linked list has been established for over a year now....its just the debugger which is not behaving well...pointers and 'this' not showing correctly, in every other aspect the application and debugger is ok....so frustrating.

                    Kind Regards,
                    Simon Platten

                    1 Reply Last reply
                    0
                    • Simon PlattenS Offline
                      Simon PlattenS Offline
                      Simon Platten
                      wrote on last edited by
                      #16

                      I'm still no further forward in finding a reason why the debugger has stopped working properly, its very annoying and seems to be something in my code that has broken the debugger, but how can anything in the code being debugged break the debugger?

                      Kind Regards,
                      Simon Platten

                      1 Reply Last reply
                      0
                      • OlivierDuguayO Offline
                        OlivierDuguayO Offline
                        OlivierDuguay
                        wrote on last edited by
                        #17

                        I don't think this is a problem in your code... I have almost the same problem since I upgraded to Qt Creator 4.2.1 with Desktop Qt 5.7.1 MSVC2015_64bit.

                        I can't access "this" pointer whichever the class, and one time out of two (and even more) I also can't access member object/variable...

                        So annoying when it come to debug the code... I have to "qDebug" everything...

                        Hope someone will find what's wrong...

                        (PS. I don't have any static variable/object, so IT AIN'T THE PROBLEM)

                        Olivier Duguay

                        1 Reply Last reply
                        0
                        • Simon PlattenS Offline
                          Simon PlattenS Offline
                          Simon Platten
                          wrote on last edited by
                          #18

                          @OlivierDuguay, thank you for posting, nice to know I'm not the only one experiencing this, now how do we escalate this issue so someone at Qt investigates the problem?

                          Kind Regards,
                          Simon Platten

                          jsulmJ 1 Reply Last reply
                          0
                          • Simon PlattenS Simon Platten

                            @OlivierDuguay, thank you for posting, nice to know I'm not the only one experiencing this, now how do we escalate this issue so someone at Qt investigates the problem?

                            jsulmJ Offline
                            jsulmJ Offline
                            jsulm
                            Lifetime Qt Champion
                            wrote on last edited by
                            #19

                            @Simon-Platten You can file a bug report if there isn't one already (https://bugreports.qt.io/secure/Dashboard.jspa)

                            https://forum.qt.io/topic/113070/qt-code-of-conduct

                            1 Reply Last reply
                            0
                            • Simon PlattenS Offline
                              Simon PlattenS Offline
                              Simon Platten
                              wrote on last edited by
                              #20

                              @jsulm, thank you, I'll do it now.

                              Kind Regards,
                              Simon Platten

                              1 Reply Last reply
                              0
                              • SGaistS Offline
                                SGaistS Offline
                                SGaist
                                Lifetime Qt Champion
                                wrote on last edited by
                                #21

                                Can you share the link to the report ? That will make it easier to find.

                                Interested in AI ? www.idiap.ch
                                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                1 Reply Last reply
                                0
                                • Simon PlattenS Offline
                                  Simon PlattenS Offline
                                  Simon Platten
                                  wrote on last edited by Simon Platten
                                  #22

                                  @SGaist , https://bugreports.qt.io/browse/QTCREATORBUG-18030

                                  Kind Regards,
                                  Simon Platten

                                  1 Reply Last reply
                                  0
                                  • Simon PlattenS Offline
                                    Simon PlattenS Offline
                                    Simon Platten
                                    wrote on last edited by Simon Platten
                                    #23

                                    Better, but not completely fixed, visit https://bugreports.qt.io/browse/QTCREATORBUG-18030 for solution.

                                    Kind Regards,
                                    Simon Platten

                                    1 Reply Last reply
                                    0
                                    • A Offline
                                      A Offline
                                      alexzk
                                      wrote on last edited by
                                      #24

                                      Yes, it's happening,
                                      Code:
                                      int* p = mask.size.p;
                                      is shown as int and value is p[0]
                                      0_1498337924396_bad_debugger.png

                                      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