[Lldb-commits] [PATCH] D17724: Replace getopt with llvm::cl in lldb driver

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 29 11:01:43 PST 2016


The straightforward way to do specify a complex command line for debugging is:

lldb —arch=x86_64 — /bin/ls -IAF

everything after the — are arguments to the program.  This also allows you to cut & paste whole command lines.  It works by the trick that if you haven’t specified a file before the — then the first of these arguments will be the file.  The other way, where you supply the file in among the arguments was to accommodate the ordinary lldb usage in the case where you do something like:

lldb /bin/ls —arch=x86_64 — oops I forgot I wanted to add arguments

I don’t find either of these particularly confusing, the “—“ is used all over in unix & lldb, so that seems pretty straightforward, and I don’t think adding extra levels of quoting around the command line is going to make this any easier.

Jim


> On Feb 29, 2016, at 10:52 AM, Zachary Turner via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> long and short options are supported, but the one I'm not sure about is the case where you use a short option with no space.  Your example "-ax86_64" might not work.  It might, just that it should be tested.  I'm 99% confident the rest of them all work.
> 
> Also not sure about this example: "% lldb /bin/ls --arch=x86_64 -- -lAF"
> 
> If I understand correctly, this runs LLDB with the --arch=x86_64 argument, and specifies the program to debug as "/bin/ls -IAF"?
> 
> Seems like a confusing syntax to me, is there any other way to specify this currently?  like:
> 
> % lldb "/bin/ls -IAF" --arch=x86_64
> % lldb /bin/ls --arch-x86_64 --args=-IAF
> 
> Or something along those lines?
> 
> On Mon, Feb 29, 2016 at 10:46 AM Greg Clayton <clayborg at gmail.com <mailto:clayborg at gmail.com>> wrote:
> clayborg added a comment.
> 
> As long as both long and short options are still supported? Can you still type any of:
> 
> - --arch=x86_64
> - --arch x86_64
> - -arch=x86_64
> - -arch x86_64
> - -ax86_64
> - -a x86_64
> 
> Are we able to track which options can be used with other options with the llvm solution? I didn't look too close. There were bits in the old option definitions which defined with options could be specified with which other options. The other thing that might throw people for a loop is if llvm doesn't support this style:
> 
> % lldb /bin/ls --arch=x86_64 -- -lAF
> 
> getopt_long allowed you to have arguments mixed in between the options so the arguments would have bee "/bin/ls" and "-lAF". Options would have been "--arch=x86_64".
> 
> 
> http://reviews.llvm.org/D17724 <http://reviews.llvm.org/D17724>
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160229/0dc01221/attachment.html>


More information about the lldb-commits mailing list