[lldb-dev] queue-name parameter

Jim Ingham via lldb-dev lldb-dev at lists.llvm.org
Thu Jul 18 17:27:18 PDT 2019


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