11 Replies
      Latest reply on Apr 26, 2019 1:49 AM by eskimo
      jldb Level 1 Level 1 (0 points)

        The breakpoints that are working are defined twice (I don't know how or why they were created twice). When editing those breakpoints the condition item has two radio buttons. The first one is on with the text: "Use parent breakpoint condition, which is not set". The other radio button is near the "classical" text field for the condition. The breakpoints that don't work have only the text field for the condition. I can't find any documentation for this.

        My questions : What makes I produce one kind of breakpoint and the other one ? Is it a bug ? (Only the working one, with radio buttons should be produced ?). It is not clear for me. What means the text: "Use parent breakpoint condition, which is not set" ? What is a parent breakpoint ? Why are they -when working- produced by pair ? Actually setting a working breakpoint seems to work randomly for me. Does anyone have the same problems ?

        • Re: Xcode 10 debugger stops on some breakpoints and doesn't on some others
          eskimo Apple Staff Apple Staff (11,265 points)

          LLDB has the concept of parent and child breakpoints.  This is necessary because the breakpoint specification (what to actually break on) can match multiple locations in memory, and that list of locations can vary over time as code is loaded and unloaded.

          The parent breakpoint is identified by a number (1, 2, and so on) and the child breakpoints are identified by a pair of numbers (1.1, 1.2, 1.3, 2.1, and so on).

          For an extreme example of this, use the Xcode user interface to set a symbolic breakpoint on open.  When you run your program, it’ll hit a breakpoint almost immediately.  Now dump the list of breakpoints using br list:

          (lldb) br list
          Current breakpoints:
          1: name = 'open', locations = 132, resolved = 132, hit count = 1
          
            1.1: where = xxst`Darwin.open(Swift.UnsafePointer<Swift.Int8>, Swift.Int32, Swift.UInt16) -> Swift.Int32, address = 0x0000000100008b20, resolved, hit count = 0 
            1.2: where = xxst`Darwin.open(Swift.UnsafePointer<Swift.Int8>, Swift.Int32) -> Swift.Int32, address = 0x0000000100008b10, resolved, hit count = 0 
            1.3: where = libc++.1.dylib`std::__1::messages<char>::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::locale const&) const, address = 0x00007fff69658af0, resolved, hit count = 0 
            1.4: where = libc++.1.dylib`std::__1::messages<wchar_t>::open(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::locale const&) const, address = 0x00007fff69658cfe, resolved, hit count = 0 
            1.5: where = Foundation`-[NSStream(NSStream) open], address = 0x00007fff4127bcd5, resolved, hit count = 0 
            1.6: where = Foundation`-[NSCFInputStream open], address = 0x00007fff4127bf1f, resolved, hit count = 0 
            1.7: where = Foundation`-[NSCFOutputStream open], address = 0x00007fff4127c260, resolved, hit count = 0 
            1.8: where = CoreFoundation`-[__NSCFOutputStream open], address = 0x00007fff3edab3e7, resolved, hit count = 0 
            1.9: where = CoreFoundation`-[__NSCFInputStream open], address = 0x00007fff3edbf88e, resolved, hit count = 0 
            1.10: where = libsystem_kernel.dylib`__open, address = 0x00007fff6c539148, resolved, hit count = 1 
            1.11: where = CFNetwork`std::__1::basic_ifstream<char, std::__1::char_traits<char> >::open(char const*, unsigned int), address = 0x00007fff3dbc7c82, resolved, hit count = 0 
            … lots of other entries elided …
          
          (lldb)

          That’s a lot of breakpoints!

          This list is also reflected in Xcode.  If you go to the breakpoints navigator and disclose the twiddle triangle next to open, you’ll see 132 items.  Normally I just collapse the twiddle triangle to hide all of these items and move on, but in some cases it’s nice to work with specific ones.  To continue the example above, I’d probably want to disable all of the breakpoints except 1.10.

          As to what’s going on in your specific case, it’s hard to say without knowing more details.  I suspect that the above might be enough to get you going, but if not you should post the result from br list and I’ll take a look.

          Share and Enjoy

          Quinn “The Eskimo!”
          Apple Developer Relations, Developer Technical Support, Core OS/Hardware
          let myEmail = "eskimo" + "1" + "@apple.com"

            • Re: Xcode 10 debugger stops on some breakpoints and doesn't on some others
              kkerekes_mac.com Level 1 Level 1 (0 points)

              XCode 10.2.1

               

              I am jumping into this thread because it keeps coming up in my DuckDuckGo searches, and because it features the comments of Quinn -- someone who over the years I have come to associate with excellent information. So...

               

              Is there any way to have LLDB _NOT_ add all of the child breakpoints? I am getting numerous spurious "child" breakpoints added to my code, and I have not found any way to prevent this.

               

              I have inserted a screenshot from XCode showing a typical such event. I set a breakpoint at line 240, and LLDB has decided to set an additional breakpoint at line 243.

               

              I have tried adding dummy code between the various closing braces, but that just moves the problem around. LLDB still insists on breaking at a point that is not in the same flow path as the intentional breakpoint. If, for example, I add dummy code between the @catch closing brace and the method closing brace, the undesired child breakpoint moves to the @catch closing brace.

               

              This mostly seems to occur with @try-@catch blocks.

               

              So is this a LLDB bug?

                   If so, is there a known workaround?

            • Re: Xcode 10 debugger stops on some breakpoints and doesn't on some others
              john daniel Level 3 Level 3 (380 points)

              One problem I have found with breakpoints is that multi-line statements really confuse them. When you set a breakpoint, always set it on a statement that has only a single line.

               

              Conditional breakpoints are tricky. If I ever do a test, just to see if they work, they work 100% of the time. But if I'm debugging for real, they will fail maybe 60% of the time. If they work, they are likely to leave me deep in assembly code in some state where it is impossible to get back out to the symbolic code.

               

              It is usually easy enough to find a single-line statement and put a break point on that. It is relatively rare that I need to break on a condition. And when I do, it is usually because of some difficult-to-debug condition that I don't want to attempt twice. I just add an if statement to the code and break on an NSLog() statement. This is a little more work that setting a breakpoint condition, but it is works perfectly 100% of the time.

                • Re: Xcode 10 debugger stops on some breakpoints and doesn't on some others
                  eskimo Apple Staff Apple Staff (11,265 points)

                  One problem I have found with breakpoints is that multi-line statements really confuse them.

                  Indeed.  I find closures (in Swift, blocks in Objective-C) to be especially annoying here.  For example, in this code:

                  autoreleasepool {
                      … some code …
                  }

                  if I set a breakpoint on line 1, I’ll hit that twice, once outside the call to autoreleasepool(_:) and once inside the closure.  This makes some degree of sense (the closure does extend to line 1) but it’s somewhat annoying (r. 48194534).

                  Share and Enjoy

                  Quinn “The Eskimo!”
                  Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                  let myEmail = "eskimo" + "1" + "@apple.com"

                • Re: Xcode 10 debugger stops on some breakpoints and doesn't on some others
                  jldb Level 1 Level 1 (0 points)

                  Thank you for your answers. I did not yet resolve my problem. Here are some screenshots of the two kinds of breapoints :

                  The one that is working (i.e. debugger stops on it):
                  https://ibb.co/hK8mSqc

                  The one that didn't work (debugger doesn't stop) :

                  https://ibb.co/tK82KFp

                  (As the forum refuses me to insert images in the message, I posted images on an external server. I'm not sure it will work ... If not I 'll come back later.)

                  Does anyone know how to produce one kind and the other ? (I just clicked on the line number to create the breakpoint and it makes (randomly?) one or the other kind.

                  I have to say I'm developping two projects here : a framework and an application. I send the breakpoints to "User" so I expected the debugger to stop in the framework and in the app.