[lldb-dev] queue-name parameter

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Mon Jul 22 10:18:18 PDT 2019


I already filed both of these issues with Apple.  If you want to file them too, feel free.  I'll dup them to the ones I filed but that way you will get notification when they get fixed.  These are also general lldb issues, so it would be good to file something with http://bugs.llvm.org.

Jim


> On Jul 19, 2019, at 3:20 AM, Fernando Bunn <fcbunn at gmail.com> wrote:
> 
> Jim,
> you're right, I was getting a false positive with -Q, sorry for the confusion.
> 
> So it seems I'm having 2 issues on Xcode, right?
> A - No rejection of illegal options (-Q)
> B - "-q" with the correct queue name is not working.
> 
> Here's what I'm doing for B:
> 
> 1 - (lldb) thread info
> thread #1: tid = 0xfc5f, 0x00000001070418f4 ThreadTest`ViewController.viewDidLoad(self=0x00007f940610d270) at ViewController.swift:16:9, queue = 'com.apple.main-thread', stop reason = breakpoint 1.1
> 
> 2 - (lldb) breakpoint set --file ViewController.swift --line 26 -q com.apple.main-thread
> Breakpoint 2: where = ThreadTest`ThreadTest.ViewController.viewDidLoad() -> () + 942 at ViewController.swift:26:15, address = 0x0000000107041c0e
> 
> 3 - (lldb) breakpoint list 2
> 2: file = 'ViewController.swift', line = 26, exact_match = 0, locations = 1, resolved = 1, hit count = 0 Options: enabled queue name: "com.apple.main-thread" 
>   2.1: where = ThreadTest`ThreadTest.ViewController.viewDidLoad() -> () + 942 at ViewController.swift:26:15, address = 0x0000000107041c0e, resolved, hit count = 0 
> 
> On #1 I just make sure the queue name is correct, com.apple.main-thread, then on #2 I set the breakpoint with "-q", and on #3 I make sure that the parameter was set correctly, and I do see the enabled queue name: "com.apple.main-thread" in there, but the breakpoint is never executed.
> 
> But if I set  breakpoint set --file ViewController.swift --line 26, without -q, the breakpoint is executed normally. 
> And to check that the queue name is "com.apple.main-thread" when this breakpoint is executed I did the following:
> 
> 1 - (lldb) breakpoint set --file ViewController.swift --line 26
> Breakpoint 3: where = ThreadTest`ThreadTest.ViewController.viewDidLoad() -> () + 942 at ViewController.swift:26:15, address = 0x0000000104a01c0e
> 2 - (lldb) c
> Process 1242 resuming
> 3 - (lldb) thread info
> thread #1: tid = 0x11cd2, 0x0000000104a01c0e ThreadTest`ViewController.viewDidLoad(self=0x00007fcb15d09d50) at ViewController.swift:26:15, queue = 'com.apple.main-thread', stop reason = breakpoint 3.1
> 
> I can verify that on #3 the queue name is in fact com.apple.main-thread but if I add -q com.apple.main-thread, it doesn't work.
> 
> At this point, I'm not sure what to do next, maybe file a radar with Apple?
> Thanks for your help, I really appreciate it :)
> 
> --
> Fernando
> 
> 
> 
> On Fri, Jul 19, 2019 at 1:27 AM Jim Ingham <jingham at apple.com> wrote:
> Fernando, I don't see quite what you do.  For me, -Q never sets the queue.  Rather, the current Xcode version of lldb seems to have a bug where it doesn't reject illegal options, so the -Q argument is silently discarded.  That would cause the breakpoint to "work" but it won't only stop on one queue. So I see:
> 
> 
> (lldb) break set -f main.c -l 10 -q whatever
> Breakpoint 1: where = SomeTool`main + 22 at main.c:13:3, address = 0x0000000100000f66
> (lldb) break list 1
> 1: file = 'main.c', line = 10, exact_match = 0, locations = 1, resolved = 1, hit count = 0 Options: enabled queue name: "whatever" 
>   1.1: where = SomeTool`main + 22 at main.c:13:3, address = 0x0000000100000f66, resolved, hit count = 0 
> 
> That's right, it got the queue name and should match against it.  But:
> 
> (lldb) break set -f main.c -l 10 -Q whatever
> Breakpoint 2: where = SomeTool`main + 22 at main.c:13:3, address = 0x0000000100000f66
> (lldb) break list 2
> 2: file = 'main.c', line = 10, exact_match = 0, locations = 1, resolved = 1, hit count = 0
>   2.1: where = SomeTool`main + 22 at main.c:13:3, address = 0x0000000100000f66, resolved, hit count = 0 
> 
> That one didn't get a queue name at all.  So it will always stop, but OTOH that's not really what you wanted.
> 
> It sounds like what is really going on is that the queue matching isn't working as you expected, so when you actually DID set a queue name - using the "-q" option, the breakpoint wasn't stopping, but when you didn't set a queue name (with the bogus -Q option) it did stop.  So there might be something going wrong with the queue name matching?
> 
> Note, this bug doesn't exist in current llvm TOT.  If you try with that lldb:
> 
> (lldb) break set -f foo.c -l 10 -Q foo
> error: unknown or ambiguous option
> 
> That's right, there is no -Q option...
> 
> I'm surprised we have no tests for rejecting illegal options in the command interpreter, but I couldn't find any...
> 
> Jim
> 
> 
> 
> > On Jul 18, 2019, at 4:23 PM, Fernando Bunn via lldb-dev <lldb-dev at lists.llvm.org> wrote:
> > 
> > Hi, everyone.
> > I'm seeing an issue when using the -q parameter on a breakpoint using Xcode.
> > 
> > when I run:
> > (lldb) help breakpoint modify
> > I see this:
> > 
> >        -q <queue-name> ( --queue-name <queue-name> )
> >             The breakpoint stops only for threads in the queue whose name is
> >             given by this argument.
> > 
> > So far, so good.
> > Then I try to set a breakpoint with -q on it like so:
> > (lldb) breakpoint set --file ViewController.swift --line 27 -q com.apple.main-thread
> > 
> > This doesn't seem to work, but if I use -Q (uppercase), it works just fine.
> > 
> > I thought that there was a typo somewhere and even had a patch ready to submit changing the CommandObjectBreakpoint.cpp file 
> > from this:
> >   { LLDB_OPT_SET_1, false, "queue-name",   'q', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeQueueName,   "The breakpoint stops only for threads in the queue whose name is given by this argument." },
> > 
> > to this:
> >   { LLDB_OPT_SET_1, false, "queue-name",   'Q', OptionParser::eRequiredArgument, nullptr, {}, 0, eArgTypeQueueName,   "The breakpoint stops only for threads in the queue whose name is given by this argument." },
> > 
> > but it looks the correct value is being used to switch the parameters:
> >     case 'q':
> >       m_bp_opts.GetThreadSpec()->SetQueueName(option_arg.str().c_str());
> >       break;
> > 
> > My question is: why Xcode's version is not respecting the 'q' case?
> > I tested on both:
> > lldb-1100.0.28.6 and lldb-1001.0.13.3 and the same thing happens.
> > 
> > Apologies if this is not the best place to ask questions like this, I'd appreciate some directions to the correct place If that's the case. Maybe file a radar directly on Apple?
> > 
> > Thanks for your attention
> > --
> > Fernando
> > 
> > _______________________________________________
> > lldb-dev mailing list
> > lldb-dev at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-dev
> 



More information about the lldb-dev mailing list