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. Conditional breakpoint?
Forum Updated to NodeBB v4.3 + New Features

Conditional breakpoint?

Scheduled Pinned Locked Moved Unsolved General and Desktop
16 Posts 3 Posters 1.4k Views 1 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.
  • JoeCFDJ JoeCFD

    you can add Conditional breakpoints by right clicking your breakpoint red circle->Edit Breakpoint->Advanced->condition

    or add something like

    if ( *** ) {
        int n = 0;
    }
    

    in your code and set a break point inside if

    SPlattenS Offline
    SPlattenS Offline
    SPlatten
    wrote on last edited by
    #3

    @JoeCFD, the point is I don't know where or what is making the change, thats why I want to use a conditional breakpoint to halt execution as soon as the condition is true.

    Kind Regards,
    Sy

    JoeCFDJ 1 Reply Last reply
    0
    • SPlattenS SPlatten

      @JoeCFD, the point is I don't know where or what is making the change, thats why I want to use a conditional breakpoint to halt execution as soon as the condition is true.

      JoeCFDJ Offline
      JoeCFDJ Offline
      JoeCFD
      wrote on last edited by
      #4

      @SPlatten previous reply is edited.

      SPlattenS 1 Reply Last reply
      0
      • JoeCFDJ JoeCFD

        @SPlatten previous reply is edited.

        SPlattenS Offline
        SPlattenS Offline
        SPlatten
        wrote on last edited by
        #5

        @JoeCFD , thank you, so I did this right clicking the member variable with a breakpoint set on a line, however I'm not sure this is what I want as the breakpoint will stop on the line where the breakpoint was created. I want a breakpoint that will halt at the location where the condition is true.

        Kind Regards,
        Sy

        JoeCFDJ 1 Reply Last reply
        0
        • SPlattenS SPlatten

          @JoeCFD , thank you, so I did this right clicking the member variable with a breakpoint set on a line, however I'm not sure this is what I want as the breakpoint will stop on the line where the breakpoint was created. I want a breakpoint that will halt at the location where the condition is true.

          JoeCFDJ Offline
          JoeCFDJ Offline
          JoeCFD
          wrote on last edited by JoeCFD
          #6

          @SPlatten add as many as you want with the same condition and you will catch it somewhere. As soon as you reach the breakpoint which meets the condition, you can trace back.

          SPlattenS 1 Reply Last reply
          0
          • JoeCFDJ JoeCFD

            @SPlatten add as many as you want with the same condition and you will catch it somewhere. As soon as you reach the breakpoint which meets the condition, you can trace back.

            SPlattenS Offline
            SPlattenS Offline
            SPlatten
            wrote on last edited by
            #7

            @JoeCFD , the problem is I don't know what is making the change or where, all I can say is I have one instance of an object which has a QFormLayout when I add a widget to it, its there and at some point between the next call to add the next widget, the previous widget is no longer there. I really don't know why.

            Kind Regards,
            Sy

            JonBJ JoeCFDJ 2 Replies Last reply
            0
            • SPlattenS SPlatten

              @JoeCFD , the problem is I don't know what is making the change or where, all I can say is I have one instance of an object which has a QFormLayout when I add a widget to it, its there and at some point between the next call to add the next widget, the previous widget is no longer there. I really don't know why.

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #8

              @SPlatten
              You cannot set a breakpoint in the way you would like. That would require the list to be monitored as every instruction is executed. I don't think gdb or even MSVC offers this.

              SPlattenS 1 Reply Last reply
              0
              • JonBJ JonB

                @SPlatten
                You cannot set a breakpoint in the way you would like. That would require the list to be monitored as every instruction is executed. I don't think gdb or even MSVC offers this.

                SPlattenS Offline
                SPlattenS Offline
                SPlatten
                wrote on last edited by
                #9

                @JonB , thank you, ok, I'm open to suggestions on how I might track down why the behaviour I'm seeing is occurring.

                Kind Regards,
                Sy

                JonBJ 1 Reply Last reply
                0
                • SPlattenS SPlatten

                  @JonB , thank you, ok, I'm open to suggestions on how I might track down why the behaviour I'm seeing is occurring.

                  JonBJ Offline
                  JonBJ Offline
                  JonB
                  wrote on last edited by
                  #10

                  @SPlatten
                  I know, I'm thinking about it. But doesn't mean I'll come up with anything... :)

                  1 Reply Last reply
                  0
                  • SPlattenS SPlatten

                    @JoeCFD , the problem is I don't know what is making the change or where, all I can say is I have one instance of an object which has a QFormLayout when I add a widget to it, its there and at some point between the next call to add the next widget, the previous widget is no longer there. I really don't know why.

                    JoeCFDJ Offline
                    JoeCFDJ Offline
                    JoeCFD
                    wrote on last edited by JoeCFD
                    #11

                    @SPlatten if you know which widget disappears(you should know by setting object name or id), create a shared point of it. Check if the shared pointer becomes nullptr at the steps where it may disapppear.

                    JonBJ SPlattenS 2 Replies Last reply
                    0
                    • JoeCFDJ JoeCFD

                      @SPlatten if you know which widget disappears(you should know by setting object name or id), create a shared point of it. Check if the shared pointer becomes nullptr at the steps where it may disapppear.

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by
                      #12

                      @JoeCFD said in Conditional breakpoint?:

                      at the steps where it may disapppear.

                      The point is @SPlatten does not know where it may disappear.....

                      1 Reply Last reply
                      0
                      • JoeCFDJ JoeCFD

                        @SPlatten if you know which widget disappears(you should know by setting object name or id), create a shared point of it. Check if the shared pointer becomes nullptr at the steps where it may disapppear.

                        SPlattenS Offline
                        SPlattenS Offline
                        SPlatten
                        wrote on last edited by
                        #13

                        @JoeCFD , I've called setObjectName on all the widgets I'm using, not sure how this helps tho.

                        Kind Regards,
                        Sy

                        JoeCFDJ JonBJ 2 Replies Last reply
                        0
                        • SPlattenS SPlatten

                          @JoeCFD , I've called setObjectName on all the widgets I'm using, not sure how this helps tho.

                          JoeCFDJ Offline
                          JoeCFDJ Offline
                          JoeCFD
                          wrote on last edited by JoeCFD
                          #14

                          @SPlatten when the widget is created with that object name, you assign it to the shared pointer. You use break points to go down step by step to check if the shared pointer is null or not. Then you will know exactly where it disappears.

                          1 Reply Last reply
                          0
                          • SPlattenS SPlatten

                            @JoeCFD , I've called setObjectName on all the widgets I'm using, not sure how this helps tho.

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by JonB
                            #15

                            @SPlatten
                            Very first thought: can you at least put a debug on the QObject::destroyed() for the object that goes missing? Find out whether that is happening.

                            And/or listen to what @JoeCFD is saying, I've never used a shared pointer but he obviously has!

                            SPlattenS 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @SPlatten
                              Very first thought: can you at least put a debug on the QObject::destroyed() for the object that goes missing? Find out whether that is happening.

                              And/or listen to what @JoeCFD is saying, I've never used a shared pointer but he obviously has!

                              SPlattenS Offline
                              SPlattenS Offline
                              SPlatten
                              wrote on last edited by
                              #16

                              @JonB , I'm not sure that the widget itself is being destroyed at all, only that it isn't in the list I appended it to when I go to add the next widget.

                              Kind Regards,
                              Sy

                              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